1 | const validate = require('./validate');
|
2 |
|
3 | module.exports = ({ instance, headers }) => {
|
4 | const url = `https://${instance}.zendesk.com`;
|
5 |
|
6 | return {
|
7 | list: (options = null) => {
|
8 | if (options) throw new Error('no options are allowed');
|
9 |
|
10 | return {
|
11 | method: 'GET',
|
12 | url: `${url}/api/v2/activities.json`,
|
13 | headers
|
14 | };
|
15 | },
|
16 |
|
17 | show: (options = {}) => {
|
18 | const { error } = validate.show(options);
|
19 | if (error) throw new Error(error.details[0].message);
|
20 |
|
21 | const { activity_id } = options;
|
22 | return {
|
23 | method: 'GET',
|
24 | url: `${url}/api/v2/activities/${activity_id}.json`,
|
25 | headers
|
26 | };
|
27 | }
|
28 | };
|
29 | };
|