@theholocron/zendesk-client 0.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md ADDED
@@ -0,0 +1,19 @@
1
+ # Zendesk Client
2
+
3
+ A NodeJS/JavaScript client for our Zendesk API.
4
+
5
+ ## Installation
6
+
7
+ ```bash
8
+ npm install --save @theholocron/client-zendesk
9
+ ```
10
+
11
+ ## Usage
12
+
13
+ ```javascript
14
+ import zendesk from "@theholocron/client-zendesk";
15
+
16
+ const [ticketsErr, tickets] = zendesk.tickets.get("loan-guid", { token: auth.token });
17
+ ```
18
+
19
+ _Check the `examples.ts` file for more._
@@ -0,0 +1,461 @@
1
+ //#region src/types.d.ts
2
+ interface IAPIResponse {
3
+ next_page?: string | null;
4
+ previous_page?: string | null;
5
+ count: number;
6
+ }
7
+ interface IAPIError {
8
+ error: string;
9
+ description: string;
10
+ }
11
+ //#endregion
12
+ //#region src/attachments/attachments.types.d.ts
13
+ interface IImage {
14
+ content_type?: string | null;
15
+ content_url?: string | null;
16
+ deleted?: boolean | null;
17
+ file_name?: string | null;
18
+ height?: number | null;
19
+ id?: number | null;
20
+ inline?: boolean | null;
21
+ malware_access_override?: boolean | null;
22
+ malware_scan_result?: "malware_found" | "malware_not_found" | "failed_to_scan" | "not_scanned" | null;
23
+ mapped_content_url?: string | null;
24
+ size?: number | null;
25
+ url?: string | null;
26
+ width?: number | null;
27
+ }
28
+ interface IAttachment extends IImage {
29
+ thumbnails?: IImage[];
30
+ }
31
+ //#endregion
32
+ //#region src/attachments/attachments.mocks.d.ts
33
+ declare const mockImage: IImage;
34
+ declare const mockThumbnail: IImage;
35
+ declare const mockAttachment: IAttachment;
36
+ //#endregion
37
+ //#region src/user/user.types.d.ts
38
+ interface IUser {
39
+ active?: boolean | null;
40
+ alias?: string | null;
41
+ chat_only?: boolean | null;
42
+ created_at?: string | null;
43
+ custom_role_id?: number | null;
44
+ default_group_id?: number | null;
45
+ details?: string | null;
46
+ email?: string | null;
47
+ external_id?: string | null;
48
+ iana_time_zone?: string | null;
49
+ id?: number | null;
50
+ last_login_at?: string | null;
51
+ locale?: string | null;
52
+ locale_id?: number | null;
53
+ moderator?: boolean | null;
54
+ name: string | null;
55
+ notes?: string | null;
56
+ only_private_comments?: boolean | null;
57
+ organization_id?: number | null;
58
+ phone?: string | null;
59
+ photo?: IAttachment | null;
60
+ remote_photo_url?: string | null;
61
+ report_csv?: boolean | null;
62
+ restricted_agent?: boolean | null;
63
+ role?: "end-user" | "agent" | "admin" | null;
64
+ role_type?: 0 | 1 | 2 | 3 | 4 | 5 | null;
65
+ shared?: boolean | null;
66
+ shared_agent?: boolean | null;
67
+ shared_phone_number?: boolean | null;
68
+ signature?: string | null;
69
+ suspended?: boolean | null;
70
+ tags?: string[] | null;
71
+ ticket_restriction?: "organization" | "groups" | "assigned" | "requested" | null;
72
+ time_zone?: string | null;
73
+ two_factor_auth_enabled?: boolean | null;
74
+ updated_at?: string | null;
75
+ url?: string | null;
76
+ user_fields?: Record<string, unknown> | null;
77
+ verified?: boolean | null;
78
+ }
79
+ //#endregion
80
+ //#region src/activities/activities.types.d.ts
81
+ interface IActivity {
82
+ actor?: IUser | null;
83
+ actor_id?: number | null;
84
+ created_at?: string | null;
85
+ id?: number | null;
86
+ object?: Record<string, unknown> | null;
87
+ target?: Record<string, unknown> | null;
88
+ title?: string | null;
89
+ updated_at?: string | null;
90
+ url?: string | null;
91
+ user?: IUser | null;
92
+ user_id?: number | null;
93
+ verb?: "tickets.assignment" | "tickets.comment" | "tickets.priority_increase" | null;
94
+ }
95
+ interface IActivityResponse extends IAPIResponse {
96
+ activities: IActivity[];
97
+ actors: IUser[];
98
+ users: IUser[];
99
+ }
100
+ //#endregion
101
+ //#region src/activities/activities.d.ts
102
+ interface FetchOptions$5 {
103
+ environment?: string;
104
+ headers?: Record<string, unknown>;
105
+ params?: Record<string, unknown>;
106
+ token: string;
107
+ }
108
+ //#endregion
109
+ //#region src/group/group.types.d.ts
110
+ interface IGroup {
111
+ created_at?: string | null;
112
+ default?: boolean | null;
113
+ deleted?: boolean | null;
114
+ description?: string | null;
115
+ id?: number | null;
116
+ is_public?: boolean | null;
117
+ name?: string | null;
118
+ updated_at?: string | null;
119
+ url?: string | null;
120
+ }
121
+ //#endregion
122
+ //#region src/tickets/comments.types.d.ts
123
+ interface IComment {
124
+ attachments?: IAttachment[] | null;
125
+ audit_id?: number | null;
126
+ author_id?: number | null;
127
+ body?: string | null;
128
+ created_at?: string | null;
129
+ html_body?: string | null;
130
+ id?: number | null;
131
+ metadata?: IMetadata | null;
132
+ plain_body?: string | null;
133
+ public?: boolean | null;
134
+ type?: "Comment" | "VoiceComment" | null;
135
+ uploads?: string[] | null;
136
+ via?: IVia | null;
137
+ }
138
+ interface ICommentResponse {
139
+ comments: IComment[];
140
+ }
141
+ //#endregion
142
+ //#region src/tickets/fields.types.d.ts
143
+ interface ICustomField {
144
+ id: number | null;
145
+ value: string | number | string[] | null;
146
+ }
147
+ interface ITicketField {
148
+ active?: boolean | null;
149
+ agent_description?: string | null;
150
+ collapsed_for_agents?: boolean | null;
151
+ created_at?: string | null;
152
+ custom_field_options?: Array<unknown> | null;
153
+ custom_statuses?: Array<unknown> | null;
154
+ description?: string | null;
155
+ editable_in_portal?: boolean | null;
156
+ id?: number | null;
157
+ position?: number | null;
158
+ raw_description?: string | null;
159
+ raw_title?: string | null;
160
+ raw_title_in_portal?: string | null;
161
+ regexp_for_validation?: string | null;
162
+ relationship_filter?: Record<string, unknown> | null;
163
+ relationship_target_type?: string | null;
164
+ removable?: boolean | null;
165
+ required?: boolean | null;
166
+ required_in_portal?: boolean | null;
167
+ sub_type_id?: number | null;
168
+ system_field_options?: Array<unknown> | null;
169
+ tag?: string | null;
170
+ title: string | null;
171
+ title_in_portal?: string | null;
172
+ type: string | null;
173
+ updated_at?: string | null;
174
+ url?: string | null;
175
+ visible_in_portal?: boolean | null;
176
+ }
177
+ type TTicketFieldsResponse = IAPIResponse & {
178
+ ticket_fields: ITicketField[];
179
+ };
180
+ type TTicketFieldResponse = IAPIResponse & {
181
+ ticket_field: ITicketField;
182
+ };
183
+ //#endregion
184
+ //#region src/tickets/tickets.types.d.ts
185
+ type TTicketStatus = 'new' | 'open' | 'pending' | 'hold' | 'solved' | 'closed';
186
+ type TTicketPriority = 'urgent' | 'high' | 'normal' | 'low';
187
+ type TTicketType = 'problem' | 'incident' | 'question' | 'task';
188
+ interface IVia {
189
+ channel: string | number | null;
190
+ source?: {
191
+ from?: Record<string, unknown>;
192
+ rel?: string | null;
193
+ to?: Record<string, unknown>;
194
+ };
195
+ }
196
+ interface IMetadata {
197
+ system?: {
198
+ client?: string | null;
199
+ ip_address?: string | null;
200
+ latitude?: number | null;
201
+ location?: string | null;
202
+ longitude?: number | null;
203
+ };
204
+ via: IVia;
205
+ }
206
+ interface ITicket$1 {
207
+ allow_attachments?: boolean | null;
208
+ allow_channelback?: boolean | null;
209
+ assignee_email?: string | null;
210
+ assignee_id?: number | null;
211
+ attribute_value_ids?: string[] | null;
212
+ brand_id?: number | null;
213
+ collaborator_ids?: number[] | null;
214
+ collaborators?: Array<unknown> | null;
215
+ comment?: IComment | null;
216
+ created_at?: string | null;
217
+ custom_fields?: ICustomField[] | null;
218
+ custom_status_id?: number | null;
219
+ description?: string | null;
220
+ due_at?: string | null;
221
+ email_cc_ids?: number[] | null;
222
+ email_ccs?: Array<Record<string, unknown>>;
223
+ external_id?: string | null;
224
+ follower_ids?: number[] | null;
225
+ followers?: Array<Record<string, unknown>>;
226
+ followup_ids?: number[] | null;
227
+ forum_topic_id?: number | null;
228
+ from_messaging_channel?: boolean | null;
229
+ group_id?: number | null;
230
+ has_incidents?: boolean | null;
231
+ id?: number | null;
232
+ is_public?: boolean | null;
233
+ macro_id?: number | null;
234
+ macro_ids?: number[] | null;
235
+ metadata?: IMetadata | null;
236
+ organization_id?: number | null;
237
+ priority?: TTicketPriority | null;
238
+ problem_id?: number | null;
239
+ raw_subject?: string | null;
240
+ recipient?: string | null;
241
+ requester?: Record<string, unknown>;
242
+ requester_id: number | null;
243
+ safe_update?: boolean | null;
244
+ satisfaction_rating?: Record<string, unknown>;
245
+ sharing_agreement_ids?: number[] | null;
246
+ status?: TTicketStatus | null;
247
+ subject?: string | null;
248
+ submitter_id?: number | null;
249
+ tags?: string[] | null;
250
+ ticket_form_id?: number | null;
251
+ type?: TTicketType | null;
252
+ updated_at?: string | null;
253
+ updated_stamp?: string | null;
254
+ url?: string | null;
255
+ via?: IVia | null;
256
+ via_followup_source_id?: number | null;
257
+ via_id?: number | null;
258
+ voice_comment?: Record<string, unknown>;
259
+ }
260
+ type TTicketsResponse = IAPIResponse & {
261
+ tickets: ITicket$1[];
262
+ deleted_ticket_forms?: Array<unknown>;
263
+ };
264
+ type TTicketResponse = IAPIResponse & {
265
+ ticket: ITicket$1;
266
+ deleted_ticket_forms?: Array<unknown>;
267
+ };
268
+ //#endregion
269
+ //#region src/search/search.types.d.ts
270
+ interface ISearchResponse extends IAPIResponse {
271
+ facets?: string | null;
272
+ results: ITicket$1[] | IUser[] | IGroup[];
273
+ }
274
+ //#endregion
275
+ //#region src/search/search.d.ts
276
+ interface FetchOptions$4 {
277
+ environment?: string;
278
+ headers?: Record<string, unknown>;
279
+ params?: Record<string, unknown>;
280
+ sort?: "asc" | "desc";
281
+ token: string;
282
+ }
283
+ //#endregion
284
+ //#region src/status/status.types.d.ts
285
+ interface IStatus {
286
+ active?: boolean | null;
287
+ agent_label?: string | null;
288
+ description?: string | null;
289
+ end_user_description?: string | null;
290
+ status_category?: string | null;
291
+ }
292
+ interface IDefaultStatus extends IStatus {
293
+ end_user_label?: "new" | "open" | "pending" | "hold" | "solved" | null;
294
+ }
295
+ interface ICustomStatus extends IStatus {
296
+ created_at?: string | null;
297
+ default?: boolean | null;
298
+ end_user_label?: string | null;
299
+ id?: number | null;
300
+ raw_agent_label?: string | null;
301
+ raw_description?: string | null;
302
+ raw_end_user_description?: string | null;
303
+ raw_end_user_label?: string | null;
304
+ updated_at?: string | null;
305
+ url?: string | null;
306
+ }
307
+ interface ICustomStatusesResponse extends IAPIResponse {
308
+ custom_statuses: ICustomStatus[];
309
+ }
310
+ interface ICustomStatusResponse extends IAPIResponse {
311
+ custom_status: ICustomStatus;
312
+ }
313
+ //#endregion
314
+ //#region src/status/status.d.ts
315
+ interface FetchOptions$3 {
316
+ environment?: string;
317
+ headers?: Record<string, unknown>;
318
+ id?: number | null;
319
+ method?: "create" | "delete" | "patch" | "post" | "put";
320
+ params?: Record<string, unknown>;
321
+ token: string;
322
+ }
323
+ //#endregion
324
+ //#region src/tickets/comments.d.ts
325
+ interface FetchOptions$2 {
326
+ environment?: string;
327
+ headers?: Record<string, unknown>;
328
+ params?: Record<string, unknown>;
329
+ token: string;
330
+ }
331
+ //#endregion
332
+ //#region src/tickets/fields.d.ts
333
+ interface FetchOptions$1 {
334
+ environment?: string;
335
+ headers?: Record<string, unknown>;
336
+ id?: number | null;
337
+ method?: "create" | "delete" | "patch" | "post" | "put";
338
+ params?: Record<string, unknown>;
339
+ token: string;
340
+ }
341
+ //#endregion
342
+ //#region src/tickets/tickets.d.ts
343
+ interface FetchOptions {
344
+ environment?: string;
345
+ headers?: Record<string, unknown>;
346
+ id?: number | null;
347
+ method?: "create" | "delete" | "patch" | "post" | "put";
348
+ params?: Record<string, unknown>;
349
+ token: string;
350
+ }
351
+ //#endregion
352
+ //#region src/activities/activities.mocks.d.ts
353
+ declare const mockActivity: IActivity;
354
+ declare const mockActivityResponse: IActivityResponse;
355
+ //#endregion
356
+ //#region src/group/group.mocks.d.ts
357
+ declare const mockGroup: IGroup;
358
+ //#endregion
359
+ //#region src/search/search.mocks.d.ts
360
+ declare const mockSearchResponseGroups: ISearchResponse;
361
+ declare const mockSearchResponseTickets: ISearchResponse;
362
+ declare const mockSearchResponseUsers: ISearchResponse;
363
+ //#endregion
364
+ //#region src/status/status.mocks.d.ts
365
+ declare const mockDefaultStatus: IDefaultStatus;
366
+ declare const mockCustomStatus: ICustomStatus;
367
+ declare const mockCustomStatusesResponse: ICustomStatusesResponse;
368
+ declare const mockCustomStatusResponse: ICustomStatusResponse;
369
+ //#endregion
370
+ //#region src/tickets/comments.mocks.d.ts
371
+ declare const mockComment: IComment;
372
+ declare const mockCommentResponse: ICommentResponse;
373
+ //#endregion
374
+ //#region src/tickets/fields.mocks.d.ts
375
+ declare const mockCustomField1: ICustomField;
376
+ declare const mockCustomField2: ICustomField;
377
+ declare const mockCustomFields: ICustomField[];
378
+ declare const mockTicketField: ITicketField;
379
+ declare const mockTicketFieldsResponse: TTicketFieldsResponse;
380
+ declare const mockTicketFieldResponse: TTicketFieldResponse;
381
+ //#endregion
382
+ //#region src/tickets/metrics.types.d.ts
383
+ interface ITimeInMinutes {
384
+ business: number;
385
+ calendar: number;
386
+ }
387
+ interface ITicketMetric {
388
+ agent_wait_time_in_minutes: ITimeInMinutes;
389
+ assigned_at: string;
390
+ assignee_stations: number;
391
+ assignee_updated_at: string;
392
+ created_at: string;
393
+ custom_status_updated_at: string;
394
+ first_resolution_time_in_minutes: ITimeInMinutes;
395
+ full_resolution_time_in_minutes: ITimeInMinutes;
396
+ group_stations: number;
397
+ id: number;
398
+ initially_assigned_at: string;
399
+ latest_comment_added_at: string;
400
+ on_hold_time_in_minutes: ITimeInMinutes;
401
+ reopens: number;
402
+ replies: number;
403
+ reply_time_in_minutes: ITimeInMinutes;
404
+ reply_time_in_seconds: {
405
+ calendar: number;
406
+ };
407
+ requester_updated_at: string;
408
+ requester_wait_time_in_minutes: ITimeInMinutes;
409
+ solved_at: string;
410
+ status_updated_at: string;
411
+ ticket_id: number;
412
+ updated_at: string;
413
+ }
414
+ //#endregion
415
+ //#region src/tickets/metrics.mocks.d.ts
416
+ declare const mockTicketMetric: ITicketMetric;
417
+ //#endregion
418
+ //#region src/tickets/tickets.mocks.d.ts
419
+ declare const mockVia: IVia;
420
+ declare const mockMetadata: IMetadata;
421
+ declare const mockTicket: ITicket$1;
422
+ declare const mockTicketsResponse: TTicketsResponse;
423
+ declare const mockTicketResponse: TTicketResponse;
424
+ //#endregion
425
+ //#region src/user/user.mocks.d.ts
426
+ declare const mockUser: IUser;
427
+ //#endregion
428
+ //#region src/utils.d.ts
429
+ declare const createToken: (user: string, password: string) => string;
430
+ declare function setToken(user: string, password: string): void;
431
+ //#endregion
432
+ //#region src/index.d.ts
433
+ declare const _default: {
434
+ activities: {
435
+ get: (options: FetchOptions$5) => Promise<[IAPIError | null, IActivityResponse]>;
436
+ };
437
+ search: (query: string, options: FetchOptions$4) => Promise<[IAPIError | null, ISearchResponse]>;
438
+ status: {
439
+ create: (status: ICustomStatus, options: FetchOptions$3) => Promise<void>;
440
+ get: (id?: number | FetchOptions$3 | undefined, options?: FetchOptions$3 | undefined) => Promise<[IAPIError, ICustomStatusResponse]>;
441
+ update: (id: number, status: ICustomStatus, options: FetchOptions$3) => Promise<void>;
442
+ };
443
+ tickets: {
444
+ comments: {
445
+ create: (id: number, comment: string, options: FetchOptions$2) => Promise<ITicket$1>;
446
+ get: (ticket: number, options: FetchOptions$2) => Promise<ICommentResponse>;
447
+ };
448
+ fields: {
449
+ create: (field: ITicketField, options: FetchOptions$1) => Promise<ITicketField>;
450
+ get: (id?: number | FetchOptions$1 | undefined, options?: FetchOptions$1 | undefined) => Promise<[IAPIError | null, TTicketFieldsResponse | TTicketFieldResponse]>;
451
+ update: (id: number, field: ITicketField, options: FetchOptions$1) => Promise<ITicketField>;
452
+ delete: (id: number, options: FetchOptions$1) => any;
453
+ };
454
+ create: (ticket: ITicket$1, options: FetchOptions) => Promise<ITicket$1>;
455
+ get: (id?: number | FetchOptions | undefined, options?: FetchOptions | undefined) => Promise<[IAPIError | null, TTicketResponse | TTicketsResponse]>;
456
+ update: (id: number, ticket: ITicket$1, options: FetchOptions) => Promise<ITicket$1>;
457
+ delete: (id: number, options: FetchOptions) => Promise<void>;
458
+ };
459
+ };
460
+ //#endregion
461
+ export { type IAPIError, type IAPIResponse, type IActivity, type IActivityResponse, type IAttachment, type IComment, type ICommentResponse, type ICustomField, type ICustomStatus, type ICustomStatusResponse, type ICustomStatusesResponse, type IDefaultStatus, type IGroup, type IImage, type IMetadata, type ISearchResponse, type ITicket$1 as ITicket, type ITicketField, type ITicketMetric, type IUser, type IVia, type TTicketFieldResponse, type TTicketFieldsResponse, type TTicketPriority, type TTicketResponse, type TTicketStatus, type TTicketType, type TTicketsResponse, createToken, _default as default, mockActivity, mockActivityResponse, mockAttachment, mockComment, mockCommentResponse, mockCustomField1, mockCustomField2, mockCustomFields, mockCustomStatus, mockCustomStatusResponse, mockCustomStatusesResponse, mockDefaultStatus, mockGroup, mockImage, mockMetadata, mockSearchResponseGroups, mockSearchResponseTickets, mockSearchResponseUsers, mockThumbnail, mockTicket, mockTicketField, mockTicketFieldResponse, mockTicketFieldsResponse, mockTicketMetric, mockTicketResponse, mockTicketsResponse, mockUser, mockVia, setToken };