@keystrokehq/sendgrid 0.0.9 → 0.0.16-integration-id-canonicalization.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.
Files changed (69) hide show
  1. package/README.md +59 -111
  2. package/dist/credential-sets/index.d.mts +2 -0
  3. package/dist/credential-sets/index.mjs +3 -0
  4. package/dist/index.d.mts +4 -1
  5. package/dist/index.mjs +5 -1
  6. package/dist/operations/index.d.mts +2 -0
  7. package/dist/operations/index.mjs +3 -0
  8. package/dist/schemas/index.d.mts +8 -8
  9. package/dist/schemas/index.mjs +1 -1
  10. package/dist/sendgrid.credential-set-CzYmlJ2Y.mjs +25 -0
  11. package/dist/sendgrid.credential-set-ivRIiUDy.d.mts +32 -0
  12. package/dist/validate-email.operation-CCCDxLjH.mjs +4301 -0
  13. package/dist/validate-email.operation-DY4rCHFE.d.mts +5436 -0
  14. package/package.json +8 -96
  15. package/dist/_official/index.d.mts +0 -2
  16. package/dist/_official/index.mjs +0 -3
  17. package/dist/_runtime/index.d.mts +0 -2
  18. package/dist/_runtime/index.mjs +0 -3
  19. package/dist/alerts.d.mts +0 -193
  20. package/dist/alerts.mjs +0 -101
  21. package/dist/api-keys.d.mts +0 -160
  22. package/dist/api-keys.mjs +0 -113
  23. package/dist/client.d.mts +0 -73
  24. package/dist/client.mjs +0 -260
  25. package/dist/connection.d.mts +0 -2
  26. package/dist/connection.mjs +0 -3
  27. package/dist/domains.d.mts +0 -114
  28. package/dist/domains.mjs +0 -62
  29. package/dist/email-validation.d.mts +0 -134
  30. package/dist/email-validation.mjs +0 -73
  31. package/dist/events.d.mts +0 -69
  32. package/dist/events.mjs +0 -28
  33. package/dist/factory-CToXR1jp.mjs +0 -24
  34. package/dist/integration-C9EALG65.mjs +0 -113
  35. package/dist/integration-zx-jmybs.d.mts +0 -56
  36. package/dist/mail-send.d.mts +0 -315
  37. package/dist/mail-send.mjs +0 -218
  38. package/dist/marketing-contacts.d.mts +0 -607
  39. package/dist/marketing-contacts.mjs +0 -277
  40. package/dist/marketing-customfields.d.mts +0 -94
  41. package/dist/marketing-customfields.mjs +0 -70
  42. package/dist/marketing-lists.d.mts +0 -184
  43. package/dist/marketing-lists.mjs +0 -130
  44. package/dist/marketing-segments.d.mts +0 -340
  45. package/dist/marketing-segments.mjs +0 -179
  46. package/dist/marketing-singlesends.d.mts +0 -648
  47. package/dist/marketing-singlesends.mjs +0 -277
  48. package/dist/operations.d.mts +0 -25
  49. package/dist/operations.mjs +0 -69
  50. package/dist/sender-identities.d.mts +0 -218
  51. package/dist/sender-identities.mjs +0 -109
  52. package/dist/senders.d.mts +0 -227
  53. package/dist/senders.mjs +0 -83
  54. package/dist/shared-BayZ0Lt6.mjs +0 -46
  55. package/dist/stats.d.mts +0 -215
  56. package/dist/stats.mjs +0 -107
  57. package/dist/suppressions.d.mts +0 -785
  58. package/dist/suppressions.mjs +0 -539
  59. package/dist/templates.d.mts +0 -451
  60. package/dist/templates.mjs +0 -238
  61. package/dist/user-account.d.mts +0 -108
  62. package/dist/user-account.mjs +0 -59
  63. package/dist/verification.d.mts +0 -67
  64. package/dist/verification.mjs +0 -72
  65. package/dist/webhooks/event.d.mts +0 -287
  66. package/dist/webhooks/event.mjs +0 -147
  67. package/dist/webhooks/parse.d.mts +0 -172
  68. package/dist/webhooks/parse.mjs +0 -125
  69. /package/dist/{webhooks-CKdsIikb.mjs → webhooks-dVOd93Hd.mjs} +0 -0
@@ -1,147 +0,0 @@
1
- import { n as __exportAll, t as sendgridOperation } from "../factory-CToXR1jp.mjs";
2
- import { n as omitUndefined } from "../shared-BayZ0Lt6.mjs";
3
- import { createSendGridClient } from "../client.mjs";
4
- import { d as sendgridSignedPublicKeySchema, i as sendgridEventWebhookSettingsSchema, n as sendgridEventWebhookListSchema, u as sendgridSignatureToggleSchema } from "../webhooks-CKdsIikb.mjs";
5
- import { z } from "zod";
6
-
7
- //#region src/webhooks/event.ts
8
- var event_exports = /* @__PURE__ */ __exportAll({
9
- createEventWebhook: () => createEventWebhook,
10
- deleteEventWebhook: () => deleteEventWebhook,
11
- getEventWebhook: () => getEventWebhook,
12
- getSignedPublicKey: () => getSignedPublicKey,
13
- listEventWebhooks: () => listEventWebhooks,
14
- testEventWebhook: () => testEventWebhook,
15
- toggleWebhookSignature: () => toggleWebhookSignature,
16
- updateEventWebhook: () => updateEventWebhook
17
- });
18
- const webhookId = z.string().min(1);
19
- const eventWebhookInputSchema = z.object({
20
- friendly_name: z.string().optional(),
21
- enabled: z.boolean().optional(),
22
- url: z.string().url(),
23
- group_resubscribe: z.boolean().optional(),
24
- delivered: z.boolean().optional(),
25
- group_unsubscribe: z.boolean().optional(),
26
- spam_report: z.boolean().optional(),
27
- bounce: z.boolean().optional(),
28
- deferred: z.boolean().optional(),
29
- unsubscribe: z.boolean().optional(),
30
- processed: z.boolean().optional(),
31
- open: z.boolean().optional(),
32
- click: z.boolean().optional(),
33
- dropped: z.boolean().optional(),
34
- oauth_client_id: z.string().optional(),
35
- oauth_client_secret: z.string().optional(),
36
- oauth_token_url: z.string().optional()
37
- });
38
- const createEventWebhook = sendgridOperation({
39
- id: "sendgrid.create-event-webhook",
40
- name: "Create Event Webhook",
41
- description: "Register a new Event Webhook endpoint.",
42
- input: eventWebhookInputSchema,
43
- output: sendgridEventWebhookSettingsSchema,
44
- needsApproval: true,
45
- run: async (input, credentials) => {
46
- const response = await createSendGridClient(credentials).request("/user/webhooks/event/settings", {
47
- method: "POST",
48
- body: omitUndefined(input)
49
- });
50
- return sendgridEventWebhookSettingsSchema.parse(response);
51
- }
52
- });
53
- const updateEventWebhook = sendgridOperation({
54
- id: "sendgrid.update-event-webhook",
55
- name: "Update Event Webhook",
56
- description: "Update an Event Webhook endpoint.",
57
- input: eventWebhookInputSchema.partial().extend({ webhookId }),
58
- output: sendgridEventWebhookSettingsSchema,
59
- needsApproval: true,
60
- run: async (input, credentials) => {
61
- const client = createSendGridClient(credentials);
62
- const { webhookId: id, ...rest } = input;
63
- const response = await client.request(`/user/webhooks/event/settings/${encodeURIComponent(id)}`, {
64
- method: "PATCH",
65
- body: omitUndefined(rest)
66
- });
67
- return sendgridEventWebhookSettingsSchema.parse(response);
68
- }
69
- });
70
- const deleteEventWebhook = sendgridOperation({
71
- id: "sendgrid.delete-event-webhook",
72
- name: "Delete Event Webhook",
73
- description: "Delete an Event Webhook endpoint.",
74
- input: z.object({ webhookId }),
75
- output: z.object({ success: z.boolean() }),
76
- needsApproval: true,
77
- run: async (input, credentials) => {
78
- await createSendGridClient(credentials).request(`/user/webhooks/event/settings/${encodeURIComponent(input.webhookId)}`, { method: "DELETE" });
79
- return { success: true };
80
- }
81
- });
82
- const listEventWebhooks = sendgridOperation({
83
- id: "sendgrid.list-event-webhooks",
84
- name: "List Event Webhooks",
85
- description: "List all Event Webhook endpoints configured on the account.",
86
- input: z.object({}).optional(),
87
- output: sendgridEventWebhookListSchema,
88
- run: async (_input, credentials) => {
89
- const response = await createSendGridClient(credentials).request("/user/webhooks/event/settings/all");
90
- return sendgridEventWebhookListSchema.parse(response ?? { webhooks: [] });
91
- }
92
- });
93
- const getEventWebhook = sendgridOperation({
94
- id: "sendgrid.get-event-webhook",
95
- name: "Get Event Webhook",
96
- description: "Retrieve a single Event Webhook endpoint by ID.",
97
- input: z.object({ webhookId }),
98
- output: sendgridEventWebhookSettingsSchema,
99
- run: async (input, credentials) => {
100
- const response = await createSendGridClient(credentials).request(`/user/webhooks/event/settings/${encodeURIComponent(input.webhookId)}`);
101
- return sendgridEventWebhookSettingsSchema.parse(response);
102
- }
103
- });
104
- const getSignedPublicKey = sendgridOperation({
105
- id: "sendgrid.get-signed-public-key",
106
- name: "Get Signed Event Webhook Public Key",
107
- description: "Retrieve the Ed25519 public key used to verify signed Event Webhook POSTs. Cache + rotate on `toggle_webhook_signature`.",
108
- input: z.object({}).optional(),
109
- output: sendgridSignedPublicKeySchema,
110
- run: async (_input, credentials) => {
111
- const response = await createSendGridClient(credentials).request("/user/webhooks/event/settings/signed");
112
- return sendgridSignedPublicKeySchema.parse(response);
113
- }
114
- });
115
- const toggleWebhookSignature = sendgridOperation({
116
- id: "sendgrid.toggle-webhook-signature",
117
- name: "Toggle Webhook Signature",
118
- description: "Enable or disable Ed25519 signing on Event Webhook deliveries.",
119
- input: z.object({ enabled: z.boolean() }),
120
- output: sendgridSignatureToggleSchema,
121
- needsApproval: true,
122
- run: async (input, credentials) => {
123
- const response = await createSendGridClient(credentials).request("/user/webhooks/event/settings/signed", {
124
- method: "PATCH",
125
- body: { enabled: input.enabled }
126
- });
127
- return sendgridSignatureToggleSchema.parse(response);
128
- }
129
- });
130
- const testEventWebhook = sendgridOperation({
131
- id: "sendgrid.test-event-webhook",
132
- name: "Test Event Webhook",
133
- description: "Ask SendGrid to POST a test payload to the configured Event Webhook URL.",
134
- input: z.object({ url: z.string().url() }),
135
- output: z.object({ success: z.boolean() }),
136
- needsApproval: true,
137
- run: async (input, credentials) => {
138
- await createSendGridClient(credentials).request("/user/webhooks/event/test", {
139
- method: "POST",
140
- body: { url: input.url }
141
- });
142
- return { success: true };
143
- }
144
- });
145
-
146
- //#endregion
147
- export { createEventWebhook, deleteEventWebhook, getEventWebhook, getSignedPublicKey, listEventWebhooks, event_exports as t, testEventWebhook, toggleWebhookSignature, updateEventWebhook };
@@ -1,172 +0,0 @@
1
- import * as _keystrokehq_core0 from "@keystrokehq/core";
2
- import { z } from "zod";
3
- import * as _keystrokehq_core_credential_set0 from "@keystrokehq/core/credential-set";
4
-
5
- //#region src/webhooks/parse.d.ts
6
- declare const createParseSetting: _keystrokehq_core0.Operation<z.ZodObject<{
7
- url: z.ZodString;
8
- hostname: z.ZodString;
9
- spamCheck: z.ZodOptional<z.ZodBoolean>;
10
- sendRaw: z.ZodOptional<z.ZodBoolean>;
11
- }, z.core.$strip>, z.ZodObject<{
12
- url: z.ZodOptional<z.ZodString>;
13
- hostname: z.ZodString;
14
- spam_check: z.ZodOptional<z.ZodBoolean>;
15
- send_raw: z.ZodOptional<z.ZodBoolean>;
16
- }, z.core.$catchall<z.ZodUnknown>>, readonly [_keystrokehq_core0.CredentialSet<"sendgrid", z.ZodObject<{
17
- SENDGRID_API_KEY: z.ZodString;
18
- SENDGRID_SUBUSER: z.ZodOptional<z.ZodString>;
19
- SENDGRID_ACCOUNT_REGION: z.ZodDefault<z.ZodEnum<{
20
- global: "global";
21
- eu: "eu";
22
- }>>;
23
- SENDGRID_EVENT_WEBHOOK_PUBLIC_KEY: z.ZodOptional<z.ZodString>;
24
- SENDGRID_INBOUND_PARSE_TOKEN: z.ZodOptional<z.ZodString>;
25
- }, z.core.$strip>, readonly _keystrokehq_core_credential_set0.CredentialConnection<z.ZodObject<{
26
- SENDGRID_API_KEY: z.ZodString;
27
- SENDGRID_SUBUSER: z.ZodOptional<z.ZodString>;
28
- SENDGRID_ACCOUNT_REGION: z.ZodDefault<z.ZodEnum<{
29
- global: "global";
30
- eu: "eu";
31
- }>>;
32
- SENDGRID_EVENT_WEBHOOK_PUBLIC_KEY: z.ZodOptional<z.ZodString>;
33
- SENDGRID_INBOUND_PARSE_TOKEN: z.ZodOptional<z.ZodString>;
34
- }, z.core.$strip>>[] | undefined>], undefined>;
35
- declare const updateParseSetting: _keystrokehq_core0.Operation<z.ZodObject<{
36
- url: z.ZodOptional<z.ZodString>;
37
- spamCheck: z.ZodOptional<z.ZodOptional<z.ZodBoolean>>;
38
- sendRaw: z.ZodOptional<z.ZodOptional<z.ZodBoolean>>;
39
- hostname: z.ZodString;
40
- }, z.core.$strip>, z.ZodObject<{
41
- url: z.ZodOptional<z.ZodString>;
42
- hostname: z.ZodString;
43
- spam_check: z.ZodOptional<z.ZodBoolean>;
44
- send_raw: z.ZodOptional<z.ZodBoolean>;
45
- }, z.core.$catchall<z.ZodUnknown>>, readonly [_keystrokehq_core0.CredentialSet<"sendgrid", z.ZodObject<{
46
- SENDGRID_API_KEY: z.ZodString;
47
- SENDGRID_SUBUSER: z.ZodOptional<z.ZodString>;
48
- SENDGRID_ACCOUNT_REGION: z.ZodDefault<z.ZodEnum<{
49
- global: "global";
50
- eu: "eu";
51
- }>>;
52
- SENDGRID_EVENT_WEBHOOK_PUBLIC_KEY: z.ZodOptional<z.ZodString>;
53
- SENDGRID_INBOUND_PARSE_TOKEN: z.ZodOptional<z.ZodString>;
54
- }, z.core.$strip>, readonly _keystrokehq_core_credential_set0.CredentialConnection<z.ZodObject<{
55
- SENDGRID_API_KEY: z.ZodString;
56
- SENDGRID_SUBUSER: z.ZodOptional<z.ZodString>;
57
- SENDGRID_ACCOUNT_REGION: z.ZodDefault<z.ZodEnum<{
58
- global: "global";
59
- eu: "eu";
60
- }>>;
61
- SENDGRID_EVENT_WEBHOOK_PUBLIC_KEY: z.ZodOptional<z.ZodString>;
62
- SENDGRID_INBOUND_PARSE_TOKEN: z.ZodOptional<z.ZodString>;
63
- }, z.core.$strip>>[] | undefined>], undefined>;
64
- declare const deleteParseSetting: _keystrokehq_core0.Operation<z.ZodObject<{
65
- hostname: z.ZodString;
66
- }, z.core.$strip>, z.ZodObject<{
67
- success: z.ZodBoolean;
68
- }, z.core.$strip>, readonly [_keystrokehq_core0.CredentialSet<"sendgrid", z.ZodObject<{
69
- SENDGRID_API_KEY: z.ZodString;
70
- SENDGRID_SUBUSER: z.ZodOptional<z.ZodString>;
71
- SENDGRID_ACCOUNT_REGION: z.ZodDefault<z.ZodEnum<{
72
- global: "global";
73
- eu: "eu";
74
- }>>;
75
- SENDGRID_EVENT_WEBHOOK_PUBLIC_KEY: z.ZodOptional<z.ZodString>;
76
- SENDGRID_INBOUND_PARSE_TOKEN: z.ZodOptional<z.ZodString>;
77
- }, z.core.$strip>, readonly _keystrokehq_core_credential_set0.CredentialConnection<z.ZodObject<{
78
- SENDGRID_API_KEY: z.ZodString;
79
- SENDGRID_SUBUSER: z.ZodOptional<z.ZodString>;
80
- SENDGRID_ACCOUNT_REGION: z.ZodDefault<z.ZodEnum<{
81
- global: "global";
82
- eu: "eu";
83
- }>>;
84
- SENDGRID_EVENT_WEBHOOK_PUBLIC_KEY: z.ZodOptional<z.ZodString>;
85
- SENDGRID_INBOUND_PARSE_TOKEN: z.ZodOptional<z.ZodString>;
86
- }, z.core.$strip>>[] | undefined>], undefined>;
87
- declare const listParseSettings: _keystrokehq_core0.Operation<z.ZodOptional<z.ZodObject<{}, z.core.$strip>>, z.ZodObject<{
88
- result: z.ZodArray<z.ZodObject<{
89
- url: z.ZodOptional<z.ZodString>;
90
- hostname: z.ZodString;
91
- spam_check: z.ZodOptional<z.ZodBoolean>;
92
- send_raw: z.ZodOptional<z.ZodBoolean>;
93
- }, z.core.$catchall<z.ZodUnknown>>>;
94
- }, z.core.$strip>, readonly [_keystrokehq_core0.CredentialSet<"sendgrid", z.ZodObject<{
95
- SENDGRID_API_KEY: z.ZodString;
96
- SENDGRID_SUBUSER: z.ZodOptional<z.ZodString>;
97
- SENDGRID_ACCOUNT_REGION: z.ZodDefault<z.ZodEnum<{
98
- global: "global";
99
- eu: "eu";
100
- }>>;
101
- SENDGRID_EVENT_WEBHOOK_PUBLIC_KEY: z.ZodOptional<z.ZodString>;
102
- SENDGRID_INBOUND_PARSE_TOKEN: z.ZodOptional<z.ZodString>;
103
- }, z.core.$strip>, readonly _keystrokehq_core_credential_set0.CredentialConnection<z.ZodObject<{
104
- SENDGRID_API_KEY: z.ZodString;
105
- SENDGRID_SUBUSER: z.ZodOptional<z.ZodString>;
106
- SENDGRID_ACCOUNT_REGION: z.ZodDefault<z.ZodEnum<{
107
- global: "global";
108
- eu: "eu";
109
- }>>;
110
- SENDGRID_EVENT_WEBHOOK_PUBLIC_KEY: z.ZodOptional<z.ZodString>;
111
- SENDGRID_INBOUND_PARSE_TOKEN: z.ZodOptional<z.ZodString>;
112
- }, z.core.$strip>>[] | undefined>], undefined>;
113
- declare const getParseSetting: _keystrokehq_core0.Operation<z.ZodObject<{
114
- hostname: z.ZodString;
115
- }, z.core.$strip>, z.ZodObject<{
116
- url: z.ZodOptional<z.ZodString>;
117
- hostname: z.ZodString;
118
- spam_check: z.ZodOptional<z.ZodBoolean>;
119
- send_raw: z.ZodOptional<z.ZodBoolean>;
120
- }, z.core.$catchall<z.ZodUnknown>>, readonly [_keystrokehq_core0.CredentialSet<"sendgrid", z.ZodObject<{
121
- SENDGRID_API_KEY: z.ZodString;
122
- SENDGRID_SUBUSER: z.ZodOptional<z.ZodString>;
123
- SENDGRID_ACCOUNT_REGION: z.ZodDefault<z.ZodEnum<{
124
- global: "global";
125
- eu: "eu";
126
- }>>;
127
- SENDGRID_EVENT_WEBHOOK_PUBLIC_KEY: z.ZodOptional<z.ZodString>;
128
- SENDGRID_INBOUND_PARSE_TOKEN: z.ZodOptional<z.ZodString>;
129
- }, z.core.$strip>, readonly _keystrokehq_core_credential_set0.CredentialConnection<z.ZodObject<{
130
- SENDGRID_API_KEY: z.ZodString;
131
- SENDGRID_SUBUSER: z.ZodOptional<z.ZodString>;
132
- SENDGRID_ACCOUNT_REGION: z.ZodDefault<z.ZodEnum<{
133
- global: "global";
134
- eu: "eu";
135
- }>>;
136
- SENDGRID_EVENT_WEBHOOK_PUBLIC_KEY: z.ZodOptional<z.ZodString>;
137
- SENDGRID_INBOUND_PARSE_TOKEN: z.ZodOptional<z.ZodString>;
138
- }, z.core.$strip>>[] | undefined>], undefined>;
139
- declare const getParseStats: _keystrokehq_core0.Operation<z.ZodOptional<z.ZodObject<{
140
- startDate: z.ZodOptional<z.ZodISODate>;
141
- endDate: z.ZodOptional<z.ZodISODate>;
142
- aggregatedBy: z.ZodOptional<z.ZodEnum<{
143
- day: "day";
144
- week: "week";
145
- month: "month";
146
- }>>;
147
- limit: z.ZodOptional<z.ZodNumber>;
148
- offset: z.ZodOptional<z.ZodNumber>;
149
- }, z.core.$strip>>, z.ZodArray<z.ZodObject<{
150
- date: z.ZodString;
151
- stats: z.ZodArray<z.ZodUnknown>;
152
- }, z.core.$catchall<z.ZodUnknown>>>, readonly [_keystrokehq_core0.CredentialSet<"sendgrid", z.ZodObject<{
153
- SENDGRID_API_KEY: z.ZodString;
154
- SENDGRID_SUBUSER: z.ZodOptional<z.ZodString>;
155
- SENDGRID_ACCOUNT_REGION: z.ZodDefault<z.ZodEnum<{
156
- global: "global";
157
- eu: "eu";
158
- }>>;
159
- SENDGRID_EVENT_WEBHOOK_PUBLIC_KEY: z.ZodOptional<z.ZodString>;
160
- SENDGRID_INBOUND_PARSE_TOKEN: z.ZodOptional<z.ZodString>;
161
- }, z.core.$strip>, readonly _keystrokehq_core_credential_set0.CredentialConnection<z.ZodObject<{
162
- SENDGRID_API_KEY: z.ZodString;
163
- SENDGRID_SUBUSER: z.ZodOptional<z.ZodString>;
164
- SENDGRID_ACCOUNT_REGION: z.ZodDefault<z.ZodEnum<{
165
- global: "global";
166
- eu: "eu";
167
- }>>;
168
- SENDGRID_EVENT_WEBHOOK_PUBLIC_KEY: z.ZodOptional<z.ZodString>;
169
- SENDGRID_INBOUND_PARSE_TOKEN: z.ZodOptional<z.ZodString>;
170
- }, z.core.$strip>>[] | undefined>], undefined>;
171
- //#endregion
172
- export { createParseSetting, deleteParseSetting, getParseSetting, getParseStats, listParseSettings, updateParseSetting };
@@ -1,125 +0,0 @@
1
- import { n as __exportAll, t as sendgridOperation } from "../factory-CToXR1jp.mjs";
2
- import { n as omitUndefined } from "../shared-BayZ0Lt6.mjs";
3
- import { createSendGridClient } from "../client.mjs";
4
- import { l as sendgridParseStatsSchema, o as sendgridParseSettingListSchema, s as sendgridParseSettingSchema } from "../webhooks-CKdsIikb.mjs";
5
- import { z } from "zod";
6
-
7
- //#region src/webhooks/parse.ts
8
- var parse_exports = /* @__PURE__ */ __exportAll({
9
- createParseSetting: () => createParseSetting,
10
- deleteParseSetting: () => deleteParseSetting,
11
- getParseSetting: () => getParseSetting,
12
- getParseStats: () => getParseStats,
13
- listParseSettings: () => listParseSettings,
14
- updateParseSetting: () => updateParseSetting
15
- });
16
- const hostname = z.string().min(1);
17
- const parseInputSchema = z.object({
18
- url: z.string().url(),
19
- hostname,
20
- spamCheck: z.boolean().optional(),
21
- sendRaw: z.boolean().optional()
22
- });
23
- const createParseSetting = sendgridOperation({
24
- id: "sendgrid.create-parse-setting",
25
- name: "Create Inbound Parse Setting",
26
- description: "Configure an Inbound Parse hostname + receiver URL.",
27
- input: parseInputSchema,
28
- output: sendgridParseSettingSchema,
29
- needsApproval: true,
30
- run: async (input, credentials) => {
31
- const response = await createSendGridClient(credentials).request("/user/webhooks/parse/settings", {
32
- method: "POST",
33
- body: omitUndefined({
34
- url: input.url,
35
- hostname: input.hostname,
36
- spam_check: input.spamCheck,
37
- send_raw: input.sendRaw
38
- })
39
- });
40
- return sendgridParseSettingSchema.parse(response);
41
- }
42
- });
43
- const updateParseSetting = sendgridOperation({
44
- id: "sendgrid.update-parse-setting",
45
- name: "Update Inbound Parse Setting",
46
- description: "Update an Inbound Parse configuration (by hostname).",
47
- input: parseInputSchema.partial().extend({ hostname }),
48
- output: sendgridParseSettingSchema,
49
- needsApproval: true,
50
- run: async (input, credentials) => {
51
- const response = await createSendGridClient(credentials).request(`/user/webhooks/parse/settings/${encodeURIComponent(input.hostname)}`, {
52
- method: "PATCH",
53
- body: omitUndefined({
54
- url: input.url,
55
- spam_check: input.spamCheck,
56
- send_raw: input.sendRaw
57
- })
58
- });
59
- return sendgridParseSettingSchema.parse(response);
60
- }
61
- });
62
- const deleteParseSetting = sendgridOperation({
63
- id: "sendgrid.delete-parse-setting",
64
- name: "Delete Inbound Parse Setting",
65
- description: "Remove an Inbound Parse configuration by hostname.",
66
- input: z.object({ hostname }),
67
- output: z.object({ success: z.boolean() }),
68
- needsApproval: true,
69
- run: async (input, credentials) => {
70
- await createSendGridClient(credentials).request(`/user/webhooks/parse/settings/${encodeURIComponent(input.hostname)}`, { method: "DELETE" });
71
- return { success: true };
72
- }
73
- });
74
- const listParseSettings = sendgridOperation({
75
- id: "sendgrid.list-parse-settings",
76
- name: "List Inbound Parse Settings",
77
- description: "List all Inbound Parse configurations on the account.",
78
- input: z.object({}).optional(),
79
- output: sendgridParseSettingListSchema,
80
- run: async (_input, credentials) => {
81
- const response = await createSendGridClient(credentials).request("/user/webhooks/parse/settings");
82
- return sendgridParseSettingListSchema.parse(response ?? { result: [] });
83
- }
84
- });
85
- const getParseSetting = sendgridOperation({
86
- id: "sendgrid.get-parse-setting",
87
- name: "Get Inbound Parse Setting",
88
- description: "Retrieve a single Inbound Parse configuration.",
89
- input: z.object({ hostname }),
90
- output: sendgridParseSettingSchema,
91
- run: async (input, credentials) => {
92
- const response = await createSendGridClient(credentials).request(`/user/webhooks/parse/settings/${encodeURIComponent(input.hostname)}`);
93
- return sendgridParseSettingSchema.parse(response);
94
- }
95
- });
96
- const getParseStats = sendgridOperation({
97
- id: "sendgrid.get-parse-stats",
98
- name: "Get Inbound Parse Stats",
99
- description: "Retrieve Inbound Parse statistics.",
100
- input: z.object({
101
- startDate: z.iso.date().optional(),
102
- endDate: z.iso.date().optional(),
103
- aggregatedBy: z.enum([
104
- "day",
105
- "week",
106
- "month"
107
- ]).optional(),
108
- limit: z.number().int().positive().max(500).optional(),
109
- offset: z.number().int().nonnegative().optional()
110
- }).optional(),
111
- output: sendgridParseStatsSchema,
112
- run: async (input, credentials) => {
113
- const response = await createSendGridClient(credentials).request("/user/webhooks/parse/stats", { query: omitUndefined({
114
- start_date: input?.startDate,
115
- end_date: input?.endDate,
116
- aggregated_by: input?.aggregatedBy,
117
- limit: input?.limit,
118
- offset: input?.offset
119
- }) });
120
- return sendgridParseStatsSchema.parse(response ?? []);
121
- }
122
- });
123
-
124
- //#endregion
125
- export { createParseSetting, deleteParseSetting, getParseSetting, getParseStats, listParseSettings, parse_exports as t, updateParseSetting };