crisp-api 9.13.0 → 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 +8 -0
  2. package/README.md +2 -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 -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,161 @@
1
+ /*
2
+ * node-crisp-api
3
+ *
4
+ * Copyright 2022, Crisp IM SAS
5
+ * Author: Baptiste Jamin <baptiste@crisp.chat>
6
+ */
7
+
8
+ /**************************************************************************
9
+ * IMPORTS
10
+ ***************************************************************************/
11
+
12
+ // PROJECT: RESOURCES
13
+ import BaseResource from "./BaseResource";
14
+
15
+ export interface WebsiteOperatorListOne {
16
+ type?: string;
17
+ details?: WebsiteOperator;
18
+ }
19
+
20
+ export interface WebsiteOperatorData {
21
+ data?: WebsiteOperator;
22
+ }
23
+
24
+ export interface WebsiteOperator {
25
+ userID?: string;
26
+ email?: string;
27
+ avatar?: string;
28
+ firstName?: string;
29
+ lastName?: string;
30
+ role?: string;
31
+ title?: string;
32
+ availability?: string;
33
+ hasToken?: boolean;
34
+ identifier?: string;
35
+ key?: string;
36
+ }
37
+
38
+ export interface WebsiteOperatorsLastActiveListOne {
39
+ userID?: string;
40
+ avatar?: string;
41
+ nickname?: string;
42
+ timestamp?: number;
43
+ }
44
+
45
+ export interface WebsiteOperatorEmail {
46
+ recipient?: string;
47
+ userID?: string;
48
+ subject?: string;
49
+ message?: string;
50
+ target?: WebsiteOperatorEmailTarget;
51
+ }
52
+
53
+ export interface WebsiteOperatorEmailTarget {
54
+ label?: string;
55
+ url?: string;
56
+ }
57
+
58
+ /**
59
+ * Crisp WebsiteOperator Resource
60
+ */
61
+ class WebsiteOperatorService extends BaseResource {
62
+ /**
63
+ * List Website Operators
64
+ */
65
+ listWebsiteOperators(websiteID: string) : Promise<WebsiteOperatorListOne[]> {
66
+ return this.crisp.get(
67
+ this.crisp.prepareRestUrl([
68
+ "website", websiteID, "operators", "list"
69
+ ])
70
+ );
71
+ };
72
+
73
+ /**
74
+ * List Last Active Website Operators
75
+ */
76
+ listLastActiveWebsiteOperators(websiteID: string) : Promise<WebsiteOperatorsLastActiveListOne[]> {
77
+ return this.crisp.get(
78
+ this.crisp.prepareRestUrl([
79
+ "website", websiteID, "operators", "active"
80
+ ])
81
+ );
82
+ };
83
+
84
+ /**
85
+ * Flush Last Active Website Operators
86
+ */
87
+ flushLastActiveWebsiteOperators(websiteID: string) {
88
+ return this.crisp.delete(
89
+ this.crisp.prepareRestUrl([
90
+ "website", websiteID, "operators", "active"
91
+ ])
92
+ );
93
+ };
94
+
95
+ /**
96
+ * Send Email To Website Operators
97
+ */
98
+ sendEmailToWebsiteOperators(websiteID: string, emailData: WebsiteOperatorEmail) {
99
+ return this.crisp.post(
100
+ this.crisp.prepareRestUrl(["website", websiteID, "operators", "email"]),
101
+
102
+ null, emailData
103
+ );
104
+ };
105
+
106
+ /**
107
+ * Get A Website Operator
108
+ */
109
+ getWebsiteOperator(websiteID: string, userID: string) : Promise<WebsiteOperator> {
110
+ return this.crisp.get(
111
+ this.crisp.prepareRestUrl([
112
+ "website", websiteID, "operator", userID
113
+ ])
114
+ );
115
+ };
116
+
117
+ /**
118
+ * Invite A Website Operator
119
+ */
120
+ inviteWebsiteOperator(websiteID: string, email: string, role: string, verify: boolean) {
121
+ return this.crisp.post(
122
+ this.crisp.prepareRestUrl(["website", websiteID, "operator"]),
123
+
124
+ null,
125
+
126
+ {
127
+ email: email,
128
+ role: role,
129
+ verify: verify
130
+ }
131
+ );
132
+ };
133
+
134
+ /**
135
+ * Change Operator Membership
136
+ */
137
+ changeOperatorMembership(websiteID: string, userID: string, role: string, title: string) {
138
+ return this.crisp.patch(
139
+ this.crisp.prepareRestUrl(["website", websiteID, "operator", userID]),
140
+
141
+ null,
142
+
143
+ {
144
+ role: role,
145
+ title: title
146
+ }
147
+ );
148
+ };
149
+
150
+ /**
151
+ * Unlink Operator From Website
152
+ */
153
+ unlinkOperatorFromWebsite(websiteID: string, userID: string) {
154
+ return this.crisp.delete(
155
+ this.crisp.prepareRestUrl(["website", websiteID, "operator", userID])
156
+ );
157
+ };
158
+ }
159
+
160
+ export default WebsiteOperatorService;
161
+
@@ -0,0 +1,527 @@
1
+ /*
2
+ * node-crisp-api
3
+ *
4
+ * Copyright 2022, Crisp IM SAS
5
+ * Author: Baptiste Jamin <baptiste@crisp.chat>
6
+ */
7
+
8
+ /**************************************************************************
9
+ * IMPORTS
10
+ ***************************************************************************/
11
+
12
+ // PROJECT: RESOURCES
13
+ import BaseResource from "./BaseResource";
14
+
15
+ export interface PeopleStatistics {
16
+ total?: number;
17
+ }
18
+
19
+ export interface PeopleSuggestedSegment {
20
+ segment?: string;
21
+ count?: number;
22
+ }
23
+
24
+ export interface PeopleSuggestedDataKey {
25
+ key?: string;
26
+ count?: number;
27
+ }
28
+
29
+ export interface PeopleSuggestedEvent {
30
+ text?: string;
31
+ count?: number;
32
+ }
33
+
34
+ export interface PeopleProfile extends PeopleProfileCard {
35
+ people_id?: string;
36
+ }
37
+
38
+ export interface PeopleProfileNew {
39
+ people_id?: string;
40
+ }
41
+
42
+ export interface PeopleProfileCard {
43
+ email?: string;
44
+ person?: PeopleProfileCardPerson;
45
+ company?: PeopleProfileCardCompany;
46
+ segments?: string[];
47
+ notepad?: string;
48
+ active?: PeopleProfileCardActive;
49
+ score?: number;
50
+ created_at?: number;
51
+ updated_at?: number;
52
+ }
53
+
54
+ export interface PeopleProfileUpdateCard {
55
+ email?: string;
56
+ person?: PeopleProfileCardPerson;
57
+ company?: PeopleProfileCardCompany;
58
+ segments?: string[];
59
+ notepad?: string;
60
+ active?: number;
61
+ }
62
+
63
+ export interface PeopleProfileCardPerson {
64
+ nickname?: string;
65
+ avatar?: string;
66
+ gender?: string;
67
+ phone?: string;
68
+ address?: string;
69
+ description?: string;
70
+ website?: string;
71
+ timezone?: number;
72
+ profiles?: PeopleProfileCardPersonProfile[];
73
+ employment?: PeopleProfileCardPersonEmployment;
74
+ geolocation?: PeopleProfileCardGeolocation;
75
+ locales?: string[];
76
+ }
77
+
78
+ export interface PeopleProfileCardPersonProfile {
79
+ type?: string;
80
+ handle?: string;
81
+ }
82
+
83
+ export interface PeopleProfileCardPersonEmployment {
84
+ name?: string;
85
+ domain?: string;
86
+ title?: string;
87
+ role?: string;
88
+ seniority?: string;
89
+ }
90
+
91
+ export interface PeopleProfileCardCompany {
92
+ name?: string;
93
+ legal_name?: string;
94
+ domain?: string;
95
+ url?: string;
96
+ description?: string;
97
+ timezone?: number;
98
+ phones?: string[];
99
+ emails?: string[];
100
+ geolocation?: PeopleProfileCardGeolocation;
101
+ metrics?: PeopleProfileCardCompanyMetrics;
102
+ tags?: string[];
103
+ }
104
+
105
+ export interface PeopleProfileCardCompanyMetrics {
106
+ employees?: number;
107
+ market_cap?: number;
108
+ raised?: number;
109
+ arr?: number;
110
+ }
111
+
112
+ export interface PeopleProfileCardGeolocation {
113
+ country?: string;
114
+ region?: string;
115
+ city?: string;
116
+ coordinates?: PeopleProfileCardGeolocationCoordinates;
117
+ }
118
+
119
+ export interface PeopleProfileCardGeolocationCoordinates {
120
+ latitude?: number;
121
+ longitude?: number;
122
+ }
123
+
124
+ export interface PeopleProfileCardActive {
125
+ now?: boolean;
126
+ last?: number;
127
+ }
128
+
129
+ export interface PeopleCampaign {
130
+ campaign_id?: string;
131
+ type?: string;
132
+ name?: string;
133
+ created_at?: number;
134
+ updated_at?: number;
135
+ dispatched_at?: number;
136
+ occurred_at?: number;
137
+ statistics?: string[];
138
+ }
139
+
140
+ export interface PeopleEvent {
141
+ text?: string;
142
+ data?: object;
143
+ color?: string;
144
+ timestamp?: number;
145
+ }
146
+
147
+ export interface PeopleData {
148
+ data?: Record<string, boolean|string|number>;
149
+ }
150
+
151
+ export interface PeopleSubscription {
152
+ email?: boolean;
153
+ }
154
+
155
+ export interface PeopleSubscriptionUpdate {
156
+ email?: boolean;
157
+ }
158
+
159
+ export interface PeopleProfileImportSetup {
160
+ url?: string;
161
+ mapping?: PeopleProfileImportSetupMapping[];
162
+ options?: PeopleProfileImportSetupOptions;
163
+ }
164
+
165
+ export interface PeopleProfileImportSetupMapping {
166
+ column?: number;
167
+ field?: string;
168
+ }
169
+
170
+ export interface PeopleProfileImportSetupOptions {
171
+ column_separator?: string;
172
+ skip_header?: boolean;
173
+ }
174
+
175
+ /**
176
+ * Crisp WebsitePeople Resource
177
+ * @class
178
+ * @classdesc This is the Crisp Website People Resource
179
+ */
180
+ class WebsitePeople extends BaseResource {
181
+ /**
182
+ * Get People Statistics
183
+ */
184
+ getPeopleStatistics(websiteID: string) : Promise<PeopleStatistics> {
185
+ return this.crisp.get(
186
+ this.crisp.prepareRestUrl(["website", websiteID, "people", "stats"])
187
+ );
188
+ };
189
+
190
+ /**
191
+ * List Suggested People Segments
192
+ */
193
+ listSuggestedPeopleSegments(websiteID: string, pageNumber: number = 1) : Promise<PeopleSuggestedSegment[]> {
194
+ return this.crisp.get(
195
+ this.crisp.prepareRestUrl([
196
+ "website", websiteID, "people", "suggest", "segments", String(pageNumber)
197
+ ])
198
+ );
199
+ };
200
+
201
+ /**
202
+ * Delete Suggested People Segment
203
+ */
204
+ deleteSuggestedPeopleSegment(websiteID: string, segment: string) {
205
+ return this.crisp.delete(
206
+ this.crisp.prepareRestUrl([
207
+ "website", websiteID, "people", "suggest", "segment"
208
+ ]),
209
+
210
+ null,
211
+
212
+ {
213
+ segment: segment
214
+ }
215
+ );
216
+ };
217
+
218
+ /**
219
+ * List Suggested People Data Keys
220
+ */
221
+ listSuggestedPeopleDataKeys(websiteID: string, pageNumber: number = 1) : Promise<PeopleSuggestedDataKey[]> {
222
+ return this.crisp.get(
223
+ this.crisp.prepareRestUrl([
224
+ "website", websiteID, "people", "suggest", "data", String(pageNumber)
225
+ ])
226
+ );
227
+ };
228
+
229
+ /**
230
+ * Delete Suggested People Data Key
231
+ */
232
+ deleteSuggestedPeopleDataKey(websiteID: string, key: string) {
233
+ return this.crisp.delete(
234
+ this.crisp.prepareRestUrl([
235
+ "website", websiteID, "people", "suggest", "data"
236
+ ]),
237
+
238
+ null,
239
+
240
+ {
241
+ key: key
242
+ }
243
+ );
244
+ };
245
+
246
+ /**
247
+ * List Suggested People Events
248
+ */
249
+ listSuggestedPeopleEvents(websiteID: string, pageNumber: number = 1) : Promise<PeopleSuggestedEvent[]> {
250
+ return this.crisp.get(
251
+ this.crisp.prepareRestUrl([
252
+ "website", websiteID, "people", "suggest", "events", String(pageNumber)
253
+ ])
254
+ );
255
+ };
256
+
257
+ /**
258
+ * Delete Suggested People Event
259
+ */
260
+ deleteSuggestedPeopleEvent(websiteID: string, text: string) {
261
+ return this.crisp.delete(
262
+ this.crisp.prepareRestUrl([
263
+ "website", websiteID, "people", "suggest", "event"
264
+ ]),
265
+
266
+ null,
267
+
268
+ {
269
+ text: text
270
+ }
271
+ );
272
+ };
273
+
274
+ /**
275
+ * List People Profiles
276
+ */
277
+ listPeopleProfiles(
278
+ websiteID: string, pageNumber: number = 1, searchField?: string, searchOrder?: string, searchOperator?: string,
279
+ searchFilter?: string, searchText?: string
280
+ ) : Promise<PeopleProfile[]> {
281
+ // Generate query
282
+ let query = {};
283
+
284
+ if (searchField) {
285
+ // @ts-ignore
286
+ query.sort_field = searchField;
287
+ }
288
+
289
+ if (searchOrder) {
290
+ // @ts-ignore
291
+ query.sort_order = searchOrder;
292
+ }
293
+
294
+ if (searchOperator) {
295
+ // @ts-ignore
296
+ query.search_operator = searchOperator;
297
+ }
298
+
299
+ if (searchFilter) {
300
+ // @ts-ignore
301
+ query.search_filter = searchFilter;
302
+ }
303
+
304
+ if (searchText) {
305
+ // @ts-ignore
306
+ query.search_text = searchText;
307
+ }
308
+
309
+ return this.crisp.get(
310
+ this.crisp.prepareRestUrl([
311
+ "website", websiteID, "people", "profiles", String(pageNumber)
312
+ ]),
313
+
314
+ query
315
+ );
316
+ };
317
+
318
+ /**
319
+ * Add New People Profile
320
+ */
321
+ addNewPeopleProfile(websiteID: string, profile: PeopleProfileUpdateCard) {
322
+ return this.crisp.post(
323
+ this.crisp.prepareRestUrl(["website", websiteID, "people", "profile"]),
324
+
325
+ null, profile
326
+ );
327
+ };
328
+
329
+ /**
330
+ * Check If People Profile Exists
331
+ */
332
+ checkPeopleProfileExists(websiteID: string, peopleID: string) {
333
+ return this.crisp.head(
334
+ this.crisp.prepareRestUrl([
335
+ "website", websiteID, "people", "profile", peopleID
336
+ ])
337
+ );
338
+ };
339
+
340
+ /**
341
+ * Save People Profile
342
+ */
343
+ getPeopleProfile(websiteID: string, peopleID: string) {
344
+ return this.crisp.get(
345
+ this.crisp.prepareRestUrl([
346
+ "website", websiteID, "people", "profile", peopleID
347
+ ])
348
+ );
349
+ };
350
+
351
+ /**
352
+ * Get People Profile
353
+ */
354
+ savePeopleProfile(websiteID: string, peopleID: string, profile: PeopleProfileUpdateCard) {
355
+ return this.crisp.put(
356
+ this.crisp.prepareRestUrl([
357
+ "website", websiteID, "people", "profile", peopleID
358
+ ]),
359
+
360
+ null, profile
361
+ );
362
+ };
363
+
364
+ /**
365
+ * Update People Profile
366
+ */
367
+ updatePeopleProfile(websiteID: string, peopleID: string, profile: PeopleProfileUpdateCard) {
368
+ return this.crisp.patch(
369
+ this.crisp.prepareRestUrl([
370
+ "website", websiteID, "people", "profile", peopleID
371
+ ]),
372
+
373
+ null, profile
374
+ );
375
+ };
376
+
377
+ /**
378
+ * Remove People Profile
379
+ */
380
+ removePeopleProfile(websiteID: string, peopleID: string) {
381
+ return this.crisp.delete(
382
+ this.crisp.prepareRestUrl([
383
+ "website", websiteID, "people", "profile", peopleID
384
+ ])
385
+ );
386
+ };
387
+
388
+ /**
389
+ * List People Conversations
390
+ */
391
+ listPeopleConversations(websiteID: string, peopleID: string, pageNumber: number = 1) : Promise<string[]> {
392
+ return this.crisp.get(
393
+ this.crisp.prepareRestUrl([
394
+ "website", websiteID, "people", "conversations", peopleID, "list",
395
+ String(pageNumber)
396
+ ])
397
+ );
398
+ };
399
+
400
+ /**
401
+ * List People Campaigns
402
+ */
403
+ listPeopleCampaigns(websiteID: string, peopleID: string, pageNumber: number = 1) : Promise<PeopleCampaign[]> {
404
+ return this.crisp.get(
405
+ this.crisp.prepareRestUrl([
406
+ "website", websiteID, "people", "campaigns", peopleID, "list",
407
+ String(pageNumber)
408
+ ])
409
+ );
410
+ };
411
+
412
+ /**
413
+ * Add A People Event
414
+ */
415
+ addPeopleEvent(websiteID: string, peopleID: string, peopleEvent: PeopleEvent) {
416
+ return this.crisp.post(
417
+ this.crisp.prepareRestUrl([
418
+ "website", websiteID, "people", "events", peopleID
419
+ ]),
420
+
421
+ null, peopleEvent
422
+ );
423
+ };
424
+
425
+ /**
426
+ * List People Events
427
+ */
428
+ listPeopleEvents(websiteID: string, peopleID: string, pageNumber: number = 1) : Promise<PeopleEvent[]> {
429
+ return this.crisp.get(
430
+ this.crisp.prepareRestUrl([
431
+ "website", websiteID, "people", "events", peopleID, "list",
432
+ String(pageNumber)
433
+ ])
434
+ );
435
+ };
436
+
437
+ /**
438
+ * Get People Data
439
+ */
440
+ getPeopleData(websiteID: string, peopleID: string) : Promise<PeopleData> {
441
+ return this.crisp.get(
442
+ this.crisp.prepareRestUrl([
443
+ "website", websiteID, "people", "data", peopleID
444
+ ])
445
+ );
446
+ };
447
+
448
+ /**
449
+ * Save People Data
450
+ */
451
+ savePeopleData(websiteID: string, peopleID: string, peopleData: Record<string, boolean|string|number>) {
452
+ return this.crisp.put(
453
+ this.crisp.prepareRestUrl([
454
+ "website", websiteID, "people", "data", peopleID
455
+ ]),
456
+
457
+ null, peopleData
458
+ );
459
+ };
460
+
461
+ /**
462
+ * Update People Data
463
+ */
464
+ updatePeopleData(websiteID: string, peopleID: string, peopleData: Record<string, boolean|string|number>) {
465
+ return this.crisp.patch(
466
+ this.crisp.prepareRestUrl([
467
+ "website", websiteID, "people", "data", peopleID
468
+ ]),
469
+
470
+ null, peopleData
471
+ );
472
+ };
473
+
474
+ /**
475
+ * Get People Subscription Status
476
+ */
477
+ getPeopleSubscriptionStatus(websiteID: string, peopleID: string) : Promise<PeopleSubscription> {
478
+ return this.crisp.get(
479
+ this.crisp.prepareRestUrl([
480
+ "website", websiteID, "people", "subscription", peopleID
481
+ ])
482
+ );
483
+ };
484
+
485
+ /**
486
+ * Update People Subscription Status
487
+ */
488
+ updatePeopleSubscriptionStatus(
489
+ websiteID: string, peopleID: string, peopleSubscription: PeopleSubscriptionUpdate
490
+ ) {
491
+ return this.crisp.patch(
492
+ this.crisp.prepareRestUrl([
493
+ "website", websiteID, "people", "subscription", peopleID
494
+ ]),
495
+
496
+ null, peopleSubscription
497
+ );
498
+ };
499
+
500
+ /**
501
+ * Export People Profiles
502
+ */
503
+ exportPeopleProfiles(websiteID: string) {
504
+ return this.crisp.post(
505
+ this.crisp.prepareRestUrl([
506
+ "website", websiteID, "people", "export", "profiles"
507
+ ]),
508
+
509
+ null, null
510
+ );
511
+ };
512
+
513
+ /**
514
+ * Import People Profiles
515
+ */
516
+ importPeopleProfiles(websiteID: string, importSetup: PeopleProfileImportSetup) {
517
+ return this.crisp.post(
518
+ this.crisp.prepareRestUrl([
519
+ "website", websiteID, "people", "import", "profiles"
520
+ ]),
521
+
522
+ null, importSetup
523
+ );
524
+ };
525
+ }
526
+
527
+ export default WebsitePeople;