crisp-api 9.13.0 → 10.0.3

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