{"id":16512912,"url":"https://github.com/n6g7/damn","last_synced_at":"2025-03-16T19:30:25.007Z","repository":{"id":35161784,"uuid":"39407930","full_name":"n6g7/damn","owner":"n6g7","description":"Node.js DeviantArt API client","archived":false,"fork":false,"pushed_at":"2024-05-24T22:13:20.000Z","size":294,"stargazers_count":9,"open_issues_count":9,"forks_count":4,"subscribers_count":4,"default_branch":"master","last_synced_at":"2024-10-18T19:06:09.939Z","etag":null,"topics":["api","client","damn","deviantart","node","rest"],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/n6g7.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2015-07-20T20:54:36.000Z","updated_at":"2023-11-27T22:37:53.000Z","dependencies_parsed_at":"2022-09-15T19:52:34.925Z","dependency_job_id":null,"html_url":"https://github.com/n6g7/damn","commit_stats":null,"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/n6g7%2Fdamn","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/n6g7%2Fdamn/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/n6g7%2Fdamn/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/n6g7%2Fdamn/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/n6g7","download_url":"https://codeload.github.com/n6g7/damn/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":221667067,"owners_count":16860541,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["api","client","damn","deviantart","node","rest"],"created_at":"2024-10-11T16:06:32.909Z","updated_at":"2024-10-27T11:08:08.307Z","avatar_url":"https://github.com/n6g7.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# dAmn\n[![CircleCI](https://circleci.com/gh/n6g7/damn.svg?style=svg)](https://circleci.com/gh/n6g7/damn) [![npm version](https://badge.fury.io/js/damn.svg)](https://badge.fury.io/js/damn) [![Coverage Status](https://coveralls.io/repos/github/n6g7/damn/badge.svg?branch=master)](https://coveralls.io/github/n6g7/damn?branch=master) [![bitHound Score](https://www.bithound.io/github/n6g7/damn/badges/score.svg)](https://www.bithound.io/github/n6g7/damn)\n\nNode.js DeviantArt API client\n\n## Quick start\n\nInstall:\n\n```shell\nyarn add damn\n```\n\n```js\nconst Damn = require('damn');\n\nconst clientId = 1234\nconst clientSecret = 'thisissecret'\n\nDamn.clientCredentials(clientId, clientSecret)\n.then(damn =\u003e damn.getDailyDeviations())\n.then(dailyDeviations =\u003e {\n  ...\n})\n\n```\n\n## Client generation\n\ndAmn currently supports two [authentication methods](https://www.deviantart.com/developers/authentication): *Client Credentials* and *Implicit*.\nBoth provide access to public endpoints but only the *Implicit* method grants access to user-specific APIs.\n\nBoth methods require a `client_id` and a `client_secret` to be granted an access token. These are obtained by creating an app in [DeviantArt's application page](https://www.deviantart.com/developers/apps).\n\n### Public API\nThe easiest way to access public API is to use the *Client Credentials* method, which is available via `Damn.clientCredentials`:\n\n```js\nDamn.clientCredentials('4321', 'cl13nt_s3cr3t')\n.then(damn =\u003e {\n  damn.getDailyDeviations()\n  ...\n})\n```\n\nWhere `4321` is your `client_id` and `cl13nt_s3cr3t` is your `client_secret`.\n\nThe `Damn.clientCredentials()` call returns a promise which resolves to a `Damn` object, from which you can call the methods marked *public* described below.\n\n### Logged-in API\nAccessing user-specific endpoints can only be done when using the *Implicit* authentication method. This methods requires you to provide an username, a password, a `client_id` and a `redirect_uri` for the application you created.\n\nIf you're using this method, make sure your \"OAuth2 Grant Type\" settings is set to \"Implicit\" in your application parameters:\n![DA application's OAuth Grant Type setting](doc/oauth-setting.png)\n\nTo instanciate a \"private\" client you may use the `Damn.implicit` method:\n\n```js\nconst clientId = 1234\nconst redirectUri = 'https://www.example.com'\nconst username = 'toto'\nconst password = 'h4xXx0r'\nconst scope = 'basic'\n\nDamn.implicit(clientId, redirectUri, username, password, scope)\n.then(damn =\u003e {\n  damn.getDailyDeviations()\n  ...\n})\n```\n\nThe `Damn.implicit()` call returns a promise which resolves to a `Damn` object, from which you can call all the methods described below.\n\n\n## Methods\n\nAll these methods are asynchronous and return promises.\n\n### getDailyDeviations(*qs*)\n\n\u003e Public endpoint\n\nReturns the list of today's [daily deviations](http://www.deviantart.com/dailydeviations/):\n\n```js\ndamn.getDailyDeviations()\n.then(dailyDeviations =\u003e {\n  ...\n})\n```\n\n**Parameters**:\n - `qs` (object): additional query parameters (eg. for pagination)\n\n### getNotifications(*qs*)\n\n\u003e Private endpoint\n\nReturns the list of current user notifications:\n\n```js\ndamn.getNotifications()\n.then(notifications =\u003e {\n  ...\n})\n```\n\n**Parameters**:\n - `qs` (object): additional query parameters (eg. for pagination)\n\n### getWatchFeed(*qs*)\n\n\u003e Private endpoint\n\nReturns the current user's watch feed:\n\n```js\ndamn.getWatchFeed()\n.then(feed =\u003e {\n  ...\n})\n```\n\n**Parameters**:\n - `qs` (object): additional query parameters (eg. for pagination)\n\n### getDeviation(*deviationId*, *qs*)\n\n\u003e Public endpoint\n\nReturns the details of a specific deviation:\n\n```js\nconst deviationId = 12345\n\ndamn.getDeviation(deviationId)\n.then(deviation =\u003e {\n  ...\n})\n```\n\n**Parameters**:\n - `deviationId` (string): the deviation id.\n - `qs` (object): additional query parameters (eg. for pagination)\n\n### galleryAll(*username*, *qs*)\n\n\u003e Public endpoint\n\nReturns the list of a user's deviations:\n\n```js\nconst username = 'sdqlm'\n\ndamn.galleryAll(username)\n.then(deviations =\u003e {\n  ...\n})\n```\n\n**Parameters**:\n - `username` (string): optional `username`, defaults to current user\n - `qs` (object): additional query parameters (eg. for pagination)\n\n### galleryFolder(*folderId*, *username*, *qs*)\n\n\u003e Public endpoint\n\nReturns the list of a folder's deviations (all user's deviations if no `folderId` is given):\n\n```js\nconst folderId = 12345\n\ndamn.galleryFolder(folderId)\n.then(deviations =\u003e {\n  ...\n})\n```\n\n**Parameters**:\n - `folderId` (string): optional `folderId`\n - `username` (string): optional `username`, defaults to current user\n - `qs` (object): additional query parameters (eg. for pagination)\n\n### galleryFolders(*username*, *qs*)\n\n\u003e Public endpoint\n\nReturns the list of an user's gallery folders:\n\n```js\nconst username = 'qpsdlq'\n\ndamn.galleryFolders(username)\n.then(deviations =\u003e {\n  ...\n})\n```\n\n**Parameters**:\n - `username` (string): optional `username`, defaults to current user\n - `qs` (object): additional query parameters (eg. for pagination)\n\n### userFriends(*username*, *qs*)\n\n\u003e Public endpoint\n\nReturns a list of the user's watched friends:\n\n```js\nconst username = 'qpsdlq'\n\ndamn.userFriends(username)\n.then(friends =\u003e {\n  ...\n})\n```\n\n**Parameters**:\n - `username` (string): username to search for friends of\n - `qs` (object): additional query parameters (eg. for pagination)\n\n### userFriendsSearch(*username*, *query*)\n\n\u003e Public endpoint\n\nReturns a list of the user's watched friends:\n\n```js\nconst username = 'qpsdlq'\nconst query = 'bob'\n\ndamn.userFriendsSearch(username, query)\n.then(friends =\u003e {\n  ...\n})\n```\n\n**Parameters**:\n - `username` (string): username to search for friends of\n - `query` (string): Search query (min length: 1)\n\n### placebo()\n\n\u003e Public endpoint\n\nImplementation of DA's [placebo](https://www.deviantart.com/developers/http/v1/20150824/placebo/53b9f8bd16df06555acb1dfc06e6df69) route. Use it to check you access token validity. Or better yet, use `checkAccessToken()`!\n\n```js\ndamn.placebo.then(placebo =\u003e {\n  ...\n})\n```\n\n### checkAccessToken()\n\nCheck the validity of your access token, returns a boolean.\n\n```js\ndamn.checkAccessToken.then(validToken =\u003e {\n  ...\n})\n```\n\n## Todo\n\n - [X] Use [Node.js v4.0.0](https://github.com/nodejs/node/blob/v4.0.0/CHANGELOG.md) and ES6 features\n - [ ] Automate token refresh\n - [X] Setup linter\n - [ ] Add access to the following routes:\n  - [X] `/user/friends/{username}` Get a list of watched friends\n  - [X] `/user/friends/search` Search a list of watched friends\n  - [X] `/deviation/{deviationid}` Fetch a deviation\n  - [ ] `/deviation/content` Fetch full data that is not included in the main deviation object\n  - [ ] `/browse/morelikethis` Fetch MoreLikeThis result for a seed deviation\n  - [ ] `/browse/newest` Browse newest deviations\n  - [ ] `/browse/popular` Browse popular deviations\n  - [ ] `/browse/hot` Browse whats hot deviations\n  - [ ] and all others routes ?\n - [ ] Revoke access / logout\n - [ ] Find a way to implement [Authorization Code](https://www.deviantart.com/developers/authentication) as an authentication method\n - [X] Support for pagination params\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fn6g7%2Fdamn","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fn6g7%2Fdamn","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fn6g7%2Fdamn/lists"}