@dawntech/blip-tools 0.3.1 → 0.5.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.
Files changed (40) hide show
  1. package/dist/exceptions/index.d.ts +5 -0
  2. package/dist/helpers/validate-instance.d.ts +1 -1
  3. package/dist/index.cjs +673 -0
  4. package/dist/index.d.ts +4 -110
  5. package/dist/{index.js → index.mjs} +451 -123
  6. package/dist/modules/blip-attendance.d.ts +11 -0
  7. package/dist/modules/blip-bucket.d.ts +3 -1
  8. package/dist/modules/blip-contact.d.ts +15 -0
  9. package/dist/modules/blip-context.d.ts +19 -0
  10. package/dist/modules/blip-dispatch.d.ts +63 -0
  11. package/dist/modules/blip-event.d.ts +12 -0
  12. package/dist/modules/blip-interaction.d.ts +13 -0
  13. package/dist/modules/blip-main.d.ts +27 -0
  14. package/dist/modules/blip-media.d.ts +3 -1
  15. package/dist/modules/blip-monitoring.d.ts +11 -0
  16. package/dist/modules/blip-ticket.d.ts +12 -0
  17. package/dist/modules/blip-whatsapp.d.ts +10 -0
  18. package/dist/modules/index.d.ts +11 -0
  19. package/dist/types/attendance-hour-container.d.ts +25 -0
  20. package/dist/types/blip-constructor.d.ts +4 -0
  21. package/dist/types/blip.d.ts +26 -0
  22. package/dist/types/campaign-notification-status.d.ts +21 -0
  23. package/dist/types/campaign-notification.d.ts +14 -0
  24. package/dist/types/campaing-request.d.ts +26 -0
  25. package/dist/types/contact.d.ts +8 -0
  26. package/dist/types/index.d.ts +7 -0
  27. package/dist/types/monitoring.d.ts +27 -0
  28. package/dist/types/template.d.ts +18 -0
  29. package/dist/types/ticket-search-result.d.ts +6 -0
  30. package/dist/types/ticket.d.ts +17 -0
  31. package/package.json +20 -5
  32. package/dist/exceptions/blip-error.js +0 -7
  33. package/dist/helpers/encode-blip-params.js +0 -11
  34. package/dist/helpers/encode-strings.js +0 -3
  35. package/dist/helpers/format-template-params.js +0 -6
  36. package/dist/helpers/handle-error.js +0 -14
  37. package/dist/helpers/validate-instance.js +0 -9
  38. package/dist/helpers/validate-response.js +0 -6
  39. package/dist/modules/blip-bucket.js +0 -88
  40. package/dist/modules/blip-media.js +0 -55
@@ -1,29 +1,312 @@
1
- import axios from 'axios';
2
1
  import { randomUUID } from 'crypto';
3
- import validateResponse from './helpers/validate-response.js';
4
- import handleError from './helpers/handle-error.js';
5
- import formatTemplateParams from './helpers/format-template-params.js';
6
- import validateInstance from './helpers/validate-instance.js';
7
- import BlipError from './exceptions/blip-error.js';
8
- import encodeBlipParams from './helpers/encode-blip-params.js';
9
- import BlipBucket from './modules/blip-bucket.js';
10
- import BlipMedia from './modules/blip-media.js';
11
- export { BlipError };
12
- export default class Blip {
2
+ import axios, { AxiosError } from 'axios';
3
+
4
+ function encodeString(value) {
5
+ return String(value).replaceAll(' ', '%20');
6
+ }
7
+
8
+ function encodeBlipParams(params) {
9
+ //This function does not uses any of the standard methods of URI parsing because Blip does not follow any of them
10
+ const parsedParams = [];
11
+ for (const [key, value] of Object.entries(params)) {
12
+ if (value && key) {
13
+ parsedParams.push(`${encodeString(key)}=${encodeString(value)}`);
14
+ }
15
+ }
16
+ return parsedParams.join('&');
17
+ }
18
+
19
+ class BlipError extends Error {
20
+ code;
21
+ constructor(message, code = 0) {
22
+ super(message);
23
+ this.code = code;
24
+ }
25
+ }
26
+
27
+ function validateResponse(response) {
28
+ if (response.data.status === 'failure') {
29
+ throw new BlipError(response.data.reason.description, response.data.reason.code);
30
+ }
31
+ }
32
+
33
+ function handleError(error) {
34
+ if (error instanceof BlipError) {
35
+ throw error;
36
+ }
37
+ if (error instanceof AxiosError) {
38
+ if (error.response?.data.code) {
39
+ throw new BlipError(error.response?.data.description, error.response?.data.code);
40
+ }
41
+ throw new BlipError(error.message, 0);
42
+ }
43
+ throw error;
44
+ }
45
+
46
+ class BlipBucket {
13
47
  api;
14
- bucket;
15
- media;
16
- constructor(params) {
17
- validateInstance(params);
18
- this.api = axios.create({
19
- baseURL: `https://${params.contract}.http.msging.net`,
20
- headers: {
21
- Authorization: `Key ${params.authToken.replace('Key ', '')}`,
22
- },
23
- timeout: 30000,
24
- });
25
- this.bucket = new BlipBucket(this.api);
26
- this.media = new BlipMedia(this.api);
48
+ constructor(context) {
49
+ this.api = context.api;
50
+ }
51
+ /**
52
+ Stores JSON content in a bucket provided by Blip. The content can be updaded or retrieved using the same id used in the update.
53
+ You can optionally provide a expiration time (in milliseconds) to delete the document after a certain amount of time.
54
+ */
55
+ async storeContentInBucket(id, content, opts) {
56
+ try {
57
+ let uri = `/buckets/${encodeString(id)}`;
58
+ const params = {};
59
+ if (opts?.expiresInMs) {
60
+ params.expiration = opts?.expiresInMs;
61
+ uri += `?${encodeBlipParams(params)}`;
62
+ }
63
+ const body = {
64
+ id: randomUUID(),
65
+ method: 'set',
66
+ type: 'application/json',
67
+ uri,
68
+ resource: content,
69
+ };
70
+ const response = await this.api.post('/commands', body);
71
+ validateResponse(response);
72
+ }
73
+ catch (error) {
74
+ throw handleError(error);
75
+ }
76
+ }
77
+ /**
78
+ Retrieves a document from the Blip bucket.
79
+ */
80
+ async getContentFromBucket(id) {
81
+ try {
82
+ const body = {
83
+ id: randomUUID(),
84
+ method: 'get',
85
+ uri: `/buckets/${encodeString(id)}`,
86
+ };
87
+ const response = await this.api.post('/commands', body);
88
+ validateResponse(response);
89
+ return response.data.resource;
90
+ }
91
+ catch (error) {
92
+ throw handleError(error);
93
+ }
94
+ }
95
+ async getAllContentIdsFromBucket() {
96
+ try {
97
+ const body = {
98
+ id: randomUUID(),
99
+ method: 'get',
100
+ uri: `/buckets`,
101
+ };
102
+ const response = await this.api.post('/commands', body);
103
+ validateResponse(response);
104
+ return response.data.resource.items;
105
+ }
106
+ catch (error) {
107
+ throw handleError(error);
108
+ }
109
+ }
110
+ /**
111
+ Deletes a JSON document from the Blip bucket.
112
+ */
113
+ async deleteContentFromBucket(id) {
114
+ try {
115
+ const body = {
116
+ id: randomUUID(),
117
+ method: 'delete',
118
+ uri: `/buckets/${encodeString(id)}`,
119
+ to: 'postmaster@msging.net',
120
+ };
121
+ const response = await this.api.post('/commands', body);
122
+ validateResponse(response);
123
+ }
124
+ catch (error) {
125
+ throw handleError(error);
126
+ }
127
+ }
128
+ }
129
+
130
+ class BlipMedia {
131
+ api;
132
+ constructor(context) {
133
+ this.api = context.api;
134
+ }
135
+ /**
136
+ * Uploads an media file to Blip storage to be used later when sending messages
137
+ * @param content A Blob containing a image, PDF or video
138
+ * @returns A public URL
139
+ */
140
+ async uploadMedia(content) {
141
+ try {
142
+ const response = await this.api.post('/commands', {
143
+ id: randomUUID(),
144
+ to: 'postmaster@media.msging.net',
145
+ method: 'get',
146
+ uri: '/upload-media-uri',
147
+ });
148
+ validateResponse(response);
149
+ const uploadResponse = await axios.post(response.data.resource, content, {
150
+ headers: { 'Content-Type': 'application/octet-stream' },
151
+ });
152
+ return uploadResponse.data.mediaUri;
153
+ }
154
+ catch (error) {
155
+ throw handleError(error);
156
+ }
157
+ }
158
+ /**
159
+ * Generates a new public URI to access blip chat media. Blip medias have expiration dates so you need to generate new ones to access the data.
160
+ * @param expiredMediaUri Blip media expired URI
161
+ * @returns A new public URI
162
+ */
163
+ async refreshMediaUri(expiredMediaUri) {
164
+ try {
165
+ const response = await this.api.post('/commands', {
166
+ id: randomUUID(),
167
+ to: 'postmaster@media.msging.net',
168
+ method: 'set',
169
+ type: 'text/plain',
170
+ uri: '/refresh-media-uri',
171
+ resource: expiredMediaUri,
172
+ });
173
+ validateResponse(response);
174
+ return response.data.resource;
175
+ }
176
+ catch (error) {
177
+ throw handleError(error);
178
+ }
179
+ }
180
+ }
181
+
182
+ class BlipAttendance {
183
+ api;
184
+ constructor(context) {
185
+ this.api = context.api;
186
+ }
187
+ async getAttendanceHourContainer({ attendanceContainerId }) {
188
+ try {
189
+ const body = {
190
+ id: randomUUID(),
191
+ to: 'postmaster@desk.msging.net',
192
+ method: 'get',
193
+ uri: `/attendance-hour-container/${attendanceContainerId}`,
194
+ };
195
+ const response = await this.api.post('/commands', body);
196
+ validateResponse(response);
197
+ return response.data.resource;
198
+ }
199
+ catch (error) {
200
+ throw handleError(error);
201
+ }
202
+ }
203
+ }
204
+
205
+ class BlipContact {
206
+ api;
207
+ constructor(context) {
208
+ this.api = context.api;
209
+ }
210
+ async update({ identity, contactData }) {
211
+ try {
212
+ const response = await this.api.post('/commands', {
213
+ id: randomUUID(),
214
+ to: 'postmaster@msging.net',
215
+ method: 'merge',
216
+ uri: '/contacts',
217
+ type: 'application/vnd.lime.contact+json',
218
+ resource: {
219
+ identity,
220
+ ...contactData,
221
+ },
222
+ });
223
+ validateResponse(response);
224
+ }
225
+ catch (error) {
226
+ handleError(error);
227
+ }
228
+ }
229
+ async get({ identity }) {
230
+ try {
231
+ const response = await this.api.post('/commands', {
232
+ id: randomUUID(),
233
+ to: 'postmaster@crm.msging.net',
234
+ method: 'get',
235
+ uri: `/contacts/${identity}`,
236
+ });
237
+ validateResponse(response);
238
+ return response.data.resource;
239
+ }
240
+ catch (error) {
241
+ throw handleError(error);
242
+ }
243
+ }
244
+ }
245
+
246
+ class BlipContext {
247
+ api;
248
+ constructor(context) {
249
+ this.api = context.api;
250
+ }
251
+ async getContextVariable({ identity, variableName }) {
252
+ try {
253
+ const response = await this.api.post('/commands', {
254
+ id: randomUUID(),
255
+ to: 'postmaster@msging.net',
256
+ method: 'get',
257
+ uri: `/contexts/${identity}/${variableName}`,
258
+ });
259
+ validateResponse(response);
260
+ return response.data.resource;
261
+ }
262
+ catch (error) {
263
+ throw handleError(error);
264
+ }
265
+ }
266
+ async getAvailableContextVariables({ identity }) {
267
+ try {
268
+ const response = await this.api.post('/commands', {
269
+ id: randomUUID(),
270
+ to: 'postmaster@msging.net',
271
+ method: 'get',
272
+ uri: `/contexts/${identity}`,
273
+ });
274
+ validateResponse(response);
275
+ return response.data.resource;
276
+ }
277
+ catch (error) {
278
+ throw handleError(error);
279
+ }
280
+ }
281
+ async setContextVariable({ value, variableName, identity, }) {
282
+ try {
283
+ const resourceType = typeof value === 'object' ? 'application/vnd.lime.contact+json' : 'text/plain';
284
+ const response = await this.api.post('/commands', {
285
+ id: randomUUID(),
286
+ method: 'set',
287
+ uri: `/contexts/${identity}/${variableName}`,
288
+ type: resourceType,
289
+ resource: value,
290
+ });
291
+ validateResponse(response);
292
+ }
293
+ catch (error) {
294
+ handleError(error);
295
+ }
296
+ }
297
+ }
298
+
299
+ function formatTemplateParams(params) {
300
+ return params.reduce((prev, current, index) => {
301
+ prev[index + 1] = current;
302
+ return prev;
303
+ }, {});
304
+ }
305
+
306
+ class BlipDispatch {
307
+ api;
308
+ constructor(context) {
309
+ this.api = context.api;
27
310
  }
28
311
  /**
29
312
  * Sends a template-based message to any user. For sending messages to clients who are active, use `sendTemplateMessage` instead.
@@ -81,36 +364,6 @@ export default class Blip {
81
364
  throw handleError(error);
82
365
  }
83
366
  }
84
- async getContextVariable({ identity, variableName }) {
85
- try {
86
- const response = await this.api.post('/commands', {
87
- id: randomUUID(),
88
- to: 'postmaster@msging.net',
89
- method: 'get',
90
- uri: `/contexts/${identity}/${variableName}`,
91
- });
92
- validateResponse(response);
93
- return response.data.resource;
94
- }
95
- catch (error) {
96
- throw handleError(error);
97
- }
98
- }
99
- async getAvailableContextVariables({ identity }) {
100
- try {
101
- const response = await this.api.post('/commands', {
102
- id: randomUUID(),
103
- to: 'postmaster@msging.net',
104
- method: 'get',
105
- uri: `/contexts/${identity}`,
106
- });
107
- validateResponse(response);
108
- return response.data.resource;
109
- }
110
- catch (error) {
111
- throw handleError(error);
112
- }
113
- }
114
367
  /**
115
368
  * Sends a template-based message to an active user. For sending messages to clients who have never interacted or are inactive, use `sendTemplate` instead.
116
369
  */
@@ -195,41 +448,83 @@ export default class Blip {
195
448
  handleError(error);
196
449
  }
197
450
  }
198
- async updateContact({ identity, contactData }) {
451
+ }
452
+
453
+ class BlipEvent {
454
+ api;
455
+ constructor(context) {
456
+ this.api = context.api;
457
+ }
458
+ async createTrackEvent({ category, action, identity }) {
199
459
  try {
200
- const response = await this.api.post('/commands', {
460
+ const body = {
201
461
  id: randomUUID(),
202
- to: 'postmaster@msging.net',
203
- method: 'merge',
204
- uri: '/contacts',
205
- type: 'application/vnd.lime.contact+json',
462
+ to: 'postmaster@analytics.msging.net',
463
+ method: 'set',
464
+ type: 'application/vnd.iris.eventTrack+json',
465
+ uri: '/event-track',
206
466
  resource: {
207
- identity,
208
- ...contactData,
467
+ category,
468
+ action,
469
+ contact: identity ? { identity } : undefined,
209
470
  },
210
- });
471
+ };
472
+ const response = await this.api.post('/commands', body);
211
473
  validateResponse(response);
212
474
  }
213
475
  catch (error) {
214
- handleError(error);
476
+ throw handleError(error);
215
477
  }
216
478
  }
217
- async getContact({ identity }) {
479
+ }
480
+
481
+ class BlipInteraction {
482
+ blipContext;
483
+ constructor(context) {
484
+ this.blipContext = context.blipContext;
485
+ }
486
+ async moveUser({ identity, botIdentity, botFlowId, botStateId, }) {
487
+ await Promise.all([
488
+ this.blipContext.setContextVariable({ identity, variableName: 'master-state', value: botIdentity }),
489
+ this.blipContext.setContextVariable({ identity, variableName: `stateid@${botFlowId}`, value: botStateId }),
490
+ ]);
491
+ }
492
+ }
493
+
494
+ class BlipTicket {
495
+ api;
496
+ constructor(context) {
497
+ this.api = context.api;
498
+ }
499
+ async search({ filter, skip, take }) {
218
500
  try {
219
- const response = await this.api.post('/commands', {
501
+ const params = {
502
+ $filter: filter,
503
+ $skip: skip,
504
+ $take: take,
505
+ };
506
+ const body = {
220
507
  id: randomUUID(),
221
- to: 'postmaster@crm.msging.net',
508
+ to: 'postmaster@desk.msging.net',
222
509
  method: 'get',
223
- uri: `/contacts/${identity}`,
224
- });
510
+ uri: `/tickets?${encodeBlipParams(params)}`,
511
+ };
512
+ const response = await this.api.post('/commands', body);
225
513
  validateResponse(response);
226
- return response.data.resource;
514
+ return response.data.resource.items;
227
515
  }
228
516
  catch (error) {
229
517
  throw handleError(error);
230
518
  }
231
519
  }
232
- async getWhatsAppTemplates() {
520
+ }
521
+
522
+ class BlipWhatsapp {
523
+ api;
524
+ constructor(context) {
525
+ this.api = context.api;
526
+ }
527
+ async getTemplates() {
233
528
  try {
234
529
  const response = await this.api.post('/commands', {
235
530
  id: randomUUID(),
@@ -244,29 +539,7 @@ export default class Blip {
244
539
  throw handleError(error);
245
540
  }
246
541
  }
247
- async setContextVariable({ value, variableName, identity, }) {
248
- try {
249
- const resourceType = typeof value === 'object' ? 'application/vnd.lime.contact+json' : 'text/plain';
250
- const response = await this.api.post('/commands', {
251
- id: randomUUID(),
252
- method: 'set',
253
- uri: `/contexts/${identity}/${variableName}`,
254
- type: resourceType,
255
- resource: value,
256
- });
257
- validateResponse(response);
258
- }
259
- catch (error) {
260
- handleError(error);
261
- }
262
- }
263
- async moveUser({ identity, botIdentity, botFlowId, botStateId, }) {
264
- await Promise.all([
265
- this.setContextVariable({ identity, variableName: 'master-state', value: botIdentity }),
266
- this.setContextVariable({ identity, variableName: `stateid@${botFlowId}`, value: botStateId }),
267
- ]);
268
- }
269
- async getWhatsAppIdentity(phone) {
542
+ async getIdentity(phone) {
270
543
  try {
271
544
  const response = await this.api.post('/commands', {
272
545
  id: randomUUID(),
@@ -281,36 +554,59 @@ export default class Blip {
281
554
  throw handleError(error);
282
555
  }
283
556
  }
284
- async createTrackEvent({ category, action, identity }) {
557
+ }
558
+
559
+ var index = /*#__PURE__*/Object.freeze({
560
+ __proto__: null,
561
+ BlipAttendance: BlipAttendance,
562
+ BlipBucket: BlipBucket,
563
+ BlipContact: BlipContact,
564
+ BlipContext: BlipContext,
565
+ BlipDispatch: BlipDispatch,
566
+ BlipEvent: BlipEvent,
567
+ BlipInteraction: BlipInteraction,
568
+ BlipMedia: BlipMedia,
569
+ BlipTicket: BlipTicket,
570
+ BlipWhatsapp: BlipWhatsapp
571
+ });
572
+
573
+ function validateInstance(params) {
574
+ if (!params.contract) {
575
+ throw new BlipError('A contract must be specified.');
576
+ }
577
+ if (!params.authToken) {
578
+ throw new BlipError('An authToken must be provided.');
579
+ }
580
+ }
581
+
582
+ class BlipMonitoring {
583
+ api;
584
+ constructor(context) {
585
+ this.api = context.api;
586
+ }
587
+ async getTickets() {
285
588
  try {
286
- const body = {
589
+ const response = await this.api.post('/commands', {
287
590
  id: randomUUID(),
288
- to: 'postmaster@analytics.msging.net',
289
- method: 'set',
290
- type: 'application/vnd.iris.eventTrack+json',
291
- uri: '/event-track',
292
- resource: {
293
- category,
294
- action,
295
- contact: identity ? { identity } : undefined,
296
- },
297
- };
298
- const response = await this.api.post('/commands', body);
591
+ to: 'postmaster@desk.msging.net',
592
+ method: 'get',
593
+ uri: '/monitoring/tickets',
594
+ });
299
595
  validateResponse(response);
596
+ return response.data.resource;
300
597
  }
301
598
  catch (error) {
302
599
  throw handleError(error);
303
600
  }
304
601
  }
305
- async getAttendanceHourContainer({ attendanceContainerId }) {
602
+ async getTicketMetrics() {
306
603
  try {
307
- const body = {
604
+ const response = await this.api.post('/commands', {
308
605
  id: randomUUID(),
309
606
  to: 'postmaster@desk.msging.net',
310
607
  method: 'get',
311
- uri: `/attendance-hour-container/${attendanceContainerId}`,
312
- };
313
- const response = await this.api.post('/commands', body);
608
+ uri: '/monitoring/ticket-metrics',
609
+ });
314
610
  validateResponse(response);
315
611
  return response.data.resource;
316
612
  }
@@ -318,25 +614,57 @@ export default class Blip {
318
614
  throw handleError(error);
319
615
  }
320
616
  }
321
- async searchTickets({ filter, skip, take }) {
617
+ async getAttendantStatusMetrics() {
322
618
  try {
323
- const params = {
324
- $filter: filter,
325
- $skip: skip,
326
- $take: take,
327
- };
328
- const body = {
619
+ const response = await this.api.post('/commands', {
329
620
  id: randomUUID(),
330
621
  to: 'postmaster@desk.msging.net',
331
622
  method: 'get',
332
- uri: `/tickets?${encodeBlipParams(params)}`,
333
- };
334
- const response = await this.api.post('/commands', body);
623
+ uri: '/monitoring/attendant-status-metrics',
624
+ });
335
625
  validateResponse(response);
336
- return response.data.resource.items;
626
+ return response.data.resource;
337
627
  }
338
628
  catch (error) {
339
629
  throw handleError(error);
340
630
  }
341
631
  }
342
632
  }
633
+
634
+ class Blip {
635
+ api;
636
+ bucket;
637
+ media;
638
+ attendance;
639
+ contact;
640
+ context;
641
+ dispatch;
642
+ event;
643
+ interaction;
644
+ ticket;
645
+ whatsapp;
646
+ monitoring;
647
+ constructor(params) {
648
+ validateInstance(params);
649
+ this.api = axios.create({
650
+ baseURL: `https://${params.contract}.http.msging.net`,
651
+ headers: {
652
+ Authorization: `Key ${params.authToken.replace('Key ', '')}`,
653
+ },
654
+ timeout: 30000,
655
+ });
656
+ this.bucket = new BlipBucket({ api: this.api });
657
+ this.media = new BlipMedia({ api: this.api });
658
+ this.attendance = new BlipAttendance({ api: this.api });
659
+ this.context = new BlipContext({ api: this.api });
660
+ this.contact = new BlipContact({ api: this.api });
661
+ this.dispatch = new BlipDispatch({ api: this.api });
662
+ this.event = new BlipEvent({ api: this.api });
663
+ this.interaction = new BlipInteraction({ blipContext: this.context });
664
+ this.ticket = new BlipTicket({ api: this.api });
665
+ this.whatsapp = new BlipWhatsapp({ api: this.api });
666
+ this.monitoring = new BlipMonitoring({ api: this.api });
667
+ }
668
+ }
669
+
670
+ export { Blip, index as Modules };
@@ -0,0 +1,11 @@
1
+ import { AxiosInstance } from 'axios';
2
+ import { AttendanceHourContainer } from '../types/attendance-hour-container';
3
+ export default class BlipAttendance {
4
+ private api;
5
+ constructor(context: {
6
+ api: AxiosInstance;
7
+ });
8
+ getAttendanceHourContainer({ attendanceContainerId }: {
9
+ attendanceContainerId: string;
10
+ }): Promise<AttendanceHourContainer>;
11
+ }
@@ -1,7 +1,9 @@
1
1
  import { AxiosInstance } from 'axios';
2
2
  export default class BlipBucket {
3
3
  private api;
4
- constructor(api: AxiosInstance);
4
+ constructor(context: {
5
+ api: AxiosInstance;
6
+ });
5
7
  /**
6
8
  Stores JSON content in a bucket provided by Blip. The content can be updaded or retrieved using the same id used in the update.
7
9
  You can optionally provide a expiration time (in milliseconds) to delete the document after a certain amount of time.
@@ -0,0 +1,15 @@
1
+ import { AxiosInstance } from 'axios';
2
+ import { Contact } from '../types/contact';
3
+ export default class BlipContact {
4
+ private api;
5
+ constructor(context: {
6
+ api: AxiosInstance;
7
+ });
8
+ update({ identity, contactData }: {
9
+ identity: string;
10
+ contactData: Record<string, unknown>;
11
+ }): Promise<void>;
12
+ get({ identity }: {
13
+ identity: string;
14
+ }): Promise<Contact>;
15
+ }