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,99 @@
1
+ "use strict";
2
+ /*
3
+ * node-crisp-api
4
+ *
5
+ * Copyright 2022, Crisp IM SAS
6
+ * Author: Baptiste Jamin <baptiste@crisp.chat>
7
+ */
8
+ var __importDefault = (this && this.__importDefault) || function (mod) {
9
+ return (mod && mod.__esModule) ? mod : { "default": mod };
10
+ };
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ /**************************************************************************
13
+ * IMPORTS
14
+ ***************************************************************************/
15
+ // PROJECT: RESOURCES
16
+ const BaseResource_1 = __importDefault(require("./BaseResource"));
17
+ /**************************************************************************
18
+ * CLASSES
19
+ ***************************************************************************/
20
+ /**
21
+ * Crisp WebsiteOperator Resource
22
+ */
23
+ class WebsiteOperatorService extends BaseResource_1.default {
24
+ /**
25
+ * List Website Operators
26
+ */
27
+ listWebsiteOperators(websiteID) {
28
+ return this.crisp.get(this.crisp.prepareRestUrl([
29
+ "website", websiteID, "operators", "list"
30
+ ]));
31
+ }
32
+ ;
33
+ /**
34
+ * List Last Active Website Operators
35
+ */
36
+ listLastActiveWebsiteOperators(websiteID) {
37
+ return this.crisp.get(this.crisp.prepareRestUrl([
38
+ "website", websiteID, "operators", "active"
39
+ ]));
40
+ }
41
+ ;
42
+ /**
43
+ * Flush Last Active Website Operators
44
+ */
45
+ flushLastActiveWebsiteOperators(websiteID) {
46
+ return this.crisp.delete(this.crisp.prepareRestUrl([
47
+ "website", websiteID, "operators", "active"
48
+ ]));
49
+ }
50
+ ;
51
+ /**
52
+ * Send Email To Website Operators
53
+ */
54
+ sendEmailToWebsiteOperators(websiteID, emailData) {
55
+ return this.crisp.post(this.crisp.prepareRestUrl(["website", websiteID, "operators", "email"]), null, emailData);
56
+ }
57
+ ;
58
+ /**
59
+ * Get A Website Operator
60
+ */
61
+ getWebsiteOperator(websiteID, userID) {
62
+ return this.crisp.get(this.crisp.prepareRestUrl([
63
+ "website", websiteID, "operator", userID
64
+ ]));
65
+ }
66
+ ;
67
+ /**
68
+ * Invite A Website Operator
69
+ */
70
+ inviteWebsiteOperator(websiteID, email, role, verify) {
71
+ return this.crisp.post(this.crisp.prepareRestUrl(["website", websiteID, "operator"]), null, {
72
+ email: email,
73
+ role: role,
74
+ verify: verify
75
+ });
76
+ }
77
+ ;
78
+ /**
79
+ * Change Operator Membership
80
+ */
81
+ changeOperatorMembership(websiteID, userID, role, title) {
82
+ return this.crisp.patch(this.crisp.prepareRestUrl(["website", websiteID, "operator", userID]), null, {
83
+ role: role,
84
+ title: title
85
+ });
86
+ }
87
+ ;
88
+ /**
89
+ * Unlink Operator From Website
90
+ */
91
+ unlinkOperatorFromWebsite(websiteID, userID) {
92
+ return this.crisp.delete(this.crisp.prepareRestUrl(["website", websiteID, "operator", userID]));
93
+ }
94
+ ;
95
+ }
96
+ /**************************************************************************
97
+ * EXPORTS
98
+ ***************************************************************************/
99
+ exports.default = WebsiteOperatorService;
@@ -0,0 +1,257 @@
1
+ /**************************************************************************
2
+ * IMPORTS
3
+ ***************************************************************************/
4
+ import BaseResource from "./BaseResource";
5
+ /**************************************************************************
6
+ * INTERFACES
7
+ ***************************************************************************/
8
+ export interface PeopleStatistics {
9
+ total?: number;
10
+ }
11
+ export interface PeopleSuggestedSegment {
12
+ segment?: string;
13
+ count?: number;
14
+ }
15
+ export interface PeopleSuggestedDataKey {
16
+ key?: string;
17
+ count?: number;
18
+ }
19
+ export interface PeopleSuggestedEvent {
20
+ text?: string;
21
+ count?: number;
22
+ }
23
+ export interface PeopleProfile extends PeopleProfileCard {
24
+ people_id?: string;
25
+ }
26
+ export interface PeopleProfileNew {
27
+ people_id?: string;
28
+ }
29
+ export interface PeopleProfileCard {
30
+ email?: string;
31
+ person?: PeopleProfileCardPerson;
32
+ company?: PeopleProfileCardCompany;
33
+ segments?: string[];
34
+ notepad?: string;
35
+ active?: PeopleProfileCardActive;
36
+ score?: number;
37
+ created_at?: number;
38
+ updated_at?: number;
39
+ }
40
+ export interface PeopleProfileUpdateCard {
41
+ email?: string;
42
+ person?: PeopleProfileCardPerson;
43
+ company?: PeopleProfileCardCompany;
44
+ segments?: string[];
45
+ notepad?: string;
46
+ active?: number;
47
+ }
48
+ export interface PeopleProfileCardPerson {
49
+ nickname?: string;
50
+ avatar?: string;
51
+ gender?: string;
52
+ phone?: string;
53
+ address?: string;
54
+ description?: string;
55
+ website?: string;
56
+ timezone?: number;
57
+ profiles?: PeopleProfileCardPersonProfile[];
58
+ employment?: PeopleProfileCardPersonEmployment;
59
+ geolocation?: PeopleProfileCardGeolocation;
60
+ locales?: string[];
61
+ }
62
+ export interface PeopleProfileCardPersonProfile {
63
+ type?: string;
64
+ handle?: string;
65
+ }
66
+ export interface PeopleProfileCardPersonEmployment {
67
+ name?: string;
68
+ domain?: string;
69
+ title?: string;
70
+ role?: string;
71
+ seniority?: string;
72
+ }
73
+ export interface PeopleProfileCardCompany {
74
+ name?: string;
75
+ legal_name?: string;
76
+ domain?: string;
77
+ url?: string;
78
+ description?: string;
79
+ timezone?: number;
80
+ phones?: string[];
81
+ emails?: string[];
82
+ geolocation?: PeopleProfileCardGeolocation;
83
+ metrics?: PeopleProfileCardCompanyMetrics;
84
+ tags?: string[];
85
+ }
86
+ export interface PeopleProfileCardCompanyMetrics {
87
+ employees?: number;
88
+ market_cap?: number;
89
+ raised?: number;
90
+ arr?: number;
91
+ }
92
+ export interface PeopleProfileCardGeolocation {
93
+ country?: string;
94
+ region?: string;
95
+ city?: string;
96
+ coordinates?: PeopleProfileCardGeolocationCoordinates;
97
+ }
98
+ export interface PeopleProfileCardGeolocationCoordinates {
99
+ latitude?: number;
100
+ longitude?: number;
101
+ }
102
+ export interface PeopleProfileCardActive {
103
+ now?: boolean;
104
+ last?: number;
105
+ }
106
+ export interface PeopleCampaign {
107
+ campaign_id?: string;
108
+ type?: string;
109
+ name?: string;
110
+ created_at?: number;
111
+ updated_at?: number;
112
+ dispatched_at?: number;
113
+ occurred_at?: number;
114
+ statistics?: string[];
115
+ }
116
+ export interface PeopleEvent {
117
+ text?: string;
118
+ data?: object;
119
+ color?: string;
120
+ timestamp?: number;
121
+ }
122
+ export interface PeopleData {
123
+ data?: Record<string, boolean | string | number>;
124
+ }
125
+ export interface PeopleSubscription {
126
+ email?: boolean;
127
+ }
128
+ export interface PeopleSubscriptionUpdate {
129
+ email?: boolean;
130
+ }
131
+ export interface PeopleProfileImportSetup {
132
+ url?: string;
133
+ mapping?: PeopleProfileImportSetupMapping[];
134
+ options?: PeopleProfileImportSetupOptions;
135
+ }
136
+ export interface PeopleProfileImportSetupMapping {
137
+ column?: number;
138
+ field?: string;
139
+ }
140
+ export interface PeopleProfileImportSetupOptions {
141
+ column_separator?: string;
142
+ skip_header?: boolean;
143
+ }
144
+ /**************************************************************************
145
+ * CLASSES
146
+ ***************************************************************************/
147
+ /**
148
+ * Crisp WebsitePeople Resource
149
+ * @class
150
+ * @classdesc This is the Crisp Website People Resource
151
+ */
152
+ declare class WebsitePeople extends BaseResource {
153
+ /**
154
+ * Get People Statistics
155
+ */
156
+ getPeopleStatistics(websiteID: string): Promise<PeopleStatistics>;
157
+ /**
158
+ * List Suggested People Segments
159
+ */
160
+ listSuggestedPeopleSegments(websiteID: string, pageNumber?: number): Promise<PeopleSuggestedSegment[]>;
161
+ /**
162
+ * Delete Suggested People Segment
163
+ */
164
+ deleteSuggestedPeopleSegment(websiteID: string, segment: string): Promise<any>;
165
+ /**
166
+ * List Suggested People Data Keys
167
+ */
168
+ listSuggestedPeopleDataKeys(websiteID: string, pageNumber?: number): Promise<PeopleSuggestedDataKey[]>;
169
+ /**
170
+ * Delete Suggested People Data Key
171
+ */
172
+ deleteSuggestedPeopleDataKey(websiteID: string, key: string): Promise<any>;
173
+ /**
174
+ * List Suggested People Events
175
+ */
176
+ listSuggestedPeopleEvents(websiteID: string, pageNumber?: number): Promise<PeopleSuggestedEvent[]>;
177
+ /**
178
+ * Delete Suggested People Event
179
+ */
180
+ deleteSuggestedPeopleEvent(websiteID: string, text: string): Promise<any>;
181
+ /**
182
+ * List People Profiles
183
+ */
184
+ listPeopleProfiles(websiteID: string, pageNumber?: number, searchField?: string, searchOrder?: string, searchOperator?: string, searchFilter?: string, searchText?: string): Promise<PeopleProfile[]>;
185
+ /**
186
+ * Add New People Profile
187
+ */
188
+ addNewPeopleProfile(websiteID: string, profile: PeopleProfileUpdateCard): Promise<any>;
189
+ /**
190
+ * Check If People Profile Exists
191
+ */
192
+ checkPeopleProfileExists(websiteID: string, peopleID: string): Promise<any>;
193
+ /**
194
+ * Save People Profile
195
+ */
196
+ getPeopleProfile(websiteID: string, peopleID: string): Promise<any>;
197
+ /**
198
+ * Get People Profile
199
+ */
200
+ savePeopleProfile(websiteID: string, peopleID: string, profile: PeopleProfileUpdateCard): Promise<any>;
201
+ /**
202
+ * Update People Profile
203
+ */
204
+ updatePeopleProfile(websiteID: string, peopleID: string, profile: PeopleProfileUpdateCard): Promise<any>;
205
+ /**
206
+ * Remove People Profile
207
+ */
208
+ removePeopleProfile(websiteID: string, peopleID: string): Promise<any>;
209
+ /**
210
+ * List People Conversations
211
+ */
212
+ listPeopleConversations(websiteID: string, peopleID: string, pageNumber?: number): Promise<string[]>;
213
+ /**
214
+ * List People Campaigns
215
+ */
216
+ listPeopleCampaigns(websiteID: string, peopleID: string, pageNumber?: number): Promise<PeopleCampaign[]>;
217
+ /**
218
+ * Add A People Event
219
+ */
220
+ addPeopleEvent(websiteID: string, peopleID: string, peopleEvent: PeopleEvent): Promise<any>;
221
+ /**
222
+ * List People Events
223
+ */
224
+ listPeopleEvents(websiteID: string, peopleID: string, pageNumber?: number): Promise<PeopleEvent[]>;
225
+ /**
226
+ * Get People Data
227
+ */
228
+ getPeopleData(websiteID: string, peopleID: string): Promise<PeopleData>;
229
+ /**
230
+ * Save People Data
231
+ */
232
+ savePeopleData(websiteID: string, peopleID: string, peopleData: Record<string, boolean | string | number>): Promise<any>;
233
+ /**
234
+ * Update People Data
235
+ */
236
+ updatePeopleData(websiteID: string, peopleID: string, peopleData: Record<string, boolean | string | number>): Promise<any>;
237
+ /**
238
+ * Get People Subscription Status
239
+ */
240
+ getPeopleSubscriptionStatus(websiteID: string, peopleID: string): Promise<PeopleSubscription>;
241
+ /**
242
+ * Update People Subscription Status
243
+ */
244
+ updatePeopleSubscriptionStatus(websiteID: string, peopleID: string, peopleSubscription: PeopleSubscriptionUpdate): Promise<any>;
245
+ /**
246
+ * Export People Profiles
247
+ */
248
+ exportPeopleProfiles(websiteID: string): Promise<any>;
249
+ /**
250
+ * Import People Profiles
251
+ */
252
+ importPeopleProfiles(websiteID: string, importSetup: PeopleProfileImportSetup): Promise<any>;
253
+ }
254
+ /**************************************************************************
255
+ * EXPORTS
256
+ ***************************************************************************/
257
+ export default WebsitePeople;
@@ -0,0 +1,282 @@
1
+ "use strict";
2
+ /*
3
+ * node-crisp-api
4
+ *
5
+ * Copyright 2022, Crisp IM SAS
6
+ * Author: Baptiste Jamin <baptiste@crisp.chat>
7
+ */
8
+ var __importDefault = (this && this.__importDefault) || function (mod) {
9
+ return (mod && mod.__esModule) ? mod : { "default": mod };
10
+ };
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ /**************************************************************************
13
+ * IMPORTS
14
+ ***************************************************************************/
15
+ // PROJECT: RESOURCES
16
+ const BaseResource_1 = __importDefault(require("./BaseResource"));
17
+ /**************************************************************************
18
+ * CLASSES
19
+ ***************************************************************************/
20
+ /**
21
+ * Crisp WebsitePeople Resource
22
+ * @class
23
+ * @classdesc This is the Crisp Website People Resource
24
+ */
25
+ class WebsitePeople extends BaseResource_1.default {
26
+ /**
27
+ * Get People Statistics
28
+ */
29
+ getPeopleStatistics(websiteID) {
30
+ return this.crisp.get(this.crisp.prepareRestUrl(["website", websiteID, "people", "stats"]));
31
+ }
32
+ ;
33
+ /**
34
+ * List Suggested People Segments
35
+ */
36
+ listSuggestedPeopleSegments(websiteID, pageNumber = 1) {
37
+ return this.crisp.get(this.crisp.prepareRestUrl([
38
+ "website", websiteID, "people", "suggest", "segments", String(pageNumber)
39
+ ]));
40
+ }
41
+ ;
42
+ /**
43
+ * Delete Suggested People Segment
44
+ */
45
+ deleteSuggestedPeopleSegment(websiteID, segment) {
46
+ return this.crisp.delete(this.crisp.prepareRestUrl([
47
+ "website", websiteID, "people", "suggest", "segment"
48
+ ]), null, {
49
+ segment: segment
50
+ });
51
+ }
52
+ ;
53
+ /**
54
+ * List Suggested People Data Keys
55
+ */
56
+ listSuggestedPeopleDataKeys(websiteID, pageNumber = 1) {
57
+ return this.crisp.get(this.crisp.prepareRestUrl([
58
+ "website", websiteID, "people", "suggest", "data", String(pageNumber)
59
+ ]));
60
+ }
61
+ ;
62
+ /**
63
+ * Delete Suggested People Data Key
64
+ */
65
+ deleteSuggestedPeopleDataKey(websiteID, key) {
66
+ return this.crisp.delete(this.crisp.prepareRestUrl([
67
+ "website", websiteID, "people", "suggest", "data"
68
+ ]), null, {
69
+ key: key
70
+ });
71
+ }
72
+ ;
73
+ /**
74
+ * List Suggested People Events
75
+ */
76
+ listSuggestedPeopleEvents(websiteID, pageNumber = 1) {
77
+ return this.crisp.get(this.crisp.prepareRestUrl([
78
+ "website", websiteID, "people", "suggest", "events", String(pageNumber)
79
+ ]));
80
+ }
81
+ ;
82
+ /**
83
+ * Delete Suggested People Event
84
+ */
85
+ deleteSuggestedPeopleEvent(websiteID, text) {
86
+ return this.crisp.delete(this.crisp.prepareRestUrl([
87
+ "website", websiteID, "people", "suggest", "event"
88
+ ]), null, {
89
+ text: text
90
+ });
91
+ }
92
+ ;
93
+ /**
94
+ * List People Profiles
95
+ */
96
+ listPeopleProfiles(websiteID, pageNumber = 1, searchField, searchOrder, searchOperator, searchFilter, searchText) {
97
+ // Generate query
98
+ let query = {};
99
+ if (searchField) {
100
+ // @ts-ignore
101
+ query.sort_field = searchField;
102
+ }
103
+ if (searchOrder) {
104
+ // @ts-ignore
105
+ query.sort_order = searchOrder;
106
+ }
107
+ if (searchOperator) {
108
+ // @ts-ignore
109
+ query.search_operator = searchOperator;
110
+ }
111
+ if (searchFilter) {
112
+ // @ts-ignore
113
+ query.search_filter = searchFilter;
114
+ }
115
+ if (searchText) {
116
+ // @ts-ignore
117
+ query.search_text = searchText;
118
+ }
119
+ return this.crisp.get(this.crisp.prepareRestUrl([
120
+ "website", websiteID, "people", "profiles", String(pageNumber)
121
+ ]), query);
122
+ }
123
+ ;
124
+ /**
125
+ * Add New People Profile
126
+ */
127
+ addNewPeopleProfile(websiteID, profile) {
128
+ return this.crisp.post(this.crisp.prepareRestUrl(["website", websiteID, "people", "profile"]), null, profile);
129
+ }
130
+ ;
131
+ /**
132
+ * Check If People Profile Exists
133
+ */
134
+ checkPeopleProfileExists(websiteID, peopleID) {
135
+ return this.crisp.head(this.crisp.prepareRestUrl([
136
+ "website", websiteID, "people", "profile", peopleID
137
+ ]));
138
+ }
139
+ ;
140
+ /**
141
+ * Save People Profile
142
+ */
143
+ getPeopleProfile(websiteID, peopleID) {
144
+ return this.crisp.get(this.crisp.prepareRestUrl([
145
+ "website", websiteID, "people", "profile", peopleID
146
+ ]));
147
+ }
148
+ ;
149
+ /**
150
+ * Get People Profile
151
+ */
152
+ savePeopleProfile(websiteID, peopleID, profile) {
153
+ return this.crisp.put(this.crisp.prepareRestUrl([
154
+ "website", websiteID, "people", "profile", peopleID
155
+ ]), null, profile);
156
+ }
157
+ ;
158
+ /**
159
+ * Update People Profile
160
+ */
161
+ updatePeopleProfile(websiteID, peopleID, profile) {
162
+ return this.crisp.patch(this.crisp.prepareRestUrl([
163
+ "website", websiteID, "people", "profile", peopleID
164
+ ]), null, profile);
165
+ }
166
+ ;
167
+ /**
168
+ * Remove People Profile
169
+ */
170
+ removePeopleProfile(websiteID, peopleID) {
171
+ return this.crisp.delete(this.crisp.prepareRestUrl([
172
+ "website", websiteID, "people", "profile", peopleID
173
+ ]));
174
+ }
175
+ ;
176
+ /**
177
+ * List People Conversations
178
+ */
179
+ listPeopleConversations(websiteID, peopleID, pageNumber = 1) {
180
+ return this.crisp.get(this.crisp.prepareRestUrl([
181
+ "website", websiteID, "people", "conversations", peopleID, "list",
182
+ String(pageNumber)
183
+ ]));
184
+ }
185
+ ;
186
+ /**
187
+ * List People Campaigns
188
+ */
189
+ listPeopleCampaigns(websiteID, peopleID, pageNumber = 1) {
190
+ return this.crisp.get(this.crisp.prepareRestUrl([
191
+ "website", websiteID, "people", "campaigns", peopleID, "list",
192
+ String(pageNumber)
193
+ ]));
194
+ }
195
+ ;
196
+ /**
197
+ * Add A People Event
198
+ */
199
+ addPeopleEvent(websiteID, peopleID, peopleEvent) {
200
+ return this.crisp.post(this.crisp.prepareRestUrl([
201
+ "website", websiteID, "people", "events", peopleID
202
+ ]), null, peopleEvent);
203
+ }
204
+ ;
205
+ /**
206
+ * List People Events
207
+ */
208
+ listPeopleEvents(websiteID, peopleID, pageNumber = 1) {
209
+ return this.crisp.get(this.crisp.prepareRestUrl([
210
+ "website", websiteID, "people", "events", peopleID, "list",
211
+ String(pageNumber)
212
+ ]));
213
+ }
214
+ ;
215
+ /**
216
+ * Get People Data
217
+ */
218
+ getPeopleData(websiteID, peopleID) {
219
+ return this.crisp.get(this.crisp.prepareRestUrl([
220
+ "website", websiteID, "people", "data", peopleID
221
+ ]));
222
+ }
223
+ ;
224
+ /**
225
+ * Save People Data
226
+ */
227
+ savePeopleData(websiteID, peopleID, peopleData) {
228
+ return this.crisp.put(this.crisp.prepareRestUrl([
229
+ "website", websiteID, "people", "data", peopleID
230
+ ]), null, peopleData);
231
+ }
232
+ ;
233
+ /**
234
+ * Update People Data
235
+ */
236
+ updatePeopleData(websiteID, peopleID, peopleData) {
237
+ return this.crisp.patch(this.crisp.prepareRestUrl([
238
+ "website", websiteID, "people", "data", peopleID
239
+ ]), null, peopleData);
240
+ }
241
+ ;
242
+ /**
243
+ * Get People Subscription Status
244
+ */
245
+ getPeopleSubscriptionStatus(websiteID, peopleID) {
246
+ return this.crisp.get(this.crisp.prepareRestUrl([
247
+ "website", websiteID, "people", "subscription", peopleID
248
+ ]));
249
+ }
250
+ ;
251
+ /**
252
+ * Update People Subscription Status
253
+ */
254
+ updatePeopleSubscriptionStatus(websiteID, peopleID, peopleSubscription) {
255
+ return this.crisp.patch(this.crisp.prepareRestUrl([
256
+ "website", websiteID, "people", "subscription", peopleID
257
+ ]), null, peopleSubscription);
258
+ }
259
+ ;
260
+ /**
261
+ * Export People Profiles
262
+ */
263
+ exportPeopleProfiles(websiteID) {
264
+ return this.crisp.post(this.crisp.prepareRestUrl([
265
+ "website", websiteID, "people", "export", "profiles"
266
+ ]), null, null);
267
+ }
268
+ ;
269
+ /**
270
+ * Import People Profiles
271
+ */
272
+ importPeopleProfiles(websiteID, importSetup) {
273
+ return this.crisp.post(this.crisp.prepareRestUrl([
274
+ "website", websiteID, "people", "import", "profiles"
275
+ ]), null, importSetup);
276
+ }
277
+ ;
278
+ }
279
+ /**************************************************************************
280
+ * EXPORTS
281
+ ***************************************************************************/
282
+ exports.default = WebsitePeople;