@radio-retail/api-client
Advanced tools
Comparing version 1.0.3 to 1.0.4
@@ -8,3 +8,7 @@ const getData = require('../utils/get-raw-data'); | ||
module.exports = function (instance) { | ||
return { ...crud(instance, baseRoute), | ||
return { | ||
// Clients | ||
createClient(data, config = {}) { | ||
return instance.post(baseRoute, data, config).then(getData(config.raw)); | ||
}, | ||
@@ -28,2 +32,8 @@ getClients(params, config = {}) { | ||
searchClients(params, config = {}) { | ||
return instance.get(`${baseRoute}/search`, { | ||
params | ||
}).then(getData(config.raw)); | ||
}, | ||
toggleActiveState(clientId, active, config = {}) { | ||
@@ -33,2 +43,3 @@ return instance.post(`${baseRoute}/${clientId}/${active ? 'deactivate' : 'activate'}`, config).then(getData(config.raw)); | ||
// Accounts | ||
getAccountsForClient(clientId = '', config = {}) { | ||
@@ -38,2 +49,14 @@ return instance.get(`${baseRoute}/${clientId}/accounts`).then(getData(config.raw)); | ||
getAccountById(clientId, accountId) { | ||
return instance.get(`${baseRoute}/${clientId}/accounts/${accountId}`).then(res => { | ||
res.data.data.ifMatch = res.headers.etag; | ||
return res.data.data; | ||
}); | ||
}, | ||
deleteAccount(clientId, accountId) { | ||
return instance.delete(`${baseRoute}/${clientId}/accounts/${accountId}`); | ||
}, | ||
// Sites | ||
getSitesForClient(clientId = '', accountId = '', config = {}) { | ||
@@ -43,14 +66,7 @@ return instance.get(`${baseRoute}/${clientId}/accounts/${accountId}/sites`).then(getData(config.raw)); | ||
createClient(data, config = {}) { | ||
return instance.post(baseRoute, data, config).then(getData(config.raw)); | ||
}, | ||
// General | ||
...crud(instance, baseRoute), | ||
getLanguages(config = {}) { | ||
return instance.get(`${baseRoute}/languages`, config).then(getData(config.raw)); | ||
}, | ||
searchClients(params, config = {}) { | ||
return instance.get(`${baseRoute}/search`, { | ||
params | ||
}).then(getData(config.raw)); | ||
} | ||
@@ -57,0 +73,0 @@ |
{ | ||
"name": "@radio-retail/api-client", | ||
"description": "Radio Retail API client", | ||
"version": "1.0.3", | ||
"version": "1.0.4", | ||
"main": "dist/index.js", | ||
@@ -6,0 +6,0 @@ "scripts": { |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
7627
199