/**
* Official Resend helpers for the caller's account: transactional email,
* sending domains, audiences/contacts, templates, and draft-first broadcasts.
*
* Auth is a saved `resend` API key by default, or a `resend` OAuth
* integration when `integration` is passed. Extra accounts use `resend-<label>`.
* Mutations support `dryRun: true`. Sends and deletes also require `confirm: true`.
*
* Root dispatcher defaults to the read-only smoke test.
*/
export {
API_BASE_URL,
API_HOST,
DASHBOARD_API_KEYS_URL,
DASHBOARD_URL,
DEFAULT_AUTH_NAME,
OAUTH_AUTHORIZE_URL,
OAUTH_SCOPES,
OAUTH_TOKEN_URL,
ResendApiError,
broadcastSummary,
contactSummary,
domainSummary,
emailSummary,
mutationPreview,
nextSetupStep,
oauthConnectUrl,
parseAction,
resendCall,
resendRequest,
resolveIntegrationName,
resolveSecretName,
secretSetupUrl,
unwrapList,
} from './resend-core.ts'
export { buildConnectUrl, registerOauthClient } from './oauth-setup.ts'
export {
cancelScheduledEmail,
getEmail,
getReceivedEmail,
listEmails,
listReceivedEmailAttachments,
listReceivedEmails,
rescheduleEmail,
sendBatch,
sendEmail,
} from './emails.ts'
export {
createDomain,
deleteDomain,
getDomain,
listDomains,
updateDomainSettings,
verifyDomain,
} from './domains.ts'
export {
addContactToSegment,
createContact,
createSegment,
createTopic,
deleteContact,
deleteSegment,
getContact,
getSegment,
getTopic,
listContactSegments,
listContactTopics,
listContacts,
listSegments,
listTopics,
removeContactFromSegment,
unsubscribeContact,
updateContact,
updateContactTopics,
} from './contacts.ts'
export {
createTemplate,
deleteTemplate,
getTemplate,
listTemplates,
publishTemplate,
updateTemplate,
} from './templates.ts'
export {
createBroadcastDraft,
deleteBroadcast,
getBroadcast,
listBroadcasts,
sendBroadcast,
updateBroadcast,
} from './broadcasts.ts'
export { createWebhook, listApiKeys, listLogs, listWebhooks } from './account.ts'
export { smokeTest } from './smoke-test.ts'
import { createWebhook, listApiKeys, listLogs, listWebhooks } from './account.ts'
import {
createBroadcastDraft,
deleteBroadcast,
getBroadcast,
listBroadcasts,
sendBroadcast,
updateBroadcast,
} from './broadcasts.ts'
import {
addContactToSegment,
createContact,
createSegment,
createTopic,
deleteContact,
deleteSegment,
getContact,
getSegment,
getTopic,
listContactSegments,
listContactTopics,
listContacts,
listSegments,
listTopics,
removeContactFromSegment,
unsubscribeContact,
updateContact,
updateContactTopics,
} from './contacts.ts'
import {
createDomain,
deleteDomain,
getDomain,
listDomains,
updateDomainSettings,
verifyDomain,
} from './domains.ts'
import {
cancelScheduledEmail,
getEmail,
getReceivedEmail,
listEmails,
listReceivedEmailAttachments,
listReceivedEmails,
rescheduleEmail,
sendBatch,
sendEmail,
} from './emails.ts'
import { parseAction, resendCall } from './resend-core.ts'
import { smokeTest } from './smoke-test.ts'
import {
createTemplate,
deleteTemplate,
getTemplate,
listTemplates,
publishTemplate,
updateTemplate,
} from './templates.ts'
const actions = {
'smoke-test': smokeTest,
'list-emails': listEmails,
'get-email': getEmail,
'send-email': sendEmail,
'send-batch': sendBatch,
'reschedule-email': rescheduleEmail,
'cancel-scheduled-email': cancelScheduledEmail,
'list-received-emails': listReceivedEmails,
'get-received-email': getReceivedEmail,
'list-received-email-attachments': listReceivedEmailAttachments,
'list-domains': listDomains,
'get-domain': getDomain,
'create-domain': createDomain,
'verify-domain': verifyDomain,
'update-domain-settings': updateDomainSettings,
'delete-domain': deleteDomain,
'list-contacts': listContacts,
'get-contact': getContact,
'create-contact': createContact,
'update-contact': updateContact,
'unsubscribe-contact': unsubscribeContact,
'delete-contact': deleteContact,
'list-segments': listSegments,
'get-segment': getSegment,
'create-segment': createSegment,
'delete-segment': deleteSegment,
'list-contact-segments': listContactSegments,
'add-contact-to-segment': addContactToSegment,
'remove-contact-from-segment': removeContactFromSegment,
'list-topics': listTopics,
'get-topic': getTopic,
'create-topic': createTopic,
'list-contact-topics': listContactTopics,
'update-contact-topics': updateContactTopics,
'list-templates': listTemplates,
'get-template': getTemplate,
'create-template': createTemplate,
'update-template': updateTemplate,
'publish-template': publishTemplate,
'delete-template': deleteTemplate,
'list-broadcasts': listBroadcasts,
'get-broadcast': getBroadcast,
'create-broadcast-draft': createBroadcastDraft,
'update-broadcast': updateBroadcast,
'send-broadcast': sendBroadcast,
'delete-broadcast': deleteBroadcast,
'list-api-keys': listApiKeys,
'list-webhooks': listWebhooks,
'create-webhook': createWebhook,
'list-logs': listLogs,
request: resendCall,
} as const
export type ResendAction = keyof typeof actions
const actionNames = Object.keys(actions) as ResendAction[]
/**
* Root dispatcher. Defaults to the read-only smoke test.
* @example
* import resend from 'kody:@kody/resend'
* const result = await resend({ action: 'list-domains' })
*/
export default async function resend(input: Record<string, unknown> = {}) {
const action = parseAction(input.action, actionNames, 'smoke-test', 'Resend')
const handler = actions[action]
return await handler(input as never)
}