Skip to content

Commit 6fbb567

Browse files
committed
1.0.2
1 parent 5ee45ae commit 6fbb567

File tree

2 files changed

+34
-23
lines changed

2 files changed

+34
-23
lines changed

README.md

+14-7
Original file line numberDiff line numberDiff line change
@@ -12,14 +12,20 @@ Node installation will include NPM, which is responsible for the dependencies ma
1212
## Installation
1313

1414
### Node.js
15-
TBD
1615

17-
`npm install bynder-js-sdk`
16+
`npm install @bynder/bynder-js-sdk`
17+
18+
`import Bynder from '@bynder/bynder-js-sdk';`
1819

1920
### Browser
20-
TBD
2121

22-
`<script src="path/to/bynder-js-sdk.js"></script>`
22+
1. Checkout the repository `git clone [email protected]:Bynder/bynder-js-sdk.git`.
23+
2. Go to the `bynder-js-sdk` directory.
24+
3. Run `yarn install`.
25+
4. Run `gulp build`.
26+
5. Use the `bundle.js` file generated in `dist` folder to use the SDK in the browser.
27+
6. Include it in your page like this: `<script src="path/to/bynder-js-sdk.js"></script>` .
28+
7. Define the constructor like this: `const Bynder = Bynder.default;`
2329

2430
## Usage
2531
As said before, this SDK relies heavily on [Promises](https://developers.google.com/web/fundamentals/getting-started/primers/promises), making it easier to handle the asynchronous requests made to the API.
@@ -87,10 +93,11 @@ Here's a list of all the methods available, separated by module:
8793
* `getCollection(queryObject)`
8894

8995
### Tags
90-
* `getTags()`
96+
* `getTags(queryObject)`
9197

9298
### Categories
93-
* `getCategories()`
99+
* `getCategories(queryObject)`
100+
* `getCategory(queryObject)`
94101

95102
## Contribute to the SDK
96103
If you wish to contribute to this repository and further extend the API coverage of the SDK, here are the steps necessary to prepare your environment:
@@ -108,7 +115,7 @@ If you wish to contribute to this repository and further extend the API coverage
108115
"public": "<public_access_key>",
109116
"secret": "<secret_access_key>"
110117
},
111-
"baseURL": "http://api-url.bynder.io/api/"
118+
"baseURL": "http://api-url.bynder.com/api/"
112119
}
113120
```
114121
4. Use any of these gulp tasks to:

src/bynder-js-sdk.js

+20-16
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,7 @@ export default class Bynder {
151151

152152
/**
153153
* Get all the categories.
154-
* @see {@link http://docs.bynder.apiary.io/#reference/general/categories/list-categories|API Call}
154+
* @see {@link http://docs.bynder.apiary.io/#reference/categories/retrieve-categories/retrieve-categories|API Call}
155155
* @return {Promise} Categories - Returns a Promise that, when fulfilled, will either return an Array with the
156156
* categories or an Error with the problem.
157157
*/
@@ -171,7 +171,7 @@ export default class Bynder {
171171

172172
/**
173173
* Login to retrieve OAuth credentials.
174-
* @see {@link http://docs.bynder.apiary.io/#reference/users/-deprecated-login-a-user-retrieve-coupled-oauth-credentials|API Call}
174+
* @see {@link http://docs.bynder.apiary.io/#reference/users/-deprecated-login-a-user-retrieve-coupled-oauth-credentials/login-a-user|API Call}
175175
* @param {Object} queryObject={} - An object containing the credentials with which the user intends to login.
176176
* @param {String} queryObject.username - The username of the user.
177177
* @param {String} queryObject.password - The password of the user.
@@ -199,7 +199,7 @@ export default class Bynder {
199199

200200
/**
201201
* Get the request token and secret.
202-
* @see {@link http://docs.bynder.apiary.io/#reference/consumers-and-access-tokens/1-obtain-a-request-token-pair|API Call}
202+
* @see {@link http://docs.bynder.apiary.io/#reference/consumers-and-access-tokens/1-obtain-a-request-token-pair/obtain-a-request-token-pair|API Call}
203203
* @return {Promise} Credentials - Returns a Promise that, when fulfilled, will either return an string with the
204204
* couple of consumer token/secret or an Error with the problem.
205205
*/
@@ -222,6 +222,7 @@ export default class Bynder {
222222

223223
/**
224224
* Get the URL to authorise the token.
225+
* @see {@link http://docs.bynder.apiary.io/#reference/consumers-and-access-tokens/2-authorise-authenticate/authorise-&-authenticate|API Call}
225226
* @param {String} token - The token to be authorised.
226227
* @param {String} [callback] - The callback to which the page will be redirected after authenticating the token.
227228
* @return {String} URL - Returns a String with the URL to the token authorisation page.
@@ -239,7 +240,7 @@ export default class Bynder {
239240

240241
/**
241242
* Get the access token and secret.
242-
* @see {@link http://docs.bynder.apiary.io/#reference/consumers-and-access-tokens/3-exchange-the-request-token-pair-for-an-access-token-pair|API Call}
243+
* @see {@link http://docs.bynder.apiary.io/#reference/consumers-and-access-tokens/3-exchange-the-request-token-pair-for-an-access-token-pair/exchange-the-request-token-pair-for-an-access-token-pair|API Call}
243244
* @param {string} token - A string containing the authorised token provided by the API.
244245
* @param {string} secret - A string containing the authorised secret provided by the API.
245246
* @return {Promise} Credentials - Returns a Promise that, when fulfilled, will either return an Object with the
@@ -264,7 +265,7 @@ export default class Bynder {
264265

265266
/**
266267
* Get the assets according to the parameters provided.
267-
* @see {@link http://docs.bynder.apiary.io/#reference/media/media-access/retrieve-entry-point|API Call}
268+
* @see {@link http://docs.bynder.apiary.io/#reference/assets/asset-operations/retrieve-assets|API Call}
268269
* @param {Object} [queryObject={}] - An object containing the parameters accepted by the API to narrow the query.
269270
* @return {Promise} Assets - Returns a Promise that, when fulfilled, will either return an Array with the assets or
270271
* an Error with the problem.
@@ -291,7 +292,7 @@ export default class Bynder {
291292

292293
/**
293294
* Get the assets information according to the id provided.
294-
* @see {@link http://docs.bynder.apiary.io/#reference/media/retrieve-specific-media-info/retrieve-entry-point|API Call}
295+
* @see {@link http://docs.bynder.apiary.io/#reference/assets/specific-asset-operations/retrieve-specific-asset|API Call}
295296
* @param {Object} queryObject - An object containing the id and the version of the desired asset.
296297
* @param {String} queryObject.id - The id of the desired asset.
297298
* @param {Number} [queryObject.version] - The version of the desired asset.
@@ -318,7 +319,7 @@ export default class Bynder {
318319

319320
/**
320321
* Get all the assets starting from the page provided (1 by default) and incrementing according to the offset given.
321-
* @see {@link http://docs.bynder.apiary.io/#reference/media/media-access/retrieve-entry-point|API Call}
322+
* @see {@link http://docs.bynder.apiary.io/#reference/assets/asset-operations/retrieve-assets|API Call}
322323
* @param {Object} [queryObject={}] - An object containing the parameters accepted by the API to narrow the query.
323324
* @return {Promise} Assets - Returns a Promise that, when fulfilled, will either return an Array with all the
324325
* assets or an Error with the problem.
@@ -349,7 +350,7 @@ export default class Bynder {
349350

350351
/**
351352
* Get the assets total according to the parameters provided.
352-
* @see {@link http://docs.bynder.apiary.io/#reference/media/media-access-with-media-count/retrieve-entry-point|API Call}
353+
* @see {@link http://docs.bynder.apiary.io/#reference/assets/asset-operations/retrieve-assets|API Call}
353354
* @param {Object} [queryObject={}] - An object containing the parameters accepted by the API to narrow the query.
354355
* @return {Promise} Number - Returns a Promise that, when fulfilled, will either return the number of assets
355356
* fitting the query or an Error with the problem.
@@ -379,7 +380,7 @@ export default class Bynder {
379380

380381
/**
381382
* Edit an existing asset with the information provided.
382-
* @see {@link http://docs.bynder.apiary.io/#reference/media/edit-media/save-entry-point|API Call}
383+
* @see {@link http://docs.bynder.apiary.io/#reference/assets/specific-asset-operations/modify-asset|API Call}
383384
* @param {Object} object={} - An object containing the parameters accepted by the API to change in the asset.
384385
* @param {String} object.id - The id of the desired asset.
385386
* @return {Promise} Object - Returns a Promise that, when fulfilled, will either return an empty Object in
@@ -432,7 +433,7 @@ export default class Bynder {
432433

433434
/**
434435
* Get the metaproperty information according to the id provided.
435-
* @see {@link http://docs.bynder.apiary.io/#reference/metaproperties/specific-metaproperty-operations/specific-metaproperty-info|API Call}
436+
* @see {@link http://docs.bynder.apiary.io/#reference/metaproperties/specific-metaproperty-operations/retrieve-specific-metaproperty|API Call}
436437
* @param {Object} queryObject={} - An object containing the id of the desired metaproperty.
437438
* @param {String} queryObject.id - The id of the desired metaproperty.
438439
* @return {Promise} Metaproperty - Returns a Promise that, when fulfilled, will either return an Object with the
@@ -457,7 +458,7 @@ export default class Bynder {
457458

458459
/**
459460
* Save a new metaproperty in the information provided.
460-
* @see {@link http://docs.bynder.apiary.io/#reference/metaproperties/metaproperty-access/save-new-metaproperty|API Call}
461+
* @see {@link http://docs.bynder.apiary.io/#reference/metaproperties/metaproperty-operations/create-metaproperty|API Call}
461462
* @param {Object} object={} - An object containing the data of the new metaproperty.
462463
* @return {Promise} Object - Returns a Promise that, when fulfilled, will either return an empty Object in
463464
* case it's successful or an Error with the problem.
@@ -479,7 +480,7 @@ export default class Bynder {
479480

480481
/**
481482
* Delete the metaproperty with the provided id.
482-
* @see {@link http://docs.bynder.apiary.io/#reference/metaproperties/specific-metaproperty-operations/remove-metaproperty|API Call}
483+
* @see {@link http://docs.bynder.apiary.io/#reference/metaproperties/delete-metaproperty|API Call}
483484
* @param {Object} object={} - An object containing the id of the metaproperty to be deleted.
484485
* @param {String} object.id - The id of the metaproperty.
485486
* @return {Promise} Object - Returns a Promise that, when fulfilled, will either return an empty Object in
@@ -505,10 +506,11 @@ export default class Bynder {
505506
/**
506507
* Get all the tags
507508
* @see {@link http://docs.bynder.apiary.io/#reference/tags/tags-access/retrieve-entry-point|API Call}
509+
* @param {Object} [queryObject={}] - An object containing the parameters accepted by the API to narrow the query.
508510
* @return {Promise} Tags - Returns a Promise that, when fulfilled, will either return an Array with the
509511
* tags or an Error with the problem.
510512
*/
511-
getTags() {
513+
getTags(queryObject) {
512514
if (!this.validURL()) {
513515
return rejectURL();
514516
}
@@ -517,14 +519,16 @@ export default class Bynder {
517519
'v4/tags/',
518520
'GET',
519521
this.consumerToken,
520-
this.accessToken
522+
this.accessToken,
523+
queryObject
521524
);
522525
return request.send();
523526
}
524527

525528
/**
526529
* Get collections according to the parameters provided
527-
* @see {@link http://docs.bynder.apiary.io/#reference/tags/tags-operations-on-assets/retrieve-collections|API Call}
530+
* @see {@link http://docs.bynder.apiary.io/#reference/collections/collection-operations/retrieve-collections|API Call}
531+
* @param {Object} [queryObject={}] - An object containing the parameters accepted by the API to narrow the query.
528532
* @return {Promise} Collections - Returns a Promise that, when fulfilled, will either return an Array with the
529533
* collections or an Error with the problem.
530534
*/
@@ -545,7 +549,7 @@ export default class Bynder {
545549

546550
/**
547551
* Get the collection information according to the id provided.
548-
* @see {@link http://docs.bynder.apiary.io/#reference/tags/tags-operations-on-assets/retrieve-specific-collection|API Call}
552+
* @see {@link http://docs.bynder.apiary.io/#reference/collections/specific-collection-operations/retrieve-specific-collection|API Call}
549553
* @param {Object} queryObject={} - An object containing the id of the desired collection.
550554
* @param {String} queryObject.id - The id of the desired collection.
551555
* @return {Promise} Collection - Returns a Promise that, when fulfilled, will either return an Object with the

0 commit comments

Comments
 (0)