UNPKG

770 BJavaScriptView Raw
1// const Joi = require('@hapi/joi');
2const { validate, prepare } = require('../../utils/options');
3
4// Validation
5// const _id = Joi.number().positive();
6// const _data = Joi.object();
7
8// Initialize Endpoint
9module.exports = (options = {}) => {
10 const { error } = validate(options);
11 if (error) throw new Error(error.details[0].message);
12
13 const { url, headers } = prepare(options);
14
15 return {
16 /**
17 * List Custom Objects Events
18 *
19 * GET api/sunshine/objects/events
20 * https://developer.zendesk.com/rest_api/docs/sunshine/object_events#list-custom-objects-events
21 */
22 list: () => {
23 // Ignore any options
24 return {
25 method: 'GET',
26 url: `${url}/api/sunshine/objects/events`,
27 headers
28 };
29 }
30 };
31};