plenna_utilities 1.5.2 → 1.6.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.
|
@@ -1,7 +1,9 @@
|
|
|
1
|
-
import { type SendPushRequestOptions } from 'customerio-node/dist/lib/api/requests';
|
|
1
|
+
import { type SendEmailRequestOptions, type SendPushRequestOptions } from 'customerio-node/dist/lib/api/requests';
|
|
2
2
|
export type PushRequestOptions = SendPushRequestOptions;
|
|
3
|
+
export type EmailRequestOptions = SendEmailRequestOptions;
|
|
3
4
|
export declare class CustomerIo {
|
|
4
5
|
private readonly key;
|
|
5
6
|
constructor(key: string);
|
|
6
7
|
sendPushNotification(requestOptions: PushRequestOptions): Promise<boolean>;
|
|
8
|
+
sendEmail(requestOptions: EmailRequestOptions): Promise<boolean>;
|
|
7
9
|
}
|
|
@@ -20,5 +20,18 @@ class CustomerIo {
|
|
|
20
20
|
return false;
|
|
21
21
|
}
|
|
22
22
|
}
|
|
23
|
+
async sendEmail(requestOptions) {
|
|
24
|
+
try {
|
|
25
|
+
const request = new customerio_node_1.SendEmailRequest(requestOptions);
|
|
26
|
+
const api = new customerio_node_1.APIClient(this.key, { region: customerio_node_1.RegionUS });
|
|
27
|
+
const response = await api.sendEmail(request);
|
|
28
|
+
console.log('Sent email success: ', response);
|
|
29
|
+
return true;
|
|
30
|
+
}
|
|
31
|
+
catch (error) {
|
|
32
|
+
console.error('Failed to send email: ', error);
|
|
33
|
+
return false;
|
|
34
|
+
}
|
|
35
|
+
}
|
|
23
36
|
}
|
|
24
37
|
exports.CustomerIo = CustomerIo;
|