@vasrefil/api-toolkit 1.13.1 → 1.13.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.
- package/dist/apis/index.d.ts +1 -0
- package/dist/apis/index.js +17 -0
- package/dist/apis/notification.api.d.ts +9 -0
- package/dist/apis/notification.api.js +72 -0
- package/dist/public-api.d.ts +1 -0
- package/dist/public-api.js +1 -0
- package/dist/utilities/index.d.ts +0 -1
- package/dist/utilities/index.js +0 -1
- package/package.json +1 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './notification.api';
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./notification.api"), exports);
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { ILinkExternalIdPushPayload, ISendEmailPayload, ISendPushPayload } from '../interfaces/notification.interface';
|
|
2
|
+
declare class NotificationApi_ {
|
|
3
|
+
send_email: (payload: ISendEmailPayload[]) => Promise<any>;
|
|
4
|
+
send_push: (payload: ISendPushPayload[]) => Promise<any>;
|
|
5
|
+
link_external_id_push: (payload: ILinkExternalIdPushPayload) => Promise<any>;
|
|
6
|
+
private api_request;
|
|
7
|
+
}
|
|
8
|
+
export declare const NotificationApi: NotificationApi_;
|
|
9
|
+
export {};
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.NotificationApi = void 0;
|
|
7
|
+
const api_request_util_1 = require("./../utilities/api-request.util");
|
|
8
|
+
const helpers_1 = require("../helpers");
|
|
9
|
+
const env_1 = __importDefault(require("../env"));
|
|
10
|
+
class NotificationApi_ {
|
|
11
|
+
constructor() {
|
|
12
|
+
this.send_email = async (payload) => {
|
|
13
|
+
try {
|
|
14
|
+
const resp = await this.api_request({
|
|
15
|
+
method: 'POST',
|
|
16
|
+
endpoint: 'emails/send',
|
|
17
|
+
body: payload
|
|
18
|
+
});
|
|
19
|
+
return resp;
|
|
20
|
+
}
|
|
21
|
+
catch (error) {
|
|
22
|
+
const err = helpers_1.RequestHelper.get_error(error);
|
|
23
|
+
throw err;
|
|
24
|
+
}
|
|
25
|
+
};
|
|
26
|
+
this.send_push = async (payload) => {
|
|
27
|
+
try {
|
|
28
|
+
const resp = await this.api_request({
|
|
29
|
+
method: 'POST',
|
|
30
|
+
endpoint: 'push/send',
|
|
31
|
+
body: payload
|
|
32
|
+
});
|
|
33
|
+
return resp;
|
|
34
|
+
}
|
|
35
|
+
catch (error) {
|
|
36
|
+
const err = helpers_1.RequestHelper.get_error(error);
|
|
37
|
+
throw err;
|
|
38
|
+
}
|
|
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
|
+
};
|
|
57
|
+
this.api_request = async (request) => {
|
|
58
|
+
try {
|
|
59
|
+
const resp = await (0, api_request_util_1.ApiRequest)({
|
|
60
|
+
baseurl: env_1.default.NOTIFICATION.BASEURL,
|
|
61
|
+
apiKey: env_1.default.NOTIFICATION.API_KEY,
|
|
62
|
+
...request,
|
|
63
|
+
});
|
|
64
|
+
return resp;
|
|
65
|
+
}
|
|
66
|
+
catch (error) {
|
|
67
|
+
throw error;
|
|
68
|
+
}
|
|
69
|
+
};
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
exports.NotificationApi = new NotificationApi_();
|
package/dist/public-api.d.ts
CHANGED
package/dist/public-api.js
CHANGED
package/dist/utilities/index.js
CHANGED
|
@@ -20,5 +20,4 @@ __exportStar(require("./logger.util"), exports);
|
|
|
20
20
|
__exportStar(require("./log.util"), exports);
|
|
21
21
|
__exportStar(require("./go-mailer.util"), exports);
|
|
22
22
|
__exportStar(require("./report.util"), exports);
|
|
23
|
-
__exportStar(require("./notification.util"), exports);
|
|
24
23
|
__exportStar(require("./ip.util"), exports);
|