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
@@ -1,1198 +0,0 @@
1
- /*
2
- * node-crisp-api
3
- *
4
- * Copyright 2023, Crisp IM SAS
5
- * Author: Valerian Saliou <valerian@valeriansaliou.name>
6
- */
7
-
8
-
9
- "use strict";
10
-
11
-
12
- /**
13
- * Crisp WebsiteHelpdesk Resource
14
- * @class
15
- * @classdesc This is the Crisp Website Helpdesk Resource
16
- */
17
- function WebsiteHelpdesk(service, crisp) {
18
- /**
19
- * Check If Helpdesk Exists
20
- * @memberof WebsiteConversation
21
- * @public
22
- * @method checkHelpdeskExists
23
- * @param {string} websiteID
24
- * @return {Promise}
25
- */
26
- service.checkHelpdeskExists = function(websiteID) {
27
- return crisp.head(
28
- crisp._prepareRestUrl(["website", websiteID, "helpdesk"])
29
- );
30
- };
31
-
32
- /**
33
- * Resolve Helpdesk
34
- * @memberof WebsiteConversation
35
- * @public
36
- * @method resolveHelpdesk
37
- * @param {string} websiteID
38
- * @return {Promise}
39
- */
40
- service.resolveHelpdesk = function(websiteID) {
41
- return crisp.get(
42
- crisp._prepareRestUrl(["website", websiteID, "helpdesk"])
43
- );
44
- };
45
-
46
- /**
47
- * Initialize Helpdesk
48
- * @memberof WebsiteConversation
49
- * @public
50
- * @method initializeHelpdesk
51
- * @param {string} websiteID
52
- * @param {string} name
53
- * @param {string} domainBasic
54
- * @return {Promise}
55
- */
56
- service.initializeHelpdesk = function(websiteID, name, domainBasic) {
57
- return crisp.post(
58
- crisp._prepareRestUrl(["website", websiteID, "helpdesk"]), null,
59
-
60
- {
61
- name : name,
62
- domain_basic : domainBasic
63
- }
64
- );
65
- };
66
-
67
- /**
68
- * Delete Helpdesk
69
- * @memberof WebsiteConversation
70
- * @public
71
- * @method deleteHelpdesk
72
- * @param {string} websiteID
73
- * @param {object} verify
74
- * @return {Promise}
75
- */
76
- service.deleteHelpdesk = function(websiteID, verify) {
77
- return crisp.delete(
78
- crisp._prepareRestUrl(["website", websiteID, "helpdesk"]), null,
79
-
80
- {
81
- verify : verify
82
- }
83
- );
84
- };
85
-
86
- /**
87
- * List Helpdesk Locales
88
- * @memberof WebsiteConversation
89
- * @public
90
- * @method listHelpdeskLocales
91
- * @param {string} websiteID
92
- * @param {number} pageNumber
93
- * @return {Promise}
94
- */
95
- service.listHelpdeskLocales = function(websiteID, pageNumber) {
96
- return crisp.get(
97
- crisp._prepareRestUrl([
98
- "website", websiteID, "helpdesk", "locales", pageNumber
99
- ])
100
- );
101
- };
102
-
103
- /**
104
- * Add Helpdesk Locale
105
- * @memberof WebsiteConversation
106
- * @public
107
- * @method addHelpdeskLocale
108
- * @param {string} websiteID
109
- * @param {string} locale
110
- * @return {Promise}
111
- */
112
- service.addHelpdeskLocale = function(websiteID, locale) {
113
- return crisp.post(
114
- crisp._prepareRestUrl(["website", websiteID, "helpdesk", "locale"]),
115
-
116
- null,
117
-
118
- {
119
- locale : locale
120
- }
121
- );
122
- };
123
-
124
- /**
125
- * Check If Helpdesk Locale Exists
126
- * @memberof WebsiteConversation
127
- * @public
128
- * @method checkHelpdeskLocaleExists
129
- * @param {string} websiteID
130
- * @param {string} locale
131
- * @return {Promise}
132
- */
133
- service.checkHelpdeskLocaleExists = function(websiteID, locale) {
134
- return crisp.head(
135
- crisp._prepareRestUrl([
136
- "website", websiteID, "helpdesk", "locale", locale
137
- ])
138
- );
139
- };
140
-
141
- /**
142
- * Resolve Helpdesk Locale
143
- * @memberof WebsiteConversation
144
- * @public
145
- * @method resolveHelpdeskLocale
146
- * @param {string} websiteID
147
- * @param {string} locale
148
- * @return {Promise}
149
- */
150
- service.resolveHelpdeskLocale = function(websiteID, locale) {
151
- return crisp.get(
152
- crisp._prepareRestUrl([
153
- "website", websiteID, "helpdesk", "locale", locale
154
- ])
155
- );
156
- };
157
-
158
- /**
159
- * Delete Helpdesk Locale
160
- * @memberof WebsiteConversation
161
- * @public
162
- * @method deleteHelpdeskLocale
163
- * @param {string} websiteID
164
- * @param {string} locale
165
- * @return {Promise}
166
- */
167
- service.deleteHelpdeskLocale = function(websiteID, locale) {
168
- return crisp.delete(
169
- crisp._prepareRestUrl([
170
- "website", websiteID, "helpdesk", "locale", locale
171
- ])
172
- );
173
- };
174
-
175
- /**
176
- * List Helpdesk Locale Articles
177
- * @memberof WebsiteConversation
178
- * @public
179
- * @method listHelpdeskLocaleArticles
180
- * @param {string} websiteID
181
- * @param {string} locale
182
- * @param {number} pageNumber
183
- * @param {object} [options]
184
- * @return {Promise}
185
- */
186
- service.listHelpdeskLocaleArticles = function(
187
- websiteID, locale, pageNumber, options={}
188
- ) {
189
- return crisp.get(
190
- crisp._prepareRestUrl([
191
- "website", websiteID, "helpdesk", "locale", locale, "articles",
192
- pageNumber
193
- ]),
194
-
195
- options
196
- );
197
- };
198
-
199
- /**
200
- * Add A New Helpdesk Locale Article
201
- * @memberof WebsiteConversation
202
- * @public
203
- * @method addNewHelpdeskLocaleArticle
204
- * @param {string} websiteID
205
- * @param {string} locale
206
- * @param {string} title
207
- * @return {Promise}
208
- */
209
- service.addNewHelpdeskLocaleArticle = function(websiteID, locale, title) {
210
- return crisp.post(
211
- crisp._prepareRestUrl([
212
- "website", websiteID, "helpdesk", "locale", locale, "article"
213
- ]),
214
-
215
- null,
216
-
217
- {
218
- title : title
219
- }
220
- );
221
- };
222
-
223
- /**
224
- * Check If Helpdesk Locale Article Exists
225
- * @memberof WebsiteConversation
226
- * @public
227
- * @method checkHelpdeskLocaleArticleExists
228
- * @param {string} websiteID
229
- * @param {string} locale
230
- * @param {string} articleId
231
- * @return {Promise}
232
- */
233
- service.checkHelpdeskLocaleArticleExists = function(
234
- websiteID, locale, articleId
235
- ) {
236
- return crisp.head(
237
- crisp._prepareRestUrl([
238
- "website", websiteID, "helpdesk", "locale", locale, "article", articleId
239
- ])
240
- );
241
- };
242
-
243
- /**
244
- * Resolve Helpdesk Locale Article
245
- * @memberof WebsiteConversation
246
- * @public
247
- * @method resolveHelpdeskLocaleArticle
248
- * @param {string} websiteID
249
- * @param {string} locale
250
- * @param {string} articleId
251
- * @return {Promise}
252
- */
253
- service.resolveHelpdeskLocaleArticle = function(
254
- websiteID, locale, articleId
255
- ) {
256
- return crisp.get(
257
- crisp._prepareRestUrl([
258
- "website", websiteID, "helpdesk", "locale", locale, "article",
259
- articleId
260
- ])
261
- );
262
- };
263
-
264
- /**
265
- * Save Helpdesk Locale Article
266
- * @memberof WebsiteConversation
267
- * @public
268
- * @method saveHelpdeskLocaleArticle
269
- * @param {string} websiteID
270
- * @param {string} locale
271
- * @param {string} articleId
272
- * @param {object} article
273
- * @return {Promise}
274
- */
275
- service.saveHelpdeskLocaleArticle = function(
276
- websiteID, locale, articleId, article
277
- ) {
278
- return crisp.put(
279
- crisp._prepareRestUrl([
280
- "website", websiteID, "helpdesk", "locale", locale, "article",
281
- articleId
282
- ]),
283
-
284
- null, article
285
- );
286
- };
287
-
288
- /**
289
- * Update Helpdesk Locale Article
290
- * @memberof WebsiteConversation
291
- * @public
292
- * @method updateHelpdeskLocaleArticle
293
- * @param {string} websiteID
294
- * @param {string} locale
295
- * @param {string} articleId
296
- * @param {object} article
297
- * @return {Promise}
298
- */
299
- service.updateHelpdeskLocaleArticle = function(
300
- websiteID, locale, articleId, article
301
- ) {
302
- return crisp.patch(
303
- crisp._prepareRestUrl([
304
- "website", websiteID, "helpdesk", "locale", locale, "article",
305
- articleId
306
- ]),
307
-
308
- null, article
309
- );
310
- };
311
-
312
- /**
313
- * Delete Helpdesk Locale Article
314
- * @memberof WebsiteConversation
315
- * @public
316
- * @method deleteHelpdeskLocaleArticle
317
- * @param {string} websiteID
318
- * @param {string} locale
319
- * @param {string} articleId
320
- * @return {Promise}
321
- */
322
- service.deleteHelpdeskLocaleArticle = function(websiteID, locale, articleId) {
323
- return crisp.delete(
324
- crisp._prepareRestUrl([
325
- "website", websiteID, "helpdesk", "locale", locale, "article",
326
- articleId
327
- ])
328
- );
329
- };
330
-
331
- /**
332
- * Resolve Helpdesk Locale Article Page
333
- * @memberof WebsiteConversation
334
- * @public
335
- * @method resolveHelpdeskLocaleArticlePage
336
- * @param {string} websiteID
337
- * @param {string} locale
338
- * @param {string} articleId
339
- * @return {Promise}
340
- */
341
- service.resolveHelpdeskLocaleArticlePage = function(
342
- websiteID, locale, articleId
343
- ) {
344
- return crisp.get(
345
- crisp._prepareRestUrl([
346
- "website", websiteID, "helpdesk", "locale", locale, "article",
347
- articleId, "page"
348
- ])
349
- );
350
- };
351
-
352
- /**
353
- * Resolve Helpdesk Locale Article Category
354
- * @memberof WebsiteConversation
355
- * @public
356
- * @method resolveHelpdeskLocaleArticleCategory
357
- * @param {string} websiteID
358
- * @param {string} locale
359
- * @param {string} articleId
360
- * @return {Promise}
361
- */
362
- service.resolveHelpdeskLocaleArticleCategory = function(
363
- websiteID, locale, articleId
364
- ) {
365
- return crisp.get(
366
- crisp._prepareRestUrl([
367
- "website", websiteID, "helpdesk", "locale", locale, "article",
368
- articleId, "category"
369
- ])
370
- );
371
- };
372
-
373
- /**
374
- * Update Helpdesk Locale Article Category
375
- * @memberof WebsiteConversation
376
- * @public
377
- * @method updateHelpdeskLocaleArticleCategory
378
- * @param {string} websiteID
379
- * @param {string} locale
380
- * @param {string} articleId
381
- * @param {string} categoryId
382
- * @param {string} [sectionId]
383
- * @return {Promise}
384
- */
385
- service.updateHelpdeskLocaleArticleCategory = function(
386
- websiteID, locale, articleId, categoryId, sectionId
387
- ) {
388
- // Generate body
389
- var _body = {
390
- category_id : categoryId
391
- };
392
-
393
- if (sectionId !== undefined) {
394
- _body.section_id = sectionId;
395
- }
396
-
397
- return crisp.patch(
398
- crisp._prepareRestUrl([
399
- "website", websiteID, "helpdesk", "locale", locale, "article",
400
- articleId, "category"
401
- ]),
402
-
403
- null, _body
404
- );
405
- };
406
-
407
- /**
408
- * List Helpdesk Locale Article Alternates
409
- * @memberof WebsiteConversation
410
- * @public
411
- * @method listHelpdeskLocaleArticleAlternates
412
- * @param {string} websiteID
413
- * @param {string} locale
414
- * @param {string} articleId
415
- * @return {Promise}
416
- */
417
- service.listHelpdeskLocaleArticleAlternates = function(
418
- websiteID, locale, articleId
419
- ) {
420
- return crisp.get(
421
- crisp._prepareRestUrl([
422
- "website", websiteID, "helpdesk", "locale", locale, "article",
423
- articleId, "alternates"
424
- ])
425
- );
426
- };
427
-
428
- /**
429
- * Check If Helpdesk Locale Article Alternate Exists
430
- * @memberof WebsiteConversation
431
- * @public
432
- * @method checkHelpdeskLocaleArticleAlternateExists
433
- * @param {string} websiteID
434
- * @param {string} locale
435
- * @param {string} articleId
436
- * @param {string} localeLinked
437
- * @return {Promise}
438
- */
439
- service.checkHelpdeskLocaleArticleAlternateExists = function(
440
- websiteID, locale, articleId, localeLinked
441
- ) {
442
- return crisp.head(
443
- crisp._prepareRestUrl([
444
- "website", websiteID, "helpdesk", "locale", locale, "article",
445
- articleId, "alternate", localeLinked
446
- ])
447
- );
448
- };
449
- /**
450
- * Resolve Helpdesk Locale Article Alternate
451
- * @memberof WebsiteConversation
452
- * @public
453
- * @method resolveHelpdeskLocaleArticleAlternate
454
- * @param {string} websiteID
455
- * @param {string} locale
456
- * @param {string} articleId
457
- * @param {string} localeLinked
458
- * @return {Promise}
459
- */
460
- service.resolveHelpdeskLocaleArticleAlternate = function(
461
- websiteID, locale, articleId, localeLinked
462
- ) {
463
- return crisp.get(
464
- crisp._prepareRestUrl([
465
- "website", websiteID, "helpdesk", "locale", locale, "article",
466
- articleId, "alternate", localeLinked
467
- ])
468
- );
469
- };
470
-
471
- /**
472
- * Save Helpdesk Locale Article Alternate
473
- * @memberof WebsiteConversation
474
- * @public
475
- * @method saveHelpdeskLocaleArticleAlternate
476
- * @param {string} websiteID
477
- * @param {string} locale
478
- * @param {string} articleId
479
- * @param {string} localeLinked
480
- * @param {string} articleIdLinked
481
- * @return {Promise}
482
- */
483
- service.saveHelpdeskLocaleArticleAlternate = function(
484
- websiteID, locale, articleId, localeLinked, articleIdLinked
485
- ) {
486
- return crisp.put(
487
- crisp._prepareRestUrl([
488
- "website", websiteID, "helpdesk", "locale", locale, "article",
489
- articleId, "alternate", localeLinked
490
- ]),
491
-
492
- null,
493
-
494
- {
495
- article_id : articleIdLinked
496
- }
497
- );
498
- };
499
-
500
- /**
501
- * Delete Helpdesk Locale Article Alternate
502
- * @memberof WebsiteConversation
503
- * @public
504
- * @method deleteHelpdeskLocaleArticleAlternate
505
- * @param {string} websiteID
506
- * @param {string} locale
507
- * @param {string} articleId
508
- * @param {string} localeLinked
509
- * @return {Promise}
510
- */
511
- service.deleteHelpdeskLocaleArticleAlternate = function(
512
- websiteID, locale, articleId, localeLinked
513
- ) {
514
- return crisp.delete(
515
- crisp._prepareRestUrl([
516
- "website", websiteID, "helpdesk", "locale", locale, "article",
517
- articleId, "alternate", localeLinked
518
- ])
519
- );
520
- };
521
-
522
- /**
523
- * Publish Helpdesk Locale Article
524
- * @memberof WebsiteConversation
525
- * @public
526
- * @method publishHelpdeskLocaleArticle
527
- * @param {string} websiteID
528
- * @param {string} locale
529
- * @param {string} articleId
530
- * @return {Promise}
531
- */
532
- service.publishHelpdeskLocaleArticle = function(
533
- websiteID, locale, articleId
534
- ) {
535
- return crisp.post(
536
- crisp._prepareRestUrl([
537
- "website", websiteID, "helpdesk", "locale", locale, "article",
538
- articleId, "publish"
539
- ])
540
- );
541
- };
542
-
543
- /**
544
- * Unpublish Helpdesk Locale Article
545
- * @memberof WebsiteConversation
546
- * @public
547
- * @method unpublishHelpdeskLocaleArticle
548
- * @param {string} websiteID
549
- * @param {string} locale
550
- * @param {string} articleId
551
- * @return {Promise}
552
- */
553
- service.unpublishHelpdeskLocaleArticle = function(
554
- websiteID, locale, articleId
555
- ) {
556
- return crisp.post(
557
- crisp._prepareRestUrl([
558
- "website", websiteID, "helpdesk", "locale", locale, "article",
559
- articleId, "unpublish"
560
- ])
561
- );
562
- };
563
-
564
- /**
565
- * List Helpdesk Locale Categories
566
- * @memberof WebsiteConversation
567
- * @public
568
- * @method listHelpdeskLocaleCategories
569
- * @param {string} websiteID
570
- * @param {string} locale
571
- * @param {number} pageNumber
572
- * @return {Promise}
573
- */
574
- service.listHelpdeskLocaleCategories = function(
575
- websiteID, locale, pageNumber
576
- ) {
577
- return crisp.get(
578
- crisp._prepareRestUrl([
579
- "website", websiteID, "helpdesk", "locale", locale, "categories",
580
- pageNumber
581
- ])
582
- );
583
- };
584
-
585
- /**
586
- * Add Helpdesk Locale Category
587
- * @memberof WebsiteConversation
588
- * @public
589
- * @method addHelpdeskLocaleCategory
590
- * @param {string} websiteID
591
- * @param {string} locale
592
- * @param {string} name
593
- * @return {Promise}
594
- */
595
- service.addHelpdeskLocaleCategory = function(websiteID, locale, name) {
596
- return crisp.post(
597
- crisp._prepareRestUrl([
598
- "website", websiteID, "helpdesk", "locale", locale, "category"
599
- ]),
600
-
601
- null,
602
-
603
- {
604
- name : name
605
- }
606
- );
607
- };
608
-
609
- /**
610
- * Check If Helpdesk Locale Category Exists
611
- * @memberof WebsiteConversation
612
- * @public
613
- * @method checkHelpdeskLocaleCategoryExists
614
- * @param {string} websiteID
615
- * @param {string} locale
616
- * @param {string} categoryId
617
- * @return {Promise}
618
- */
619
- service.checkHelpdeskLocaleCategoryExists = function(
620
- websiteID, locale, categoryId
621
- ) {
622
- return crisp.head(
623
- crisp._prepareRestUrl([
624
- "website", websiteID, "helpdesk", "locale", locale, "category",
625
- categoryId
626
- ])
627
- );
628
- };
629
-
630
- /**
631
- * Resolve Helpdesk Locale Category
632
- * @memberof WebsiteConversation
633
- * @public
634
- * @method resolveHelpdeskLocaleCategory
635
- * @param {string} websiteID
636
- * @param {string} locale
637
- * @param {string} categoryId
638
- * @return {Promise}
639
- */
640
- service.resolveHelpdeskLocaleCategory = function(
641
- websiteID, locale, categoryId
642
- ) {
643
- return crisp.get(
644
- crisp._prepareRestUrl([
645
- "website", websiteID, "helpdesk", "locale", locale, "category",
646
- categoryId
647
- ])
648
- );
649
- };
650
-
651
- /**
652
- * Save Helpdesk Locale Category
653
- * @memberof WebsiteConversation
654
- * @public
655
- * @method saveHelpdeskLocaleCategory
656
- * @param {string} websiteID
657
- * @param {string} locale
658
- * @param {string} categoryId
659
- * @param {object} category
660
- * @return {Promise}
661
- */
662
- service.saveHelpdeskLocaleCategory = function(
663
- websiteID, locale, categoryId, category
664
- ) {
665
- return crisp.put(
666
- crisp._prepareRestUrl([
667
- "website", websiteID, "helpdesk", "locale", locale, "category",
668
- categoryId
669
- ]),
670
-
671
- null, category
672
- );
673
- };
674
- /**
675
- * Update Helpdesk Locale Category
676
- * @memberof WebsiteConversation
677
- * @public
678
- * @method updateHelpdeskLocaleCategory
679
- * @param {string} websiteID
680
- * @param {string} locale
681
- * @param {string} categoryId
682
- * @param {object} category
683
- * @return {Promise}
684
- */
685
- service.updateHelpdeskLocaleCategory = function(
686
- websiteID, locale, categoryId, category
687
- ) {
688
- return crisp.patch(
689
- crisp._prepareRestUrl([
690
- "website", websiteID, "helpdesk", "locale", locale, "category",
691
- categoryId
692
- ]),
693
-
694
- null, category
695
- );
696
- };
697
-
698
- /**
699
- * Delete Helpdesk Locale Category
700
- * @memberof WebsiteConversation
701
- * @public
702
- * @method deleteHelpdeskLocaleCategory
703
- * @param {string} websiteID
704
- * @param {string} locale
705
- * @param {string} categoryId
706
- * @return {Promise}
707
- */
708
- service.deleteHelpdeskLocaleCategory = function(
709
- websiteID, locale, categoryId
710
- ) {
711
- return crisp.delete(
712
- crisp._prepareRestUrl([
713
- "website", websiteID, "helpdesk", "locale", locale, "category",
714
- categoryId
715
- ])
716
- );
717
- };
718
-
719
- /**
720
- * List Helpdesk Locale Sections
721
- * @memberof WebsiteConversation
722
- * @public
723
- * @method listHelpdeskLocaleSections
724
- * @param {string} websiteID
725
- * @param {string} locale
726
- * @param {string} categoryId
727
- * @param {number} pageNumber
728
- * @return {Promise}
729
- */
730
- service.listHelpdeskLocaleSections = function(
731
- websiteID, locale, categoryId, pageNumber
732
- ) {
733
- return crisp.get(
734
- crisp._prepareRestUrl([
735
- "website", websiteID, "helpdesk", "locale", locale, "category",
736
- categoryId, "sections", pageNumber
737
- ])
738
- );
739
- };
740
-
741
- /**
742
- * Add Helpdesk Locale Section
743
- * @memberof WebsiteConversation
744
- * @public
745
- * @method addHelpdeskLocaleSection
746
- * @param {string} websiteID
747
- * @param {string} locale
748
- * @param {string} categoryId
749
- * @param {string} name
750
- * @return {Promise}
751
- */
752
- service.addHelpdeskLocaleSection = function(
753
- websiteID, locale, categoryId, name
754
- ) {
755
- return crisp.post(
756
- crisp._prepareRestUrl([
757
- "website", websiteID, "helpdesk", "locale", locale, "category",
758
- categoryId, "section"
759
- ]),
760
-
761
- null,
762
-
763
- {
764
- name : name
765
- }
766
- );
767
- };
768
-
769
- /**
770
- * Check If Helpdesk Locale Section Exists
771
- * @memberof WebsiteConversation
772
- * @public
773
- * @method checkHelpdeskLocaleSectionExists
774
- * @param {string} websiteID
775
- * @param {string} locale
776
- * @param {string} categoryId
777
- * @param {string} sectionId
778
- * @return {Promise}
779
- */
780
- service.checkHelpdeskLocaleSectionExists = function(
781
- websiteID, locale, categoryId, sectionId
782
- ) {
783
- return crisp.head(
784
- crisp._prepareRestUrl([
785
- "website", websiteID, "helpdesk", "locale", locale, "category",
786
- categoryId, "section", sectionId
787
- ])
788
- );
789
- };
790
-
791
- /**
792
- * Resolve Helpdesk Locale Section
793
- * @memberof WebsiteConversation
794
- * @public
795
- * @method resolveHelpdeskLocaleSection
796
- * @param {string} websiteID
797
- * @param {string} locale
798
- * @param {string} categoryId
799
- * @param {string} sectionId
800
- * @return {Promise}
801
- */
802
- service.resolveHelpdeskLocaleSection = function(
803
- websiteID, locale, categoryId, sectionId
804
- ) {
805
- return crisp.get(
806
- crisp._prepareRestUrl([
807
- "website", websiteID, "helpdesk", "locale", locale, "category",
808
- categoryId, "section", sectionId
809
- ])
810
- );
811
- };
812
-
813
- /**
814
- * Save Helpdesk Locale Section
815
- * @memberof WebsiteConversation
816
- * @public
817
- * @method saveHelpdeskLocaleSection
818
- * @param {string} websiteID
819
- * @param {string} locale
820
- * @param {string} categoryId
821
- * @param {string} sectionId
822
- * @param {object} section
823
- * @return {Promise}
824
- */
825
- service.saveHelpdeskLocaleSection = function(
826
- websiteID, locale, categoryId, sectionId, section
827
- ) {
828
- return crisp.put(
829
- crisp._prepareRestUrl([
830
- "website", websiteID, "helpdesk", "locale", locale, "category",
831
- categoryId, "section", sectionId
832
- ]),
833
-
834
- null, section
835
- );
836
- };
837
-
838
- /**
839
- * Update Helpdesk Locale Section
840
- * @memberof WebsiteConversation
841
- * @public
842
- * @method updateHelpdeskLocaleSection
843
- * @param {string} websiteID
844
- * @param {string} locale
845
- * @param {string} categoryId
846
- * @param {string} sectionId
847
- * @param {object} section
848
- * @return {Promise}
849
- */
850
- service.updateHelpdeskLocaleSection = function(
851
- websiteID, locale, categoryId, sectionId, section
852
- ) {
853
- return crisp.patch(
854
- crisp._prepareRestUrl([
855
- "website", websiteID, "helpdesk", "locale", locale, "category",
856
- categoryId, "section", sectionId
857
- ]),
858
-
859
- null, section
860
- );
861
- };
862
-
863
- /**
864
- * Delete Helpdesk Locale Section
865
- * @memberof WebsiteConversation
866
- * @public
867
- * @method deleteHelpdeskLocaleSection
868
- * @param {string} websiteID
869
- * @param {string} locale
870
- * @param {string} categoryId
871
- * @param {string} sectionId
872
- * @return {Promise}
873
- */
874
- service.deleteHelpdeskLocaleSection = function(
875
- websiteID, locale, categoryId, sectionId
876
- ) {
877
- return crisp.delete(
878
- crisp._prepareRestUrl([
879
- "website", websiteID, "helpdesk", "locale", locale, "category",
880
- categoryId, "section", sectionId
881
- ])
882
- );
883
- };
884
-
885
- /**
886
- * Map Helpdesk Locale Feedback Ratings
887
- * @memberof WebsiteConversation
888
- * @public
889
- * @method mapHelpdeskLocaleFeedbackRatings
890
- * @param {string} websiteID
891
- * @param {string} locale
892
- * @param {string} [filterDateStart]
893
- * @param {string} [filterDateEnd]
894
- * @return {Promise}
895
- */
896
- service.mapHelpdeskLocaleFeedbackRatings = function(
897
- websiteID, locale, filterDateStart, filterDateEnd
898
- ) {
899
- filterDateStart = (filterDateStart || null);
900
- filterDateEnd = (filterDateEnd || null);
901
-
902
- // Generate query
903
- var _query = {};
904
-
905
- if (filterDateStart !== null) {
906
- _query.filter_date_start = filterDateStart;
907
- }
908
- if (filterDateEnd !== null) {
909
- _query.filter_date_end = filterDateEnd;
910
- }
911
-
912
- return crisp.get(
913
- crisp._prepareRestUrl([
914
- "website", websiteID, "helpdesk", "locale", locale, "feedback",
915
- "ratings"
916
- ]),
917
-
918
- _query
919
- );
920
- };
921
- /**
922
- * List Helpdesk Locale Feedbacks
923
- * @memberof WebsiteConversation
924
- * @public
925
- * @method listHelpdeskLocaleFeedbacks
926
- * @param {string} websiteID
927
- * @param {string} locale
928
- * @param {number} pageNumber
929
- * @param {string} [filterDateStart]
930
- * @param {string} [filterDateEnd]
931
- * @return {Promise}
932
- */
933
- service.listHelpdeskLocaleFeedbacks = function(
934
- websiteID, locale, pageNumber, filterDateStart, filterDateEnd
935
- ) {
936
- filterDateStart = (filterDateStart || null);
937
- filterDateEnd = (filterDateEnd || null);
938
-
939
- // Generate query
940
- var _query = {};
941
-
942
- if (filterDateStart !== null) {
943
- _query.filter_date_start = filterDateStart;
944
- }
945
- if (filterDateEnd !== null) {
946
- _query.filter_date_end = filterDateEnd;
947
- }
948
-
949
- return crisp.get(
950
- crisp._prepareRestUrl([
951
- "website", websiteID, "helpdesk", "locale", locale, "feedback", "list",
952
- pageNumber
953
- ]),
954
-
955
- _query
956
- );
957
- };
958
-
959
- /**
960
- * Import External Helpdesk To Locale
961
- * @memberof WebsiteConversation
962
- * @public
963
- * @method importExternalHelpdeskToLocale
964
- * @param {string} websiteID
965
- * @param {string} locale
966
- * @param {string} helpdeskUrl
967
- * @return {Promise}
968
- */
969
- service.importExternalHelpdeskToLocale = function(
970
- websiteID, locale, helpdeskUrl
971
- ) {
972
- return crisp.post(
973
- crisp._prepareRestUrl([
974
- "website", websiteID, "helpdesk", "locale", locale, "import"
975
- ]),
976
-
977
- null,
978
-
979
- {
980
- helpdesk_url : helpdeskUrl
981
- }
982
- );
983
- };
984
-
985
- /**
986
- * Export Helpdesk Locale Articles
987
- * @memberof WebsiteConversation
988
- * @public
989
- * @method exportHelpdeskLocaleArticles
990
- * @param {string} websiteID
991
- * @param {string} locale
992
- * @return {Promise}
993
- */
994
- service.exportHelpdeskLocaleArticles = function(websiteID, locale) {
995
- return crisp.post(
996
- crisp._prepareRestUrl([
997
- "website", websiteID, "helpdesk", "locale", locale, "export"
998
- ])
999
- );
1000
- };
1001
-
1002
- /**
1003
- * List Helpdesk Redirections
1004
- * @memberof WebsiteConversation
1005
- * @public
1006
- * @method listHelpdeskRedirections
1007
- * @param {string} websiteID
1008
- * @param {number} pageNumber
1009
- * @return {Promise}
1010
- */
1011
- service.listHelpdeskRedirections = function(websiteID, pageNumber) {
1012
- return crisp.get(
1013
- crisp._prepareRestUrl([
1014
- "website", websiteID, "helpdesk", "redirections", pageNumber
1015
- ])
1016
- );
1017
- };
1018
-
1019
- /**
1020
- * Add Helpdesk Redirection
1021
- * @memberof WebsiteConversation
1022
- * @public
1023
- * @method addHelpdeskRedirection
1024
- * @param {string} websiteID
1025
- * @param {string} redirectionPath
1026
- * @param {string} redirectionTarget
1027
- * @return {Promise}
1028
- */
1029
- service.addHelpdeskRedirection = function(
1030
- websiteID, redirectionPath, redirectionTarget
1031
- ) {
1032
- return crisp.post(
1033
- crisp._prepareRestUrl(["website", websiteID, "helpdesk", "redirection"]),
1034
-
1035
- null,
1036
-
1037
- {
1038
- path : redirectionPath,
1039
- target : redirectionTarget
1040
- }
1041
- );
1042
- };
1043
-
1044
- /**
1045
- * Check If Helpdesk Redirection Exists
1046
- * @memberof WebsiteConversation
1047
- * @public
1048
- * @method checkHelpdeskRedirectionExists
1049
- * @param {string} websiteID
1050
- * @param {string} redirectionId
1051
- * @return {Promise}
1052
- */
1053
- service.checkHelpdeskRedirectionExists = function(websiteID, redirectionId) {
1054
- return crisp.head(
1055
- crisp._prepareRestUrl([
1056
- "website", websiteID, "helpdesk", "redirection", redirectionId
1057
- ])
1058
- );
1059
- };
1060
-
1061
- /**
1062
- * Resolve Helpdesk Redirection
1063
- * @memberof WebsiteConversation
1064
- * @public
1065
- * @method resolveHelpdeskRedirection
1066
- * @param {string} websiteID
1067
- * @param {string} redirectionId
1068
- * @return {Promise}
1069
- */
1070
- service.resolveHelpdeskRedirection = function(websiteID, redirectionId) {
1071
- return crisp.get(
1072
- crisp._prepareRestUrl([
1073
- "website", websiteID, "helpdesk", "redirection", redirectionId
1074
- ])
1075
- );
1076
- };
1077
-
1078
- /**
1079
- * Delete Helpdesk Redirection
1080
- * @memberof WebsiteConversation
1081
- * @public
1082
- * @method deleteHelpdeskRedirection
1083
- * @param {string} websiteID
1084
- * @param {string} redirectionId
1085
- * @return {Promise}
1086
- */
1087
- service.deleteHelpdeskRedirection = function(websiteID, redirectionId) {
1088
- return crisp.delete(
1089
- crisp._prepareRestUrl([
1090
- "website", websiteID, "helpdesk", "redirection", redirectionId
1091
- ])
1092
- );
1093
- };
1094
-
1095
- /**
1096
- * Resolve Helpdesk Settings
1097
- * @memberof WebsiteConversation
1098
- * @public
1099
- * @method resolveHelpdeskSettings
1100
- * @param {string} websiteID
1101
- * @return {Promise}
1102
- */
1103
- service.resolveHelpdeskSettings = function(websiteID) {
1104
- return crisp.get(
1105
- crisp._prepareRestUrl(["website", websiteID, "helpdesk", "settings"])
1106
- );
1107
- };
1108
-
1109
- /**
1110
- * Save Helpdesk Settings
1111
- * @memberof WebsiteConversation
1112
- * @public
1113
- * @method saveHelpdeskSettings
1114
- * @param {string} websiteID
1115
- * @param {object} settings
1116
- * @return {Promise}
1117
- */
1118
- service.saveHelpdeskSettings = function(websiteID, settings) {
1119
- return crisp.patch(
1120
- crisp._prepareRestUrl(["website", websiteID, "helpdesk", "settings"]),
1121
-
1122
- null, settings
1123
- );
1124
- };
1125
-
1126
- /**
1127
- * Resolve Helpdesk Domain
1128
- * @memberof WebsiteConversation
1129
- * @public
1130
- * @method resolveHelpdeskDomain
1131
- * @param {string} websiteID
1132
- * @return {Promise}
1133
- */
1134
- service.resolveHelpdeskDomain = function(websiteID) {
1135
- return crisp.get(
1136
- crisp._prepareRestUrl(["website", websiteID, "helpdesk", "domain"])
1137
- );
1138
- };
1139
-
1140
- /**
1141
- * Request Helpdesk Domain Change
1142
- * @memberof WebsiteConversation
1143
- * @public
1144
- * @method requestHelpdeskDomainChange
1145
- * @param {string} websiteID
1146
- * @param {string} basic
1147
- * @param {string} custom
1148
- * @return {Promise}
1149
- */
1150
- service.requestHelpdeskDomainChange = function(websiteID, basic, custom) {
1151
- // Generate body
1152
- var _body = {};
1153
-
1154
- if (basic !== undefined) {
1155
- _body.basic = basic;
1156
- }
1157
- if (custom !== undefined) {
1158
- _body.custom = custom;
1159
- }
1160
-
1161
- return crisp.patch(
1162
- crisp._prepareRestUrl(["website", websiteID, "helpdesk", "domain"]),
1163
-
1164
- null, _body
1165
- );
1166
- };
1167
-
1168
- /**
1169
- * Generate Helpdesk Domain Setup Flow
1170
- * @memberof WebsiteConversation
1171
- * @public
1172
- * @method generateHelpdeskDomainSetupFlow
1173
- * @param {string} websiteID
1174
- * @param {string} [custom]
1175
- * @return {Promise}
1176
- */
1177
- service.generateHelpdeskDomainSetupFlow = function(websiteID, custom) {
1178
- custom = (custom || null);
1179
-
1180
- // Generate query
1181
- var _query = {};
1182
-
1183
- if (custom !== null) {
1184
- _query.custom = custom;
1185
- }
1186
-
1187
- return crisp.get(
1188
- crisp._prepareRestUrl([
1189
- "website", websiteID, "helpdesk", "domain", "setup"
1190
- ]),
1191
-
1192
- _query
1193
- );
1194
- };
1195
- }
1196
-
1197
-
1198
- module.exports = WebsiteHelpdesk;