From faf6814a53ab2ca8eb6000e48a4e2b7b6c0a534a Mon Sep 17 00:00:00 2001 From: Drew Warren Date: Tue, 11 Apr 2017 16:18:44 -0600 Subject: [PATCH] API Pullout-glueAdd,dnsUnset,deviceDetach --- oauth3.dns.js | 42 ++++++++++++++++++++++++------------------ oauth3.domains.js | 2 +- 2 files changed, 25 insertions(+), 19 deletions(-) diff --git a/oauth3.dns.js b/oauth3.dns.js index 22c92e2..e81f9c5 100644 --- a/oauth3.dns.js +++ b/oauth3.dns.js @@ -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)); diff --git a/oauth3.domains.js b/oauth3.domains.js index 3db3524..280f16c 100644 --- a/oauth3.domains.js +++ b/oauth3.domains.js @@ -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'