ensend 0.0.2 → 0.0.3
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/AudienceApi.d.ts +5 -5
- package/dist/apis/SendApi.d.ts +11 -11
- package/dist/lib/types.d.ts +7 -3
- package/package.json +1 -1
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import type { HttpClient } from "../lib/types";
|
|
1
|
+
import type { HttpClient, HttpClientResponse } from "../lib/types";
|
|
2
2
|
export declare class AudienceApi {
|
|
3
3
|
private http;
|
|
4
4
|
constructor(http: HttpClient);
|
|
5
5
|
CreateProfile(dto: TAudienceApi.CreateProfileDto): Promise<{
|
|
6
|
-
data:
|
|
7
|
-
error: import("../lib/types").
|
|
6
|
+
data: TAudienceApi.CreateProfileResponse;
|
|
7
|
+
error: import("../lib/types").HttpClientError;
|
|
8
8
|
}>;
|
|
9
9
|
}
|
|
10
10
|
export declare namespace TAudienceApi {
|
|
@@ -14,7 +14,7 @@ export declare namespace TAudienceApi {
|
|
|
14
14
|
identity: string;
|
|
15
15
|
sendConsentEmail: boolean;
|
|
16
16
|
};
|
|
17
|
-
type CreateProfileResponse = {
|
|
17
|
+
type CreateProfileResponse = HttpClientResponse<{
|
|
18
18
|
profile: {
|
|
19
19
|
ref: string;
|
|
20
20
|
name: string;
|
|
@@ -23,5 +23,5 @@ export declare namespace TAudienceApi {
|
|
|
23
23
|
status: string;
|
|
24
24
|
createdAt: string;
|
|
25
25
|
};
|
|
26
|
-
}
|
|
26
|
+
}>;
|
|
27
27
|
}
|
package/dist/apis/SendApi.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { HttpClient } from "../lib/types";
|
|
1
|
+
import type { HttpClient, HttpClientResponse } from "../lib/types";
|
|
2
2
|
export declare class SendApi<const I extends readonly string[], const T extends readonly string[]> {
|
|
3
3
|
private http;
|
|
4
4
|
constructor(http: HttpClient);
|
|
@@ -20,8 +20,8 @@ export declare class SendApi<const I extends readonly string[], const T extends
|
|
|
20
20
|
* @see {@link https://docs.ensend.co/send/mail-message | More in the documentation}
|
|
21
21
|
*/
|
|
22
22
|
SendMailMessage(dto: TSendApi.SendMailMessageDto<I, T>): Promise<{
|
|
23
|
-
data:
|
|
24
|
-
error: import("../lib/types").
|
|
23
|
+
data: TSendApi.SendMailMessageResponse;
|
|
24
|
+
error: import("../lib/types").HttpClientError;
|
|
25
25
|
}>;
|
|
26
26
|
/**
|
|
27
27
|
* This API method Creates and sends a new mail broadcast.
|
|
@@ -41,8 +41,8 @@ export declare class SendApi<const I extends readonly string[], const T extends
|
|
|
41
41
|
* @see {@link https://docs.ensend.co/send/mail-broadast | More about personalization in the documentation}
|
|
42
42
|
*/
|
|
43
43
|
SendMailBroadcast(dto: TSendApi.SendMailBroadcastDto<I, T>): Promise<{
|
|
44
|
-
data:
|
|
45
|
-
error: import("../lib/types").
|
|
44
|
+
data: TSendApi.SendMailBroadcastResponse;
|
|
45
|
+
error: import("../lib/types").HttpClientError;
|
|
46
46
|
}>;
|
|
47
47
|
/**
|
|
48
48
|
* This API method sends a mail message to new recipients in a broadcast.
|
|
@@ -57,8 +57,8 @@ export declare class SendApi<const I extends readonly string[], const T extends
|
|
|
57
57
|
* @see {@link https://docs.ensend.co/send/mail-broadcast | More in the documentation}
|
|
58
58
|
*/
|
|
59
59
|
SendExistingMailBroadcast(dto: TSendApi.SendExistingMailBroadcastDto): Promise<{
|
|
60
|
-
data:
|
|
61
|
-
error: import("../lib/types").
|
|
60
|
+
data: TSendApi.SendMailBroadcastResponse;
|
|
61
|
+
error: import("../lib/types").HttpClientError;
|
|
62
62
|
}>;
|
|
63
63
|
}
|
|
64
64
|
export declare namespace TSendApi {
|
|
@@ -104,9 +104,9 @@ export declare namespace TSendApi {
|
|
|
104
104
|
variables?: Record<string, string>;
|
|
105
105
|
};
|
|
106
106
|
}, "message" | "template">;
|
|
107
|
-
export type SendMailMessageResponse = {
|
|
107
|
+
export type SendMailMessageResponse = HttpClientResponse<{
|
|
108
108
|
ref: string;
|
|
109
|
-
}
|
|
109
|
+
}>;
|
|
110
110
|
export type SendMailBroadcastDto<I extends readonly string[] = [], T extends readonly string[] = []> = {
|
|
111
111
|
subject: string;
|
|
112
112
|
sender: I[number] | {
|
|
@@ -159,11 +159,11 @@ export declare namespace TSendApi {
|
|
|
159
159
|
address: string;
|
|
160
160
|
}>;
|
|
161
161
|
};
|
|
162
|
-
export type SendMailBroadcastResponse = {
|
|
162
|
+
export type SendMailBroadcastResponse = HttpClientResponse<{
|
|
163
163
|
broadcast: {
|
|
164
164
|
ref: string;
|
|
165
165
|
status: string;
|
|
166
166
|
};
|
|
167
|
-
}
|
|
167
|
+
}>;
|
|
168
168
|
export {};
|
|
169
169
|
}
|
package/dist/lib/types.d.ts
CHANGED
|
@@ -8,9 +8,13 @@ export type HttpClientResponse<T = undefined> = {
|
|
|
8
8
|
statusCode: number;
|
|
9
9
|
data: T;
|
|
10
10
|
} | null;
|
|
11
|
-
export type
|
|
12
|
-
|
|
13
|
-
|
|
11
|
+
export type HttpClientError = {
|
|
12
|
+
message: string;
|
|
13
|
+
statusCode: number;
|
|
14
|
+
} | null;
|
|
15
|
+
export type HttpClient = <T extends HttpClientResponse<Record<string, any>>>(body: HttpClientOptions) => Promise<{
|
|
16
|
+
data: T;
|
|
17
|
+
error: HttpClientError;
|
|
14
18
|
}>;
|
|
15
19
|
export type ClientOptions<I extends readonly string[], T extends readonly string[]> = {
|
|
16
20
|
secret: string;
|
package/package.json
CHANGED