{"_id":"7digital-api-promisified","_rev":"2-3f23e68803c20b0943481ef4a09e0094","name":"7digital-api-promisified","dist-tags":{"latest":"0.39.0"},"versions":{"0.38.0":{"name":"7digital-api-promisified","version":"0.38.0","description":"Promisified 7digital API client for nodeJS","homepage":"https://github.com/7digital/7digital-api","repository":{"type":"git","url":"git://github.com/ruzicka/7digital-api-promisified.git"},"docs":{"url":"https://github.com/ruzicka/7digital-api-promisified/blob/master/README.md"},"bugs":{"url":"https://github.com/ruzicka/7digital-api-promisified/issues"},"keywords":["api","nodejs","7digital","promise","promisified"],"author":{"name":"7digital Tools Team","email":"tools@7digital.com"},"license":"ISC","engines":{"node":"~8.12.0"},"scripts":{"integration-test":"mocha --recursive -R spec test-integration/","test":"mocha --recursive -R spec test/"},"main":"index.js","dependencies":{"lodash":"~4.17.15","oauth":"0.9.14","step":"~0.0.5","verror":"^1.6.0","xml2js":"~0.4.3","uuid":"^3.0.0"},"devDependencies":{"async":"^1.5.0","browserify":"~12.0.1","chai":"~3.4.1","docco":"~0.7.0","jshint":"~2.11.0","mocha":"~7.0.1","mocha-teamcity-reporter":"1.0.0","sinon":"~1.17.2","winston":"^2.1.1"},"optionalDependencies":{"uuid":"^3.0.0"},"contributors":[{"name":"Raoul Millais","email":"raoul.millais@7digital.com","url":"http://www.raoulmillais.com"},{"name":"Tony To","email":"tony.to@7digital.com","url":"http://tonyto.es"},{"name":"Dan Haller","email":"dan.haller@7digital.com","url":"http://github.com/raoulmillais"},{"name":"Dave Aitken","email":"dave.aitken@gmail.com","url":"http://actionshrimp.com"},{"name":"Chris Watson","email":"chris.watson@7digital.com","url":"http://github.com/c24w"},{"name":"Matt Bailey","email":"matthew.bailey@7digital.com","url":"https://github.com/Matt-B"}],"gitHead":"6e2e96109fb9f910072f085f2f720f50b3823a2a","_id":"7digital-api-promisified@0.38.0","_npmVersion":"6.4.1","_nodeVersion":"8.12.0","_npmUser":{"name":"david-ruzicka","email":"mail@david-ruzicka.com"},"dist":{"integrity":"sha512-ylefTAUUoCjZP5Cy7wpAP2MLZCOT2tTfbeUSQShbl4YA6PDXzvW0F0MQilkqY03qUCG+h+Q2vGVW3JcKdj1J3A==","shasum":"7913a30931490a3b8af412ccc233ce5b87e94824","tarball":"https://registry.npmjs.org/7digital-api-promisified/-/7digital-api-promisified-0.38.0.tgz","fileCount":79,"unpackedSize":197180,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJeMYkuCRA9TVsSAnZWagAADFMQAJZk7AVc2sFycWM74a7E\nanrABqX71MRXxaKmnWJkkWXfzF69NeeCuG8nthrtcY2tSZsCstFm7AjoKd+4\nAxGaqe39TM4qru3VPrk2BEcsgberZgXA9zKPBSY8+wBdpST+PxvH6USL+l1M\n7ybytSltZkC46+kzKpbT4XrGsHJ1LOK/Yj6PoLeSvYSb0V4JL4KW7pmUL+YM\n8WN6FnauvSZPoKhdrUjHhYtL7uVsfUk4wKjg4OmE/APIfiam6/jcKQXqFFJC\nvA6cPDUCoBhVdcItcUeg1+Dpd6GrlHJqpWPFFavhGfBvZFnER6oxpFG7cLra\nw6omRLxz1U4OnTWzVhMg+qZBKCCHwlPwL1i6N5f9Dtif639RL2Lr0ZjJLXUW\n860aArgDOk7B2YwVBDhiO8tmEfoke63f5TLsajRz9d1tMLfpUyV6Tx6LChl4\nRrGAc7ntCTsFyoIkqzHD9V6qO2D5Q0fz9LltBGwqHX+UJRIwhg69JNz0swAC\nFQC3xM/yQ37qwnodThlaeEYPchUuBquU+0cIG6Haix/J1yd8WWkiYlukzx6Q\nvCsPDG3iUzY6TaYqLH9E+R7NO9Jp8GegNNZoMvdxgyGqUU1krvzODjZ6fTDg\n96valRghh/9tqLtRBrbFQX6OGJlO0WPQsV5DRGGL38MPRqaDTCf7BzE4U9OY\nAgQU\r\n=QGM4\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQDfrJjoYZgATVn1dZT8ua1X8ovgmNsLj6eHiEet3MFvBAIhAKBbUWwW0jindUl1ZZAqgLB0odtXJyl2mOlNdvjToSp1"}]},"maintainers":[{"name":"david-ruzicka","email":"mail@david-ruzicka.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/7digital-api-promisified_0.38.0_1580304686352_0.3623525780330221"},"_hasShrinkwrap":false},"0.39.0":{"name":"7digital-api-promisified","version":"0.39.0","description":"Promisified 7digital API client for nodeJS","homepage":"https://github.com/7digital/7digital-api","repository":{"type":"git","url":"git://github.com/ruzicka/7digital-api-promisified.git"},"docs":{"url":"https://github.com/ruzicka/7digital-api-promisified/blob/master/README.md"},"bugs":{"url":"https://github.com/ruzicka/7digital-api-promisified/issues"},"keywords":["api","nodejs","7digital","promise","promisified"],"author":{"name":"7digital Tools Team","email":"tools@7digital.com"},"license":"ISC","engines":{"node":"~8.12.0"},"scripts":{"integration-test":"mocha --recursive -R spec test-integration/","test":"mocha --recursive -R spec test/"},"main":"index.js","dependencies":{"lodash":"~4.17.15","oauth":"0.9.14","step":"~0.0.5","verror":"^1.6.0","xml2js":"~0.4.3","uuid":"^3.0.0"},"devDependencies":{"async":"^1.5.0","browserify":"~12.0.1","chai":"~3.4.1","docco":"~0.7.0","jshint":"~2.11.0","mocha":"~7.0.1","mocha-teamcity-reporter":"1.0.0","sinon":"~1.17.2","winston":"^2.1.1"},"optionalDependencies":{"uuid":"^3.0.0"},"contributors":[{"name":"Raoul Millais","email":"raoul.millais@7digital.com","url":"http://www.raoulmillais.com"},{"name":"Tony To","email":"tony.to@7digital.com","url":"http://tonyto.es"},{"name":"Dan Haller","email":"dan.haller@7digital.com","url":"http://github.com/raoulmillais"},{"name":"Dave Aitken","email":"dave.aitken@gmail.com","url":"http://actionshrimp.com"},{"name":"Chris Watson","email":"chris.watson@7digital.com","url":"http://github.com/c24w"},{"name":"Matt Bailey","email":"matthew.bailey@7digital.com","url":"https://github.com/Matt-B"}],"gitHead":"16e44d8bdc0a526b7e2813157ec945cddc12f966","_id":"7digital-api-promisified@0.39.0","_npmVersion":"6.4.1","_nodeVersion":"8.12.0","_npmUser":{"name":"david-ruzicka","email":"mail@david-ruzicka.com"},"dist":{"integrity":"sha512-Z/ZQNODPwGEBt5if1dkB6oUpR1DNanOWQr1oZVfrNsFWcqR13xc4TCM2PCYqLAV5Yvho9rEju9XvhEcjyz/fxA==","shasum":"b3f7a28ed94724e185af97017fa4042bcde67fc3","tarball":"https://registry.npmjs.org/7digital-api-promisified/-/7digital-api-promisified-0.39.0.tgz","fileCount":79,"unpackedSize":197905,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJeMfF0CRA9TVsSAnZWagAA+eoP/2Q6yNrKgXZ+1gEr5SX+\n5zTkhLHurX5DbMEHpoUa7HYhEFmdpGNSRZmAPfI7+2b4J4JYP61P1fXZ53yG\nbsletg4dHYWyApqF3KVHj6KBSPBtKlP2NqCYJsQtQ8OtIPTSXSQTk8R+ncqY\n4Uq49C9YUotxHLW+5PwM3/EaQvGanyr/UD1bT0r1yuHnX0yPaa18h/Rzd55t\nUDfi2097hzl0+MV1WtxW8GNZNfjFAw1ESf5wLIKWkLC18OHF0imqnOmDookO\n7I30PyEsBztSD5mzNlW0+VlDL1cPWcwe71EqyO7GFR/3b2V6/DYIZvh8D/J2\nMFHTNUCp2OlG7QMIN1F4qgtDlVkzzlydIRJERDv2TS5A9zfW/bAQcBY6D44b\nsAPRImWfmVoOJk1ZuTf3zmJCZ73wI7oXDby2Xtq4F+ke+JFb1fKEewxMc+5p\noQXCPJmDtTXa9zx/82A3FsvNQYJcqtzXHDiKLBQILBoGmh5k7Nxabp4RDrSV\nZNLTfHH3V9g2Q3eWFcpPnOhrJmOZNHLT8yTfuZWKzZZoYXAbAOJWGfUvn/dr\nk3XrKPu0SaufQcwnBVK7HB0CRY3rsILCiQhcnz1sAq7hiAhkdUqwORfzZlf4\nNUb61n4pocq0uDLEDKvzrc5TYeaAEptKTTXt/Qy2cYJ2np3FfpNNb5lEMI1q\n1HJK\r\n=AhEA\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQCGlHuE9WdVof+gg3A0xdMDIyagrPoLP1YiFrhrTyDzrQIgd7wAMRIRYC5df6LxMz7gB9GB2hS2SZlkjT1/wgLw/SQ="}]},"maintainers":[{"name":"david-ruzicka","email":"mail@david-ruzicka.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/7digital-api-promisified_0.39.0_1580331379938_0.39312600385007146"},"_hasShrinkwrap":false}},"time":{"created":"2020-01-29T13:31:26.352Z","0.38.0":"2020-01-29T13:31:26.523Z","modified":"2022-04-04T10:24:16.575Z","0.39.0":"2020-01-29T20:56:20.104Z"},"maintainers":[{"name":"david-ruzicka","email":"mail@david-ruzicka.com"}],"description":"Promisified 7digital API client for nodeJS","homepage":"https://github.com/7digital/7digital-api","keywords":["api","nodejs","7digital","promise","promisified"],"repository":{"type":"git","url":"git://github.com/ruzicka/7digital-api-promisified.git"},"contributors":[{"name":"Raoul Millais","email":"raoul.millais@7digital.com","url":"http://www.raoulmillais.com"},{"name":"Tony To","email":"tony.to@7digital.com","url":"http://tonyto.es"},{"name":"Dan Haller","email":"dan.haller@7digital.com","url":"http://github.com/raoulmillais"},{"name":"Dave Aitken","email":"dave.aitken@gmail.com","url":"http://actionshrimp.com"},{"name":"Chris Watson","email":"chris.watson@7digital.com","url":"http://github.com/c24w"},{"name":"Matt Bailey","email":"matthew.bailey@7digital.com","url":"https://github.com/Matt-B"}],"author":{"name":"7digital Tools Team","email":"tools@7digital.com"},"bugs":{"url":"https://github.com/ruzicka/7digital-api-promisified/issues"},"license":"ISC","readme":"![7digital](http://i.imgur.com/StUnvCy.png?1)\n# Node.js API Client\n\nCurrent head build status:\n\n[![Build Status](https://travis-ci.org/7digital/7digital-api.svg?branch=master)](https://travis-ci.org/7digital/7digital-api)\n\n## About 7digital\n\n7digital.com is an online music store operating in over 16 countries and\noffering more than 11 million high quality DRM free MP3s (320kbps) from all\nmajor labels and wide range of idependent labels and distributors. 7digital\nAPI will give you access to the full catalogue including high quality album\nart, 30s preview clips for all tracks, commissions on sales, integrated\npurchasing and full length streaming. More details at\n[developer.7digital.net](http://developer.7digital.net/)\n\n### What is this?\n\n\nA serverside javascript client for the 7digital API .\nFull code documentation for the most recent release can be found [here](http://raoulmillais.github.com/node-7digital-api/api.html).\n\nTo map documentation endpoints with this library's methods, it's best to look\n at the [API definition file](https://github.com/7digital/7digital-api/blob/master/assets/7digital-api-schema.json).\n\n### Installation\n\n\n[![NPM](https://nodei.co/npm/7digital-api.png?downloads=true)](https://nodei.co/npm/7digital-api/)\n\nInstall it via [npm](http://npmjs.org/)\n\n```bash\nnpm install --save 7digital-api\n```\n\n### Usage\n\n**Note: this is a fork of original library that adds promisified versions of all API methods**\n\nTo use promisified version, just add suffix _Promise_ to the name of the method and don't pass callback function:\n```javascript\nconst api = require('7digital-api');\nconst artists = new api.Artists();\n\nasync function printData() {\n    const data = await artists.getReleasesPromise({ artistid: 1 });\n    console.dir(data);\n}\n```\n\n\nSee the examples folder for examples of how to use this.  If you have included\n7digital-api in your dependencies in the package.json file, you can use the\nlike so:\n\n```javascript\nvar api = require('7digital-api'),\n\tartists = new api.Artists();\n\nartists.getReleases({ artistid: 1 }, function(err, data) {\n\tconsole.dir(data);\n});\n```\n\nTo supply your OAuth credentials or if you want XML responses, you can use the\nconfigure function.  Here is how you can do so:\n\n\n```javascript\nvar api, artists;\n\napi = require('7digital-api').configure({\n\tformat: 'XML',\n\tconsumerkey: 'MY_KEY_HERE',\n\tconsumersecret: 'MY_SECRET_HERE',\n\tdefaultParams: { country: 'fr' }\n});\n\nartists = new api.Artists();\n\nartists.getReleases({ artistid: 1 }, function(err, data) {\n\tconsole.dir(data);\n});\n```\n\nYou can specify default parameters on a per resource basis also:\n\n\n```javascript\nvar api, artists;\n\napi = require('7digital-api').configure({\n\tdefaultParams: {\n\t\tcountry: 'fr'\n\t}\n});\n\nartists = new api.Artists({ defaultParams: { pageSize: 15 } });\n\nartists.getReleases({ artistid: 1 }, function(err, data) {\n\t// 15 releases in france\n\tconsole.dir(data);\n});\n```\n\nSee [developer.7digital.net](http://developer.7digital.net/) for full details\nof the API endpoints and the parameters they accept.\n\n## OAuth protected endpoints\n\n**NOTE: The oauth access method changed considerably in 0.19.0, updating to\nthe latest version is highly recommended**\n\n### Accessing the media delivery api\n\nThe media delivery endpoints behave differently from the other endpoints as\nthey return you the bytes to the content. You must sign all your requests like\nso:\n\n```javascript\nvar api = require('7digital-api').configure({\n\tconsumerkey: 'YOUR_KEY_HERE',\n\tconsumersecret: 'YOUR_SECRET_HERE',\n\tdefaultParams: {\n\t\tcountry: 'es'\n\t}\n});\n\nvar oauth = new api.OAuth();\nvar previewUrl = oauth.sign('http://previews.7digital.com/clip/12345');\n\n// For access to locker / subscription streaming without managed users you\n// will need to provide the accesstoken and secret for the user\nvar signedUrl = oauth.sign('https://stream.svc.7digital.net/stream/locker', {\n\ttrackId: 1234,\n\tformatId: 26,\n\taccesstoken: 'ACCESS_TOKEN',\n\taccesssecret: 'ACCESS_SECRET'\n});\n// Requesting this URL will now respond with the media data (or redirect to\n// an error).\n```\n\n### Making requests on behalf of a user to OAuth protected endpoints\n\n**NOTE: The oauth access method changed considerably in 0.19.0**\n\nThis example assumes you have access to the oauth/requestToken/authorise\nendpoint to authenticate users.  If you do not have this access you will\nneed to send the user to the authoriseUrl provided by `getRequestToken`\nand complete the auth flow when your callbackUrl is hit.\n\n```javascript\nvar api = require('7digital-api').configure({\n\tconsumerkey: 'YOUR_KEY_HERE',\n\tconsumersecret: 'YOUR_SECRET_HERE',\n\tdefaultParams: {\n\t\tcountry: 'fr'\n\t}\n});\n\nvar oauth = new api.OAuth();\noauth.getRequestToken('http://callbackurl.com/', authoriseToken);\nfunction authoriseToken(err, requesttoken, requestsecret) {\n\toauth.authoriseRequestToken({\n\t\tusername: 'joe@bloggs.com',\n\t\tpassword: 'top-secret',\n\t\ttoken: requesttoken\n\t}, function (err) {\n\t\toauth.getAccessToken({\n\t\t\trequesttoken: requesttoken,\n\t\t\trequestsecret: requestsecret\n\t\t}, function (err, accesstoken, accesssecret) {\n\t\t\t// use the token and secret to call secure endpoints.\n\t\t\tvar apiForJoeBloggs = api.reconfigure({\n\t\t\t\tdefaultParams: {\n\t\t\t\t\taccesstoken: accesstoken,\n\t\t\t\t\taccesssecret: accesssecret\n\t\t\t\t}\n\t\t\t});\n\t\t\tvar user = new apiForJoeBloggs.User();\n\t\t\tuser.getLocker({\n\t\t\t\tpageSize: 1\n\t\t\t}, function (err, response) {\n\t\t\t\t// Do something with the locker\n\t\t\t});\n\t\t});\n\t});\n```\n\nSee oauth.js and create-user.js in the examples folder for examples of the\nOAuth flow for acquiring an authorised access token and secret that you will\nneed to access any of the protected endpoints on behalf of a user.\n\n### Partner users (3rd party user management)\n\nIf your key has permissions to create 3rd-party (partner) users, you must\nconfigure the client to allow you to access protected enpoints with your\nuser ids instead of access tokens.  This can be done like so:\n\n```javascript\nvar api = require('7digital-api').configure({\n\tconsumerkey: 'YOUR_KEY_HERE',\n\tconsumersecret: 'YOUR_SECRET_HERE',\n\tuserManagement: true,\n\tdefaultParams: {\n\t\tcountry: 'fr'\n\t}\n});\n\n// You can now access user endpoints for your users without an access token or\n// secret and with your external user id instead\napi.User().create({\n\tuserId: 'external-user-12345',\n\temailAddress: 'joe@bloggs.com'\n\t}, function (err, userResponse) {\n\t\tapi.User().getLocker({\n\t\t\tuserId: 'external-user-12345',\n\t\t\tpageSize: 1\n\t\t}, function (err, response) {\n\t\t// Do something with the user's (empty!) locker\n\t});\n});\n```\n\n### Using the environment to configure the client\n\nThe client will check the environment for the following variables which makes\nit possible to keep your key and secret actually secret:\n\n- `_7D_API_CLIENT_CONSUMER_KEY` - defaults to 'YOUR_KEY_HERE'\n- `_7D_API_CLIENT_CONSUMER_SECRET` - defaults to 'YOUR_SECRET_HERE'\n- `_7D_API_CLIENT_USER_TOKEN` - is not set by default\n- `_7D_API_CLIENT_USER_SECRET` - is not set by default\n\nThe client will check the environment for the following variables which makes\ncontrolling the behaviour per-environment easier (e.g. in tests) with out\nhaving to branch in your application code:\n\n- `_7D_API_CLIENT_HOST` - defaults to 'api.7digital.com'\n- `_7D_API_CLIENT_SSL_HOST` - defaults to 'api.7digital.com'\n- `_7D_API_CLIENT_PORT` - defaults to 80\n- `_7D_API_CLIENT_PREFIX` - defaults to '1.2'\n\nNote that these variables have the lowest precedence (apart from defaults).\nI.E. overriding them in application code will take precendence.\n\n### Running the tests\n\nTo run the unit tests:\n\n    npm test\n\nThere are also integration tests. Tests for various error handling scenarios\nare run against a stub 7d api. It can be installed\nwith:\n\n    npm install git://github.com/7digital/api-stub.git\n\nSome of the integration tests (around the client's handling of OAuth) run\nagainst the real 7d api. In order for these tests to work, you'll need to set\nthe environment variables outlined above. As well as the following:\n\n- `_7D_API_CLIENT_TEST_VOUCHER_CODE`\n\nThe code for a voucher which can be applied to a basket containing an item of\n1p, used for a two-legged OAuth test.\n\nThe tests can then be run with:\n\n    npm run integration-test\n","readmeFilename":"README.md"}