upgrade to 1.1.0
This commit is contained in:
1 parent
02c95d89bb
commit
f5893a107d
46 files changed
+3764
-2891
No files matched your search
Vendored
+30
@@ -0,0 +1,30 @@
|
||||
"use strict";
|
||||
const axios = require('axios');
|
||||
const { getConfig } = require('./config.js');
|
||||
function _getUrl(path) {
|
||||
const cfg = getConfig();
|
||||
return `${cfg.apiUrl}${path}`;
|
||||
}
|
||||
function _headers(token) {
|
||||
return {
|
||||
'Authorization': `Bearer ${token || getConfig().apiKey}`,
|
||||
};
|
||||
}
|
||||
async function getDomains({ fedidUrl, auth: authPayload }) {
|
||||
const cfg = getConfig();
|
||||
return (await axios.post(_getUrl('/api/v1/data/entity/domains/get'), {
|
||||
fedidUrl: fedidUrl || cfg.fedidUrl,
|
||||
auth: authPayload,
|
||||
}, { headers: _headers() })).data;
|
||||
}
|
||||
async function createEntity({ fedidUrl, shortName }) {
|
||||
const cfg = getConfig();
|
||||
return (await axios.post(_getUrl('/api/v1/data/entity/create'), {
|
||||
fedidUrl: fedidUrl || cfg.fedidUrl,
|
||||
shortName,
|
||||
}, { headers: _headers() })).data;
|
||||
}
|
||||
async function getEntity({ shortName }) {
|
||||
return (await axios.post(_getUrl('/api/v1/data/entity/get'), { shortName }, { headers: _headers() }));
|
||||
}
|
||||
module.exports = { getDomains, getEntity, createEntity };
|
||||
Reference in new issue
Block a user