@androozka/zendesk-api-js
Version:
A JS library for interacting with the Zendesk API.
30 lines (24 loc) • 676 B
JavaScript
const validate = require('./validate');
module.exports = ({ instance, headers }) => {
const url = `https://${instance}.zendesk.com`;
return {
list: (options = null) => {
if (options) throw new Error('no options are allowed');
return {
method: 'GET',
url: `${url}/api/v2/activities.json`,
headers
};
},
show: (options = {}) => {
const { error } = validate.show(options);
if (error) throw new Error(error.details[0].message);
const { activity_id } = options;
return {
method: 'GET',
url: `${url}/api/v2/activities/${activity_id}.json`,
headers
};
}
};
};