@suprsend/node-sdk 1.8.1 → 1.9.0

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.
@@ -16,6 +16,7 @@ const IDENT_KEY_IOSPUSH = "$iospush";
16
16
  const IDENT_KEY_WHATSAPP = "$whatsapp";
17
17
  const IDENT_KEY_WEBPUSH = "$webpush";
18
18
  const IDENT_KEY_SLACK = "$slack";
19
+ const IDENT_KEY_MS_TEAMS = "$ms_teams";
19
20
 
20
21
  const IDENT_KEYS_ALL = [
21
22
  IDENT_KEY_EMAIL,
@@ -25,6 +26,7 @@ const IDENT_KEYS_ALL = [
25
26
  IDENT_KEY_WHATSAPP,
26
27
  IDENT_KEY_WEBPUSH,
27
28
  IDENT_KEY_SLACK,
29
+ IDENT_KEY_MS_TEAMS,
28
30
  ];
29
31
 
30
32
  const KEY_PUSHVENDOR = "$pushvendor";
@@ -81,6 +83,10 @@ export default class _SubscriberInternalHelper {
81
83
 
82
84
  this.__dict_set = {};
83
85
 
86
+ this.__dict_set_once = {};
87
+
88
+ this.__dict_increment = {};
89
+
84
90
  this.__dict_append = {};
85
91
 
86
92
  this.__dict_remove = {};
@@ -93,6 +99,8 @@ export default class _SubscriberInternalHelper {
93
99
 
94
100
  reset() {
95
101
  this.__dict_set = {};
102
+ this.__dict_set_once = {};
103
+ this.__dict_increment = {};
96
104
  this.__dict_append = {};
97
105
  this.__dict_remove = {};
98
106
  this.__list_unset = [];
@@ -116,6 +124,12 @@ export default class _SubscriberInternalHelper {
116
124
  if (!is_empty(this.__dict_set)) {
117
125
  event["$set"] = this.__dict_set;
118
126
  }
127
+ if (!is_empty(this.__dict_set_once)) {
128
+ event["$set_once"] = this.__dict_set_once;
129
+ }
130
+ if (!is_empty(this.__dict_increment)) {
131
+ event["$add"] = this.__dict_increment;
132
+ }
119
133
  if (!is_empty(this.__dict_append)) {
120
134
  event["$append"] = this.__dict_append;
121
135
  }
@@ -174,6 +188,42 @@ export default class _SubscriberInternalHelper {
174
188
  }
175
189
  }
176
190
 
191
+ _set_kv(key, value, args = {}, caller = "set") {
192
+ const [validated_key, is_k_valid] = this.__validate_key_basic(key, caller);
193
+ if (!is_k_valid) {
194
+ return;
195
+ } else {
196
+ const is_k_valid = this.__validate_key_prefix(validated_key, caller);
197
+ if (is_k_valid) {
198
+ this.__dict_set[validated_key] = value;
199
+ }
200
+ }
201
+ }
202
+
203
+ _set_once_kv(key, value, args = {}, caller = "set_once") {
204
+ const [validated_key, is_k_valid] = this.__validate_key_basic(key, caller);
205
+ if (!is_k_valid) {
206
+ return;
207
+ } else {
208
+ const is_k_valid = this.__validate_key_prefix(validated_key, caller);
209
+ if (is_k_valid) {
210
+ this.__dict_set_once[validated_key] = value;
211
+ }
212
+ }
213
+ }
214
+
215
+ _increment_kv(key, value, args = {}, caller = "increment") {
216
+ const [validated_key, is_k_valid] = this.__validate_key_basic(key, caller);
217
+ if (!is_k_valid) {
218
+ return;
219
+ } else {
220
+ const is_k_valid = this.__validate_key_prefix(validated_key, caller);
221
+ if (is_k_valid) {
222
+ this.__dict_increment[validated_key] = value;
223
+ }
224
+ }
225
+ }
226
+
177
227
  _remove_kv(key, value, args = {}, caller = "remove") {
178
228
  const [validated_key, is_k_valid] = this.__validate_key_basic(key, caller);
179
229
  if (!is_k_valid) {
@@ -229,6 +279,9 @@ export default class _SubscriberInternalHelper {
229
279
  case IDENT_KEY_SLACK:
230
280
  this._add_slack(value, caller);
231
281
  break;
282
+ case IDENT_KEY_MS_TEAMS:
283
+ this._add_ms_teams(value, caller);
284
+ break;
232
285
  default:
233
286
  break;
234
287
  }
@@ -258,6 +311,9 @@ export default class _SubscriberInternalHelper {
258
311
  case IDENT_KEY_SLACK:
259
312
  this._remove_slack(val, caller);
260
313
  break;
314
+ case IDENT_KEY_MS_TEAMS:
315
+ this._remove_ms_teams(val, caller);
316
+ break;
261
317
  default:
262
318
  break;
263
319
  }
@@ -540,4 +596,36 @@ export default class _SubscriberInternalHelper {
540
596
  }
541
597
  this.__dict_remove[IDENT_KEY_SLACK] = validated_value;
542
598
  }
599
+
600
+ __check_ms_teams_dict(value, caller) {
601
+ const msg = "value must be a valid dict/json with proper keys";
602
+ if (!(value && value instanceof Object)) {
603
+ this.__errors.push(`[${caller}] ${msg}`);
604
+ return [value, false];
605
+ } else {
606
+ return [value, true];
607
+ }
608
+ }
609
+
610
+ _add_ms_teams(value, caller) {
611
+ const [validated_value, is_valid] = this.__check_ms_teams_dict(
612
+ value,
613
+ caller
614
+ );
615
+ if (!is_valid) {
616
+ return;
617
+ }
618
+ this.__dict_append[IDENT_KEY_MS_TEAMS] = validated_value;
619
+ }
620
+
621
+ _remove_ms_teams(value, caller) {
622
+ const [validated_value, is_valid] = this.__check_ms_teams_dict(
623
+ value,
624
+ caller
625
+ );
626
+ if (!is_valid) {
627
+ return;
628
+ }
629
+ this.__dict_remove[IDENT_KEY_MS_TEAMS] = validated_value;
630
+ }
543
631
  }
@@ -22,6 +22,7 @@ class SubscriberListBroadcast {
22
22
  }
23
23
  this.body = body;
24
24
  this.idempotency_key = kwargs?.idempotency_key;
25
+ this.tenant_id = kwargs?.tenant_id;
25
26
  this.brand_id = kwargs?.brand_id;
26
27
  }
27
28
 
@@ -64,6 +65,9 @@ class SubscriberListBroadcast {
64
65
  if (this.idempotency_key) {
65
66
  this.body["$idempotency_key"] = this.idempotency_key;
66
67
  }
68
+ if (this.tenant_id) {
69
+ this.body["tenant_id"] = this.tenant_id;
70
+ }
67
71
  if (this.brand_id) {
68
72
  this.body["brand_id"] = this.brand_id;
69
73
  }
@@ -82,6 +86,9 @@ class SubscriberListBroadcast {
82
86
  if (this.idempotency_key) {
83
87
  body_dict["$idempotency_key"] = this.idempotency_key;
84
88
  }
89
+ if (this.tenant_id) {
90
+ body_dict["tenant_id"] = this.tenant_id;
91
+ }
85
92
  if (this.brand_id) {
86
93
  body_dict["brand_id"] = this.brand_id;
87
94
  }
@@ -235,7 +242,7 @@ class SubscriberListsApi {
235
242
 
236
243
  const url = `${this.__subscriber_list_detail_url(
237
244
  cleaned_list_id
238
- )}subscriber/add`;
245
+ )}subscriber/add/`;
239
246
  const headers = { ...this.__headers, ...this.__dynamic_headers() };
240
247
  const content_text = JSON.stringify({ distinct_ids: distinct_ids });
241
248
 
@@ -267,7 +274,7 @@ class SubscriberListsApi {
267
274
 
268
275
  const url = `${this.__subscriber_list_detail_url(
269
276
  cleaned_list_id
270
- )}subscriber/remove`;
277
+ )}subscriber/remove/`;
271
278
  const headers = { ...this.__headers, ...this.__dynamic_headers() };
272
279
  const content_text = JSON.stringify({ distinct_ids: distinct_ids });
273
280
 
@@ -288,6 +295,31 @@ class SubscriberListsApi {
288
295
  }
289
296
  }
290
297
 
298
+ async delete(list_id) {
299
+ const cleaned_list_id = this._validate_list_id(list_id);
300
+ const content_text = JSON.stringify({});
301
+
302
+ const url = `${this.__subscriber_list_detail_url(cleaned_list_id)}delete/`;
303
+
304
+ const headers = { ...this.__headers, ...this.__dynamic_headers() };
305
+
306
+ const signature = get_request_signature(
307
+ url,
308
+ "PATCH",
309
+ content_text,
310
+ headers,
311
+ this.config.workspace_secret
312
+ );
313
+ headers["Authorization"] = `${this.config.workspace_key}:${signature}`;
314
+
315
+ try {
316
+ const response = await axios.patch(url, content_text, { headers });
317
+ return response.data;
318
+ } catch (err) {
319
+ throw new SuprsendApiError(err);
320
+ }
321
+ }
322
+
291
323
  async broadcast(broadcast_instance) {
292
324
  if (!(broadcast_instance instanceof SubscriberListBroadcast)) {
293
325
  throw new InputValueError(
@@ -338,6 +370,200 @@ class SubscriberListsApi {
338
370
  };
339
371
  }
340
372
  }
373
+
374
+ async start_sync(list_id) {
375
+ const cleaned_list_id = this._validate_list_id(list_id);
376
+
377
+ const url = `${this.__subscriber_list_detail_url(
378
+ cleaned_list_id
379
+ )}start_sync/`;
380
+ const headers = { ...this.__headers, ...this.__dynamic_headers() };
381
+ const content_text = JSON.stringify({});
382
+
383
+ const signature = get_request_signature(
384
+ url,
385
+ "POST",
386
+ content_text,
387
+ headers,
388
+ this.config.workspace_secret
389
+ );
390
+ headers["Authorization"] = `${this.config.workspace_key}:${signature}`;
391
+
392
+ try {
393
+ const response = await axios.post(url, content_text, { headers });
394
+ return response.data;
395
+ } catch (err) {
396
+ throw new SuprsendApiError(err);
397
+ }
398
+ }
399
+
400
+ _validate_version_id(version_id) {
401
+ if (typeof version_id != "string") {
402
+ throw new SuprsendError("version_id must be a string");
403
+ }
404
+ let cleaned_version_id = version_id.trim();
405
+ if (!cleaned_version_id) {
406
+ throw new SuprsendError("missing version_id");
407
+ }
408
+ return version_id;
409
+ }
410
+
411
+ __subscriber_list_url_with_version(list_id, version_id) {
412
+ return `${this.config.base_url}v1/subscriber_list/${list_id}/version/${version_id}/`;
413
+ }
414
+
415
+ async get_version(list_id, version_id) {
416
+ const cleaned_list_id = this._validate_list_id(list_id);
417
+ const cleaned_version_id = this._validate_version_id(version_id);
418
+
419
+ const url = this.__subscriber_list_url_with_version(
420
+ cleaned_list_id,
421
+ cleaned_version_id
422
+ );
423
+
424
+ const headers = { ...this.__headers, ...this.__dynamic_headers() };
425
+
426
+ const signature = get_request_signature(
427
+ url,
428
+ "GET",
429
+ "",
430
+ headers,
431
+ this.config.workspace_secret
432
+ );
433
+ headers["Authorization"] = `${this.config.workspace_key}:${signature}`;
434
+
435
+ try {
436
+ const response = await axios.get(url, { headers });
437
+ return response.data;
438
+ } catch (err) {
439
+ throw new SuprsendApiError(err);
440
+ }
441
+ }
442
+
443
+ async add_to_version(list_id, version_id, distinct_ids) {
444
+ const cleaned_list_id = this._validate_list_id(list_id);
445
+ const cleaned_version_id = this._validate_version_id(version_id);
446
+
447
+ if (!Array.isArray(distinct_ids)) {
448
+ throw new SuprsendError("distinct_ids must be list of strings");
449
+ }
450
+ if (distinct_ids.length === 0) {
451
+ return this.non_error_default_response;
452
+ }
453
+
454
+ const url = `${this.__subscriber_list_url_with_version(
455
+ cleaned_list_id,
456
+ cleaned_version_id
457
+ )}subscriber/add/`;
458
+ const headers = { ...this.__headers, ...this.__dynamic_headers() };
459
+ const content_text = JSON.stringify({ distinct_ids: distinct_ids });
460
+
461
+ const signature = get_request_signature(
462
+ url,
463
+ "POST",
464
+ content_text,
465
+ headers,
466
+ this.config.workspace_secret
467
+ );
468
+ headers["Authorization"] = `${this.config.workspace_key}:${signature}`;
469
+
470
+ try {
471
+ const response = await axios.post(url, content_text, { headers });
472
+ return response.data;
473
+ } catch (err) {
474
+ throw new SuprsendApiError(err);
475
+ }
476
+ }
477
+
478
+ async remove_from_version(list_id, version_id, distinct_ids = []) {
479
+ const cleaned_list_id = this._validate_list_id(list_id);
480
+ const cleaned_version_id = this._validate_version_id(version_id);
481
+ if (!Array.isArray(distinct_ids)) {
482
+ throw new SuprsendError("distinct_ids must be list of strings");
483
+ }
484
+ if (distinct_ids.length === 0) {
485
+ return this.non_error_default_response;
486
+ }
487
+
488
+ const url = `${this.__subscriber_list_url_with_version(
489
+ cleaned_list_id,
490
+ cleaned_version_id
491
+ )}subscriber/remove/`;
492
+ const headers = { ...this.__headers, ...this.__dynamic_headers() };
493
+ const content_text = JSON.stringify({ distinct_ids: distinct_ids });
494
+
495
+ const signature = get_request_signature(
496
+ url,
497
+ "POST",
498
+ content_text,
499
+ headers,
500
+ this.config.workspace_secret
501
+ );
502
+ headers["Authorization"] = `${this.config.workspace_key}:${signature}`;
503
+
504
+ try {
505
+ const response = await axios.post(url, content_text, { headers });
506
+ return response.data;
507
+ } catch (err) {
508
+ throw new SuprsendApiError(err);
509
+ }
510
+ }
511
+
512
+ async finish_sync(list_id, version_id) {
513
+ const cleaned_list_id = this._validate_list_id(list_id);
514
+ const cleaned_version_id = this._validate_version_id(version_id);
515
+
516
+ const url = `${this.__subscriber_list_url_with_version(
517
+ cleaned_list_id,
518
+ cleaned_version_id
519
+ )}finish_sync/`;
520
+ const headers = { ...this.__headers, ...this.__dynamic_headers() };
521
+ const content_text = JSON.stringify({});
522
+
523
+ const signature = get_request_signature(
524
+ url,
525
+ "PATCH",
526
+ content_text,
527
+ headers,
528
+ this.config.workspace_secret
529
+ );
530
+ headers["Authorization"] = `${this.config.workspace_key}:${signature}`;
531
+
532
+ try {
533
+ const response = await axios.patch(url, content_text, { headers });
534
+ return response.data;
535
+ } catch (err) {
536
+ throw new SuprsendApiError(err);
537
+ }
538
+ }
539
+
540
+ async delete_version(list_id, version_id) {
541
+ const cleaned_list_id = this._validate_list_id(list_id);
542
+ const cleaned_version_id = this._validate_version_id(version_id);
543
+
544
+ const url = `${this.__subscriber_list_url_with_version(
545
+ cleaned_list_id,
546
+ cleaned_version_id
547
+ )}delete/`;
548
+ const headers = { ...this.__headers, ...this.__dynamic_headers() };
549
+ const content_text = JSON.stringify({});
550
+
551
+ const signature = get_request_signature(
552
+ url,
553
+ "PATCH",
554
+ content_text,
555
+ headers,
556
+ this.config.workspace_secret
557
+ );
558
+ headers["Authorization"] = `${this.config.workspace_key}:${signature}`;
559
+
560
+ try {
561
+ const response = await axios.patch(url, content_text, { headers });
562
+ return response.data;
563
+ } catch (err) {
564
+ throw new SuprsendApiError(err);
565
+ }
566
+ }
341
567
  }
342
568
 
343
569
  export { SubscriberListsApi, SubscriberListBroadcast };
package/src/tenant.js ADDED
@@ -0,0 +1,120 @@
1
+ import get_request_signature from "./signature";
2
+ import { SuprsendApiError } from "./utils";
3
+ import axios from "axios";
4
+
5
+ class TenantsApi {
6
+ constructor(config) {
7
+ this.config = config;
8
+ this.list_url = this.__list_url();
9
+ this.__headers = this.__common_headers();
10
+ }
11
+
12
+ __list_url() {
13
+ const list_uri_template = `${this.config.base_url}v1/tenant/`;
14
+ return list_uri_template;
15
+ }
16
+
17
+ __common_headers() {
18
+ return {
19
+ "Content-Type": "application/json; charset=utf-8",
20
+ "User-Agent": this.config.user_agent,
21
+ };
22
+ }
23
+
24
+ cleaned_limit_offset(limit, offset) {
25
+ let cleaned_limit =
26
+ typeof limit === "number" && limit > 0 && limit <= 1000 ? limit : 20;
27
+ let cleaned_offset = typeof offset === "number" && offset >= 0 ? offset : 0;
28
+ return [cleaned_limit, cleaned_offset];
29
+ }
30
+
31
+ __dynamic_headers() {
32
+ return {
33
+ Date: new Date().toUTCString(),
34
+ };
35
+ }
36
+
37
+ async list(kwargs = {}) {
38
+ const limit = kwargs?.limit;
39
+ const offset = kwargs?.offset;
40
+ const [cleaned_limit, cleaner_offset] = this.cleaned_limit_offset(
41
+ limit,
42
+ offset
43
+ );
44
+ const final_url_obj = new URL(this.list_url);
45
+ final_url_obj.searchParams.append("limit", cleaned_limit);
46
+ final_url_obj.searchParams.append("offset", cleaner_offset);
47
+ const final_url_string = final_url_obj.href;
48
+
49
+ const headers = { ...this.__headers, ...this.__dynamic_headers() };
50
+
51
+ const signature = get_request_signature(
52
+ final_url_string,
53
+ "GET",
54
+ "",
55
+ headers,
56
+ this.config.workspace_secret
57
+ );
58
+ headers["Authorization"] = `${this.config.workspace_key}:${signature}`;
59
+
60
+ try {
61
+ const response = await axios.get(final_url_string, { headers });
62
+ return response.data;
63
+ } catch (err) {
64
+ throw new SuprsendApiError(err);
65
+ }
66
+ }
67
+
68
+ detail_url(tenant_id = "") {
69
+ const cleaned_tenant_id = tenant_id.toString().trim();
70
+ const tenant_id_encoded = encodeURI(cleaned_tenant_id);
71
+ const url = `${this.list_url}${tenant_id_encoded}/`;
72
+ return url;
73
+ }
74
+
75
+ async get(tenant_id = "") {
76
+ const url = this.detail_url(tenant_id);
77
+
78
+ const headers = { ...this.__headers, ...this.__dynamic_headers() };
79
+ const signature = get_request_signature(
80
+ url,
81
+ "GET",
82
+ "",
83
+ headers,
84
+ this.config.workspace_secret
85
+ );
86
+ headers["Authorization"] = `${this.config.workspace_key}:${signature}`;
87
+
88
+ try {
89
+ const response = await axios.get(url, { headers });
90
+ return response.data;
91
+ } catch (err) {
92
+ throw new SuprsendApiError(err);
93
+ }
94
+ }
95
+
96
+ async upsert(tenant_id = "", tenant_payload = {}) {
97
+ const url = this.detail_url(tenant_id);
98
+
99
+ const headers = { ...this.__headers, ...this.__dynamic_headers() };
100
+ const content_text = JSON.stringify(tenant_payload);
101
+
102
+ const signature = get_request_signature(
103
+ url,
104
+ "POST",
105
+ content_text,
106
+ headers,
107
+ this.config.workspace_secret
108
+ );
109
+ headers["Authorization"] = `${this.config.workspace_key}:${signature}`;
110
+
111
+ try {
112
+ const response = await axios.post(url, content_text, { headers });
113
+ return response.data;
114
+ } catch (err) {
115
+ throw new SuprsendApiError(err);
116
+ }
117
+ }
118
+ }
119
+
120
+ export default TenantsApi;
package/src/workflow.js CHANGED
@@ -19,6 +19,7 @@ export default class Workflow {
19
19
  }
20
20
  this.body = body;
21
21
  this.idempotency_key = kwargs?.idempotency_key;
22
+ this.tenant_id = kwargs?.tenant_id;
22
23
  this.brand_id = kwargs?.brand_id;
23
24
  }
24
25
 
@@ -56,6 +57,9 @@ export default class Workflow {
56
57
  if (this.idempotency_key) {
57
58
  this.body["$idempotency_key"] = this.idempotency_key;
58
59
  }
60
+ if (this.tenant_id) {
61
+ this.body["tenant_id"] = this.tenant_id;
62
+ }
59
63
  if (this.brand_id) {
60
64
  this.body["brand_id"] = this.brand_id;
61
65
  }
@@ -77,6 +81,9 @@ export default class Workflow {
77
81
  if (this.idempotency_key) {
78
82
  body_dict["$idempotency_key"] = this.idempotency_key;
79
83
  }
84
+ if (this.tenant_id) {
85
+ body_dict["tenant_id"] = this.tenant_id;
86
+ }
80
87
  if (this.brand_id) {
81
88
  body_dict["brand_id"] = this.brand_id;
82
89
  }
package/types/index.d.ts CHANGED
@@ -22,7 +22,11 @@ declare namespace suprsend {
22
22
  interface Workflow {
23
23
  new (
24
24
  body: Dictionary,
25
- kwargs?: { idempotency_key?: string; brand_id?: string }
25
+ kwargs?: {
26
+ idempotency_key?: string;
27
+ tenant_id?: string;
28
+ brand_id?: string;
29
+ }
26
30
  ): Workflow;
27
31
 
28
32
  add_attachment(
@@ -47,7 +51,11 @@ declare namespace suprsend {
47
51
  distinct_id: any,
48
52
  event_name: string,
49
53
  properties?: Dictionary,
50
- kwargs?: { idempotency_key?: string; brand_id?: string }
54
+ kwargs?: {
55
+ idempotency_key?: string;
56
+ tenant_id?: string;
57
+ brand_id?: string;
58
+ }
51
59
  ): Event;
52
60
 
53
61
  add_attachment(
@@ -71,6 +79,9 @@ declare namespace suprsend {
71
79
  save(): Promise<SResponse>;
72
80
 
73
81
  append(key: string | Dictionary, value?: any): void;
82
+ set(key: string | Dictionary, value?: any): void;
83
+ set_once(key: string | Dictionary, value?: any): void;
84
+ increment(key: string | Dictionary, value?: number): void;
74
85
  remove(key: string | Dictionary, value?: any): void;
75
86
  unset(keys: string | string[]): void;
76
87
 
@@ -97,6 +108,9 @@ declare namespace suprsend {
97
108
  add_slack(value: Dictionary): void;
98
109
  remove_slack(value: Dictionary): void;
99
110
 
111
+ add_ms_teams(value: Dictionary): void;
112
+ remove_ms_teams(value: Dictionary): void;
113
+
100
114
  add_slack_email(email: string): void;
101
115
  remove_slack_email(email: string): void;
102
116
 
@@ -122,6 +136,15 @@ declare namespace suprsend {
122
136
  save(): Promise<SBulkResponse>;
123
137
  }
124
138
 
139
+ // tenants
140
+ interface TenantsApi {
141
+ list(options?: { limit?: number; offset?: number }): Promise<Dictionary>;
142
+
143
+ get(tenant_id: any): Promise<Dictionary>;
144
+
145
+ upsert(tenant_id: any, brand_payload?: Dictionary): Promise<Dictionary>;
146
+ }
147
+
125
148
  // brands
126
149
  interface BrandsApi {
127
150
  list(options?: { limit?: number; offset?: number }): Promise<Dictionary>;
@@ -135,7 +158,11 @@ declare namespace suprsend {
135
158
  interface SubscriberListBroadcast {
136
159
  new (
137
160
  body: Dictionary,
138
- kwargs?: { idempotency_key?: string; brand_id?: string }
161
+ kwargs?: {
162
+ idempotency_key?: string;
163
+ tenant_id?: string;
164
+ brand_id?: string;
165
+ }
139
166
  ): SubscriberListBroadcast;
140
167
 
141
168
  add_attachment(
@@ -155,7 +182,29 @@ declare namespace suprsend {
155
182
 
156
183
  remove(list_id: string, distinct_ids: string[]): Promise<Dictionary>;
157
184
 
185
+ delete(list_id: string): Promise<Dictionary>;
186
+
158
187
  broadcast(broadcast_instance: SubscriberListBroadcast): Promise<SResponse>;
188
+
189
+ start_sync(list_id: string): Promise<Dictionary>;
190
+
191
+ get_version(list_id: string, version_id: string): Promise<Dictionary>;
192
+
193
+ add_to_version(
194
+ list_id: string,
195
+ version_id: string,
196
+ distinct_ids: string[]
197
+ ): Promise<Dictionary>;
198
+
199
+ remove_from_version(
200
+ list_id: string,
201
+ version_id: string,
202
+ distinct_ids: string[]
203
+ ): Promise<Dictionary>;
204
+
205
+ finish_sync(list_id: string, version_id: string): Promise<Dictionary>;
206
+
207
+ delete_version(list_id: string, version_id: string): Promise<Dictionary>;
159
208
  }
160
209
 
161
210
  interface Suprsend {
@@ -173,6 +222,8 @@ declare namespace suprsend {
173
222
 
174
223
  get bulk_users(): BulkSubscribersFactory;
175
224
 
225
+ tenants: TenantsApi;
226
+
176
227
  brands: BrandsApi;
177
228
 
178
229
  subscriber_lists: SubscriberListsApi;
@@ -189,7 +240,11 @@ declare namespace suprsend {
189
240
  distinct_id: any,
190
241
  event_name: string,
191
242
  properties?: Dictionary,
192
- kwargs?: { idempotency_key?: string; brand_id?: string }
243
+ kwargs?: {
244
+ idempotency_key?: string;
245
+ tenant_id?: string;
246
+ brand_id?: string;
247
+ }
193
248
  ): Promise<SResponse>;
194
249
 
195
250
  track_event(event: Event): Promise<SResponse>;