@keystrokehq/resend 0.0.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.
- package/README.md +184 -0
- package/dist/_official/index.d.mts +2 -0
- package/dist/_official/index.mjs +3 -0
- package/dist/_runtime/index.d.mts +1 -0
- package/dist/_runtime/index.mjs +1 -0
- package/dist/api-keys.d.mts +67 -0
- package/dist/api-keys.mjs +90 -0
- package/dist/broadcasts.d.mts +238 -0
- package/dist/broadcasts.mjs +178 -0
- package/dist/client.d.mts +27 -0
- package/dist/client.mjs +40 -0
- package/dist/connection.d.mts +2 -0
- package/dist/connection.mjs +3 -0
- package/dist/contact-properties.d.mts +139 -0
- package/dist/contact-properties.mjs +115 -0
- package/dist/contacts.d.mts +218 -0
- package/dist/contacts.mjs +225 -0
- package/dist/domains.d.mts +293 -0
- package/dist/domains.mjs +160 -0
- package/dist/emails-receiving.d.mts +177 -0
- package/dist/emails-receiving.mjs +114 -0
- package/dist/emails.d.mts +307 -0
- package/dist/emails.mjs +241 -0
- package/dist/events.d.mts +571 -0
- package/dist/events.mjs +178 -0
- package/dist/factory-B3VyPRsL.mjs +8 -0
- package/dist/index.d.mts +1 -0
- package/dist/index.mjs +1 -0
- package/dist/integration-BR1nTAnU.mjs +28 -0
- package/dist/integration-ClH0F7x-.d.mts +49 -0
- package/dist/logs.d.mts +71 -0
- package/dist/logs.mjs +61 -0
- package/dist/schemas.d.mts +77 -0
- package/dist/schemas.mjs +68 -0
- package/dist/segments.d.mts +112 -0
- package/dist/segments.mjs +120 -0
- package/dist/templates.d.mts +193 -0
- package/dist/templates.mjs +151 -0
- package/dist/topics.d.mts +125 -0
- package/dist/topics.mjs +113 -0
- package/dist/triggers.d.mts +68 -0
- package/dist/triggers.mjs +141 -0
- package/dist/verification.d.mts +49 -0
- package/dist/verification.mjs +139 -0
- package/dist/webhooks.d.mts +285 -0
- package/dist/webhooks.mjs +124 -0
- package/package.json +137 -0
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
import { createResendClient } from "./client.mjs";
|
|
2
|
+
import { paginationQuerySchema, resendListEnvelope } from "./schemas.mjs";
|
|
3
|
+
import { t as resendOperation } from "./factory-B3VyPRsL.mjs";
|
|
4
|
+
import { z } from "zod";
|
|
5
|
+
|
|
6
|
+
//#region src/emails-receiving.ts
|
|
7
|
+
/**
|
|
8
|
+
* resend/emails-receiving.ts
|
|
9
|
+
*
|
|
10
|
+
* Inbound / received-email operations backed by the Resend
|
|
11
|
+
* `/emails/receiving` endpoints.
|
|
12
|
+
*
|
|
13
|
+
* Covers every operation listed in PLAN.md § 6.2:
|
|
14
|
+
*
|
|
15
|
+
* - GET /emails/receiving → listReceivedEmails
|
|
16
|
+
* - GET /emails/receiving/{id} → retrieveReceivedEmail
|
|
17
|
+
* - GET /emails/receiving/{id}/attachments → listReceivedAttachments
|
|
18
|
+
* - GET /emails/receiving/{id}/attachments/{aid} → retrieveReceivedAttachment
|
|
19
|
+
*
|
|
20
|
+
* Path note: PLAN.md § 6.2 initially speculated `/emails/received/*`.
|
|
21
|
+
* Verified against Resend docs + SDK + CLI: the canonical path is
|
|
22
|
+
* `/emails/receiving/*`. PLAN.md is updated in the same commit as this
|
|
23
|
+
* file. See IMPLEMENTATION_NOTES.md § 7 correction #1.
|
|
24
|
+
*/
|
|
25
|
+
const receivedAttachmentSummarySchema = z.object({
|
|
26
|
+
id: z.string(),
|
|
27
|
+
filename: z.string().optional(),
|
|
28
|
+
content_type: z.string().optional(),
|
|
29
|
+
content_id: z.string().nullable().optional(),
|
|
30
|
+
content_disposition: z.string().nullable().optional(),
|
|
31
|
+
size: z.number().optional()
|
|
32
|
+
}).passthrough();
|
|
33
|
+
const receivedAttachmentDetailSchema = receivedAttachmentSummarySchema.extend({ url: z.string().optional() }).passthrough();
|
|
34
|
+
const receivedEmailSummarySchema = z.object({
|
|
35
|
+
id: z.string(),
|
|
36
|
+
object: z.literal("email").optional(),
|
|
37
|
+
created_at: z.string().optional(),
|
|
38
|
+
to: z.array(z.string()).optional(),
|
|
39
|
+
from: z.string().optional(),
|
|
40
|
+
bcc: z.array(z.string()).optional(),
|
|
41
|
+
cc: z.array(z.string()).optional(),
|
|
42
|
+
reply_to: z.array(z.string()).optional(),
|
|
43
|
+
subject: z.string().optional(),
|
|
44
|
+
message_id: z.string().optional(),
|
|
45
|
+
attachments: z.array(receivedAttachmentSummarySchema).optional()
|
|
46
|
+
}).passthrough();
|
|
47
|
+
const receivedEmailDetailSchema = receivedEmailSummarySchema.extend({
|
|
48
|
+
html: z.string().nullable().optional(),
|
|
49
|
+
text: z.string().nullable().optional(),
|
|
50
|
+
headers: z.record(z.string(), z.string()).optional()
|
|
51
|
+
}).passthrough();
|
|
52
|
+
const listReceivedEmailsResponseSchema = resendListEnvelope(receivedEmailSummarySchema);
|
|
53
|
+
const listReceivedAttachmentsResponseSchema = resendListEnvelope(receivedAttachmentSummarySchema);
|
|
54
|
+
const listReceivedEmails = resendOperation({
|
|
55
|
+
id: "list_resend_received_emails",
|
|
56
|
+
name: "List Resend Received Emails",
|
|
57
|
+
description: "List inbound (received) emails for the authenticated team.",
|
|
58
|
+
input: paginationQuerySchema,
|
|
59
|
+
output: listReceivedEmailsResponseSchema,
|
|
60
|
+
run: async (input, credentials) => {
|
|
61
|
+
return createResendClient(credentials).request({
|
|
62
|
+
method: "GET",
|
|
63
|
+
path: "/emails/receiving",
|
|
64
|
+
query: input
|
|
65
|
+
});
|
|
66
|
+
}
|
|
67
|
+
});
|
|
68
|
+
const retrieveReceivedEmail = resendOperation({
|
|
69
|
+
id: "retrieve_resend_received_email",
|
|
70
|
+
name: "Retrieve Resend Received Email",
|
|
71
|
+
description: "Retrieve a single received email with its body, headers, and attachment metadata.",
|
|
72
|
+
input: z.object({ id: z.string().min(1) }),
|
|
73
|
+
output: receivedEmailDetailSchema,
|
|
74
|
+
run: async (input, credentials) => {
|
|
75
|
+
return createResendClient(credentials).request({
|
|
76
|
+
method: "GET",
|
|
77
|
+
path: `/emails/receiving/${encodeURIComponent(input.id)}`
|
|
78
|
+
});
|
|
79
|
+
}
|
|
80
|
+
});
|
|
81
|
+
const listReceivedAttachments = resendOperation({
|
|
82
|
+
id: "list_resend_received_email_attachments",
|
|
83
|
+
name: "List Resend Received Email Attachments",
|
|
84
|
+
description: "List attachments on a single received email.",
|
|
85
|
+
input: paginationQuerySchema.extend({ email_id: z.string().min(1) }),
|
|
86
|
+
output: listReceivedAttachmentsResponseSchema,
|
|
87
|
+
run: async (input, credentials) => {
|
|
88
|
+
const { email_id, ...query } = input;
|
|
89
|
+
return createResendClient(credentials).request({
|
|
90
|
+
method: "GET",
|
|
91
|
+
path: `/emails/receiving/${encodeURIComponent(email_id)}/attachments`,
|
|
92
|
+
query
|
|
93
|
+
});
|
|
94
|
+
}
|
|
95
|
+
});
|
|
96
|
+
const retrieveReceivedAttachment = resendOperation({
|
|
97
|
+
id: "retrieve_resend_received_email_attachment",
|
|
98
|
+
name: "Retrieve Resend Received Email Attachment",
|
|
99
|
+
description: "Retrieve a single attachment from a received email. Response includes a time-limited signed URL for the binary body.",
|
|
100
|
+
input: z.object({
|
|
101
|
+
email_id: z.string().min(1),
|
|
102
|
+
attachment_id: z.string().min(1)
|
|
103
|
+
}),
|
|
104
|
+
output: receivedAttachmentDetailSchema,
|
|
105
|
+
run: async (input, credentials) => {
|
|
106
|
+
return createResendClient(credentials).request({
|
|
107
|
+
method: "GET",
|
|
108
|
+
path: `/emails/receiving/${encodeURIComponent(input.email_id)}/attachments/${encodeURIComponent(input.attachment_id)}`
|
|
109
|
+
});
|
|
110
|
+
}
|
|
111
|
+
});
|
|
112
|
+
|
|
113
|
+
//#endregion
|
|
114
|
+
export { listReceivedAttachments, listReceivedEmails, retrieveReceivedAttachment, retrieveReceivedEmail };
|
|
@@ -0,0 +1,307 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import * as _keystrokehq_core_credential_set0 from "@keystrokehq/core/credential-set";
|
|
3
|
+
import * as _keystrokehq_core0 from "@keystrokehq/core";
|
|
4
|
+
|
|
5
|
+
//#region src/emails.d.ts
|
|
6
|
+
/** Input accepted by `sendEmail`. Includes attachments + scheduling. */
|
|
7
|
+
declare const sendEmailInputSchema: z.ZodObject<{
|
|
8
|
+
from: z.ZodString;
|
|
9
|
+
to: z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>]>;
|
|
10
|
+
subject: z.ZodOptional<z.ZodString>;
|
|
11
|
+
cc: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>]>>;
|
|
12
|
+
bcc: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>]>>;
|
|
13
|
+
reply_to: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>]>>;
|
|
14
|
+
html: z.ZodOptional<z.ZodString>;
|
|
15
|
+
text: z.ZodOptional<z.ZodString>;
|
|
16
|
+
headers: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
17
|
+
tags: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
18
|
+
name: z.ZodString;
|
|
19
|
+
value: z.ZodString;
|
|
20
|
+
}, z.core.$strip>>>;
|
|
21
|
+
topic_id: z.ZodOptional<z.ZodString>;
|
|
22
|
+
template: z.ZodOptional<z.ZodObject<{
|
|
23
|
+
id: z.ZodString;
|
|
24
|
+
variables: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>>>;
|
|
25
|
+
}, z.core.$strip>>;
|
|
26
|
+
attachments: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
27
|
+
filename: z.ZodString;
|
|
28
|
+
content: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodCustom<Uint8Array<ArrayBuffer>, Uint8Array<ArrayBuffer>>]>>;
|
|
29
|
+
path: z.ZodOptional<z.ZodString>;
|
|
30
|
+
content_type: z.ZodOptional<z.ZodString>;
|
|
31
|
+
content_id: z.ZodOptional<z.ZodString>;
|
|
32
|
+
}, z.core.$strip>>>;
|
|
33
|
+
scheduled_at: z.ZodOptional<z.ZodString>;
|
|
34
|
+
idempotency_key: z.ZodOptional<z.ZodString>;
|
|
35
|
+
}, z.core.$strip>;
|
|
36
|
+
/** Input accepted by `sendBatchEmails`. Up to 100 messages per request. */
|
|
37
|
+
declare const batchSendInputSchema: z.ZodObject<{
|
|
38
|
+
emails: z.ZodArray<z.ZodObject<{
|
|
39
|
+
from: z.ZodString;
|
|
40
|
+
to: z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>]>;
|
|
41
|
+
subject: z.ZodOptional<z.ZodString>;
|
|
42
|
+
cc: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>]>>;
|
|
43
|
+
bcc: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>]>>;
|
|
44
|
+
reply_to: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>]>>;
|
|
45
|
+
html: z.ZodOptional<z.ZodString>;
|
|
46
|
+
text: z.ZodOptional<z.ZodString>;
|
|
47
|
+
headers: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
48
|
+
tags: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
49
|
+
name: z.ZodString;
|
|
50
|
+
value: z.ZodString;
|
|
51
|
+
}, z.core.$strip>>>;
|
|
52
|
+
topic_id: z.ZodOptional<z.ZodString>;
|
|
53
|
+
template: z.ZodOptional<z.ZodObject<{
|
|
54
|
+
id: z.ZodString;
|
|
55
|
+
variables: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>>>;
|
|
56
|
+
}, z.core.$strip>>;
|
|
57
|
+
}, z.core.$strip>>;
|
|
58
|
+
idempotency_key: z.ZodOptional<z.ZodString>;
|
|
59
|
+
}, z.core.$strip>;
|
|
60
|
+
declare const emailSummarySchema: z.ZodObject<{
|
|
61
|
+
id: z.ZodString;
|
|
62
|
+
object: z.ZodOptional<z.ZodLiteral<"email">>;
|
|
63
|
+
created_at: z.ZodOptional<z.ZodString>;
|
|
64
|
+
to: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
65
|
+
from: z.ZodOptional<z.ZodString>;
|
|
66
|
+
subject: z.ZodOptional<z.ZodString>;
|
|
67
|
+
bcc: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
68
|
+
cc: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
69
|
+
reply_to: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
70
|
+
last_event: z.ZodOptional<z.ZodString>;
|
|
71
|
+
scheduled_at: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
72
|
+
}, z.core.$loose>;
|
|
73
|
+
declare const emailDetailSchema: z.ZodObject<{
|
|
74
|
+
id: z.ZodString;
|
|
75
|
+
object: z.ZodOptional<z.ZodLiteral<"email">>;
|
|
76
|
+
created_at: z.ZodOptional<z.ZodString>;
|
|
77
|
+
to: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
78
|
+
from: z.ZodOptional<z.ZodString>;
|
|
79
|
+
subject: z.ZodOptional<z.ZodString>;
|
|
80
|
+
bcc: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
81
|
+
cc: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
82
|
+
reply_to: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
83
|
+
last_event: z.ZodOptional<z.ZodString>;
|
|
84
|
+
scheduled_at: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
85
|
+
html: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
86
|
+
text: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
87
|
+
headers: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
88
|
+
tags: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
89
|
+
name: z.ZodString;
|
|
90
|
+
value: z.ZodString;
|
|
91
|
+
}, z.core.$strip>>>;
|
|
92
|
+
}, z.core.$loose>;
|
|
93
|
+
declare const attachmentSummarySchema: z.ZodObject<{
|
|
94
|
+
id: z.ZodString;
|
|
95
|
+
filename: z.ZodOptional<z.ZodString>;
|
|
96
|
+
content_type: z.ZodOptional<z.ZodString>;
|
|
97
|
+
content_id: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
98
|
+
content_disposition: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
99
|
+
size: z.ZodOptional<z.ZodNumber>;
|
|
100
|
+
}, z.core.$loose>;
|
|
101
|
+
declare const attachmentDetailSchema: z.ZodObject<{
|
|
102
|
+
id: z.ZodString;
|
|
103
|
+
filename: z.ZodOptional<z.ZodString>;
|
|
104
|
+
content_type: z.ZodOptional<z.ZodString>;
|
|
105
|
+
content_id: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
106
|
+
content_disposition: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
107
|
+
size: z.ZodOptional<z.ZodNumber>;
|
|
108
|
+
url: z.ZodOptional<z.ZodString>;
|
|
109
|
+
}, z.core.$loose>;
|
|
110
|
+
declare const sendEmail: _keystrokehq_core0.Operation<z.ZodObject<{
|
|
111
|
+
from: z.ZodString;
|
|
112
|
+
to: z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>]>;
|
|
113
|
+
subject: z.ZodOptional<z.ZodString>;
|
|
114
|
+
cc: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>]>>;
|
|
115
|
+
bcc: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>]>>;
|
|
116
|
+
reply_to: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>]>>;
|
|
117
|
+
html: z.ZodOptional<z.ZodString>;
|
|
118
|
+
text: z.ZodOptional<z.ZodString>;
|
|
119
|
+
headers: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
120
|
+
tags: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
121
|
+
name: z.ZodString;
|
|
122
|
+
value: z.ZodString;
|
|
123
|
+
}, z.core.$strip>>>;
|
|
124
|
+
topic_id: z.ZodOptional<z.ZodString>;
|
|
125
|
+
template: z.ZodOptional<z.ZodObject<{
|
|
126
|
+
id: z.ZodString;
|
|
127
|
+
variables: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>>>;
|
|
128
|
+
}, z.core.$strip>>;
|
|
129
|
+
attachments: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
130
|
+
filename: z.ZodString;
|
|
131
|
+
content: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodCustom<Uint8Array<ArrayBuffer>, Uint8Array<ArrayBuffer>>]>>;
|
|
132
|
+
path: z.ZodOptional<z.ZodString>;
|
|
133
|
+
content_type: z.ZodOptional<z.ZodString>;
|
|
134
|
+
content_id: z.ZodOptional<z.ZodString>;
|
|
135
|
+
}, z.core.$strip>>>;
|
|
136
|
+
scheduled_at: z.ZodOptional<z.ZodString>;
|
|
137
|
+
idempotency_key: z.ZodOptional<z.ZodString>;
|
|
138
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
139
|
+
id: z.ZodString;
|
|
140
|
+
}, z.core.$strip>, readonly [_keystrokehq_core0.CredentialSet<"resend", z.ZodObject<{
|
|
141
|
+
RESEND_API_KEY: z.ZodString;
|
|
142
|
+
RESEND_WEBHOOK_SIGNING_SECRETS: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
143
|
+
}, z.core.$strip>, readonly _keystrokehq_core_credential_set0.CredentialConnection<z.ZodObject<{
|
|
144
|
+
RESEND_API_KEY: z.ZodString;
|
|
145
|
+
RESEND_WEBHOOK_SIGNING_SECRETS: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
146
|
+
}, z.core.$strip>>[] | undefined>], undefined>;
|
|
147
|
+
declare const sendBatchEmails: _keystrokehq_core0.Operation<z.ZodObject<{
|
|
148
|
+
emails: z.ZodArray<z.ZodObject<{
|
|
149
|
+
from: z.ZodString;
|
|
150
|
+
to: z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>]>;
|
|
151
|
+
subject: z.ZodOptional<z.ZodString>;
|
|
152
|
+
cc: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>]>>;
|
|
153
|
+
bcc: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>]>>;
|
|
154
|
+
reply_to: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>]>>;
|
|
155
|
+
html: z.ZodOptional<z.ZodString>;
|
|
156
|
+
text: z.ZodOptional<z.ZodString>;
|
|
157
|
+
headers: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
158
|
+
tags: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
159
|
+
name: z.ZodString;
|
|
160
|
+
value: z.ZodString;
|
|
161
|
+
}, z.core.$strip>>>;
|
|
162
|
+
topic_id: z.ZodOptional<z.ZodString>;
|
|
163
|
+
template: z.ZodOptional<z.ZodObject<{
|
|
164
|
+
id: z.ZodString;
|
|
165
|
+
variables: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>>>;
|
|
166
|
+
}, z.core.$strip>>;
|
|
167
|
+
}, z.core.$strip>>;
|
|
168
|
+
idempotency_key: z.ZodOptional<z.ZodString>;
|
|
169
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
170
|
+
data: z.ZodArray<z.ZodObject<{
|
|
171
|
+
id: z.ZodString;
|
|
172
|
+
}, z.core.$strip>>;
|
|
173
|
+
}, z.core.$strip>, readonly [_keystrokehq_core0.CredentialSet<"resend", z.ZodObject<{
|
|
174
|
+
RESEND_API_KEY: z.ZodString;
|
|
175
|
+
RESEND_WEBHOOK_SIGNING_SECRETS: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
176
|
+
}, z.core.$strip>, readonly _keystrokehq_core_credential_set0.CredentialConnection<z.ZodObject<{
|
|
177
|
+
RESEND_API_KEY: z.ZodString;
|
|
178
|
+
RESEND_WEBHOOK_SIGNING_SECRETS: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
179
|
+
}, z.core.$strip>>[] | undefined>], undefined>;
|
|
180
|
+
declare const listSentEmails: _keystrokehq_core0.Operation<z.ZodObject<{
|
|
181
|
+
limit: z.ZodOptional<z.ZodNumber>;
|
|
182
|
+
after: z.ZodOptional<z.ZodString>;
|
|
183
|
+
before: z.ZodOptional<z.ZodString>;
|
|
184
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
185
|
+
object: z.ZodLiteral<"list">;
|
|
186
|
+
has_more: z.ZodBoolean;
|
|
187
|
+
data: z.ZodArray<z.ZodObject<{
|
|
188
|
+
id: z.ZodString;
|
|
189
|
+
object: z.ZodOptional<z.ZodLiteral<"email">>;
|
|
190
|
+
created_at: z.ZodOptional<z.ZodString>;
|
|
191
|
+
to: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
192
|
+
from: z.ZodOptional<z.ZodString>;
|
|
193
|
+
subject: z.ZodOptional<z.ZodString>;
|
|
194
|
+
bcc: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
195
|
+
cc: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
196
|
+
reply_to: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
197
|
+
last_event: z.ZodOptional<z.ZodString>;
|
|
198
|
+
scheduled_at: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
199
|
+
}, z.core.$loose>>;
|
|
200
|
+
}, z.core.$strip>, readonly [_keystrokehq_core0.CredentialSet<"resend", z.ZodObject<{
|
|
201
|
+
RESEND_API_KEY: z.ZodString;
|
|
202
|
+
RESEND_WEBHOOK_SIGNING_SECRETS: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
203
|
+
}, z.core.$strip>, readonly _keystrokehq_core_credential_set0.CredentialConnection<z.ZodObject<{
|
|
204
|
+
RESEND_API_KEY: z.ZodString;
|
|
205
|
+
RESEND_WEBHOOK_SIGNING_SECRETS: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
206
|
+
}, z.core.$strip>>[] | undefined>], undefined>;
|
|
207
|
+
declare const retrieveEmail: _keystrokehq_core0.Operation<z.ZodObject<{
|
|
208
|
+
id: z.ZodString;
|
|
209
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
210
|
+
id: z.ZodString;
|
|
211
|
+
object: z.ZodOptional<z.ZodLiteral<"email">>;
|
|
212
|
+
created_at: z.ZodOptional<z.ZodString>;
|
|
213
|
+
to: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
214
|
+
from: z.ZodOptional<z.ZodString>;
|
|
215
|
+
subject: z.ZodOptional<z.ZodString>;
|
|
216
|
+
bcc: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
217
|
+
cc: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
218
|
+
reply_to: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
219
|
+
last_event: z.ZodOptional<z.ZodString>;
|
|
220
|
+
scheduled_at: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
221
|
+
html: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
222
|
+
text: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
223
|
+
headers: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
224
|
+
tags: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
225
|
+
name: z.ZodString;
|
|
226
|
+
value: z.ZodString;
|
|
227
|
+
}, z.core.$strip>>>;
|
|
228
|
+
}, z.core.$loose>, readonly [_keystrokehq_core0.CredentialSet<"resend", z.ZodObject<{
|
|
229
|
+
RESEND_API_KEY: z.ZodString;
|
|
230
|
+
RESEND_WEBHOOK_SIGNING_SECRETS: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
231
|
+
}, z.core.$strip>, readonly _keystrokehq_core_credential_set0.CredentialConnection<z.ZodObject<{
|
|
232
|
+
RESEND_API_KEY: z.ZodString;
|
|
233
|
+
RESEND_WEBHOOK_SIGNING_SECRETS: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
234
|
+
}, z.core.$strip>>[] | undefined>], undefined>;
|
|
235
|
+
declare const updateScheduledEmail: _keystrokehq_core0.Operation<z.ZodObject<{
|
|
236
|
+
id: z.ZodString;
|
|
237
|
+
scheduled_at: z.ZodOptional<z.ZodString>;
|
|
238
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
239
|
+
id: z.ZodString;
|
|
240
|
+
}, z.core.$strip>, readonly [_keystrokehq_core0.CredentialSet<"resend", z.ZodObject<{
|
|
241
|
+
RESEND_API_KEY: z.ZodString;
|
|
242
|
+
RESEND_WEBHOOK_SIGNING_SECRETS: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
243
|
+
}, z.core.$strip>, readonly _keystrokehq_core_credential_set0.CredentialConnection<z.ZodObject<{
|
|
244
|
+
RESEND_API_KEY: z.ZodString;
|
|
245
|
+
RESEND_WEBHOOK_SIGNING_SECRETS: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
246
|
+
}, z.core.$strip>>[] | undefined>], undefined>;
|
|
247
|
+
declare const cancelScheduledEmail: _keystrokehq_core0.Operation<z.ZodObject<{
|
|
248
|
+
id: z.ZodString;
|
|
249
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
250
|
+
object: z.ZodOptional<z.ZodLiteral<"email">>;
|
|
251
|
+
id: z.ZodString;
|
|
252
|
+
}, z.core.$strip>, readonly [_keystrokehq_core0.CredentialSet<"resend", z.ZodObject<{
|
|
253
|
+
RESEND_API_KEY: z.ZodString;
|
|
254
|
+
RESEND_WEBHOOK_SIGNING_SECRETS: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
255
|
+
}, z.core.$strip>, readonly _keystrokehq_core_credential_set0.CredentialConnection<z.ZodObject<{
|
|
256
|
+
RESEND_API_KEY: z.ZodString;
|
|
257
|
+
RESEND_WEBHOOK_SIGNING_SECRETS: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
258
|
+
}, z.core.$strip>>[] | undefined>], undefined>;
|
|
259
|
+
declare const listSentAttachments: _keystrokehq_core0.Operation<z.ZodObject<{
|
|
260
|
+
limit: z.ZodOptional<z.ZodNumber>;
|
|
261
|
+
after: z.ZodOptional<z.ZodString>;
|
|
262
|
+
before: z.ZodOptional<z.ZodString>;
|
|
263
|
+
email_id: z.ZodString;
|
|
264
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
265
|
+
object: z.ZodLiteral<"list">;
|
|
266
|
+
has_more: z.ZodBoolean;
|
|
267
|
+
data: z.ZodArray<z.ZodObject<{
|
|
268
|
+
id: z.ZodString;
|
|
269
|
+
filename: z.ZodOptional<z.ZodString>;
|
|
270
|
+
content_type: z.ZodOptional<z.ZodString>;
|
|
271
|
+
content_id: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
272
|
+
content_disposition: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
273
|
+
size: z.ZodOptional<z.ZodNumber>;
|
|
274
|
+
}, z.core.$loose>>;
|
|
275
|
+
}, z.core.$strip>, readonly [_keystrokehq_core0.CredentialSet<"resend", z.ZodObject<{
|
|
276
|
+
RESEND_API_KEY: z.ZodString;
|
|
277
|
+
RESEND_WEBHOOK_SIGNING_SECRETS: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
278
|
+
}, z.core.$strip>, readonly _keystrokehq_core_credential_set0.CredentialConnection<z.ZodObject<{
|
|
279
|
+
RESEND_API_KEY: z.ZodString;
|
|
280
|
+
RESEND_WEBHOOK_SIGNING_SECRETS: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
281
|
+
}, z.core.$strip>>[] | undefined>], undefined>;
|
|
282
|
+
declare const retrieveSentAttachment: _keystrokehq_core0.Operation<z.ZodObject<{
|
|
283
|
+
email_id: z.ZodString;
|
|
284
|
+
attachment_id: z.ZodString;
|
|
285
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
286
|
+
id: z.ZodString;
|
|
287
|
+
filename: z.ZodOptional<z.ZodString>;
|
|
288
|
+
content_type: z.ZodOptional<z.ZodString>;
|
|
289
|
+
content_id: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
290
|
+
content_disposition: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
291
|
+
size: z.ZodOptional<z.ZodNumber>;
|
|
292
|
+
url: z.ZodOptional<z.ZodString>;
|
|
293
|
+
}, z.core.$loose>, readonly [_keystrokehq_core0.CredentialSet<"resend", z.ZodObject<{
|
|
294
|
+
RESEND_API_KEY: z.ZodString;
|
|
295
|
+
RESEND_WEBHOOK_SIGNING_SECRETS: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
296
|
+
}, z.core.$strip>, readonly _keystrokehq_core_credential_set0.CredentialConnection<z.ZodObject<{
|
|
297
|
+
RESEND_API_KEY: z.ZodString;
|
|
298
|
+
RESEND_WEBHOOK_SIGNING_SECRETS: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
299
|
+
}, z.core.$strip>>[] | undefined>], undefined>;
|
|
300
|
+
type ResendSendEmailInput = z.infer<typeof sendEmailInputSchema>;
|
|
301
|
+
type ResendBatchSendInput = z.infer<typeof batchSendInputSchema>;
|
|
302
|
+
type ResendEmailSummary = z.infer<typeof emailSummarySchema>;
|
|
303
|
+
type ResendEmailDetail = z.infer<typeof emailDetailSchema>;
|
|
304
|
+
type ResendAttachmentSummary = z.infer<typeof attachmentSummarySchema>;
|
|
305
|
+
type ResendAttachmentDetail = z.infer<typeof attachmentDetailSchema>;
|
|
306
|
+
//#endregion
|
|
307
|
+
export { ResendAttachmentDetail, ResendAttachmentSummary, ResendBatchSendInput, ResendEmailDetail, ResendEmailSummary, ResendSendEmailInput, cancelScheduledEmail, listSentAttachments, listSentEmails, retrieveEmail, retrieveSentAttachment, sendBatchEmails, sendEmail, updateScheduledEmail };
|
package/dist/emails.mjs
ADDED
|
@@ -0,0 +1,241 @@
|
|
|
1
|
+
import { createResendClient } from "./client.mjs";
|
|
2
|
+
import { paginationQuerySchema, resendListEnvelope } from "./schemas.mjs";
|
|
3
|
+
import { t as resendOperation } from "./factory-B3VyPRsL.mjs";
|
|
4
|
+
import { z } from "zod";
|
|
5
|
+
|
|
6
|
+
//#region src/emails.ts
|
|
7
|
+
/**
|
|
8
|
+
* resend/emails.ts
|
|
9
|
+
*
|
|
10
|
+
* Transactional + scheduled email operations backed by the Resend
|
|
11
|
+
* `/emails` endpoints. Covers every operation listed in PLAN.md § 6.1:
|
|
12
|
+
*
|
|
13
|
+
* - POST /emails → sendEmail
|
|
14
|
+
* - POST /emails/batch → sendBatchEmails
|
|
15
|
+
* - GET /emails → listSentEmails
|
|
16
|
+
* - GET /emails/{id} → retrieveEmail
|
|
17
|
+
* - PATCH /emails/{id} → updateScheduledEmail
|
|
18
|
+
* - POST /emails/{id}/cancel → cancelScheduledEmail
|
|
19
|
+
* - GET /emails/{id}/attachments → listSentAttachments
|
|
20
|
+
* - GET /emails/{id}/attachments/{aid} → retrieveSentAttachment
|
|
21
|
+
*
|
|
22
|
+
* The `react` body field from the official Resend SDK is not accepted:
|
|
23
|
+
* we do not render React server-side (see IMPLEMENTATION_NOTES.md § 3).
|
|
24
|
+
* Callers render to HTML upstream and pass `html`.
|
|
25
|
+
*/
|
|
26
|
+
/** A single recipient or an array (max 50 per Resend docs). */
|
|
27
|
+
const recipientsSchema = z.union([z.string().min(1), z.array(z.string().min(1)).min(1).max(50)]);
|
|
28
|
+
/** Email attachment. Exactly one of `content` or `path` must be provided. */
|
|
29
|
+
const attachmentSchema = z.object({
|
|
30
|
+
filename: z.string().min(1),
|
|
31
|
+
content: z.union([z.string(), z.instanceof(Uint8Array)]).optional(),
|
|
32
|
+
path: z.string().optional(),
|
|
33
|
+
content_type: z.string().optional(),
|
|
34
|
+
content_id: z.string().optional()
|
|
35
|
+
}).refine((a) => a.content !== void 0 || a.path !== void 0, { message: "Attachment requires either `content` or `path`." });
|
|
36
|
+
const tagSchema = z.object({
|
|
37
|
+
name: z.string().min(1).max(256).regex(/^[A-Za-z0-9_-]+$/, "Tag name may only contain a–z, A–Z, 0–9, underscore, dash."),
|
|
38
|
+
value: z.string().min(1).max(256).regex(/^[A-Za-z0-9_-]+$/, "Tag value may only contain a–z, A–Z, 0–9, underscore, dash.")
|
|
39
|
+
});
|
|
40
|
+
const templateVariablesSchema = z.record(z.string().regex(/^[A-Za-z0-9_]+$/).max(50), z.union([z.string().max(2e3), z.number().safe()]));
|
|
41
|
+
const templateRefSchema = z.object({
|
|
42
|
+
id: z.string().min(1),
|
|
43
|
+
variables: templateVariablesSchema.optional()
|
|
44
|
+
});
|
|
45
|
+
/**
|
|
46
|
+
* Body accepted by both `POST /emails` and (with a handful of
|
|
47
|
+
* restrictions) `POST /emails/batch`.
|
|
48
|
+
*
|
|
49
|
+
* Accepts either `html`/`text` or `template`. Rejects `react` — see
|
|
50
|
+
* module-level comment.
|
|
51
|
+
*/
|
|
52
|
+
const commonSendFieldsSchema = z.object({
|
|
53
|
+
from: z.string().min(1),
|
|
54
|
+
to: recipientsSchema,
|
|
55
|
+
subject: z.string().optional(),
|
|
56
|
+
cc: recipientsSchema.optional(),
|
|
57
|
+
bcc: recipientsSchema.optional(),
|
|
58
|
+
reply_to: recipientsSchema.optional(),
|
|
59
|
+
html: z.string().optional(),
|
|
60
|
+
text: z.string().optional(),
|
|
61
|
+
headers: z.record(z.string().min(1), z.string()).optional(),
|
|
62
|
+
tags: z.array(tagSchema).optional(),
|
|
63
|
+
topic_id: z.string().min(1).optional(),
|
|
64
|
+
template: templateRefSchema.optional()
|
|
65
|
+
});
|
|
66
|
+
/** Input accepted by `sendEmail`. Includes attachments + scheduling. */
|
|
67
|
+
const sendEmailInputSchema = commonSendFieldsSchema.extend({
|
|
68
|
+
attachments: z.array(attachmentSchema).optional(),
|
|
69
|
+
scheduled_at: z.string().min(1).optional(),
|
|
70
|
+
idempotency_key: z.string().min(1).max(256).optional()
|
|
71
|
+
});
|
|
72
|
+
/** Input accepted by `sendBatchEmails`. Up to 100 messages per request. */
|
|
73
|
+
const batchSendInputSchema = z.object({
|
|
74
|
+
emails: z.array(commonSendFieldsSchema).min(1).max(100),
|
|
75
|
+
idempotency_key: z.string().min(1).max(256).optional()
|
|
76
|
+
});
|
|
77
|
+
const sendEmailResponseSchema = z.object({ id: z.string() });
|
|
78
|
+
const batchSendResponseSchema = z.object({ data: z.array(z.object({ id: z.string() })) });
|
|
79
|
+
const emailSummarySchema = z.object({
|
|
80
|
+
id: z.string(),
|
|
81
|
+
object: z.literal("email").optional(),
|
|
82
|
+
created_at: z.string().optional(),
|
|
83
|
+
to: z.array(z.string()).optional(),
|
|
84
|
+
from: z.string().optional(),
|
|
85
|
+
subject: z.string().optional(),
|
|
86
|
+
bcc: z.array(z.string()).optional(),
|
|
87
|
+
cc: z.array(z.string()).optional(),
|
|
88
|
+
reply_to: z.array(z.string()).optional(),
|
|
89
|
+
last_event: z.string().optional(),
|
|
90
|
+
scheduled_at: z.string().nullable().optional()
|
|
91
|
+
}).passthrough();
|
|
92
|
+
const emailDetailSchema = emailSummarySchema.extend({
|
|
93
|
+
html: z.string().optional().nullable(),
|
|
94
|
+
text: z.string().optional().nullable(),
|
|
95
|
+
headers: z.record(z.string(), z.string()).optional(),
|
|
96
|
+
tags: z.array(z.object({
|
|
97
|
+
name: z.string(),
|
|
98
|
+
value: z.string()
|
|
99
|
+
})).optional()
|
|
100
|
+
}).passthrough();
|
|
101
|
+
const attachmentSummarySchema = z.object({
|
|
102
|
+
id: z.string(),
|
|
103
|
+
filename: z.string().optional(),
|
|
104
|
+
content_type: z.string().optional(),
|
|
105
|
+
content_id: z.string().optional().nullable(),
|
|
106
|
+
content_disposition: z.string().optional().nullable(),
|
|
107
|
+
size: z.number().optional()
|
|
108
|
+
}).passthrough();
|
|
109
|
+
const attachmentDetailSchema = attachmentSummarySchema.extend({ url: z.string().optional() }).passthrough();
|
|
110
|
+
const listEmailsResponseSchema = resendListEnvelope(emailSummarySchema);
|
|
111
|
+
const listAttachmentsResponseSchema = resendListEnvelope(attachmentSummarySchema);
|
|
112
|
+
const sendEmail = resendOperation({
|
|
113
|
+
id: "send_resend_email",
|
|
114
|
+
name: "Send Resend Email",
|
|
115
|
+
description: "Send a single transactional email via Resend.",
|
|
116
|
+
input: sendEmailInputSchema,
|
|
117
|
+
output: sendEmailResponseSchema,
|
|
118
|
+
needsApproval: true,
|
|
119
|
+
run: async (input, credentials) => {
|
|
120
|
+
const { idempotency_key, ...body } = input;
|
|
121
|
+
return createResendClient(credentials).request({
|
|
122
|
+
method: "POST",
|
|
123
|
+
path: "/emails",
|
|
124
|
+
body,
|
|
125
|
+
...idempotency_key ? { headers: { "Idempotency-Key": idempotency_key } } : {}
|
|
126
|
+
});
|
|
127
|
+
}
|
|
128
|
+
});
|
|
129
|
+
const sendBatchEmails = resendOperation({
|
|
130
|
+
id: "send_resend_batch_emails",
|
|
131
|
+
name: "Send Resend Batch Emails",
|
|
132
|
+
description: "Send up to 100 transactional emails in a single Resend API call.",
|
|
133
|
+
input: batchSendInputSchema,
|
|
134
|
+
output: batchSendResponseSchema,
|
|
135
|
+
needsApproval: true,
|
|
136
|
+
run: async (input, credentials) => {
|
|
137
|
+
return createResendClient(credentials).request({
|
|
138
|
+
method: "POST",
|
|
139
|
+
path: "/emails/batch",
|
|
140
|
+
body: input.emails,
|
|
141
|
+
...input.idempotency_key ? { headers: { "Idempotency-Key": input.idempotency_key } } : {}
|
|
142
|
+
});
|
|
143
|
+
}
|
|
144
|
+
});
|
|
145
|
+
const listSentEmails = resendOperation({
|
|
146
|
+
id: "list_resend_sent_emails",
|
|
147
|
+
name: "List Resend Sent Emails",
|
|
148
|
+
description: "Retrieve a cursor-paginated list of emails your team has sent.",
|
|
149
|
+
input: paginationQuerySchema,
|
|
150
|
+
output: listEmailsResponseSchema,
|
|
151
|
+
run: async (input, credentials) => {
|
|
152
|
+
return createResendClient(credentials).request({
|
|
153
|
+
method: "GET",
|
|
154
|
+
path: "/emails",
|
|
155
|
+
query: input
|
|
156
|
+
});
|
|
157
|
+
}
|
|
158
|
+
});
|
|
159
|
+
const retrieveEmail = resendOperation({
|
|
160
|
+
id: "retrieve_resend_email",
|
|
161
|
+
name: "Retrieve Resend Email",
|
|
162
|
+
description: "Retrieve a single sent email by its id.",
|
|
163
|
+
input: z.object({ id: z.string().min(1) }),
|
|
164
|
+
output: emailDetailSchema,
|
|
165
|
+
run: async (input, credentials) => {
|
|
166
|
+
return createResendClient(credentials).request({
|
|
167
|
+
method: "GET",
|
|
168
|
+
path: `/emails/${encodeURIComponent(input.id)}`
|
|
169
|
+
});
|
|
170
|
+
}
|
|
171
|
+
});
|
|
172
|
+
const updateScheduledEmail = resendOperation({
|
|
173
|
+
id: "update_resend_scheduled_email",
|
|
174
|
+
name: "Update Resend Scheduled Email",
|
|
175
|
+
description: "Update a scheduled email before it is sent. Typically used to move `scheduled_at`.",
|
|
176
|
+
input: z.object({
|
|
177
|
+
id: z.string().min(1),
|
|
178
|
+
scheduled_at: z.string().min(1).optional()
|
|
179
|
+
}),
|
|
180
|
+
output: sendEmailResponseSchema,
|
|
181
|
+
needsApproval: true,
|
|
182
|
+
run: async (input, credentials) => {
|
|
183
|
+
const { id, ...body } = input;
|
|
184
|
+
return createResendClient(credentials).request({
|
|
185
|
+
method: "PATCH",
|
|
186
|
+
path: `/emails/${encodeURIComponent(id)}`,
|
|
187
|
+
body
|
|
188
|
+
});
|
|
189
|
+
}
|
|
190
|
+
});
|
|
191
|
+
const cancelScheduledEmail = resendOperation({
|
|
192
|
+
id: "cancel_resend_scheduled_email",
|
|
193
|
+
name: "Cancel Resend Scheduled Email",
|
|
194
|
+
description: "Cancel a scheduled email before it is sent.",
|
|
195
|
+
input: z.object({ id: z.string().min(1) }),
|
|
196
|
+
output: z.object({
|
|
197
|
+
object: z.literal("email").optional(),
|
|
198
|
+
id: z.string()
|
|
199
|
+
}),
|
|
200
|
+
needsApproval: true,
|
|
201
|
+
run: async (input, credentials) => {
|
|
202
|
+
return createResendClient(credentials).request({
|
|
203
|
+
method: "POST",
|
|
204
|
+
path: `/emails/${encodeURIComponent(input.id)}/cancel`
|
|
205
|
+
});
|
|
206
|
+
}
|
|
207
|
+
});
|
|
208
|
+
const listSentAttachments = resendOperation({
|
|
209
|
+
id: "list_resend_sent_email_attachments",
|
|
210
|
+
name: "List Resend Sent Email Attachments",
|
|
211
|
+
description: "List attachments that were sent with a given email.",
|
|
212
|
+
input: paginationQuerySchema.extend({ email_id: z.string().min(1) }),
|
|
213
|
+
output: listAttachmentsResponseSchema,
|
|
214
|
+
run: async (input, credentials) => {
|
|
215
|
+
const { email_id, ...query } = input;
|
|
216
|
+
return createResendClient(credentials).request({
|
|
217
|
+
method: "GET",
|
|
218
|
+
path: `/emails/${encodeURIComponent(email_id)}/attachments`,
|
|
219
|
+
query
|
|
220
|
+
});
|
|
221
|
+
}
|
|
222
|
+
});
|
|
223
|
+
const retrieveSentAttachment = resendOperation({
|
|
224
|
+
id: "retrieve_resend_sent_email_attachment",
|
|
225
|
+
name: "Retrieve Resend Sent Email Attachment",
|
|
226
|
+
description: "Retrieve a single attachment from a sent email. Response includes a time-limited signed URL for the binary body.",
|
|
227
|
+
input: z.object({
|
|
228
|
+
email_id: z.string().min(1),
|
|
229
|
+
attachment_id: z.string().min(1)
|
|
230
|
+
}),
|
|
231
|
+
output: attachmentDetailSchema,
|
|
232
|
+
run: async (input, credentials) => {
|
|
233
|
+
return createResendClient(credentials).request({
|
|
234
|
+
method: "GET",
|
|
235
|
+
path: `/emails/${encodeURIComponent(input.email_id)}/attachments/${encodeURIComponent(input.attachment_id)}`
|
|
236
|
+
});
|
|
237
|
+
}
|
|
238
|
+
});
|
|
239
|
+
|
|
240
|
+
//#endregion
|
|
241
|
+
export { cancelScheduledEmail, listSentAttachments, listSentEmails, retrieveEmail, retrieveSentAttachment, sendBatchEmails, sendEmail, updateScheduledEmail };
|