|
@ -1,13 +1,19 @@ |
|
|
const axios = require('axios'); |
|
|
const axios = require('axios'); |
|
|
|
|
|
const path = require('path'); |
|
|
|
|
|
|
|
|
const { |
|
|
const { |
|
|
token |
|
|
token |
|
|
} = require('./config') |
|
|
} = require(path.resolve(path.dirname(require.main.filename), 'config')); |
|
|
|
|
|
|
|
|
const domainList = require('./lib/domains/list'); |
|
|
const domainList = require('./lib/domains/list'); |
|
|
const domainCreate = require('./lib/domains/create'); |
|
|
const domainCreate = require('./lib/domains/create'); |
|
|
const domainRetrieve = require('./lib/domains/retrieve'); |
|
|
const domainRetrieve = require('./lib/domains/retrieve'); |
|
|
const domainDelete = require('./lib/domains/deleteDomain'); |
|
|
const domainDelete = require('./lib/domains/delete'); |
|
|
|
|
|
const listDomainRecords = require('./lib/domain-records/list'); |
|
|
|
|
|
const createDomainRecords = require('./lib/domain-records/create'); |
|
|
|
|
|
const retrieveDomainRecords = require('./lib/domain-records/retrieve'); |
|
|
|
|
|
const updateDomainRecords = require('./lib/domain-records/update'); |
|
|
|
|
|
const deleteDomainRecords = require('./lib/domain-records/delete'); |
|
|
|
|
|
|
|
|
const instance = axios.create({ |
|
|
const instance = axios.create({ |
|
|
baseURL: 'https://api.digitalocean.com/v2', |
|
|
baseURL: 'https://api.digitalocean.com/v2', |
|
@ -17,11 +23,18 @@ const instance = axios.create({ |
|
|
} |
|
|
} |
|
|
}); |
|
|
}); |
|
|
|
|
|
|
|
|
const domain = { |
|
|
module.exports = { |
|
|
List: (instance) => domainList(instance), |
|
|
domain: { |
|
|
Create: (instance, domainObject) => domainCreate(instance, domainObject), |
|
|
List: () => domainList(instance), |
|
|
Retrieve: (instance, domainName) => domainRetrieve(instance, domainName), |
|
|
Create: (domainObject) => domainCreate(instance, domainObject), |
|
|
Delete: (instance, domainName) => domainDelete(instance, domainName), |
|
|
Retrieve: (domainObject) => domainRetrieve(instance, domainObject), |
|
|
|
|
|
Delete: (domainObject) => domainDelete(instance, domainObject), |
|
|
|
|
|
Records: { |
|
|
|
|
|
List: (domainObject) => listDomainRecords(instance, domainObject), |
|
|
|
|
|
Create: (domainObject, domainRecords) => createDomainRecords(instance, domainObject, domainRecords), |
|
|
|
|
|
Retrieve: (domainObject, recordId) => retrieveDomainRecords(instance, domainObject, recordId), |
|
|
|
|
|
Update: (domainObject, recordId) => updateDomainRecords(instance, domainObject, recordId), |
|
|
|
|
|
Delete: (domainObject, recordId) => deleteDomainRecords(instance, domainObject, recordId), |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
}; |
|
|
}; |
|
|
|
|
|
|
|
|
module.exports.domain = domain; |
|
|
|