crisp-api 9.12.1 → 10.0.2

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.
Files changed (116) hide show
  1. package/CHANGELOG.md +14 -0
  2. package/README.md +6 -2
  3. package/dist/crisp.d.ts +167 -0
  4. package/dist/crisp.js +764 -0
  5. package/dist/resources/BaseResource.d.ts +15 -0
  6. package/dist/resources/BaseResource.js +20 -0
  7. package/dist/resources/BucketURL.d.ts +28 -0
  8. package/dist/resources/BucketURL.js +29 -0
  9. package/dist/resources/MediaAnimation.d.ts +14 -0
  10. package/dist/resources/MediaAnimation.js +32 -0
  11. package/dist/resources/PluginConnect.d.ts +50 -0
  12. package/dist/resources/PluginConnect.js +73 -0
  13. package/dist/resources/PluginSubscription.d.ts +103 -0
  14. package/dist/resources/PluginSubscription.js +122 -0
  15. package/dist/resources/WebsiteAnalytics.d.ts +14 -0
  16. package/dist/resources/WebsiteAnalytics.js +29 -0
  17. package/dist/resources/WebsiteAvailability.d.ts +31 -0
  18. package/dist/resources/WebsiteAvailability.js +36 -0
  19. package/dist/resources/WebsiteBase.d.ts +60 -0
  20. package/dist/resources/WebsiteBase.js +71 -0
  21. package/dist/resources/WebsiteBatch.d.ts +52 -0
  22. package/dist/resources/WebsiteBatch.js +70 -0
  23. package/dist/resources/WebsiteCampaign.d.ts +199 -0
  24. package/dist/resources/WebsiteCampaign.js +194 -0
  25. package/dist/resources/WebsiteConversation.d.ts +701 -0
  26. package/dist/resources/WebsiteConversation.js +595 -0
  27. package/dist/resources/WebsiteHelpdesk.d.ts +347 -0
  28. package/dist/resources/WebsiteHelpdesk.js +587 -0
  29. package/dist/resources/WebsiteOperator.d.ts +79 -0
  30. package/dist/resources/WebsiteOperator.js +93 -0
  31. package/dist/resources/WebsitePeople.d.ts +248 -0
  32. package/dist/resources/WebsitePeople.js +276 -0
  33. package/dist/resources/WebsiteSettings.d.ts +159 -0
  34. package/dist/resources/WebsiteSettings.js +36 -0
  35. package/dist/resources/WebsiteVerify.d.ts +38 -0
  36. package/dist/resources/WebsiteVerify.js +50 -0
  37. package/dist/resources/WebsiteVisitors.d.ts +113 -0
  38. package/dist/resources/WebsiteVisitors.js +88 -0
  39. package/dist/resources/index.d.ts +17 -0
  40. package/dist/resources/index.js +40 -0
  41. package/dist/services/bucket.d.ts +13 -0
  42. package/dist/services/bucket.js +28 -0
  43. package/dist/services/media.d.ts +13 -0
  44. package/dist/services/media.js +28 -0
  45. package/dist/services/plugin.d.ts +14 -0
  46. package/dist/services/plugin.js +30 -0
  47. package/dist/services/website.d.ts +24 -0
  48. package/dist/services/website.js +50 -0
  49. package/eslint.config.mjs +208 -0
  50. package/lib/crisp.ts +957 -0
  51. package/lib/resources/BaseResource.ts +29 -0
  52. package/lib/resources/BucketURL.ts +49 -0
  53. package/lib/resources/MediaAnimation.ts +34 -0
  54. package/lib/resources/PluginConnect.ts +128 -0
  55. package/lib/resources/PluginSubscription.ts +208 -0
  56. package/lib/resources/WebsiteAnalytics.ts +31 -0
  57. package/lib/resources/WebsiteAvailability.ts +54 -0
  58. package/lib/resources/WebsiteBase.ts +108 -0
  59. package/lib/resources/WebsiteBatch.ts +96 -0
  60. package/lib/resources/WebsiteCampaign.ts +399 -0
  61. package/lib/resources/WebsiteConversation.ts +1416 -0
  62. package/lib/resources/WebsiteHelpdesk.ts +982 -0
  63. package/lib/resources/WebsiteOperator.ts +161 -0
  64. package/lib/resources/WebsitePeople.ts +527 -0
  65. package/lib/resources/WebsiteSettings.ts +192 -0
  66. package/lib/resources/WebsiteVerify.ts +76 -0
  67. package/lib/resources/WebsiteVisitors.ts +196 -0
  68. package/lib/resources/index.ts +25 -0
  69. package/lib/services/bucket.ts +28 -0
  70. package/lib/services/media.ts +28 -0
  71. package/lib/services/plugin.ts +32 -0
  72. package/lib/services/website.ts +62 -0
  73. package/package.json +16 -11
  74. package/tsconfig.json +12 -5
  75. package/lib/crisp.js +0 -1168
  76. package/lib/resources/BucketURL.js +0 -34
  77. package/lib/resources/MediaAnimation.js +0 -41
  78. package/lib/resources/PluginConnect.js +0 -119
  79. package/lib/resources/PluginSubscription.js +0 -234
  80. package/lib/resources/WebsiteAnalytics.js +0 -37
  81. package/lib/resources/WebsiteAvailability.js +0 -48
  82. package/lib/resources/WebsiteBase.js +0 -100
  83. package/lib/resources/WebsiteBatch.js +0 -92
  84. package/lib/resources/WebsiteCampaign.js +0 -396
  85. package/lib/resources/WebsiteConversation.js +0 -1261
  86. package/lib/resources/WebsiteHelpdesk.js +0 -1198
  87. package/lib/resources/WebsiteOperator.js +0 -167
  88. package/lib/resources/WebsitePeople.js +0 -516
  89. package/lib/resources/WebsiteSettings.js +0 -50
  90. package/lib/resources/WebsiteVerify.js +0 -79
  91. package/lib/resources/WebsiteVisitors.js +0 -148
  92. package/lib/services/Bucket.js +0 -28
  93. package/lib/services/Media.js +0 -28
  94. package/lib/services/Plugin.js +0 -29
  95. package/lib/services/Website.js +0 -39
  96. package/types/crisp.d.ts +0 -151
  97. package/types/resources/BucketURL.d.ts +0 -15
  98. package/types/resources/MediaAnimation.d.ts +0 -15
  99. package/types/resources/PluginConnect.d.ts +0 -15
  100. package/types/resources/PluginSubscription.d.ts +0 -15
  101. package/types/resources/WebsiteAnalytics.d.ts +0 -15
  102. package/types/resources/WebsiteAvailability.d.ts +0 -15
  103. package/types/resources/WebsiteBase.d.ts +0 -15
  104. package/types/resources/WebsiteBatch.d.ts +0 -15
  105. package/types/resources/WebsiteCampaign.d.ts +0 -15
  106. package/types/resources/WebsiteConversation.d.ts +0 -15
  107. package/types/resources/WebsiteHelpdesk.d.ts +0 -15
  108. package/types/resources/WebsiteOperator.d.ts +0 -15
  109. package/types/resources/WebsitePeople.d.ts +0 -15
  110. package/types/resources/WebsiteSettings.d.ts +0 -15
  111. package/types/resources/WebsiteVerify.d.ts +0 -15
  112. package/types/resources/WebsiteVisitors.d.ts +0 -15
  113. package/types/services/Bucket.d.ts +0 -14
  114. package/types/services/Media.d.ts +0 -14
  115. package/types/services/Plugin.d.ts +0 -14
  116. package/types/services/Website.d.ts +0 -14
@@ -0,0 +1,982 @@
1
+ /*
2
+ * node-crisp-api
3
+ *
4
+ * Copyright 2023, Crisp IM SAS
5
+ * Author: Valerian Saliou <valerian@valeriansaliou.name>
6
+ */
7
+
8
+ /**************************************************************************
9
+ * IMPORTS
10
+ ***************************************************************************/
11
+
12
+ // PROJECT: RESOURCES
13
+ import BaseResource from "./BaseResource";
14
+
15
+ export interface Helpdesk {
16
+ name?: string;
17
+ url?: string;
18
+ }
19
+
20
+ export interface HelpdeskRemoveVerify {
21
+ method: string;
22
+ secret: string;
23
+ }
24
+
25
+ export interface HelpdeskLocale {
26
+ locale_id?: string;
27
+ locale?: string;
28
+ url?: string;
29
+ articles?: number;
30
+ categories?: number;
31
+ }
32
+
33
+ export interface HelpdeskLocaleArticle {
34
+ locale_id?: string;
35
+ locale?: string;
36
+ url?: string;
37
+ articles?: number;
38
+ categories?: number;
39
+ }
40
+
41
+ export interface HelpdeskLocaleArticleCategory {
42
+ category_id?: string;
43
+ section_id?: string;
44
+ }
45
+
46
+ export interface HelpdeskLocaleArticleAlternate {
47
+ locale?: string;
48
+ article_id?: string;
49
+ }
50
+
51
+ export interface HelpdeskLocaleSection {
52
+ section_id?: string;
53
+ name?: string;
54
+ order?: number;
55
+ created_at?: number;
56
+ updated_at?: number;
57
+ }
58
+
59
+ export interface HelpdeskLocaleFeedbackRatings {
60
+ ratings?: HelpdeskLocaleFeedbackRatingsRatings;
61
+ }
62
+
63
+ export interface HelpdeskLocaleFeedbackRatingsRatings {
64
+ helpful?: number;
65
+ unhelpful?: number;
66
+ }
67
+
68
+ export interface HelpdeskLocaleFeedbackItem {
69
+ rating?: string;
70
+ comment?: string;
71
+ article?: HelpdeskLocaleFeedbackItemArticle;
72
+ session?: HelpdeskLocaleFeedbackItemSession;
73
+ created_at?: number;
74
+ }
75
+
76
+ export interface HelpdeskLocaleFeedbackItemArticle {
77
+ article_id?: string;
78
+ title?: string;
79
+ url?: string;
80
+ }
81
+
82
+ export interface HelpdeskLocaleFeedbackItemSession {
83
+ session_id?: string;
84
+ nickname?: string;
85
+ email?: string;
86
+ avatar?: string;
87
+ geolocation?: HelpdeskLocaleFeedbackItemSessionGeolocation;
88
+ assigned?: HelpdeskLocaleFeedbackItemSessionAssigned;
89
+ }
90
+
91
+ export interface HelpdeskLocaleFeedbackItemSessionGeolocation {
92
+ country?: string;
93
+ region?: string;
94
+ city?: string;
95
+ coordinates?: HelpdeskLocaleFeedbackItemSessionGeolocationCoordinates;
96
+ }
97
+
98
+ export interface HelpdeskLocaleFeedbackItemSessionGeolocationCoordinates {
99
+ latitude?: number;
100
+ longitude?: number;
101
+ }
102
+
103
+ export interface HelpdeskLocaleFeedbackItemSessionAssigned {
104
+ user_id?: string;
105
+ }
106
+
107
+ export interface HelpdeskRedirection {
108
+ redirection_id?: string;
109
+ path?: string;
110
+ target?: string;
111
+ created_at?: number;
112
+ updated_at?: number;
113
+ }
114
+
115
+ export interface HelpdeskSettings {
116
+ name?: string;
117
+ appearance?: HelpdeskSettingsAppearance;
118
+ behavior?: HelpdeskSettingsBehavior;
119
+ include?: HelpdeskSettingsInclude;
120
+ access?: HelpdeskSettingsAccess;
121
+ }
122
+
123
+ export interface HelpdeskSettingsAppearance {
124
+ logos?: HelpdeskSettingsAppearanceLogos;
125
+ banner?: string;
126
+ }
127
+
128
+ export interface HelpdeskSettingsAppearanceLogos {
129
+ header?: string;
130
+ footer?: string;
131
+ }
132
+
133
+ export interface HelpdeskSettingsBehavior {
134
+ frequentlyRead?: boolean;
135
+ showCategoryImages?: boolean;
136
+ showChatbox?: boolean;
137
+ askFeedback?: boolean;
138
+ localePicker?: boolean;
139
+ referLink?: boolean;
140
+ forbidIndexing?: boolean;
141
+ statusHealthDead?: boolean;
142
+ }
143
+
144
+ export interface HelpdeskSettingsInclude {
145
+ html?: string;
146
+ }
147
+
148
+ export interface HelpdeskSettingsAccess {
149
+ password?: string;
150
+ }
151
+
152
+ export interface HelpdeskDomain {
153
+ root?: string;
154
+ basic?: string;
155
+ custom?: string;
156
+ verified?: boolean;
157
+ }
158
+
159
+ /**
160
+ * Crisp WebsiteHelpdesk Resource
161
+ */
162
+ class WebsiteHelpdesk extends BaseResource {
163
+ /**
164
+ * Check If Helpdesk Exists
165
+ */
166
+ checkHelpdeskExists(websiteID: string) {
167
+ return this.crisp.head(
168
+ this.crisp.prepareRestUrl(["website", websiteID, "helpdesk"])
169
+ );
170
+ };
171
+
172
+ /**
173
+ * Resolve Helpdesk
174
+ */
175
+ resolveHelpdesk(websiteID: string) : Promise<Helpdesk> {
176
+ return this.crisp.get(
177
+ this.crisp.prepareRestUrl(["website", websiteID, "helpdesk"])
178
+ );
179
+ };
180
+
181
+ /**
182
+ * Initialize Helpdesk
183
+ */
184
+ initializeHelpdesk(websiteID: string, name: string, domainBasic: string) {
185
+ return this.crisp.post(
186
+ this.crisp.prepareRestUrl(["website", websiteID, "helpdesk"]), null,
187
+
188
+ {
189
+ name: name,
190
+ domain_basic: domainBasic
191
+ }
192
+ );
193
+ };
194
+
195
+ /**
196
+ * Delete Helpdesk
197
+ */
198
+ deleteHelpdesk(websiteID: string, verify: HelpdeskRemoveVerify) {
199
+ return this.crisp.delete(
200
+ this.crisp.prepareRestUrl(["website", websiteID, "helpdesk"]), null,
201
+
202
+ {
203
+ verify: verify
204
+ }
205
+ );
206
+ };
207
+
208
+ /**
209
+ * List Helpdesk Locales
210
+ */
211
+ listHelpdeskLocales(websiteID: string, pageNumber: number = 1) {
212
+ return this.crisp.get(
213
+ this.crisp.prepareRestUrl([
214
+ "website", websiteID, "helpdesk", "locales", String(pageNumber)
215
+ ])
216
+ );
217
+ };
218
+
219
+ /**
220
+ * Add Helpdesk Locale
221
+ */
222
+ addHelpdeskLocale(websiteID: string, locale: string) {
223
+ return this.crisp.post(
224
+ this.crisp.prepareRestUrl(["website", websiteID, "helpdesk", "locale"]),
225
+
226
+ null,
227
+
228
+ {
229
+ locale: locale
230
+ }
231
+ );
232
+ };
233
+
234
+ /**
235
+ * Check If Helpdesk Locale Exists
236
+ */
237
+ checkHelpdeskLocaleExists(websiteID: string, locale: string) {
238
+ return this.crisp.head(
239
+ this.crisp.prepareRestUrl([
240
+ "website", websiteID, "helpdesk", "locale", locale
241
+ ])
242
+ );
243
+ };
244
+
245
+ /**
246
+ * Resolve Helpdesk Locale
247
+ */
248
+ resolveHelpdeskLocale(websiteID: string, locale: string) : Promise<HelpdeskLocale> {
249
+ return this.crisp.get(
250
+ this.crisp.prepareRestUrl([
251
+ "website", websiteID, "helpdesk", "locale", locale
252
+ ])
253
+ );
254
+ };
255
+
256
+ /**
257
+ * Delete Helpdesk Locale
258
+ */
259
+ deleteHelpdeskLocale(websiteID: string, locale: string) {
260
+ return this.crisp.delete(
261
+ this.crisp.prepareRestUrl([
262
+ "website", websiteID, "helpdesk", "locale", locale
263
+ ])
264
+ );
265
+ };
266
+
267
+ /**
268
+ * List Helpdesk Locale Articles
269
+ */
270
+ listHelpdeskLocaleArticles(
271
+ websiteID: string, locale: string, pageNumber: number = 1, options: object = {}
272
+ ) {
273
+ return this.crisp.get(
274
+ this.crisp.prepareRestUrl([
275
+ "website", websiteID, "helpdesk", "locale", locale, "articles",
276
+ String(pageNumber)
277
+ ]),
278
+
279
+ options
280
+ );
281
+ };
282
+
283
+ /**
284
+ * Add A New Helpdesk Locale Article
285
+ */
286
+ addNewHelpdeskLocaleArticle(websiteID: string, locale: string, title: string) {
287
+ return this.crisp.post(
288
+ this.crisp.prepareRestUrl([
289
+ "website", websiteID, "helpdesk", "locale", locale, "article"
290
+ ]),
291
+
292
+ null,
293
+
294
+ {
295
+ title: title
296
+ }
297
+ );
298
+ };
299
+
300
+ /**
301
+ * Check If Helpdesk Locale Article Exists
302
+ */
303
+ checkHelpdeskLocaleArticleExists(websiteID: string, locale: string, articleId: string) {
304
+ return this.crisp.head(
305
+ this.crisp.prepareRestUrl([
306
+ "website", websiteID, "helpdesk", "locale", locale, "article", articleId
307
+ ])
308
+ );
309
+ };
310
+
311
+ /**
312
+ * Resolve Helpdesk Locale Article
313
+ */
314
+ resolveHelpdeskLocaleArticle(websiteID: string, locale: string, articleId: string) : Promise<HelpdeskLocaleArticle> {
315
+ return this.crisp.get(
316
+ this.crisp.prepareRestUrl([
317
+ "website", websiteID, "helpdesk", "locale", locale, "article",
318
+ articleId
319
+ ])
320
+ );
321
+ };
322
+
323
+ /**
324
+ * Save Helpdesk Locale Article
325
+ */
326
+ saveHelpdeskLocaleArticle(
327
+ websiteID: string, locale: string, articleId: string, article: HelpdeskLocaleArticle
328
+ ) {
329
+ return this.crisp.put(
330
+ this.crisp.prepareRestUrl([
331
+ "website", websiteID, "helpdesk", "locale", locale, "article",
332
+ articleId
333
+ ]),
334
+
335
+ null, article
336
+ );
337
+ };
338
+
339
+ /**
340
+ * Update Helpdesk Locale Article
341
+ */
342
+ updateHelpdeskLocaleArticle(
343
+ websiteID: string, locale: string, articleId: string, article: HelpdeskLocaleArticle
344
+ ) {
345
+ return this.crisp.patch(
346
+ this.crisp.prepareRestUrl([
347
+ "website", websiteID, "helpdesk", "locale", locale, "article",
348
+ articleId
349
+ ]),
350
+
351
+ null, article
352
+ );
353
+ };
354
+
355
+ /**
356
+ * Delete Helpdesk Locale Article
357
+ */
358
+ deleteHelpdeskLocaleArticle(websiteID: string, locale: string, articleId: string) {
359
+ return this.crisp.delete(
360
+ this.crisp.prepareRestUrl([
361
+ "website", websiteID, "helpdesk", "locale", locale, "article",
362
+ articleId
363
+ ])
364
+ );
365
+ };
366
+
367
+ /**
368
+ * Resolve Helpdesk Locale Article Page
369
+ */
370
+ resolveHelpdeskLocaleArticlePage(
371
+ websiteID: string, locale: string, articleId: string
372
+ ) {
373
+ return this.crisp.get(
374
+ this.crisp.prepareRestUrl([
375
+ "website", websiteID, "helpdesk", "locale", locale, "article",
376
+ articleId, "page"
377
+ ])
378
+ );
379
+ };
380
+
381
+ /**
382
+ * Resolve Helpdesk Locale Article Category
383
+ */
384
+ resolveHelpdeskLocaleArticleCategory(
385
+ websiteID: string, locale: string, articleId: string
386
+ ) : Promise<HelpdeskLocaleArticleCategory> {
387
+ return this.crisp.get(
388
+ this.crisp.prepareRestUrl([
389
+ "website", websiteID, "helpdesk", "locale", locale, "article",
390
+ articleId, "category"
391
+ ])
392
+ );
393
+ };
394
+
395
+ /**
396
+ * Update Helpdesk Locale Article Category
397
+ */
398
+ updateHelpdeskLocaleArticleCategory(
399
+ websiteID: string, locale: string, articleId: string, categoryId: string, sectionId?: string
400
+ ) {
401
+ // Generate body
402
+ let body = {
403
+ category_id: categoryId
404
+ };
405
+
406
+ if (sectionId !== undefined) {
407
+ // @ts-ignore
408
+ body.section_id = sectionId;
409
+ }
410
+
411
+ return this.crisp.patch(
412
+ this.crisp.prepareRestUrl([
413
+ "website", websiteID, "helpdesk", "locale", locale, "article",
414
+ articleId, "category"
415
+ ]),
416
+
417
+ null, body
418
+ );
419
+ };
420
+
421
+ /**
422
+ * List Helpdesk Locale Article Alternates
423
+ */
424
+ listHelpdeskLocaleArticleAlternates(
425
+ websiteID: string, locale: string, articleId: string
426
+ ) : Promise<HelpdeskLocaleArticleAlternate[]> {
427
+ return this.crisp.get(
428
+ this.crisp.prepareRestUrl([
429
+ "website", websiteID, "helpdesk", "locale", locale, "article",
430
+ articleId, "alternates"
431
+ ])
432
+ );
433
+ };
434
+
435
+ /**
436
+ * Check If Helpdesk Locale Article Alternate Exists
437
+ */
438
+ checkHelpdeskLocaleArticleAlternateExists(
439
+ websiteID: string, locale: string, articleId: string, localeLinked: string
440
+ ) {
441
+ return this.crisp.head(
442
+ this.crisp.prepareRestUrl([
443
+ "website", websiteID, "helpdesk", "locale", locale, "article",
444
+ articleId, "alternate", localeLinked
445
+ ])
446
+ );
447
+ };
448
+
449
+ /**
450
+ * Resolve Helpdesk Locale Article Alternate
451
+ */
452
+ resolveHelpdeskLocaleArticleAlternate(
453
+ websiteID: string, locale: string, articleId: string, localeLinked: string
454
+ ) : Promise<HelpdeskLocaleArticleAlternate> {
455
+ return this.crisp.get(
456
+ this.crisp.prepareRestUrl([
457
+ "website", websiteID, "helpdesk", "locale", locale, "article",
458
+ articleId, "alternate", localeLinked
459
+ ])
460
+ );
461
+ };
462
+
463
+ /**
464
+ * Save Helpdesk Locale Article Alternate
465
+ */
466
+ saveHelpdeskLocaleArticleAlternate(
467
+ websiteID: string, locale: string, articleId: string, localeLinked: string, articleIdLinked: string
468
+ ) {
469
+ return this.crisp.put(
470
+ this.crisp.prepareRestUrl([
471
+ "website", websiteID, "helpdesk", "locale", locale, "article",
472
+ articleId, "alternate", localeLinked
473
+ ]),
474
+
475
+ null,
476
+
477
+ {
478
+ article_id: articleIdLinked
479
+ }
480
+ );
481
+ };
482
+
483
+ /**
484
+ * Delete Helpdesk Locale Article Alternate
485
+ */
486
+ deleteHelpdeskLocaleArticleAlternate(
487
+ websiteID: string, locale: string, articleId: string, localeLinked: string
488
+ ) {
489
+ return this.crisp.delete(
490
+ this.crisp.prepareRestUrl([
491
+ "website", websiteID, "helpdesk", "locale", locale, "article",
492
+ articleId, "alternate", localeLinked
493
+ ])
494
+ );
495
+ };
496
+
497
+ /**
498
+ * Publish Helpdesk Locale Article
499
+ */
500
+ publishHelpdeskLocaleArticle(
501
+ websiteID: string, locale: string, articleId: string
502
+ ) {
503
+ return this.crisp.post(
504
+ this.crisp.prepareRestUrl([
505
+ "website", websiteID, "helpdesk", "locale", locale, "article",
506
+ articleId, "publish"
507
+ ]),
508
+
509
+ null,
510
+
511
+ null
512
+ );
513
+ };
514
+
515
+ /**
516
+ * Unpublish Helpdesk Locale Article
517
+ */
518
+ unpublishHelpdeskLocaleArticle(
519
+ websiteID: string, locale: string, articleId: string
520
+ ) {
521
+ return this.crisp.post(
522
+ this.crisp.prepareRestUrl([
523
+ "website", websiteID, "helpdesk", "locale", locale, "article",
524
+ articleId, "unpublish"
525
+ ]),
526
+
527
+ null,
528
+
529
+ null
530
+ );
531
+ };
532
+
533
+ /**
534
+ * List Helpdesk Locale Categories
535
+ */
536
+ listHelpdeskLocaleCategories(
537
+ websiteID: string, locale: string, pageNumber: number = 1
538
+ ) : Promise<HelpdeskLocaleArticleCategory[]> {
539
+ return this.crisp.get(
540
+ this.crisp.prepareRestUrl([
541
+ "website", websiteID, "helpdesk", "locale", locale, "categories",
542
+ String(pageNumber)
543
+ ])
544
+ );
545
+ };
546
+
547
+ /**
548
+ * Add Helpdesk Locale Category
549
+ */
550
+ addHelpdeskLocaleCategory(websiteID: string, locale: string, name: string) {
551
+ return this.crisp.post(
552
+ this.crisp.prepareRestUrl([
553
+ "website", websiteID, "helpdesk", "locale", locale, "category"
554
+ ]),
555
+
556
+ null,
557
+
558
+ {
559
+ name: name
560
+ }
561
+ );
562
+ };
563
+
564
+ /**
565
+ * Check If Helpdesk Locale Category Exists
566
+ */
567
+ checkHelpdeskLocaleCategoryExists(
568
+ websiteID: string, locale: string, categoryId: string
569
+ ) {
570
+ return this.crisp.head(
571
+ this.crisp.prepareRestUrl([
572
+ "website", websiteID, "helpdesk", "locale", locale, "category",
573
+ categoryId
574
+ ])
575
+ );
576
+ };
577
+
578
+ /**
579
+ * Resolve Helpdesk Locale Category
580
+ */
581
+ resolveHelpdeskLocaleCategory(
582
+ websiteID: string, locale: string, categoryId: string
583
+ ) : Promise<HelpdeskLocaleArticleCategory> {
584
+ return this.crisp.get(
585
+ this.crisp.prepareRestUrl([
586
+ "website", websiteID, "helpdesk", "locale", locale, "category",
587
+ categoryId
588
+ ])
589
+ );
590
+ };
591
+
592
+ /**
593
+ * Save Helpdesk Locale Category
594
+ */
595
+ saveHelpdeskLocaleCategory(
596
+ websiteID: string, locale: string, categoryId: string, category: HelpdeskLocaleArticleCategory
597
+ ) {
598
+ return this.crisp.put(
599
+ this.crisp.prepareRestUrl([
600
+ "website", websiteID, "helpdesk", "locale", locale, "category",
601
+ categoryId
602
+ ]),
603
+
604
+ null, category
605
+ );
606
+ };
607
+ /**
608
+ * Update Helpdesk Locale Category
609
+ */
610
+ updateHelpdeskLocaleCategory(
611
+ websiteID: string, locale: string, categoryId: string, category: HelpdeskLocaleArticleCategory
612
+ ) {
613
+ return this.crisp.patch(
614
+ this.crisp.prepareRestUrl([
615
+ "website", websiteID, "helpdesk", "locale", locale, "category",
616
+ categoryId
617
+ ]),
618
+
619
+ null, category
620
+ );
621
+ };
622
+
623
+ /**
624
+ * Delete Helpdesk Locale Category
625
+ */
626
+ deleteHelpdeskLocaleCategory(
627
+ websiteID: string, locale: string, categoryId: string
628
+ ) {
629
+ return this.crisp.delete(
630
+ this.crisp.prepareRestUrl([
631
+ "website", websiteID, "helpdesk", "locale", locale, "category",
632
+ categoryId
633
+ ])
634
+ );
635
+ };
636
+
637
+ /**
638
+ * List Helpdesk Locale Sections
639
+ */
640
+ listHelpdeskLocaleSections(
641
+ websiteID: string, locale: string, categoryId: string, pageNumber: number = 1
642
+ ) : Promise<HelpdeskLocaleSection[]> {
643
+ return this.crisp.get(
644
+ this.crisp.prepareRestUrl([
645
+ "website", websiteID, "helpdesk", "locale", locale, "category",
646
+ categoryId, "sections", String(pageNumber)
647
+ ])
648
+ );
649
+ };
650
+
651
+ /**
652
+ * Add Helpdesk Locale Section
653
+ */
654
+ addHelpdeskLocaleSection(
655
+ websiteID: string, locale: string, categoryId: string, name: string
656
+ ) {
657
+ return this.crisp.post(
658
+ this.crisp.prepareRestUrl([
659
+ "website", websiteID, "helpdesk", "locale", locale, "category",
660
+ categoryId, "section"
661
+ ]),
662
+
663
+ null,
664
+
665
+ {
666
+ name: name
667
+ }
668
+ );
669
+ };
670
+
671
+ /**
672
+ * Check If Helpdesk Locale Section Exists
673
+ */
674
+ checkHelpdeskLocaleSectionExists(
675
+ websiteID: string, locale: string, categoryId: string, sectionId: string
676
+ ) {
677
+ return this.crisp.head(
678
+ this.crisp.prepareRestUrl([
679
+ "website", websiteID, "helpdesk", "locale", locale, "category",
680
+ categoryId, "section", sectionId
681
+ ])
682
+ );
683
+ };
684
+
685
+ /**
686
+ * Resolve Helpdesk Locale Section
687
+ */
688
+ resolveHelpdeskLocaleSection(
689
+ websiteID: string, locale: string, categoryId: string, sectionId: string
690
+ ) : Promise<HelpdeskLocaleSection> {
691
+ return this.crisp.get(
692
+ this.crisp.prepareRestUrl([
693
+ "website", websiteID, "helpdesk", "locale", locale, "category",
694
+ categoryId, "section", sectionId
695
+ ])
696
+ );
697
+ };
698
+
699
+ /**
700
+ * Save Helpdesk Locale Section
701
+ */
702
+ saveHelpdeskLocaleSection(
703
+ websiteID: string, locale: string, categoryId: string, sectionId: string, section: HelpdeskLocaleSection
704
+ ) {
705
+ return this.crisp.put(
706
+ this.crisp.prepareRestUrl([
707
+ "website", websiteID, "helpdesk", "locale", locale, "category",
708
+ categoryId, "section", sectionId
709
+ ]),
710
+
711
+ null, section
712
+ );
713
+ };
714
+
715
+ /**
716
+ * Update Helpdesk Locale Section
717
+ */
718
+ updateHelpdeskLocaleSection(
719
+ websiteID: string, locale: string, categoryId: string, sectionId: string, section: HelpdeskLocaleSection
720
+ ) {
721
+ return this.crisp.patch(
722
+ this.crisp.prepareRestUrl([
723
+ "website", websiteID, "helpdesk", "locale", locale, "category",
724
+ categoryId, "section", sectionId
725
+ ]),
726
+
727
+ null, section
728
+ );
729
+ };
730
+
731
+ /**
732
+ * Delete Helpdesk Locale Section
733
+ */
734
+ deleteHelpdeskLocaleSection(
735
+ websiteID: string, locale: string, categoryId: string, sectionId: string
736
+ ) {
737
+ return this.crisp.delete(
738
+ this.crisp.prepareRestUrl([
739
+ "website", websiteID, "helpdesk", "locale", locale, "category",
740
+ categoryId, "section", sectionId
741
+ ])
742
+ );
743
+ };
744
+
745
+ /**
746
+ * Map Helpdesk Locale Feedback Ratings
747
+ */
748
+ mapHelpdeskLocaleFeedbackRatings(
749
+ websiteID: string, locale: string, filterDateStart?: string | null, filterDateEnd?: string | null
750
+ ) : Promise<HelpdeskLocaleFeedbackRatings> {
751
+ filterDateStart = (filterDateStart || null);
752
+ filterDateEnd = (filterDateEnd || null);
753
+
754
+ // Generate query
755
+ let query = {};
756
+
757
+ if (filterDateStart !== null) {
758
+ // @ts-ignore
759
+ query.filter_date_start = filterDateStart;
760
+ }
761
+
762
+ if (filterDateEnd !== null) {
763
+ // @ts-ignore
764
+ query.filter_date_end = filterDateEnd;
765
+ }
766
+
767
+ return this.crisp.get(
768
+ this.crisp.prepareRestUrl([
769
+ "website", websiteID, "helpdesk", "locale", locale, "feedback",
770
+ "ratings"
771
+ ]),
772
+
773
+ query
774
+ );
775
+ };
776
+
777
+ /**
778
+ * List Helpdesk Locale Feedbacks
779
+ */
780
+ listHelpdeskLocaleFeedbacks(
781
+ websiteID: string, locale: string, pageNumber: number = 1, filterDateStart?: string | null, filterDateEnd?: string | null
782
+ ) : Promise<HelpdeskLocaleFeedbackItem[]> {
783
+ filterDateStart = (filterDateStart || null);
784
+ filterDateEnd = (filterDateEnd || null);
785
+
786
+ // Generate query
787
+ let query = {};
788
+
789
+ if (filterDateStart !== null) {
790
+ // @ts-ignore
791
+ query.filter_date_start = filterDateStart;
792
+ }
793
+
794
+ if (filterDateEnd !== null) {
795
+ // @ts-ignore
796
+ query.filter_date_end = filterDateEnd;
797
+ }
798
+
799
+ return this.crisp.get(
800
+ this.crisp.prepareRestUrl([
801
+ "website", websiteID, "helpdesk", "locale", locale, "feedback", "list",
802
+ String(pageNumber)
803
+ ]),
804
+
805
+ query
806
+ );
807
+ };
808
+
809
+ /**
810
+ * Import External Helpdesk To Locale
811
+ */
812
+ importExternalHelpdeskToLocale(
813
+ websiteID: string, locale: string, helpdeskUrl: string
814
+ ) {
815
+ return this.crisp.post(
816
+ this.crisp.prepareRestUrl([
817
+ "website", websiteID, "helpdesk", "locale", locale, "import"
818
+ ]),
819
+
820
+ null,
821
+
822
+ {
823
+ helpdesk_url: helpdeskUrl
824
+ }
825
+ );
826
+ };
827
+
828
+ /**
829
+ * Export Helpdesk Locale Articles
830
+ */
831
+ exportHelpdeskLocaleArticles(websiteID: string, locale: string) {
832
+ return this.crisp.post(
833
+ this.crisp.prepareRestUrl([
834
+ "website", websiteID, "helpdesk", "locale", locale, "export"
835
+ ]),
836
+
837
+ null,
838
+
839
+ null
840
+ );
841
+ };
842
+
843
+ /**
844
+ * List Helpdesk Redirections
845
+ */
846
+ listHelpdeskRedirections(websiteID: string, pageNumber: number = 1) : Promise<HelpdeskRedirection[]> {
847
+ return this.crisp.get(
848
+ this.crisp.prepareRestUrl([
849
+ "website", websiteID, "helpdesk", "redirections", String(pageNumber)
850
+ ])
851
+ );
852
+ };
853
+
854
+ /**
855
+ * Add Helpdesk Redirection
856
+ */
857
+ addHelpdeskRedirection(
858
+ websiteID: string, redirectionPath: string, redirectionTarget: string
859
+ ) {
860
+ return this.crisp.post(
861
+ this.crisp.prepareRestUrl(["website", websiteID, "helpdesk", "redirection"]),
862
+
863
+ null,
864
+
865
+ {
866
+ path: redirectionPath,
867
+ target: redirectionTarget
868
+ }
869
+ );
870
+ };
871
+
872
+ /**
873
+ * Check If Helpdesk Redirection Exists
874
+ */
875
+ checkHelpdeskRedirectionExists(websiteID: string, redirectionId: string) {
876
+ return this.crisp.head(
877
+ this.crisp.prepareRestUrl([
878
+ "website", websiteID, "helpdesk", "redirection", redirectionId
879
+ ])
880
+ );
881
+ };
882
+
883
+ /**
884
+ * Resolve Helpdesk Redirection
885
+ */
886
+ resolveHelpdeskRedirection(websiteID: string, redirectionId: string) : Promise<HelpdeskRedirection> {
887
+ return this.crisp.get(
888
+ this.crisp.prepareRestUrl([
889
+ "website", websiteID, "helpdesk", "redirection", redirectionId
890
+ ])
891
+ );
892
+ };
893
+
894
+ /**
895
+ * Delete Helpdesk Redirection
896
+ */
897
+ deleteHelpdeskRedirection(websiteID: string, redirectionId: string) {
898
+ return this.crisp.delete(
899
+ this.crisp.prepareRestUrl([
900
+ "website", websiteID, "helpdesk", "redirection", redirectionId
901
+ ])
902
+ );
903
+ };
904
+
905
+ /**
906
+ * Resolve Helpdesk Settings
907
+ */
908
+ resolveHelpdeskSettings(websiteID: string) : Promise<HelpdeskSettings> {
909
+ return this.crisp.get(
910
+ this.crisp.prepareRestUrl(["website", websiteID, "helpdesk", "settings"])
911
+ );
912
+ };
913
+
914
+ /**
915
+ * Save Helpdesk Settings
916
+ */
917
+ saveHelpdeskSettings(websiteID: string, settings: HelpdeskSettings) {
918
+ return this.crisp.patch(
919
+ this.crisp.prepareRestUrl(["website", websiteID, "helpdesk", "settings"]),
920
+
921
+ null, settings
922
+ );
923
+ };
924
+
925
+ /**
926
+ * Resolve Helpdesk Domain
927
+ */
928
+ resolveHelpdeskDomain(websiteID: string) : Promise<HelpdeskDomain> {
929
+ return this.crisp.get(
930
+ this.crisp.prepareRestUrl(["website", websiteID, "helpdesk", "domain"])
931
+ );
932
+ };
933
+
934
+ /**
935
+ * Request Helpdesk Domain Change
936
+ */
937
+ requestHelpdeskDomainChange(websiteID: string, basic: string, custom: string) {
938
+ // Generate body
939
+ let body = {};
940
+
941
+ if (basic !== undefined) {
942
+ // @ts-ignore
943
+ body.basic = basic;
944
+ }
945
+
946
+ if (custom !== undefined) {
947
+ // @ts-ignore
948
+ body.custom = custom;
949
+ }
950
+
951
+ return this.crisp.patch(
952
+ this.crisp.prepareRestUrl(["website", websiteID, "helpdesk", "domain"]),
953
+
954
+ null, body
955
+ );
956
+ };
957
+
958
+ /**
959
+ * Generate Helpdesk Domain Setup Flow
960
+ */
961
+ generateHelpdeskDomainSetupFlow(websiteID: string, custom?: string | null) {
962
+ custom = (custom || null);
963
+
964
+ // Generate query
965
+ let query = {};
966
+
967
+ if (custom !== null) {
968
+ // @ts-ignore
969
+ query.custom = custom;
970
+ }
971
+
972
+ return this.crisp.get(
973
+ this.crisp.prepareRestUrl([
974
+ "website", websiteID, "helpdesk", "domain", "setup"
975
+ ]),
976
+
977
+ query
978
+ );
979
+ };
980
+ }
981
+
982
+ export default WebsiteHelpdesk;