@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/LICENSE +674 -0
- package/README.md +19 -0
- package/dist/index.d.mts +461 -0
- package/dist/index.mjs +593 -0
- package/package.json +63 -0
package/dist/index.mjs
ADDED
|
@@ -0,0 +1,593 @@
|
|
|
1
|
+
import appConf from "@ce/app-config";
|
|
2
|
+
import { exreq, parseArgs, setBaseURL } from "@ce/utils-fetch";
|
|
3
|
+
import axios from "axios";
|
|
4
|
+
//#region src/activities/activities.ts
|
|
5
|
+
const operation$5 = "/api/v2/activities";
|
|
6
|
+
const getActivities = (options) => exreq({
|
|
7
|
+
operation: operation$5,
|
|
8
|
+
options: {
|
|
9
|
+
...options,
|
|
10
|
+
headers: {
|
|
11
|
+
...options.headers,
|
|
12
|
+
Authorization: `Basic ${options.token}`
|
|
13
|
+
},
|
|
14
|
+
baseURL: setBaseURL("zendesk", appConf, options?.environment)
|
|
15
|
+
}
|
|
16
|
+
});
|
|
17
|
+
var activities_default$1 = { get: getActivities };
|
|
18
|
+
//#endregion
|
|
19
|
+
//#region src/attachments/attachments.mocks.ts
|
|
20
|
+
const mockImage = {
|
|
21
|
+
content_type: "image/gif",
|
|
22
|
+
content_url: "https://example.zendesk.com/system/photos/8730791/1f84950b8d7949b3.gif",
|
|
23
|
+
deleted: false,
|
|
24
|
+
file_name: "1f84950b8d7949b3.gif",
|
|
25
|
+
height: 80,
|
|
26
|
+
id: 8730791,
|
|
27
|
+
inline: false,
|
|
28
|
+
mapped_content_url: "https://example.zendesk.com/system/photos/8730791/1f84950b8d7949b3.gif",
|
|
29
|
+
size: 4566,
|
|
30
|
+
url: "https://example.zendesk.com/api/v2/attachments/8730791.json",
|
|
31
|
+
width: 80
|
|
32
|
+
};
|
|
33
|
+
const mockThumbnail = {
|
|
34
|
+
content_type: "image/gif",
|
|
35
|
+
content_url: "https://example.zendesk.com/system/photos/8730801/1f84950b8d7949b3_thumb.gif",
|
|
36
|
+
deleted: false,
|
|
37
|
+
file_name: "1f84950b8d7949b3_thumb.gif",
|
|
38
|
+
height: 32,
|
|
39
|
+
id: 8730801,
|
|
40
|
+
inline: false,
|
|
41
|
+
mapped_content_url: "https://example.zendesk.com/system/photos/8730801/1f84950b8d7949b3_thumb.gif",
|
|
42
|
+
size: 1517,
|
|
43
|
+
url: "https://example.zendesk.com/api/v2/attachments/8730801.json",
|
|
44
|
+
width: 32
|
|
45
|
+
};
|
|
46
|
+
const mockAttachment = {
|
|
47
|
+
...mockImage,
|
|
48
|
+
thumbnails: [mockThumbnail]
|
|
49
|
+
};
|
|
50
|
+
//#endregion
|
|
51
|
+
//#region src/user/user.mocks.ts
|
|
52
|
+
const mockUser = {
|
|
53
|
+
active: true,
|
|
54
|
+
alias: "test",
|
|
55
|
+
created_at: "2017-08-14T20:13:53Z",
|
|
56
|
+
custom_role_id: null,
|
|
57
|
+
default_group_id: 1873,
|
|
58
|
+
details: "",
|
|
59
|
+
email: "user@zendesk.com",
|
|
60
|
+
external_id: "oev7jj",
|
|
61
|
+
iana_time_zone: "Pacific/Pago_Pago",
|
|
62
|
+
id: 3343,
|
|
63
|
+
last_login_at: "2020-11-16T22:57:45Z",
|
|
64
|
+
locale: "en-gb",
|
|
65
|
+
locale_id: 5,
|
|
66
|
+
moderator: true,
|
|
67
|
+
name: "Samwise Gamgee",
|
|
68
|
+
notes: "test",
|
|
69
|
+
only_private_comments: false,
|
|
70
|
+
organization_id: 1873,
|
|
71
|
+
phone: null,
|
|
72
|
+
photo: mockAttachment,
|
|
73
|
+
report_csv: true,
|
|
74
|
+
restricted_agent: false,
|
|
75
|
+
role: "admin",
|
|
76
|
+
role_type: null,
|
|
77
|
+
shared: false,
|
|
78
|
+
shared_agent: false,
|
|
79
|
+
shared_phone_number: null,
|
|
80
|
+
signature: "test",
|
|
81
|
+
suspended: false,
|
|
82
|
+
tags: ["101"],
|
|
83
|
+
ticket_restriction: null,
|
|
84
|
+
time_zone: "American Samoa",
|
|
85
|
+
two_factor_auth_enabled: null,
|
|
86
|
+
updated_at: "2020-11-17T00:33:55Z",
|
|
87
|
+
url: "https://example.zendesk.com/api/v2/users/3343.json",
|
|
88
|
+
user_fields: {
|
|
89
|
+
its_remember_september: null,
|
|
90
|
+
skittles: "2018-09-14T00:00:00+00:00",
|
|
91
|
+
user_field_1: "101"
|
|
92
|
+
},
|
|
93
|
+
verified: true
|
|
94
|
+
};
|
|
95
|
+
//#endregion
|
|
96
|
+
//#region src/activities/activities.mocks.ts
|
|
97
|
+
const mockActivity = {
|
|
98
|
+
actor: mockUser,
|
|
99
|
+
actor_id: 158488612,
|
|
100
|
+
created_at: "2020-11-17T00:34:40Z",
|
|
101
|
+
id: 29183462,
|
|
102
|
+
object: { ticket: {
|
|
103
|
+
id: 1521,
|
|
104
|
+
subject: "test"
|
|
105
|
+
} },
|
|
106
|
+
target: { ticket: {
|
|
107
|
+
id: 1521,
|
|
108
|
+
subject: "test"
|
|
109
|
+
} },
|
|
110
|
+
title: "Tedd assigned ticket #1521 to you.",
|
|
111
|
+
updated_at: "2020-11-17T00:34:40Z",
|
|
112
|
+
url: "https://example.zendesk.com/api/v2/activities/29183462.json",
|
|
113
|
+
user: mockUser,
|
|
114
|
+
user_id: 3343,
|
|
115
|
+
verb: "tickets.assignment"
|
|
116
|
+
};
|
|
117
|
+
const mockActivityResponse = {
|
|
118
|
+
activities: [mockActivity],
|
|
119
|
+
actors: [mockUser],
|
|
120
|
+
count: 1,
|
|
121
|
+
next_page: null,
|
|
122
|
+
previous_page: null,
|
|
123
|
+
users: [mockUser]
|
|
124
|
+
};
|
|
125
|
+
//#endregion
|
|
126
|
+
//#region src/activities/index.ts
|
|
127
|
+
var activities_default = { ...activities_default$1 };
|
|
128
|
+
//#endregion
|
|
129
|
+
//#region src/group/group.mocks.ts
|
|
130
|
+
const mockGroup = {
|
|
131
|
+
created_at: "2018-04-06T03:17:05Z",
|
|
132
|
+
default: false,
|
|
133
|
+
deleted: false,
|
|
134
|
+
description: "",
|
|
135
|
+
id: 1835972,
|
|
136
|
+
name: "Ragtail",
|
|
137
|
+
updated_at: "2018-04-06T03:17:05Z",
|
|
138
|
+
url: "https://example.zendesk.com/api/v2/groups/1835972.json"
|
|
139
|
+
};
|
|
140
|
+
//#endregion
|
|
141
|
+
//#region src/search/search.ts
|
|
142
|
+
const operation$4 = "/api/v2/search";
|
|
143
|
+
var search_default$1 = (query, options) => exreq({
|
|
144
|
+
operation: operation$4,
|
|
145
|
+
options: {
|
|
146
|
+
...options,
|
|
147
|
+
params: {
|
|
148
|
+
...options.params,
|
|
149
|
+
query,
|
|
150
|
+
sort_order: options?.sort || "desc"
|
|
151
|
+
},
|
|
152
|
+
headers: {
|
|
153
|
+
...options.headers,
|
|
154
|
+
Authorization: `Basic ${options.token}`
|
|
155
|
+
},
|
|
156
|
+
baseURL: setBaseURL("zendesk", appConf, options?.environment)
|
|
157
|
+
}
|
|
158
|
+
});
|
|
159
|
+
//#endregion
|
|
160
|
+
//#region src/tickets/fields.mocks.ts
|
|
161
|
+
const mockCustomField1 = {
|
|
162
|
+
id: 27642,
|
|
163
|
+
value: "745"
|
|
164
|
+
};
|
|
165
|
+
const mockCustomField2 = {
|
|
166
|
+
id: 27648,
|
|
167
|
+
value: "yes"
|
|
168
|
+
};
|
|
169
|
+
const mockCustomFields = [mockCustomField1, mockCustomField2];
|
|
170
|
+
const mockTicketField = {
|
|
171
|
+
active: true,
|
|
172
|
+
agent_description: "Agent only description",
|
|
173
|
+
collapsed_for_agents: false,
|
|
174
|
+
created_at: "2009-07-20T22:55:29Z",
|
|
175
|
+
description: "This is the subject field of a ticket",
|
|
176
|
+
editable_in_portal: true,
|
|
177
|
+
id: 34,
|
|
178
|
+
position: 21,
|
|
179
|
+
raw_description: "This is the subject field of a ticket",
|
|
180
|
+
raw_title: "{{dc.my_title}}",
|
|
181
|
+
raw_title_in_portal: "{{dc.my_title_in_portal}}",
|
|
182
|
+
regexp_for_validation: null,
|
|
183
|
+
required: true,
|
|
184
|
+
required_in_portal: true,
|
|
185
|
+
tag: null,
|
|
186
|
+
title: "Subject",
|
|
187
|
+
title_in_portal: "Subject",
|
|
188
|
+
type: "subject",
|
|
189
|
+
updated_at: "2011-05-05T10:38:52Z",
|
|
190
|
+
url: "https://company.zendesk.com/api/v2/ticket_fields/34.json",
|
|
191
|
+
visible_in_portal: true
|
|
192
|
+
};
|
|
193
|
+
const mockTicketFieldsResponse = {
|
|
194
|
+
count: 1,
|
|
195
|
+
ticket_fields: [mockTicketField]
|
|
196
|
+
};
|
|
197
|
+
const mockTicketFieldResponse = {
|
|
198
|
+
count: 1,
|
|
199
|
+
ticket_field: mockTicketField
|
|
200
|
+
};
|
|
201
|
+
//#endregion
|
|
202
|
+
//#region src/tickets/tickets.mocks.ts
|
|
203
|
+
const mockVia = {
|
|
204
|
+
channel: "web",
|
|
205
|
+
source: {
|
|
206
|
+
from: {},
|
|
207
|
+
rel: "web_widget",
|
|
208
|
+
to: {}
|
|
209
|
+
}
|
|
210
|
+
};
|
|
211
|
+
const mockMetadata = {
|
|
212
|
+
system: {
|
|
213
|
+
client: "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/61.0.3163.100 Safari/537.36",
|
|
214
|
+
ip_address: "1.1.1.1",
|
|
215
|
+
latitude: -37.000000000001,
|
|
216
|
+
location: "Melbourne, 07, Australia",
|
|
217
|
+
longitude: 144.0000000000002
|
|
218
|
+
},
|
|
219
|
+
via: mockVia
|
|
220
|
+
};
|
|
221
|
+
const mockTicket = {
|
|
222
|
+
assignee_id: 235323,
|
|
223
|
+
collaborator_ids: [35334, 234],
|
|
224
|
+
created_at: "2009-07-20T22:55:29Z",
|
|
225
|
+
custom_fields: mockCustomFields,
|
|
226
|
+
custom_status_id: 123,
|
|
227
|
+
description: "The fire is very colorful.",
|
|
228
|
+
due_at: null,
|
|
229
|
+
external_id: "ahg35h3jh",
|
|
230
|
+
follower_ids: [35334, 234],
|
|
231
|
+
from_messaging_channel: false,
|
|
232
|
+
group_id: 98738,
|
|
233
|
+
has_incidents: false,
|
|
234
|
+
id: 35436,
|
|
235
|
+
organization_id: 509974,
|
|
236
|
+
priority: "high",
|
|
237
|
+
problem_id: 9873764,
|
|
238
|
+
raw_subject: "{{dc.printer_on_fire}}",
|
|
239
|
+
recipient: "support@company.com",
|
|
240
|
+
requester_id: 20978392,
|
|
241
|
+
satisfaction_rating: {
|
|
242
|
+
comment: "Great support!",
|
|
243
|
+
id: 1234,
|
|
244
|
+
score: "good"
|
|
245
|
+
},
|
|
246
|
+
sharing_agreement_ids: [84432],
|
|
247
|
+
status: "open",
|
|
248
|
+
subject: "Help, my printer is on fire!",
|
|
249
|
+
submitter_id: 76872,
|
|
250
|
+
tags: ["enterprise", "other_tag"],
|
|
251
|
+
type: "incident",
|
|
252
|
+
updated_at: "2011-05-05T10:38:52Z",
|
|
253
|
+
url: "https://company.zendesk.com/api/v2/tickets/35436.json",
|
|
254
|
+
via: mockVia
|
|
255
|
+
};
|
|
256
|
+
const mockTicketsResponse = {
|
|
257
|
+
count: 1,
|
|
258
|
+
tickets: [mockTicket]
|
|
259
|
+
};
|
|
260
|
+
const mockTicketResponse = {
|
|
261
|
+
count: 1,
|
|
262
|
+
ticket: mockTicket
|
|
263
|
+
};
|
|
264
|
+
//#endregion
|
|
265
|
+
//#region src/search/search.mocks.ts
|
|
266
|
+
const mockSearchResponseGroups = {
|
|
267
|
+
count: 1,
|
|
268
|
+
facets: null,
|
|
269
|
+
results: [mockGroup]
|
|
270
|
+
};
|
|
271
|
+
const mockSearchResponseTickets = {
|
|
272
|
+
count: 1,
|
|
273
|
+
facets: null,
|
|
274
|
+
results: [mockTicket]
|
|
275
|
+
};
|
|
276
|
+
const mockSearchResponseUsers = {
|
|
277
|
+
count: 1,
|
|
278
|
+
facets: null,
|
|
279
|
+
results: [mockUser]
|
|
280
|
+
};
|
|
281
|
+
//#endregion
|
|
282
|
+
//#region src/search/index.ts
|
|
283
|
+
var search_default = search_default$1;
|
|
284
|
+
//#endregion
|
|
285
|
+
//#region src/status/status.ts
|
|
286
|
+
const operation$3 = "/api/v2/custom_statuses";
|
|
287
|
+
const createStatus = (status, options) => exreq({
|
|
288
|
+
operation: operation$3,
|
|
289
|
+
id: options?.id,
|
|
290
|
+
method: options?.method || "post",
|
|
291
|
+
data: { custom_status: status },
|
|
292
|
+
options: {
|
|
293
|
+
...options,
|
|
294
|
+
headers: {
|
|
295
|
+
...options?.headers,
|
|
296
|
+
Authorization: `Basic ${options.token}`
|
|
297
|
+
},
|
|
298
|
+
baseURL: setBaseURL("zendesk", appConf, options?.environment)
|
|
299
|
+
}
|
|
300
|
+
});
|
|
301
|
+
const getStatus = (...args) => {
|
|
302
|
+
const [id, options] = parseArgs(args);
|
|
303
|
+
return exreq({
|
|
304
|
+
operation: operation$3,
|
|
305
|
+
id,
|
|
306
|
+
options: {
|
|
307
|
+
...options,
|
|
308
|
+
headers: {
|
|
309
|
+
...options.headers,
|
|
310
|
+
Authorization: `Basic ${options.token}`
|
|
311
|
+
},
|
|
312
|
+
baseURL: setBaseURL("zendesk", appConf, options?.environment)
|
|
313
|
+
}
|
|
314
|
+
});
|
|
315
|
+
};
|
|
316
|
+
const updateStatus = (id, status, options) => createStatus(status, {
|
|
317
|
+
method: "put",
|
|
318
|
+
id,
|
|
319
|
+
...options
|
|
320
|
+
});
|
|
321
|
+
var status_default$1 = {
|
|
322
|
+
create: createStatus,
|
|
323
|
+
get: getStatus,
|
|
324
|
+
update: updateStatus
|
|
325
|
+
};
|
|
326
|
+
//#endregion
|
|
327
|
+
//#region src/status/status.mocks.ts
|
|
328
|
+
const mockDefaultStatus = {
|
|
329
|
+
active: true,
|
|
330
|
+
agent_label: "open",
|
|
331
|
+
description: "Customer needs a response quickly",
|
|
332
|
+
end_user_description: "Your ticket is being responded to",
|
|
333
|
+
end_user_label: "open",
|
|
334
|
+
status_category: "open"
|
|
335
|
+
};
|
|
336
|
+
const mockCustomStatus = {
|
|
337
|
+
active: true,
|
|
338
|
+
agent_label: "Responding quickly",
|
|
339
|
+
created_at: "2021-07-20T22:55:29Z",
|
|
340
|
+
default: false,
|
|
341
|
+
description: "Customer needs a response quickly",
|
|
342
|
+
end_user_description: "Your ticket is being responded to",
|
|
343
|
+
end_user_label: "Urgent processing",
|
|
344
|
+
id: 35436,
|
|
345
|
+
raw_agent_label: "Responding quickly",
|
|
346
|
+
raw_description: "Customer needs a response quickly",
|
|
347
|
+
raw_end_user_description: "Your ticket is being responded to",
|
|
348
|
+
raw_end_user_label: "Urgent processing",
|
|
349
|
+
status_category: "open",
|
|
350
|
+
updated_at: "2021-07-20T22:55:29Z"
|
|
351
|
+
};
|
|
352
|
+
const mockCustomStatusesResponse = {
|
|
353
|
+
count: 1,
|
|
354
|
+
custom_statuses: [mockCustomStatus]
|
|
355
|
+
};
|
|
356
|
+
const mockCustomStatusResponse = {
|
|
357
|
+
count: 1,
|
|
358
|
+
custom_status: mockCustomStatus
|
|
359
|
+
};
|
|
360
|
+
//#endregion
|
|
361
|
+
//#region src/status/index.ts
|
|
362
|
+
var status_default = { ...status_default$1 };
|
|
363
|
+
//#endregion
|
|
364
|
+
//#region src/tickets/comments.ts
|
|
365
|
+
const operation$2 = "/api/v2/tickets";
|
|
366
|
+
const createComment = (id, comment, options) => exreq({
|
|
367
|
+
operation: operation$2,
|
|
368
|
+
id,
|
|
369
|
+
method: options?.method || "post",
|
|
370
|
+
data: { ticket: { comment: { body: comment } } },
|
|
371
|
+
options: {
|
|
372
|
+
...options,
|
|
373
|
+
headers: {
|
|
374
|
+
...options?.headers,
|
|
375
|
+
Authorization: `Basic ${options.token}`
|
|
376
|
+
},
|
|
377
|
+
baseURL: setBaseURL("zendesk", appConf, options?.environment)
|
|
378
|
+
}
|
|
379
|
+
});
|
|
380
|
+
const getComments = (ticket, options) => {
|
|
381
|
+
console.log({ ticket });
|
|
382
|
+
return exreq({
|
|
383
|
+
operation: `${operation$2}/${ticket}/comments`,
|
|
384
|
+
options: {
|
|
385
|
+
...options,
|
|
386
|
+
headers: {
|
|
387
|
+
...options.headers,
|
|
388
|
+
Authorization: `Basic ${options.token}`
|
|
389
|
+
},
|
|
390
|
+
baseURL: setBaseURL("zendesk", appConf, options?.environment)
|
|
391
|
+
}
|
|
392
|
+
});
|
|
393
|
+
};
|
|
394
|
+
var comments_default = {
|
|
395
|
+
create: createComment,
|
|
396
|
+
get: getComments
|
|
397
|
+
};
|
|
398
|
+
//#endregion
|
|
399
|
+
//#region src/tickets/fields.ts
|
|
400
|
+
const operation$1 = "/api/v2/ticket_fields";
|
|
401
|
+
const createField = (field, options) => exreq({
|
|
402
|
+
operation: operation$1,
|
|
403
|
+
id: options?.id,
|
|
404
|
+
method: options?.method || "post",
|
|
405
|
+
data: { ticket_field: field },
|
|
406
|
+
options: {
|
|
407
|
+
...options,
|
|
408
|
+
headers: {
|
|
409
|
+
...options?.headers,
|
|
410
|
+
Authorization: `Basic ${options.token}`
|
|
411
|
+
},
|
|
412
|
+
baseURL: setBaseURL("zendesk", appConf, options?.environment)
|
|
413
|
+
}
|
|
414
|
+
});
|
|
415
|
+
const getFields = (...args) => {
|
|
416
|
+
const [id, options] = parseArgs(args);
|
|
417
|
+
return exreq({
|
|
418
|
+
operation: operation$1,
|
|
419
|
+
id,
|
|
420
|
+
options: {
|
|
421
|
+
...options,
|
|
422
|
+
headers: {
|
|
423
|
+
...options.headers,
|
|
424
|
+
Authorization: `Basic ${options.token}`
|
|
425
|
+
},
|
|
426
|
+
baseURL: setBaseURL("zendesk", appConf, options?.environment)
|
|
427
|
+
}
|
|
428
|
+
});
|
|
429
|
+
};
|
|
430
|
+
const updateField = (id, field, options) => createField(field, {
|
|
431
|
+
method: "put",
|
|
432
|
+
id,
|
|
433
|
+
...options
|
|
434
|
+
});
|
|
435
|
+
const deleteField = (id, options) => exreq({
|
|
436
|
+
operation: operation$1,
|
|
437
|
+
id,
|
|
438
|
+
method: "delete",
|
|
439
|
+
options: {
|
|
440
|
+
...options,
|
|
441
|
+
headers: {
|
|
442
|
+
...options.headers,
|
|
443
|
+
Authorization: `Basic ${options.token}`
|
|
444
|
+
},
|
|
445
|
+
baseURL: setBaseURL("zendesk", appConf, options?.environment)
|
|
446
|
+
}
|
|
447
|
+
});
|
|
448
|
+
var fields_default = {
|
|
449
|
+
create: createField,
|
|
450
|
+
get: getFields,
|
|
451
|
+
update: updateField,
|
|
452
|
+
delete: deleteField
|
|
453
|
+
};
|
|
454
|
+
//#endregion
|
|
455
|
+
//#region src/tickets/tickets.ts
|
|
456
|
+
const operation = "/api/v2/tickets";
|
|
457
|
+
const createTicket = (ticket, options) => exreq({
|
|
458
|
+
operation,
|
|
459
|
+
id: options?.id,
|
|
460
|
+
method: options?.method || "post",
|
|
461
|
+
data: { ticket },
|
|
462
|
+
options: {
|
|
463
|
+
...options,
|
|
464
|
+
headers: {
|
|
465
|
+
...options?.headers,
|
|
466
|
+
Authorization: `Basic ${options.token}`
|
|
467
|
+
},
|
|
468
|
+
baseURL: setBaseURL("zendesk", appConf, options?.environment)
|
|
469
|
+
}
|
|
470
|
+
});
|
|
471
|
+
const getTickets = (...args) => {
|
|
472
|
+
const [id, options] = parseArgs(args);
|
|
473
|
+
return exreq({
|
|
474
|
+
operation,
|
|
475
|
+
id,
|
|
476
|
+
options: {
|
|
477
|
+
...options,
|
|
478
|
+
params: { include: "custom_statuses" },
|
|
479
|
+
headers: {
|
|
480
|
+
...options.headers,
|
|
481
|
+
Authorization: `Basic ${options.token}`
|
|
482
|
+
},
|
|
483
|
+
baseURL: setBaseURL("zendesk", appConf, options?.environment)
|
|
484
|
+
}
|
|
485
|
+
});
|
|
486
|
+
};
|
|
487
|
+
const updateTicket = (id, ticket, options) => createTicket(ticket, {
|
|
488
|
+
method: "put",
|
|
489
|
+
id,
|
|
490
|
+
...options
|
|
491
|
+
});
|
|
492
|
+
const deleteTicket = (id, options) => exreq({
|
|
493
|
+
operation,
|
|
494
|
+
id,
|
|
495
|
+
method: "delete",
|
|
496
|
+
options: {
|
|
497
|
+
...options,
|
|
498
|
+
headers: {
|
|
499
|
+
...options.headers,
|
|
500
|
+
Authorization: `Basic ${options.token}`
|
|
501
|
+
},
|
|
502
|
+
baseURL: setBaseURL("zendesk", appConf, options?.environment)
|
|
503
|
+
}
|
|
504
|
+
});
|
|
505
|
+
var tickets_default$1 = {
|
|
506
|
+
create: createTicket,
|
|
507
|
+
get: getTickets,
|
|
508
|
+
update: updateTicket,
|
|
509
|
+
delete: deleteTicket
|
|
510
|
+
};
|
|
511
|
+
//#endregion
|
|
512
|
+
//#region src/tickets/comments.mocks.ts
|
|
513
|
+
const mockComment = {
|
|
514
|
+
attachments: [mockAttachment],
|
|
515
|
+
audit_id: 432567,
|
|
516
|
+
author_id: 123123,
|
|
517
|
+
body: "Thanks for your help!",
|
|
518
|
+
created_at: "2009-07-20T22:55:29Z",
|
|
519
|
+
id: 1274,
|
|
520
|
+
metadata: mockMetadata,
|
|
521
|
+
public: true,
|
|
522
|
+
type: "Comment"
|
|
523
|
+
};
|
|
524
|
+
const mockCommentResponse = { comments: [mockComment] };
|
|
525
|
+
//#endregion
|
|
526
|
+
//#region src/tickets/metrics.mocks.ts
|
|
527
|
+
const mockTicketMetric = {
|
|
528
|
+
agent_wait_time_in_minutes: {
|
|
529
|
+
business: 737,
|
|
530
|
+
calendar: 2391
|
|
531
|
+
},
|
|
532
|
+
assigned_at: "2011-05-05T10:38:52Z",
|
|
533
|
+
assignee_stations: 1,
|
|
534
|
+
assignee_updated_at: "2011-05-06T10:38:52Z",
|
|
535
|
+
created_at: "2009-07-20T22:55:29Z",
|
|
536
|
+
custom_status_updated_at: "2011-05-09T10:38:52Z",
|
|
537
|
+
first_resolution_time_in_minutes: {
|
|
538
|
+
business: 737,
|
|
539
|
+
calendar: 2391
|
|
540
|
+
},
|
|
541
|
+
full_resolution_time_in_minutes: {
|
|
542
|
+
business: 737,
|
|
543
|
+
calendar: 2391
|
|
544
|
+
},
|
|
545
|
+
group_stations: 7,
|
|
546
|
+
id: 33,
|
|
547
|
+
initially_assigned_at: "2011-05-03T10:38:52Z",
|
|
548
|
+
latest_comment_added_at: "2011-05-09T10:38:52Z",
|
|
549
|
+
on_hold_time_in_minutes: {
|
|
550
|
+
business: 637,
|
|
551
|
+
calendar: 2290
|
|
552
|
+
},
|
|
553
|
+
reopens: 55,
|
|
554
|
+
replies: 322,
|
|
555
|
+
reply_time_in_minutes: {
|
|
556
|
+
business: 737,
|
|
557
|
+
calendar: 2391
|
|
558
|
+
},
|
|
559
|
+
reply_time_in_seconds: { calendar: 143460 },
|
|
560
|
+
requester_updated_at: "2011-05-07T10:38:52Z",
|
|
561
|
+
requester_wait_time_in_minutes: {
|
|
562
|
+
business: 737,
|
|
563
|
+
calendar: 2391
|
|
564
|
+
},
|
|
565
|
+
solved_at: "2011-05-09T10:38:52Z",
|
|
566
|
+
status_updated_at: "2011-05-04T10:38:52Z",
|
|
567
|
+
ticket_id: 4343,
|
|
568
|
+
updated_at: "2011-05-05T10:38:52Z"
|
|
569
|
+
};
|
|
570
|
+
//#endregion
|
|
571
|
+
//#region src/tickets/index.ts
|
|
572
|
+
var tickets_default = {
|
|
573
|
+
...tickets_default$1,
|
|
574
|
+
comments: comments_default,
|
|
575
|
+
fields: fields_default
|
|
576
|
+
};
|
|
577
|
+
//#endregion
|
|
578
|
+
//#region src/utils.ts
|
|
579
|
+
const createToken = (user, password) => Buffer.from(`${user}/token:${password}`).toString("base64");
|
|
580
|
+
function setToken(user, password) {
|
|
581
|
+
const encoded = createToken(user, password);
|
|
582
|
+
axios.defaults.headers.common.Authorization = `Basic ${encoded}`;
|
|
583
|
+
}
|
|
584
|
+
//#endregion
|
|
585
|
+
//#region src/index.ts
|
|
586
|
+
var src_default = {
|
|
587
|
+
activities: activities_default,
|
|
588
|
+
search: search_default,
|
|
589
|
+
status: status_default,
|
|
590
|
+
tickets: tickets_default
|
|
591
|
+
};
|
|
592
|
+
//#endregion
|
|
593
|
+
export { createToken, src_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 };
|
package/package.json
ADDED
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@theholocron/zendesk-client",
|
|
3
|
+
"version": "0.0.0",
|
|
4
|
+
"description": "A TypeScript client for the Zendesk API",
|
|
5
|
+
"homepage": "https://github.com/theholocron/clients/tree/main/packages/zendesk-client#readme",
|
|
6
|
+
"bugs": "https://github.com/theholocron/clients/issues",
|
|
7
|
+
"repository": {
|
|
8
|
+
"type": "git",
|
|
9
|
+
"url": "git+https://github.com/theholocron/clients.git",
|
|
10
|
+
"directory": "packages/zendesk-client"
|
|
11
|
+
},
|
|
12
|
+
"license": "GPL-3.0",
|
|
13
|
+
"author": "Newton Koumantzelis",
|
|
14
|
+
"type": "module",
|
|
15
|
+
"main": "./src/index.ts",
|
|
16
|
+
"exports": {
|
|
17
|
+
".": "./src/index.ts"
|
|
18
|
+
},
|
|
19
|
+
"scripts": {
|
|
20
|
+
"build": "tsdown",
|
|
21
|
+
"lint": "eslint .",
|
|
22
|
+
"test": "vitest run",
|
|
23
|
+
"test:watch": "vitest",
|
|
24
|
+
"test:coverage": "vitest run --coverage",
|
|
25
|
+
"typecheck": "tsc --noEmit"
|
|
26
|
+
},
|
|
27
|
+
"dependencies": {
|
|
28
|
+
"axios": "^1.10.0"
|
|
29
|
+
},
|
|
30
|
+
"devDependencies": {
|
|
31
|
+
"@types/node": "^22.0.0",
|
|
32
|
+
"@theholocron/eslint-config": "catalog:",
|
|
33
|
+
"@theholocron/tsconfig": "catalog:",
|
|
34
|
+
"@theholocron/tsdown-config": "catalog:",
|
|
35
|
+
"@theholocron/vitest-config": "catalog:",
|
|
36
|
+
"@vitest/coverage-v8": "catalog:",
|
|
37
|
+
"@vitest/eslint-plugin": "catalog:",
|
|
38
|
+
"eslint": "catalog:",
|
|
39
|
+
"eslint-plugin-n": "catalog:",
|
|
40
|
+
"globals": "catalog:",
|
|
41
|
+
"tsdown": "catalog:",
|
|
42
|
+
"typescript": "catalog:",
|
|
43
|
+
"vitest": "catalog:"
|
|
44
|
+
},
|
|
45
|
+
"publishConfig": {
|
|
46
|
+
"access": "public",
|
|
47
|
+
"main": "./dist/index.mjs",
|
|
48
|
+
"types": "./dist/index.d.mts",
|
|
49
|
+
"exports": {
|
|
50
|
+
".": {
|
|
51
|
+
"types": "./dist/index.d.mts",
|
|
52
|
+
"import": "./dist/index.mjs",
|
|
53
|
+
"default": "./dist/index.mjs"
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
},
|
|
57
|
+
"files": [
|
|
58
|
+
"dist",
|
|
59
|
+
"README.md"
|
|
60
|
+
],
|
|
61
|
+
"releases": "https://github.com/theholocron/clients/releases",
|
|
62
|
+
"wiki": "https://github.com/theholocron/clients/wiki"
|
|
63
|
+
}
|