ensend 0.0.6 → 0.0.8
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/SendApi.js +2 -2
- package/dist/client.js +20 -22
- package/dist/lib/types.d.ts +1 -1
- package/package.json +1 -1
package/dist/apis/SendApi.js
CHANGED
|
@@ -46,7 +46,7 @@ export class SendApi {
|
|
|
46
46
|
async SendMailBroadcast(dto) {
|
|
47
47
|
return this.http({
|
|
48
48
|
method: "POST",
|
|
49
|
-
path: "/send/mail/
|
|
49
|
+
path: "/send/mail/broadcast",
|
|
50
50
|
body: dto,
|
|
51
51
|
});
|
|
52
52
|
}
|
|
@@ -65,7 +65,7 @@ export class SendApi {
|
|
|
65
65
|
async SendExistingMailBroadcast(dto) {
|
|
66
66
|
return this.http({
|
|
67
67
|
method: "POST",
|
|
68
|
-
path: "/send/mail/
|
|
68
|
+
path: "/send/mail/broadcast",
|
|
69
69
|
body: dto,
|
|
70
70
|
});
|
|
71
71
|
}
|
package/dist/client.js
CHANGED
|
@@ -9,32 +9,30 @@ export class Client {
|
|
|
9
9
|
? process?.env?.ENSEND_PROJECT_SECRET
|
|
10
10
|
: undefined;
|
|
11
11
|
this.http = async (options) => {
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
})
|
|
22
|
-
.then(async (res) => {
|
|
12
|
+
try {
|
|
13
|
+
const res = await fetch(this.ENSEND_BASE_URL + options.path, {
|
|
14
|
+
headers: {
|
|
15
|
+
"Content-Type": "application/json",
|
|
16
|
+
Authorization: `Bearer ${this.PROJECT_SECRET}`,
|
|
17
|
+
},
|
|
18
|
+
method: options.method,
|
|
19
|
+
body: options.method === "POST" ? JSON.stringify(options.body) : undefined,
|
|
20
|
+
});
|
|
23
21
|
const responseData = await res.json();
|
|
24
22
|
if (res.status === 200) {
|
|
25
|
-
data
|
|
23
|
+
return { data: responseData, error: null };
|
|
26
24
|
}
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
25
|
+
return { data: null, error: responseData };
|
|
26
|
+
}
|
|
27
|
+
catch (err) {
|
|
28
|
+
return {
|
|
29
|
+
data: null,
|
|
30
|
+
error: {
|
|
31
|
+
message: err.message,
|
|
32
|
+
statusCode: 500,
|
|
33
|
+
},
|
|
35
34
|
};
|
|
36
|
-
}
|
|
37
|
-
return { data, error };
|
|
35
|
+
}
|
|
38
36
|
};
|
|
39
37
|
this.SendApi = new SendApi(this.http);
|
|
40
38
|
if (options?.secret) {
|
package/dist/lib/types.d.ts
CHANGED