API Pullout-glueAdd,dnsUnset,deviceDetach

This commit is contained in:
Drew Warren 2017-04-11 16:18:44 -06:00
parent ebb44c3dcb
commit faf6814a53
2 changed files with 25 additions and 19 deletions

View File

@ -55,28 +55,15 @@ OAUTH3.api['devices.attach'] = function (providerUri, opts) {
OAUTH3.api['devices.detach'] = function (providerUri, opts) {
var session = opts.session;
var device = opts.device;
var tld = opts.tld;
var sld = opts.sld;
var sub = opts.sub;
return OAUTH3.request({
url: OAUTH3.url.normalize(providerUri)
+ '/api/com.daplie.domains/accounts/' + session.token.sub
//+ '/devices/' + device + '/'
+ '/devices/' + (opts.data.uid || '_') + '/' + opts.data.device
+ '/' + opts.data.tld + '/' + opts.data.sld + '/' + (opts.data.sub || '')
, method: 'DELETE'
, session: session
}, {}).then(function (res) {
return res.data.devices || res.data;
});
};
OAUTH3.api['devices.detach'] = function (providerUri, opts) {
var session = opts.session;
return OAUTH3.request({
url: OAUTH3.url.normalize(providerUri)
+ '/api/com.daplie.domains/accounts/' + session.token.sub
+ '/devices/' + opts.data.device
+ '/' + opts.data.tld + '/' + opts.data.sld + '/' + (opts.data.sub || '')
+ '/devices/' + device + '/' + tld + '/' + sld + '/' + (sub || '')
, method: 'DELETE'
, session: session
}, {}).then(function (res) {
@ -115,4 +102,23 @@ OAUTH3.api['dns.set'] = function (providerUri, opts) {
});
};
OAUTH3.api['dns.unset'] = function (providerUri, opts) {
var session = opts.session;
var tld = opts.tld;
var sld = opts.sld;
var sub = (opts.sub || '@');
var type = opts.type;
var value = opts.value;
return OAUTH3.request({
url: OAUTH3.url.normalize(providerUri)
+ '/api/com.daplie.domains/accounts/' + session.token.sub
+ '/dns/' + tld + '/' + sld + '/' + sub + '/' + type + '/' + value
, method: 'DELETE'
, session: session
}, {}).then(function (res) {
return res.data || res;
});
};
}('undefined' !== typeof exports ? exports : window));

View File

@ -84,7 +84,7 @@ OAUTH3.api['glue.add'] = function (providerUri, opts) {
var ip = opts.ip;
var tld = opts.tld;
var sld = opts.sld;
var sub = opts.sub;
var sub = (opts.sub || '@');
return OAUTH3.request({
method: 'POST'