@vasrefil/api-toolkit 1.12.7 → 1.13.1
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.
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import { ISendEmailPayload, ISendPushPayload } from '../interfaces/notification.interface';
|
|
1
|
+
import { ILinkExternalIdPushPayload, ISendEmailPayload, ISendPushPayload } from '../interfaces/notification.interface';
|
|
2
2
|
declare class NotificationUtil_ {
|
|
3
3
|
send_email: (payload: ISendEmailPayload[]) => Promise<any>;
|
|
4
4
|
send_push: (payload: ISendPushPayload[]) => Promise<any>;
|
|
5
|
+
link_external_id_push: (payload: ILinkExternalIdPushPayload) => Promise<any>;
|
|
5
6
|
private api_request;
|
|
6
7
|
}
|
|
7
8
|
export declare const NotificationUtil: NotificationUtil_;
|
|
@@ -37,6 +37,23 @@ class NotificationUtil_ {
|
|
|
37
37
|
throw err;
|
|
38
38
|
}
|
|
39
39
|
};
|
|
40
|
+
this.link_external_id_push = async (payload) => {
|
|
41
|
+
try {
|
|
42
|
+
const { external_id, subscription_id } = payload;
|
|
43
|
+
const resp = await this.api_request({
|
|
44
|
+
method: 'POST',
|
|
45
|
+
endpoint: `subscriptions/${subscription_id}/identity`,
|
|
46
|
+
body: {
|
|
47
|
+
external_id
|
|
48
|
+
}
|
|
49
|
+
});
|
|
50
|
+
return resp;
|
|
51
|
+
}
|
|
52
|
+
catch (error) {
|
|
53
|
+
const err = helpers_1.RequestHelper.get_error(error);
|
|
54
|
+
throw err;
|
|
55
|
+
}
|
|
56
|
+
};
|
|
40
57
|
this.api_request = async (request) => {
|
|
41
58
|
try {
|
|
42
59
|
const resp = await (0, api_request_util_1.ApiRequest)({
|
|
@@ -47,8 +64,7 @@ class NotificationUtil_ {
|
|
|
47
64
|
return resp;
|
|
48
65
|
}
|
|
49
66
|
catch (error) {
|
|
50
|
-
|
|
51
|
-
console.log(`Send Email error: ${err?.message}`);
|
|
67
|
+
throw error;
|
|
52
68
|
}
|
|
53
69
|
};
|
|
54
70
|
}
|