-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathidentifiers.js
38 lines (35 loc) · 1.17 KB
/
identifiers.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
/*
* robin-js-sdk
* http://getrobin.com/
*
* Copyright (c) 2014 Robin Powered Inc.
* Licensed under the Apache v2 license.
* https://github.com/robinpowered/robin-js-sdk/blob/master/LICENSE
*
*/
var constants = require('../../util').constants;
module.exports = {
/**
* Get all the identifiers or a particular identifier identified by the `identifierUrn` parameter
* @param {String|Integer|undefined} identifierUrn A Robin identifier URN
* @param {Object|undefined} params A querystring object
* @return {Function} A Promise
*/
get: function (identifierUrn, params) {
var path = this.constructPath(constants.IDENTIFIERS, identifierUrn);
return this.Core.GET(path, params);
},
/**
* Delete an identifier
* @param {String|Integer} identifierUrn A Robin identifier URN
* @return {Function} A Promise
*/
delete: function (identifierUrn) {
if (identifierUrn) {
var path = this.constructPath(constants.IDENTIFIERS, identifierUrn);
return this.Core.DELETE(path);
} else {
return this.rejectRequest('Bad request: An identifier URN is required.');
}
}
};