oauth3.js/oauth3.domains.js

20 lines
564 B
JavaScript

;(function (exports) {
'use strict';
var OAUTH3 = exports.OAUTH3 = exports.OAUTH3 || require('./oauth3.core.js').OAUTH3;
OAUTH3.api['domains.list'] = function (providerUri, opts) {
var session = opts.session;
return OAUTH3.request({
method: 'GET'
, url: OAUTH3.url.normalize(providerUri)
+ '/api/com.daplie.domains/accounts/' + session.token.sub + '/registrations'
, session: session
}).then(function (res) {
return res.data.registrations || res.data.domains || res.data;
});
};
}('undefined' !== typeof exports ? exports : window));