crisp-api 9.12.1 → 10.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (116) hide show
  1. package/CHANGELOG.md +14 -0
  2. package/README.md +6 -2
  3. package/dist/crisp.d.ts +167 -0
  4. package/dist/crisp.js +764 -0
  5. package/dist/resources/BaseResource.d.ts +15 -0
  6. package/dist/resources/BaseResource.js +20 -0
  7. package/dist/resources/BucketURL.d.ts +28 -0
  8. package/dist/resources/BucketURL.js +29 -0
  9. package/dist/resources/MediaAnimation.d.ts +14 -0
  10. package/dist/resources/MediaAnimation.js +32 -0
  11. package/dist/resources/PluginConnect.d.ts +50 -0
  12. package/dist/resources/PluginConnect.js +73 -0
  13. package/dist/resources/PluginSubscription.d.ts +103 -0
  14. package/dist/resources/PluginSubscription.js +122 -0
  15. package/dist/resources/WebsiteAnalytics.d.ts +14 -0
  16. package/dist/resources/WebsiteAnalytics.js +29 -0
  17. package/dist/resources/WebsiteAvailability.d.ts +31 -0
  18. package/dist/resources/WebsiteAvailability.js +36 -0
  19. package/dist/resources/WebsiteBase.d.ts +60 -0
  20. package/dist/resources/WebsiteBase.js +71 -0
  21. package/dist/resources/WebsiteBatch.d.ts +52 -0
  22. package/dist/resources/WebsiteBatch.js +70 -0
  23. package/dist/resources/WebsiteCampaign.d.ts +199 -0
  24. package/dist/resources/WebsiteCampaign.js +194 -0
  25. package/dist/resources/WebsiteConversation.d.ts +701 -0
  26. package/dist/resources/WebsiteConversation.js +595 -0
  27. package/dist/resources/WebsiteHelpdesk.d.ts +347 -0
  28. package/dist/resources/WebsiteHelpdesk.js +587 -0
  29. package/dist/resources/WebsiteOperator.d.ts +79 -0
  30. package/dist/resources/WebsiteOperator.js +93 -0
  31. package/dist/resources/WebsitePeople.d.ts +248 -0
  32. package/dist/resources/WebsitePeople.js +276 -0
  33. package/dist/resources/WebsiteSettings.d.ts +159 -0
  34. package/dist/resources/WebsiteSettings.js +36 -0
  35. package/dist/resources/WebsiteVerify.d.ts +38 -0
  36. package/dist/resources/WebsiteVerify.js +50 -0
  37. package/dist/resources/WebsiteVisitors.d.ts +113 -0
  38. package/dist/resources/WebsiteVisitors.js +88 -0
  39. package/dist/resources/index.d.ts +17 -0
  40. package/dist/resources/index.js +40 -0
  41. package/dist/services/bucket.d.ts +13 -0
  42. package/dist/services/bucket.js +28 -0
  43. package/dist/services/media.d.ts +13 -0
  44. package/dist/services/media.js +28 -0
  45. package/dist/services/plugin.d.ts +14 -0
  46. package/dist/services/plugin.js +30 -0
  47. package/dist/services/website.d.ts +24 -0
  48. package/dist/services/website.js +50 -0
  49. package/eslint.config.mjs +208 -0
  50. package/lib/crisp.ts +957 -0
  51. package/lib/resources/BaseResource.ts +29 -0
  52. package/lib/resources/BucketURL.ts +49 -0
  53. package/lib/resources/MediaAnimation.ts +34 -0
  54. package/lib/resources/PluginConnect.ts +128 -0
  55. package/lib/resources/PluginSubscription.ts +208 -0
  56. package/lib/resources/WebsiteAnalytics.ts +31 -0
  57. package/lib/resources/WebsiteAvailability.ts +54 -0
  58. package/lib/resources/WebsiteBase.ts +108 -0
  59. package/lib/resources/WebsiteBatch.ts +96 -0
  60. package/lib/resources/WebsiteCampaign.ts +399 -0
  61. package/lib/resources/WebsiteConversation.ts +1416 -0
  62. package/lib/resources/WebsiteHelpdesk.ts +982 -0
  63. package/lib/resources/WebsiteOperator.ts +161 -0
  64. package/lib/resources/WebsitePeople.ts +527 -0
  65. package/lib/resources/WebsiteSettings.ts +192 -0
  66. package/lib/resources/WebsiteVerify.ts +76 -0
  67. package/lib/resources/WebsiteVisitors.ts +196 -0
  68. package/lib/resources/index.ts +25 -0
  69. package/lib/services/bucket.ts +28 -0
  70. package/lib/services/media.ts +28 -0
  71. package/lib/services/plugin.ts +32 -0
  72. package/lib/services/website.ts +62 -0
  73. package/package.json +16 -11
  74. package/tsconfig.json +12 -5
  75. package/lib/crisp.js +0 -1168
  76. package/lib/resources/BucketURL.js +0 -34
  77. package/lib/resources/MediaAnimation.js +0 -41
  78. package/lib/resources/PluginConnect.js +0 -119
  79. package/lib/resources/PluginSubscription.js +0 -234
  80. package/lib/resources/WebsiteAnalytics.js +0 -37
  81. package/lib/resources/WebsiteAvailability.js +0 -48
  82. package/lib/resources/WebsiteBase.js +0 -100
  83. package/lib/resources/WebsiteBatch.js +0 -92
  84. package/lib/resources/WebsiteCampaign.js +0 -396
  85. package/lib/resources/WebsiteConversation.js +0 -1261
  86. package/lib/resources/WebsiteHelpdesk.js +0 -1198
  87. package/lib/resources/WebsiteOperator.js +0 -167
  88. package/lib/resources/WebsitePeople.js +0 -516
  89. package/lib/resources/WebsiteSettings.js +0 -50
  90. package/lib/resources/WebsiteVerify.js +0 -79
  91. package/lib/resources/WebsiteVisitors.js +0 -148
  92. package/lib/services/Bucket.js +0 -28
  93. package/lib/services/Media.js +0 -28
  94. package/lib/services/Plugin.js +0 -29
  95. package/lib/services/Website.js +0 -39
  96. package/types/crisp.d.ts +0 -151
  97. package/types/resources/BucketURL.d.ts +0 -15
  98. package/types/resources/MediaAnimation.d.ts +0 -15
  99. package/types/resources/PluginConnect.d.ts +0 -15
  100. package/types/resources/PluginSubscription.d.ts +0 -15
  101. package/types/resources/WebsiteAnalytics.d.ts +0 -15
  102. package/types/resources/WebsiteAvailability.d.ts +0 -15
  103. package/types/resources/WebsiteBase.d.ts +0 -15
  104. package/types/resources/WebsiteBatch.d.ts +0 -15
  105. package/types/resources/WebsiteCampaign.d.ts +0 -15
  106. package/types/resources/WebsiteConversation.d.ts +0 -15
  107. package/types/resources/WebsiteHelpdesk.d.ts +0 -15
  108. package/types/resources/WebsiteOperator.d.ts +0 -15
  109. package/types/resources/WebsitePeople.d.ts +0 -15
  110. package/types/resources/WebsiteSettings.d.ts +0 -15
  111. package/types/resources/WebsiteVerify.d.ts +0 -15
  112. package/types/resources/WebsiteVisitors.d.ts +0 -15
  113. package/types/services/Bucket.d.ts +0 -14
  114. package/types/services/Media.d.ts +0 -14
  115. package/types/services/Plugin.d.ts +0 -14
  116. package/types/services/Website.d.ts +0 -14
@@ -0,0 +1,71 @@
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
+ * Crisp WebsiteBase Resource
19
+ */
20
+ class WebsiteBase extends BaseResource_1.default {
21
+ /**
22
+ * Check If Website Exists
23
+ * @memberof WebsiteBase
24
+ * @public
25
+ * @method checkWebsiteExists
26
+ * @param {string} domain
27
+ * @return {Promise}
28
+ */
29
+ checkWebsiteExists(domain) {
30
+ return this.crisp.head(this.crisp.prepareRestUrl(["website"]), {
31
+ domain: domain
32
+ });
33
+ }
34
+ ;
35
+ /**
36
+ * Create Website
37
+ */
38
+ createWebsite(websiteData) {
39
+ return this.crisp.post(this.crisp.prepareRestUrl(["website"]), null, websiteData);
40
+ }
41
+ ;
42
+ /**
43
+ * Get A Website
44
+ * @memberof WebsiteBase
45
+ * @public
46
+ * @method getWebsite
47
+ * @param {string} websiteID
48
+ * @return {Promise}
49
+ */
50
+ getWebsite(websiteID) {
51
+ return this.crisp.get(this.crisp.prepareRestUrl(["website", websiteID]));
52
+ }
53
+ ;
54
+ /**
55
+ * Delete A Website
56
+ */
57
+ deleteWebsite(websiteID, verify) {
58
+ return this.crisp.delete(this.crisp.prepareRestUrl(["website", websiteID]), undefined, {
59
+ verify: verify
60
+ });
61
+ }
62
+ ;
63
+ /**
64
+ * Abort Website Deletion
65
+ */
66
+ abortWebsiteDeletion(websiteID) {
67
+ return this.crisp.delete(this.crisp.prepareRestUrl(["website", websiteID, "expunge"]));
68
+ }
69
+ ;
70
+ }
71
+ exports.default = WebsiteBase;
@@ -0,0 +1,52 @@
1
+ /**************************************************************************
2
+ * IMPORTS
3
+ ***************************************************************************/
4
+ import BaseResource from "./BaseResource";
5
+ type WebsiteBatchConversationsOperation = {
6
+ inbox_id?: string;
7
+ sessions?: string[];
8
+ };
9
+ type WebsiteBatchPeopleOperationInner = {
10
+ profiles?: string[];
11
+ search?: string;
12
+ };
13
+ /**
14
+ * Crisp WebsiteBatch Resource
15
+ */
16
+ declare class WebsiteBatch extends BaseResource {
17
+ /**
18
+ * Batch Resolve Conversations
19
+ */
20
+ batchResolveConversations(websiteID: string, operation: WebsiteBatchConversationsOperation): Promise<any>;
21
+ /**
22
+ * Batch Read Conversations
23
+ * @memberof WebsiteBatch
24
+ * @public
25
+ * @method batchReadConversations
26
+ * @param {string} websiteID
27
+ * @param {object} operation
28
+ * @return {Promise}
29
+ */
30
+ batchReadConversations(websiteID: string, operation: WebsiteBatchConversationsOperation): Promise<any>;
31
+ /**
32
+ * Batch Remove Conversations
33
+ * @memberof WebsiteBatch
34
+ * @public
35
+ * @method batchRemoveConversations
36
+ * @param {string} websiteID
37
+ * @param {object} operation
38
+ * @return {Promise}
39
+ */
40
+ batchRemoveConversations(websiteID: string, operation: WebsiteBatchConversationsOperation): Promise<any>;
41
+ /**
42
+ * Batch Remove People
43
+ * @memberof WebsiteBatch
44
+ * @public
45
+ * @method batchRemovePeople
46
+ * @param {string} websiteID
47
+ * @param {object} people
48
+ * @return {Promise}
49
+ */
50
+ batchRemovePeople(websiteID: string, people: WebsiteBatchPeopleOperationInner): Promise<any>;
51
+ }
52
+ export default WebsiteBatch;
@@ -0,0 +1,70 @@
1
+ "use strict";
2
+ /*
3
+ * node-crisp-api
4
+ *
5
+ * Copyright 2022, Crisp IM SAS
6
+ * Author: Valerian Saliou <valerian@valeriansaliou.name>
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
+ * Crisp WebsiteBatch Resource
19
+ */
20
+ class WebsiteBatch extends BaseResource_1.default {
21
+ /**
22
+ * Batch Resolve Conversations
23
+ */
24
+ batchResolveConversations(websiteID, operation) {
25
+ return this.crisp.patch(this.crisp.prepareRestUrl(["website", websiteID, "batch", "resolve"]), null, operation);
26
+ }
27
+ ;
28
+ /**
29
+ * Batch Read Conversations
30
+ * @memberof WebsiteBatch
31
+ * @public
32
+ * @method batchReadConversations
33
+ * @param {string} websiteID
34
+ * @param {object} operation
35
+ * @return {Promise}
36
+ */
37
+ batchReadConversations(websiteID, operation) {
38
+ return this.crisp.patch(this.crisp.prepareRestUrl(["website", websiteID, "batch", "read"]), null, operation);
39
+ }
40
+ ;
41
+ /**
42
+ * Batch Remove Conversations
43
+ * @memberof WebsiteBatch
44
+ * @public
45
+ * @method batchRemoveConversations
46
+ * @param {string} websiteID
47
+ * @param {object} operation
48
+ * @return {Promise}
49
+ */
50
+ batchRemoveConversations(websiteID, operation) {
51
+ return this.crisp.patch(this.crisp.prepareRestUrl(["website", websiteID, "batch", "remove"]), null, operation);
52
+ }
53
+ ;
54
+ /**
55
+ * Batch Remove People
56
+ * @memberof WebsiteBatch
57
+ * @public
58
+ * @method batchRemovePeople
59
+ * @param {string} websiteID
60
+ * @param {object} people
61
+ * @return {Promise}
62
+ */
63
+ batchRemovePeople(websiteID, people) {
64
+ return this.crisp.patch(this.crisp.prepareRestUrl(["website", websiteID, "batch", "remove"]), null, {
65
+ people: people
66
+ });
67
+ }
68
+ ;
69
+ }
70
+ exports.default = WebsiteBatch;
@@ -0,0 +1,199 @@
1
+ /**************************************************************************
2
+ * IMPORTS
3
+ ***************************************************************************/
4
+ import BaseResource from "./BaseResource";
5
+ import { WebsiteFilter } from "./WebsiteBase";
6
+ type WebsiteCampaignExcerpt = {
7
+ campaign_id?: string;
8
+ type?: string;
9
+ format?: string;
10
+ name?: string;
11
+ subject?: string;
12
+ tag?: string;
13
+ ready?: boolean;
14
+ dispatched?: boolean;
15
+ running?: boolean;
16
+ progress?: number;
17
+ targets?: number;
18
+ reached?: number;
19
+ created_at: number;
20
+ updated_at: number;
21
+ dispatched_at?: number;
22
+ };
23
+ type WebsiteCampaignTemplateExcerpt = {
24
+ template_id?: string;
25
+ type?: string;
26
+ name?: string;
27
+ format?: string;
28
+ created_at?: number;
29
+ updated_at?: number;
30
+ };
31
+ type WebsiteCampaignTemplateNew = {
32
+ template_id?: string;
33
+ };
34
+ interface WebsiteCampaignTemplateItem extends WebsiteCampaignTemplateExcerpt {
35
+ content?: string;
36
+ }
37
+ interface WebsiteCampaignItem extends WebsiteCampaignExcerpt {
38
+ sender?: WebsiteCampaignItemSender;
39
+ recipients?: WebsiteCampaignItemRecipients;
40
+ flow?: WebsiteCampaignItemFlow;
41
+ message?: string;
42
+ options?: WebsiteCampaignItemOptions;
43
+ statistics?: WebsiteCampaignItemStatistics;
44
+ }
45
+ type WebsiteCampaignItemSender = {
46
+ user_id?: string;
47
+ };
48
+ type WebsiteCampaignItemRecipients = {
49
+ type?: string;
50
+ segments?: string[];
51
+ people?: string[];
52
+ filter?: WebsiteFilter[];
53
+ };
54
+ type WebsiteCampaignItemFlow = {
55
+ launch_event?: string;
56
+ assert_filter?: WebsiteFilter[];
57
+ assert_delay?: number;
58
+ deliver_once?: boolean;
59
+ deliver_delay?: number;
60
+ };
61
+ type WebsiteCampaignItemOptions = {
62
+ deliver_to_chatbox?: boolean;
63
+ deliver_to_email?: boolean;
64
+ sender_name_website?: boolean;
65
+ sender_email_reply?: boolean;
66
+ tracking?: boolean;
67
+ };
68
+ type WebsiteCampaignItemStatistics = {
69
+ opened?: number;
70
+ clicked?: number;
71
+ unsubscribed?: number;
72
+ };
73
+ type WebsiteCampaignRecipient = {
74
+ people_id?: string;
75
+ email?: string;
76
+ person?: WebsiteCampaignRecipientPerson;
77
+ subscribed?: boolean;
78
+ };
79
+ type WebsiteCampaignRecipientPerson = {
80
+ nickname?: string;
81
+ avatar?: string;
82
+ };
83
+ type WebsiteCampaignStatistic = {
84
+ profile?: WebsiteCampaignStatisticProfile;
85
+ data?: Record<string, unknown>;
86
+ created_at?: number;
87
+ updated_at?: number;
88
+ };
89
+ type WebsiteCampaignStatisticProfile = {
90
+ people_id?: string;
91
+ email?: string;
92
+ person?: WebsiteCampaignStatisticProfilePerson;
93
+ };
94
+ type WebsiteCampaignStatisticProfilePerson = {
95
+ nickname?: string;
96
+ avatar?: string;
97
+ geolocation?: WebsiteCampaignStatisticProfilePersonGeolocation;
98
+ };
99
+ type WebsiteCampaignStatisticProfilePersonGeolocation = {
100
+ country?: string;
101
+ region?: string;
102
+ city?: string;
103
+ coordinates?: WebsiteCampaignStatisticProfilePersonGeolocationCoordinates;
104
+ };
105
+ type WebsiteCampaignStatisticProfilePersonGeolocationCoordinates = {
106
+ latitude?: number;
107
+ longitude?: number;
108
+ };
109
+ /**
110
+ * Crisp WebsiteCampaign Resource
111
+ */
112
+ declare class WebsiteCampaign extends BaseResource {
113
+ /**
114
+ * List Campaigns
115
+ */
116
+ listCampaigns(websiteID: string, pageNumber?: number): Promise<WebsiteCampaignExcerpt[]>;
117
+ /**
118
+ * List Campaign Tags
119
+ */
120
+ listCampaignTags(websiteID: string): Promise<string[]>;
121
+ /**
122
+ * List Campaign Templates
123
+ */
124
+ listCampaignTemplates(websiteID: string, pageNumber?: number): Promise<WebsiteCampaignTemplateExcerpt[]>;
125
+ /**
126
+ * Create A New Campaign Template
127
+ */
128
+ createNewCampaignTemplate(websiteID: string, templateFormat: string, templateName: string): Promise<WebsiteCampaignTemplateNew>;
129
+ /**
130
+ * Check If Campaign Template Exists
131
+ */
132
+ checkCampaignTemplateExists(websiteID: string, templateID: string): Promise<any>;
133
+ /**
134
+ * Get A Campaign Template
135
+ */
136
+ getCampaignTemplate(websiteID: string, templateID: string): Promise<WebsiteCampaignTemplateItem>;
137
+ /**
138
+ * Save A Campaign Template
139
+ */
140
+ saveCampaignTemplate(websiteID: string, templateID: string, template: WebsiteCampaignTemplateItem): Promise<any>;
141
+ /**
142
+ * Update A Campaign Template
143
+ */
144
+ updateCampaignTemplate(websiteID: string, templateID: string, template: WebsiteCampaignTemplateItem): Promise<any>;
145
+ /**
146
+ * Remove A Campaign Template
147
+ */
148
+ removeCampaignTemplate(websiteID: string, templateID: string): Promise<any>;
149
+ /**
150
+ * Create A New Campaign
151
+ */
152
+ createNewCampaign(websiteID: string, campaignType: string, campaignName: string): Promise<any>;
153
+ /**
154
+ * Check If Campaign Exists
155
+ */
156
+ checkCampaignExists(websiteID: string, campaignID: string): Promise<any>;
157
+ /**
158
+ * Get A Campaign
159
+ */
160
+ getCampaign(websiteID: string, campaignID: string): Promise<WebsiteCampaignItem>;
161
+ /**
162
+ * Save A Campaign
163
+ */
164
+ saveCampaign(websiteID: string, campaignID: string, campaign: WebsiteCampaignItem): Promise<any>;
165
+ /**
166
+ * Update A Campaign
167
+ */
168
+ updateCampaign(websiteID: string, campaignID: string, campaign: WebsiteCampaignItem): Promise<any>;
169
+ /**
170
+ * Remove A Campaign
171
+ */
172
+ removeCampaign(websiteID: string, campaignID: string): Promise<any>;
173
+ /**
174
+ * Dispatch A Campaign
175
+ * @return {Promise}
176
+ */
177
+ dispatchCampaign(websiteID: string, campaignID: string): Promise<any>;
178
+ /**
179
+ * Resume A Campaign
180
+ */
181
+ resumeCampaign(websiteID: string, campaignID: string): Promise<any>;
182
+ /**
183
+ * Pause A Campaign
184
+ */
185
+ pauseCampaign(websiteID: string, campaignID: string): Promise<any>;
186
+ /**
187
+ * Test A Campaign
188
+ */
189
+ testCampaign(websiteID: string, campaignID: string): Promise<any>;
190
+ /**
191
+ * List Campaign Recipients
192
+ */
193
+ listCampaignRecipients(websiteID: string, campaignID: string, pageNumber?: number): Promise<WebsiteCampaignRecipient[]>;
194
+ /**
195
+ * List Campaign Statistics
196
+ */
197
+ listCampaignStatistics(websiteID: string, campaignID: string, action: string, pageNumber?: number): Promise<WebsiteCampaignStatistic[]>;
198
+ }
199
+ export default WebsiteCampaign;
@@ -0,0 +1,194 @@
1
+ "use strict";
2
+ /*
3
+ * node-crisp-api
4
+ *
5
+ * Copyright 2022, Crisp IM SAS
6
+ * Author: Valerian Saliou <valerian@valeriansaliou.name>
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
+ * Crisp WebsiteCampaign Resource
19
+ */
20
+ class WebsiteCampaign extends BaseResource_1.default {
21
+ /**
22
+ * List Campaigns
23
+ */
24
+ listCampaigns(websiteID, pageNumber = 1) {
25
+ return this.crisp.get(this.crisp.prepareRestUrl([
26
+ "website", websiteID, "campaigns", "list", String(pageNumber)
27
+ ]));
28
+ }
29
+ /**
30
+ * List Campaign Tags
31
+ */
32
+ listCampaignTags(websiteID) {
33
+ return this.crisp.get(this.crisp.prepareRestUrl(["website", websiteID, "campaigns", "tags"]));
34
+ }
35
+ /**
36
+ * List Campaign Templates
37
+ */
38
+ listCampaignTemplates(websiteID, pageNumber = 1) {
39
+ return this.crisp.get(this.crisp.prepareRestUrl([
40
+ "website", websiteID, "campaigns", "templates", String(pageNumber)
41
+ ]));
42
+ }
43
+ /**
44
+ * Create A New Campaign Template
45
+ */
46
+ createNewCampaignTemplate(websiteID, templateFormat, templateName) {
47
+ return this.crisp.post(this.crisp.prepareRestUrl(["website", websiteID, "campaigns", "template"]), null, {
48
+ format: templateFormat,
49
+ name: templateName
50
+ });
51
+ }
52
+ /**
53
+ * Check If Campaign Template Exists
54
+ */
55
+ checkCampaignTemplateExists(websiteID, templateID) {
56
+ return this.crisp.head(this.crisp.prepareRestUrl([
57
+ "website", websiteID, "campaigns", "template", templateID
58
+ ]));
59
+ }
60
+ /**
61
+ * Get A Campaign Template
62
+ */
63
+ getCampaignTemplate(websiteID, templateID) {
64
+ return this.crisp.get(this.crisp.prepareRestUrl([
65
+ "website", websiteID, "campaigns", "template", templateID
66
+ ]));
67
+ }
68
+ /**
69
+ * Save A Campaign Template
70
+ */
71
+ saveCampaignTemplate(websiteID, templateID, template) {
72
+ return this.crisp.put(this.crisp.prepareRestUrl([
73
+ "website", websiteID, "campaigns", "template", templateID
74
+ ]), null, template);
75
+ }
76
+ /**
77
+ * Update A Campaign Template
78
+ */
79
+ updateCampaignTemplate(websiteID, templateID, template) {
80
+ return this.crisp.patch(this.crisp.prepareRestUrl([
81
+ "website", websiteID, "campaigns", "template", templateID
82
+ ]), null, template);
83
+ }
84
+ /**
85
+ * Remove A Campaign Template
86
+ */
87
+ removeCampaignTemplate(websiteID, templateID) {
88
+ return this.crisp.delete(this.crisp.prepareRestUrl([
89
+ "website", websiteID, "campaigns", "template", templateID
90
+ ]));
91
+ }
92
+ /**
93
+ * Create A New Campaign
94
+ */
95
+ createNewCampaign(websiteID, campaignType, campaignName) {
96
+ return this.crisp.post(this.crisp.prepareRestUrl(["website", websiteID, "campaign"]), null, {
97
+ type: campaignType,
98
+ name: campaignName
99
+ });
100
+ }
101
+ ;
102
+ /**
103
+ * Check If Campaign Exists
104
+ */
105
+ checkCampaignExists(websiteID, campaignID) {
106
+ return this.crisp.head(this.crisp.prepareRestUrl(["website", websiteID, "campaign", campaignID]));
107
+ }
108
+ ;
109
+ /**
110
+ * Get A Campaign
111
+ */
112
+ getCampaign(websiteID, campaignID) {
113
+ return this.crisp.get(this.crisp.prepareRestUrl(["website", websiteID, "campaign", campaignID]));
114
+ }
115
+ ;
116
+ /**
117
+ * Save A Campaign
118
+ */
119
+ saveCampaign(websiteID, campaignID, campaign) {
120
+ return this.crisp.put(this.crisp.prepareRestUrl(["website", websiteID, "campaign", campaignID]), null, campaign);
121
+ }
122
+ ;
123
+ /**
124
+ * Update A Campaign
125
+ */
126
+ updateCampaign(websiteID, campaignID, campaign) {
127
+ return this.crisp.patch(this.crisp.prepareRestUrl(["website", websiteID, "campaign", campaignID]), null, campaign);
128
+ }
129
+ ;
130
+ /**
131
+ * Remove A Campaign
132
+ */
133
+ removeCampaign(websiteID, campaignID) {
134
+ return this.crisp.delete(this.crisp.prepareRestUrl(["website", websiteID, "campaign", campaignID]));
135
+ }
136
+ ;
137
+ /**
138
+ * Dispatch A Campaign
139
+ * @return {Promise}
140
+ */
141
+ dispatchCampaign(websiteID, campaignID) {
142
+ return this.crisp.post(this.crisp.prepareRestUrl([
143
+ "website", websiteID, "campaign", campaignID, "dispatch"
144
+ ]), null, null);
145
+ }
146
+ ;
147
+ /**
148
+ * Resume A Campaign
149
+ */
150
+ resumeCampaign(websiteID, campaignID) {
151
+ return this.crisp.post(this.crisp.prepareRestUrl([
152
+ "website", websiteID, "campaign", campaignID, "resume"
153
+ ]), null, null);
154
+ }
155
+ ;
156
+ /**
157
+ * Pause A Campaign
158
+ */
159
+ pauseCampaign(websiteID, campaignID) {
160
+ return this.crisp.post(this.crisp.prepareRestUrl([
161
+ "website", websiteID, "campaign", campaignID, "pause"
162
+ ]), null, null);
163
+ }
164
+ ;
165
+ /**
166
+ * Test A Campaign
167
+ */
168
+ testCampaign(websiteID, campaignID) {
169
+ return this.crisp.post(this.crisp.prepareRestUrl([
170
+ "website", websiteID, "campaign", campaignID, "test"
171
+ ]), null, null);
172
+ }
173
+ ;
174
+ /**
175
+ * List Campaign Recipients
176
+ */
177
+ listCampaignRecipients(websiteID, campaignID, pageNumber = 1) {
178
+ return this.crisp.get(this.crisp.prepareRestUrl([
179
+ "website", websiteID, "campaign", campaignID, "recipients", String(pageNumber)
180
+ ]));
181
+ }
182
+ ;
183
+ /**
184
+ * List Campaign Statistics
185
+ */
186
+ listCampaignStatistics(websiteID, campaignID, action, pageNumber = 1) {
187
+ return this.crisp.get(this.crisp.prepareRestUrl([
188
+ "website", websiteID, "campaign", campaignID, "statistics", action,
189
+ String(pageNumber)
190
+ ]));
191
+ }
192
+ ;
193
+ }
194
+ exports.default = WebsiteCampaign;