@suprsend/node-sdk 1.10.0 → 1.11.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.
- package/README.md +601 -13
- package/dist/index.js +2 -0
- package/dist/object.js +902 -0
- package/dist/object_helper.js +659 -0
- package/dist/subscriber_helper.js +1 -1
- package/package.json +1 -1
- package/src/index.js +2 -0
- package/src/object.js +618 -0
- package/src/object_helper.js +593 -0
- package/src/subscriber_helper.js +1 -1
- package/types/index.d.ts +64 -0
package/src/object.js
ADDED
|
@@ -0,0 +1,618 @@
|
|
|
1
|
+
import {
|
|
2
|
+
is_object,
|
|
3
|
+
is_empty,
|
|
4
|
+
is_string,
|
|
5
|
+
InputValueError, SuprsendApiError,
|
|
6
|
+
} from "./utils";
|
|
7
|
+
import get_request_signature from "./signature";
|
|
8
|
+
import axios from "axios";
|
|
9
|
+
import _ObjectInternalHelper from "./object_helper";
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
class ObjectsApi {
|
|
13
|
+
constructor(config) {
|
|
14
|
+
this.config = config;
|
|
15
|
+
this.listUrl = this.create_list_url();
|
|
16
|
+
this.headers = this.common_headers();
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
create_list_url() {
|
|
20
|
+
return `${this.config.base_url}v1/object/`;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
common_headers() {
|
|
24
|
+
return {
|
|
25
|
+
'Content-Type': 'application/json; charset=utf-8',
|
|
26
|
+
'User-Agent': this.config.user_agent,
|
|
27
|
+
};
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
dynamic_headers() {
|
|
31
|
+
return {
|
|
32
|
+
'Date': new Date().toISOString(), // Adjust to your header date format
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
validate_object_entity_string(entityId) {
|
|
37
|
+
if (!is_string(entityId)) {
|
|
38
|
+
throw new InputValueError(
|
|
39
|
+
"object entity must be a string"
|
|
40
|
+
);
|
|
41
|
+
}
|
|
42
|
+
entityId = entityId.trim();
|
|
43
|
+
if (!entityId) {
|
|
44
|
+
throw new InputValueError("object entity must be passed");
|
|
45
|
+
}
|
|
46
|
+
return entityId;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
async list(objectType, options = {}) {
|
|
50
|
+
const params = new URLSearchParams(options).toString();
|
|
51
|
+
const validatedType = this.validate_object_entity_string(objectType);
|
|
52
|
+
const encodedType = encodeURIComponent(validatedType);
|
|
53
|
+
const url = `${this.listUrl}${encodedType}/?${params}`;
|
|
54
|
+
const headers = { ...this.headers, ...this.dynamic_headers() };
|
|
55
|
+
const signature = get_request_signature(
|
|
56
|
+
url,
|
|
57
|
+
"GET",
|
|
58
|
+
"",
|
|
59
|
+
headers,
|
|
60
|
+
this.config.workspace_secret
|
|
61
|
+
);
|
|
62
|
+
headers['Authorization'] = `${this.config.workspace_key}:${signature}`;
|
|
63
|
+
|
|
64
|
+
try {
|
|
65
|
+
const response = await axios.get(url, { headers });
|
|
66
|
+
return response.data;
|
|
67
|
+
} catch (err) {
|
|
68
|
+
throw new SuprsendApiError(err);
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
async detail_url(objectType, objectId) {
|
|
73
|
+
const validatedType = this.validate_object_entity_string(objectType);
|
|
74
|
+
const encodedType = encodeURIComponent(validatedType);
|
|
75
|
+
|
|
76
|
+
const validatedId = this.validate_object_entity_string(objectId);
|
|
77
|
+
const encodedId = encodeURIComponent(validatedId);
|
|
78
|
+
|
|
79
|
+
return `${this.listUrl}${encodedType}/${encodedId}/`;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
async get(objectType, objectId) {
|
|
83
|
+
const url = await this.detail_url(objectType, objectId);
|
|
84
|
+
const headers = { ...this.headers, ...this.dynamic_headers() };
|
|
85
|
+
const signature = get_request_signature(
|
|
86
|
+
url,
|
|
87
|
+
"GET",
|
|
88
|
+
"",
|
|
89
|
+
headers,
|
|
90
|
+
this.config.workspace_secret
|
|
91
|
+
);
|
|
92
|
+
headers['Authorization'] = `${this.config.workspace_key}:${signature}`;
|
|
93
|
+
|
|
94
|
+
try {
|
|
95
|
+
const response = await axios.get(url, { headers });
|
|
96
|
+
return response.data;
|
|
97
|
+
} catch (err) {
|
|
98
|
+
throw new SuprsendApiError(err);
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
async upsert(objectType, objectId, objectPayload) {
|
|
103
|
+
const url = await this.detail_url(objectType, objectId);
|
|
104
|
+
const headers = { ...this.headers, ...this.dynamic_headers() };
|
|
105
|
+
const contentText = JSON.stringify(objectPayload);
|
|
106
|
+
const signature = get_request_signature(
|
|
107
|
+
url,
|
|
108
|
+
"POST",
|
|
109
|
+
contentText,
|
|
110
|
+
headers,
|
|
111
|
+
this.config.workspace_secret
|
|
112
|
+
);
|
|
113
|
+
headers['Authorization'] = `${this.config.workspace_key}:${signature}`;
|
|
114
|
+
|
|
115
|
+
try {
|
|
116
|
+
const response = await axios.post(url, contentText, { headers });
|
|
117
|
+
return response.data;
|
|
118
|
+
} catch (err) {
|
|
119
|
+
throw new SuprsendApiError(err);
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
async edit(objectType, objectId, editPayload) {
|
|
124
|
+
const url = await this.detail_url(objectType, objectId);
|
|
125
|
+
const headers = { ...this.headers, ...this.dynamic_headers() };
|
|
126
|
+
const contentText = JSON.stringify(editPayload);
|
|
127
|
+
const signature = get_request_signature(
|
|
128
|
+
url,
|
|
129
|
+
"PATCH",
|
|
130
|
+
contentText,
|
|
131
|
+
headers,
|
|
132
|
+
this.config.workspace_secret
|
|
133
|
+
);
|
|
134
|
+
headers['Authorization'] = `${this.config.workspace_key}:${signature}`;
|
|
135
|
+
|
|
136
|
+
try {
|
|
137
|
+
const response = await axios.patch(url, contentText, { headers });
|
|
138
|
+
return response.data;
|
|
139
|
+
} catch (err) {
|
|
140
|
+
throw new SuprsendApiError(err);
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
async delete(objectType, objectId) {
|
|
145
|
+
const url = await this.detail_url(objectType, objectId);
|
|
146
|
+
const headers = { ...this.headers, ...this.dynamic_headers() };
|
|
147
|
+
const signature = get_request_signature(
|
|
148
|
+
url,
|
|
149
|
+
"DELETE",
|
|
150
|
+
"",
|
|
151
|
+
headers,
|
|
152
|
+
this.config.workspace_secret
|
|
153
|
+
);
|
|
154
|
+
headers['Authorization'] = `${this.config.workspace_key}:${signature}`;
|
|
155
|
+
|
|
156
|
+
try {
|
|
157
|
+
const response = await axios.delete(url, { headers });
|
|
158
|
+
return response.data;
|
|
159
|
+
} catch (err) {
|
|
160
|
+
throw new SuprsendApiError(err);
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
async bulk_ops_url(objectType) {
|
|
165
|
+
const validatedType = this.validate_object_entity_string(objectType);
|
|
166
|
+
const encodedType = encodeURIComponent(validatedType);
|
|
167
|
+
|
|
168
|
+
return `${this.config.base_url}v1/bulk/object/${encodedType}/`;
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
async bulk_delete(objectType, payload) {
|
|
172
|
+
const url = await this.bulk_ops_url(objectType);
|
|
173
|
+
const headers = { ...this.headers, ...this.dynamic_headers() };
|
|
174
|
+
const contentText = JSON.stringify(payload);
|
|
175
|
+
const signature = get_request_signature(
|
|
176
|
+
url,
|
|
177
|
+
"DELETE",
|
|
178
|
+
contentText,
|
|
179
|
+
headers,
|
|
180
|
+
this.config.workspace_secret
|
|
181
|
+
);
|
|
182
|
+
headers['Authorization'] = `${this.config.workspace_key}:${signature}`;
|
|
183
|
+
|
|
184
|
+
try {
|
|
185
|
+
const response = await axios.delete(url, {
|
|
186
|
+
headers: headers,
|
|
187
|
+
data: payload
|
|
188
|
+
});
|
|
189
|
+
return response.data;
|
|
190
|
+
} catch (err) {
|
|
191
|
+
throw new SuprsendApiError(err);
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
async get_subscriptions(objectType, objectId, options = {}) {
|
|
196
|
+
const params = new URLSearchParams(options).toString();
|
|
197
|
+
const url = await this.detail_url(objectType, objectId);
|
|
198
|
+
const subscription_url = `${url}subscription/?${params}`;
|
|
199
|
+
const headers = { ...this.headers, ...this.dynamic_headers() };
|
|
200
|
+
const signature = get_request_signature(
|
|
201
|
+
subscription_url,
|
|
202
|
+
"GET",
|
|
203
|
+
"",
|
|
204
|
+
headers,
|
|
205
|
+
this.config.workspace_secret
|
|
206
|
+
);
|
|
207
|
+
headers['Authorization'] = `${this.config.workspace_key}:${signature}`;
|
|
208
|
+
|
|
209
|
+
try {
|
|
210
|
+
const response = await axios.get(subscription_url, { headers });
|
|
211
|
+
return response.data;
|
|
212
|
+
} catch (err) {
|
|
213
|
+
throw new SuprsendApiError(err);
|
|
214
|
+
}
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
async create_subscriptions(objectType, objectId, subscriptions) {
|
|
218
|
+
const url = await this.detail_url(objectType, objectId);
|
|
219
|
+
const subscription_url = `${url}subscription/`;
|
|
220
|
+
const headers = { ...this.headers, ...this.dynamic_headers() };
|
|
221
|
+
const contentText = JSON.stringify(subscriptions);
|
|
222
|
+
const signature = get_request_signature(
|
|
223
|
+
subscription_url,
|
|
224
|
+
"POST",
|
|
225
|
+
contentText,
|
|
226
|
+
headers,
|
|
227
|
+
this.config.workspace_secret
|
|
228
|
+
);
|
|
229
|
+
headers['Authorization'] = `${this.config.workspace_key}:${signature}`;
|
|
230
|
+
|
|
231
|
+
try {
|
|
232
|
+
const response = await axios.post(subscription_url, contentText, { headers });
|
|
233
|
+
return response.data;
|
|
234
|
+
} catch (err) {
|
|
235
|
+
throw new SuprsendApiError(err);
|
|
236
|
+
}
|
|
237
|
+
}
|
|
238
|
+
|
|
239
|
+
async delete_subscriptions(objectType, objectId, subscriptions) {
|
|
240
|
+
const url = await this.detail_url(objectType, objectId);
|
|
241
|
+
const subscription_url = `${url}subscription/`;
|
|
242
|
+
const headers = { ...this.headers, ...this.dynamic_headers() };
|
|
243
|
+
const contentText = JSON.stringify(subscriptions);
|
|
244
|
+
const signature = get_request_signature(
|
|
245
|
+
subscription_url,
|
|
246
|
+
"DELETE",
|
|
247
|
+
contentText,
|
|
248
|
+
headers,
|
|
249
|
+
this.config.workspace_secret
|
|
250
|
+
);
|
|
251
|
+
headers['Authorization'] = `${this.config.workspace_key}:${signature}`;
|
|
252
|
+
|
|
253
|
+
try {
|
|
254
|
+
const response = await axios.delete(subscription_url, {
|
|
255
|
+
headers: headers,
|
|
256
|
+
data: subscriptions
|
|
257
|
+
});
|
|
258
|
+
return response.data;
|
|
259
|
+
} catch (err) {
|
|
260
|
+
throw new SuprsendApiError(err);
|
|
261
|
+
}
|
|
262
|
+
}
|
|
263
|
+
|
|
264
|
+
get_instance(object_type, object_id) {
|
|
265
|
+
if (!is_string(object_type)) {
|
|
266
|
+
throw new InputValueError(
|
|
267
|
+
"object_type must be a string"
|
|
268
|
+
);
|
|
269
|
+
}
|
|
270
|
+
object_type = object_type.trim();
|
|
271
|
+
if (!object_type) {
|
|
272
|
+
throw new InputValueError("object_type must be passed");
|
|
273
|
+
}
|
|
274
|
+
|
|
275
|
+
if (!is_string(object_id)) {
|
|
276
|
+
throw new InputValueError(
|
|
277
|
+
"object_id must be a string"
|
|
278
|
+
);
|
|
279
|
+
}
|
|
280
|
+
object_id = object_id.trim();
|
|
281
|
+
if (!object_id) {
|
|
282
|
+
throw new InputValueError("object_id must be passed");
|
|
283
|
+
}
|
|
284
|
+
return new _Object(this.config, object_type, object_id);
|
|
285
|
+
}
|
|
286
|
+
|
|
287
|
+
}
|
|
288
|
+
|
|
289
|
+
export class _Object {
|
|
290
|
+
constructor(config, object_type, object_id) {
|
|
291
|
+
this.config = config;
|
|
292
|
+
this.object_type = object_type;
|
|
293
|
+
this.object_id = object_id;
|
|
294
|
+
this.__url = this.__get_url();
|
|
295
|
+
this.__super_props = this.__super_properties();
|
|
296
|
+
|
|
297
|
+
this.__errors = [];
|
|
298
|
+
this.__info = [];
|
|
299
|
+
this.operations = [];
|
|
300
|
+
this._helper = new _ObjectInternalHelper();
|
|
301
|
+
}
|
|
302
|
+
|
|
303
|
+
__get_url() {
|
|
304
|
+
return `${this.config.base_url}v1/object/${this.object_type}/${this.object_id}/`;
|
|
305
|
+
}
|
|
306
|
+
|
|
307
|
+
__get_headers() {
|
|
308
|
+
return {
|
|
309
|
+
"Content-Type": "application/json; charset=utf-8",
|
|
310
|
+
Date: new Date().toUTCString(),
|
|
311
|
+
"User-Agent": this.config.user_agent,
|
|
312
|
+
};
|
|
313
|
+
}
|
|
314
|
+
|
|
315
|
+
__super_properties() {
|
|
316
|
+
return {
|
|
317
|
+
$ss_sdk_version: this.config.user_agent,
|
|
318
|
+
};
|
|
319
|
+
}
|
|
320
|
+
|
|
321
|
+
validate_body() {
|
|
322
|
+
if (!is_empty(this.__info)) {
|
|
323
|
+
const msg = `[object_type: ${this.object_type}, ${this.object_id}]${this.__info.join("\n")}`;
|
|
324
|
+
console.log(`WARNING: ${msg}`);
|
|
325
|
+
}
|
|
326
|
+
if (!is_empty(this.__errors)) {
|
|
327
|
+
const msg = `[object_type: ${this.object_type}, ${this.object_id}]${this.__errors.join("\n")}`;
|
|
328
|
+
console.log(`ERROR: ${msg}`);
|
|
329
|
+
}
|
|
330
|
+
}
|
|
331
|
+
|
|
332
|
+
async save() {
|
|
333
|
+
this.validate_body();
|
|
334
|
+
const headers = this.__get_headers();
|
|
335
|
+
//
|
|
336
|
+
const payload = {
|
|
337
|
+
operations: this.operations
|
|
338
|
+
}
|
|
339
|
+
const content_text = JSON.stringify(payload);
|
|
340
|
+
|
|
341
|
+
const signature = get_request_signature(
|
|
342
|
+
this.__url,
|
|
343
|
+
"PATCH",
|
|
344
|
+
content_text,
|
|
345
|
+
headers,
|
|
346
|
+
this.config.workspace_secret
|
|
347
|
+
);
|
|
348
|
+
headers['Authorization'] = `${this.config.workspace_key}:${signature}`;
|
|
349
|
+
|
|
350
|
+
try {
|
|
351
|
+
const response = await axios.patch(this.__url, content_text, { headers });
|
|
352
|
+
return response.data;
|
|
353
|
+
} catch (err) {
|
|
354
|
+
throw new SuprsendApiError(err);
|
|
355
|
+
}
|
|
356
|
+
}
|
|
357
|
+
|
|
358
|
+
_collect_payload() {
|
|
359
|
+
const resp = this._helper.get_identity_events();
|
|
360
|
+
if (!is_empty(resp["errors"])) {
|
|
361
|
+
this.__errors = [...this.__errors, ...resp["errors"]];
|
|
362
|
+
}
|
|
363
|
+
if (!is_empty(resp["info"])) {
|
|
364
|
+
this.__info = [...this.__info, ...resp["info"]];
|
|
365
|
+
}
|
|
366
|
+
if (!is_empty(resp["payload"])) {
|
|
367
|
+
this.operations.push(resp["payload"]);
|
|
368
|
+
}
|
|
369
|
+
}
|
|
370
|
+
|
|
371
|
+
append(key, value) {
|
|
372
|
+
const caller = "append";
|
|
373
|
+
if (!is_string(key) && !is_object(key)) {
|
|
374
|
+
this.__errors.push(`[${caller}] arg1 must be either string or a dict`);
|
|
375
|
+
return;
|
|
376
|
+
}
|
|
377
|
+
if (is_string(key)) {
|
|
378
|
+
if (!value) {
|
|
379
|
+
this.__errors.push(
|
|
380
|
+
`[${caller}] if arg1 is a string, then arg2 must be passed`
|
|
381
|
+
);
|
|
382
|
+
return;
|
|
383
|
+
} else {
|
|
384
|
+
this._helper._append_kv(key, value, {}, caller);
|
|
385
|
+
this._collect_payload();
|
|
386
|
+
}
|
|
387
|
+
} else {
|
|
388
|
+
for (let item in key) {
|
|
389
|
+
this._helper._append_kv(item, key[item], key, caller);
|
|
390
|
+
}
|
|
391
|
+
this._collect_payload();
|
|
392
|
+
}
|
|
393
|
+
}
|
|
394
|
+
|
|
395
|
+
set(key, value) {
|
|
396
|
+
const caller = "set";
|
|
397
|
+
if (!is_string(key) && !is_object(key)) {
|
|
398
|
+
this.__errors.push(`[${caller}] arg1 must be either string or a dict`);
|
|
399
|
+
return;
|
|
400
|
+
}
|
|
401
|
+
if (is_string(key)) {
|
|
402
|
+
if (value === null || value === undefined) {
|
|
403
|
+
this.__errors.push(
|
|
404
|
+
`[${caller}] if arg1 is a string, then arg2 must be passed`
|
|
405
|
+
);
|
|
406
|
+
return;
|
|
407
|
+
} else {
|
|
408
|
+
this._helper._set_kv(key, value, {}, caller);
|
|
409
|
+
this._collect_payload();
|
|
410
|
+
}
|
|
411
|
+
} else {
|
|
412
|
+
for (let item in key) {
|
|
413
|
+
this._helper._set_kv(item, key[item], key, caller);
|
|
414
|
+
}
|
|
415
|
+
this._collect_payload();
|
|
416
|
+
}
|
|
417
|
+
}
|
|
418
|
+
|
|
419
|
+
set_once(key, value) {
|
|
420
|
+
const caller = "set_once";
|
|
421
|
+
if (!is_string(key) && !is_object(key)) {
|
|
422
|
+
this.__errors.push(`[${caller}] arg1 must be either string or a dict`);
|
|
423
|
+
return;
|
|
424
|
+
}
|
|
425
|
+
if (is_string(key)) {
|
|
426
|
+
if (value === null || value === undefined) {
|
|
427
|
+
this.__errors.push(
|
|
428
|
+
`[${caller}] if arg1 is a string, then arg2 must be passed`
|
|
429
|
+
);
|
|
430
|
+
return;
|
|
431
|
+
} else {
|
|
432
|
+
this._helper._set_once_kv(key, value, {}, caller);
|
|
433
|
+
this._collect_payload();
|
|
434
|
+
}
|
|
435
|
+
} else {
|
|
436
|
+
for (let item in key) {
|
|
437
|
+
this._helper._set_once_kv(item, key[item], key, caller);
|
|
438
|
+
}
|
|
439
|
+
this._collect_payload();
|
|
440
|
+
}
|
|
441
|
+
}
|
|
442
|
+
|
|
443
|
+
increment(key, value) {
|
|
444
|
+
const caller = "increment";
|
|
445
|
+
if (!is_string(key) && !is_object(key)) {
|
|
446
|
+
this.__errors.push(`[${caller}] arg1 must be either string or a dict`);
|
|
447
|
+
return;
|
|
448
|
+
}
|
|
449
|
+
if (is_string(key)) {
|
|
450
|
+
if (value === null || value === undefined) {
|
|
451
|
+
this.__errors.push(
|
|
452
|
+
`[${caller}] if arg1 is a string, then arg2 must be passed`
|
|
453
|
+
);
|
|
454
|
+
return;
|
|
455
|
+
} else {
|
|
456
|
+
this._helper._increment_kv(key, value, {}, caller);
|
|
457
|
+
this._collect_payload();
|
|
458
|
+
}
|
|
459
|
+
} else {
|
|
460
|
+
for (let item in key) {
|
|
461
|
+
this._helper._increment_kv(item, key[item], key, caller);
|
|
462
|
+
}
|
|
463
|
+
this._collect_payload();
|
|
464
|
+
}
|
|
465
|
+
}
|
|
466
|
+
|
|
467
|
+
remove(key, value) {
|
|
468
|
+
const caller = "remove";
|
|
469
|
+
if (!is_string(key) && !is_object(key)) {
|
|
470
|
+
this.__errors.push(`[${caller}] arg1 must be either string or a dict`);
|
|
471
|
+
return;
|
|
472
|
+
}
|
|
473
|
+
if (is_string(key)) {
|
|
474
|
+
if (!value) {
|
|
475
|
+
this.__errors.push(
|
|
476
|
+
`[${caller}] if arg1 is a string, then arg2 must be passed`
|
|
477
|
+
);
|
|
478
|
+
return;
|
|
479
|
+
} else {
|
|
480
|
+
this._helper._remove_kv(key, value, {}, caller);
|
|
481
|
+
this._collect_payload();
|
|
482
|
+
}
|
|
483
|
+
} else {
|
|
484
|
+
for (let item in key) {
|
|
485
|
+
this._helper._remove_kv(item, key[item], key, caller);
|
|
486
|
+
}
|
|
487
|
+
this._collect_payload();
|
|
488
|
+
}
|
|
489
|
+
}
|
|
490
|
+
|
|
491
|
+
unset(key) {
|
|
492
|
+
const caller = "unset";
|
|
493
|
+
if (!is_string(key) && !Array.isArray(key)) {
|
|
494
|
+
this.__errors.push(`[${caller}] key must be either string or array`);
|
|
495
|
+
return;
|
|
496
|
+
}
|
|
497
|
+
if (is_string(key)) {
|
|
498
|
+
this._helper._unset_k(key, caller);
|
|
499
|
+
this._collect_payload();
|
|
500
|
+
} else {
|
|
501
|
+
for (let item of key) {
|
|
502
|
+
this._helper._unset_k(item, caller);
|
|
503
|
+
}
|
|
504
|
+
this._collect_payload();
|
|
505
|
+
}
|
|
506
|
+
}
|
|
507
|
+
|
|
508
|
+
set_preferred_language(lang_code) {
|
|
509
|
+
const caller = "set_preferred_language";
|
|
510
|
+
this._helper._set_preferred_language(lang_code, caller);
|
|
511
|
+
this._collect_payload();
|
|
512
|
+
}
|
|
513
|
+
|
|
514
|
+
set_timezone(timezone) {
|
|
515
|
+
const caller = "set_timezone";
|
|
516
|
+
this._helper._set_timezone(timezone, caller);
|
|
517
|
+
this._collect_payload();
|
|
518
|
+
}
|
|
519
|
+
|
|
520
|
+
add_email(email) {
|
|
521
|
+
const caller = "add_email";
|
|
522
|
+
this._helper._add_email(email, caller);
|
|
523
|
+
this._collect_payload();
|
|
524
|
+
}
|
|
525
|
+
|
|
526
|
+
remove_email(email) {
|
|
527
|
+
const caller = "remove_email";
|
|
528
|
+
this._helper._remove_email(email, caller);
|
|
529
|
+
this._collect_payload();
|
|
530
|
+
}
|
|
531
|
+
|
|
532
|
+
add_sms(mobile_no) {
|
|
533
|
+
const caller = "add_sms";
|
|
534
|
+
this._helper._add_sms(mobile_no, caller);
|
|
535
|
+
this._collect_payload();
|
|
536
|
+
}
|
|
537
|
+
|
|
538
|
+
remove_sms(mobile_no) {
|
|
539
|
+
const caller = "remove_sms";
|
|
540
|
+
this._helper._remove_sms(mobile_no, caller);
|
|
541
|
+
this._collect_payload();
|
|
542
|
+
}
|
|
543
|
+
|
|
544
|
+
add_whatsapp(mobile_no) {
|
|
545
|
+
const caller = "add_whatsapp";
|
|
546
|
+
this._helper._add_whatsapp(mobile_no, caller);
|
|
547
|
+
this._collect_payload();
|
|
548
|
+
}
|
|
549
|
+
|
|
550
|
+
remove_whatsapp(mobile_no) {
|
|
551
|
+
const caller = "remove_whatsapp";
|
|
552
|
+
this._helper._remove_whatsapp(mobile_no, caller);
|
|
553
|
+
this._collect_payload();
|
|
554
|
+
}
|
|
555
|
+
|
|
556
|
+
add_androidpush(push_token, provider = "fcm") {
|
|
557
|
+
const caller = "add_androidpush";
|
|
558
|
+
this._helper._add_androidpush(push_token, provider, caller);
|
|
559
|
+
this._collect_payload();
|
|
560
|
+
}
|
|
561
|
+
|
|
562
|
+
remove_androidpush(push_token, provider = "fcm") {
|
|
563
|
+
const caller = "remove_androidpush";
|
|
564
|
+
this._helper._remove_androidpush(push_token, provider, caller);
|
|
565
|
+
this._collect_payload();
|
|
566
|
+
}
|
|
567
|
+
|
|
568
|
+
add_iospush(push_token, provider = "apns") {
|
|
569
|
+
const caller = "add_iospush";
|
|
570
|
+
this._helper._add_iospush(push_token, provider, caller);
|
|
571
|
+
this._collect_payload();
|
|
572
|
+
}
|
|
573
|
+
|
|
574
|
+
remove_iospush(push_token, provider = "apns") {
|
|
575
|
+
const caller = "remove_iospush";
|
|
576
|
+
this._helper._remove_iospush(push_token, provider, caller);
|
|
577
|
+
this._collect_payload();
|
|
578
|
+
}
|
|
579
|
+
|
|
580
|
+
add_webpush(push_token, provider = "vapid") {
|
|
581
|
+
const caller = "add_webpush";
|
|
582
|
+
this._helper._add_webpush(push_token, provider, caller);
|
|
583
|
+
this._collect_payload();
|
|
584
|
+
}
|
|
585
|
+
|
|
586
|
+
remove_webpush(push_token, provider = "vapid") {
|
|
587
|
+
const caller = "remove_webpush";
|
|
588
|
+
this._helper._remove_webpush(push_token, provider, caller);
|
|
589
|
+
this._collect_payload();
|
|
590
|
+
}
|
|
591
|
+
|
|
592
|
+
add_slack(value) {
|
|
593
|
+
const caller = "add_slack";
|
|
594
|
+
this._helper._add_slack(value, caller);
|
|
595
|
+
this._collect_payload();
|
|
596
|
+
}
|
|
597
|
+
|
|
598
|
+
remove_slack(value) {
|
|
599
|
+
const caller = "remove_slack";
|
|
600
|
+
this._helper._remove_slack(value, caller);
|
|
601
|
+
this._collect_payload();
|
|
602
|
+
}
|
|
603
|
+
|
|
604
|
+
add_ms_teams(value) {
|
|
605
|
+
const caller = "add_ms_teams";
|
|
606
|
+
this._helper._add_ms_teams(value, caller);
|
|
607
|
+
this._collect_payload();
|
|
608
|
+
}
|
|
609
|
+
|
|
610
|
+
remove_ms_teams(value) {
|
|
611
|
+
const caller = "remove_ms_teams";
|
|
612
|
+
this._helper._remove_ms_teams(value, caller);
|
|
613
|
+
this._collect_payload();
|
|
614
|
+
}
|
|
615
|
+
|
|
616
|
+
}
|
|
617
|
+
|
|
618
|
+
export default ObjectsApi;
|