@messagebird/sdk 0.27.0 → 0.28.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 +1 @@
1
- {"version":3,"file":"index.mjs","names":["mergeHeaders","mergeHeaders","#defaults","#secret","#client","#baseUrl","#fetch","#headers","#raw"],"sources":["../src/generated/core/bodySerializer.gen.ts","../src/generated/core/serverSentEvents.gen.ts","../src/generated/core/pathSerializer.gen.ts","../src/generated/core/utils.gen.ts","../src/generated/core/auth.gen.ts","../src/generated/client/utils.gen.ts","../src/generated/client/client.gen.ts","../src/region.ts","../src/caller-rules.gen.ts","../src/detect-caller.ts","../src/errors.ts","../src/core/http.ts","../src/core/result.ts","../src/generated/client.gen.ts","../src/generated/sdk.gen.ts","../src/resources/base.ts","../src/resources/email.gen.ts","../src/resources/emailStats.gen.ts","../src/resources/emailMailboxes.gen.ts","../src/resources/emailMailboxesMessages.ts","../src/resources/emailMailboxesReceiveRules.gen.ts","../src/resources/emailMailboxes.ts","../src/resources/emailThreads.gen.ts","../src/resources/emailThreadsMessages.gen.ts","../src/resources/emailThreads.ts","../src/resources/email.ts","../src/resources/audiences.gen.ts","../src/resources/domains.gen.ts","../src/resources/contactProperties.gen.ts","../src/resources/contacts.gen.ts","../src/resources/sms.gen.ts","../src/resources/sms.ts","../src/resources/smsTemplates.gen.ts","../src/resources/whatsapp.gen.ts","../src/resources/whatsapp.ts","../src/resources/voice.gen.ts","../src/resources/verifyVerifications.gen.ts","../src/resources/verify.ts","../src/resources/webhooks.ts","../src/resources/realtime.gen.ts","../src/resources/realtimeChannels.gen.ts","../src/resources/realtimeMembers.gen.ts","../src/resources/realtime.ts","../src/client.ts","../src/event-types.gen.ts","../src/open-enums.gen.ts"],"sourcesContent":["// This file is auto-generated by @hey-api/openapi-ts\n\nimport type {\n ArrayStyle,\n ObjectStyle,\n SerializerOptions,\n} from \"./pathSerializer.gen\";\n\nexport type QuerySerializer = (query: Record<string, unknown>) => string;\n\nexport type BodySerializer = (body: unknown) => unknown;\n\ntype QuerySerializerOptionsObject = {\n allowReserved?: boolean;\n array?: Partial<SerializerOptions<ArrayStyle>>;\n object?: Partial<SerializerOptions<ObjectStyle>>;\n};\n\nexport type QuerySerializerOptions = QuerySerializerOptionsObject & {\n /**\n * Per-parameter serialization overrides. When provided, these settings\n * override the global array/object settings for specific parameter names.\n */\n parameters?: Record<string, QuerySerializerOptionsObject>;\n};\n\nconst serializeFormDataPair = (\n data: FormData,\n key: string,\n value: unknown,\n): void => {\n if (typeof value === \"string\" || value instanceof Blob) {\n data.append(key, value);\n } else if (value instanceof Date) {\n data.append(key, value.toISOString());\n } else {\n data.append(key, JSON.stringify(value));\n }\n};\n\nconst serializeUrlSearchParamsPair = (\n data: URLSearchParams,\n key: string,\n value: unknown,\n): void => {\n if (typeof value === \"string\") {\n data.append(key, value);\n } else {\n data.append(key, JSON.stringify(value));\n }\n};\n\nexport const formDataBodySerializer = {\n bodySerializer: (body: unknown): FormData => {\n const data = new FormData();\n\n Object.entries(body as Record<string, unknown>).forEach(([key, value]) => {\n if (value === undefined || value === null) {\n return;\n }\n if (Array.isArray(value)) {\n value.forEach((v) => serializeFormDataPair(data, key, v));\n } else {\n serializeFormDataPair(data, key, value);\n }\n });\n\n return data;\n },\n};\n\nexport const jsonBodySerializer = {\n bodySerializer: (body: unknown): string =>\n JSON.stringify(body, (_key, value) =>\n typeof value === \"bigint\" ? value.toString() : value,\n ),\n};\n\nexport const urlSearchParamsBodySerializer = {\n bodySerializer: (body: unknown): string => {\n const data = new URLSearchParams();\n\n Object.entries(body as Record<string, unknown>).forEach(([key, value]) => {\n if (value === undefined || value === null) {\n return;\n }\n if (Array.isArray(value)) {\n value.forEach((v) => serializeUrlSearchParamsPair(data, key, v));\n } else {\n serializeUrlSearchParamsPair(data, key, value);\n }\n });\n\n return data.toString();\n },\n};\n","// This file is auto-generated by @hey-api/openapi-ts\n\nimport type { Config } from \"./types.gen\";\n\nexport type ServerSentEventsOptions<TData = unknown> = Omit<\n RequestInit,\n \"method\"\n> &\n Pick<Config, \"method\" | \"responseTransformer\" | \"responseValidator\"> & {\n /**\n * Fetch API implementation. You can use this option to provide a custom\n * fetch instance.\n *\n * @default globalThis.fetch\n */\n fetch?: typeof fetch;\n /**\n * Implementing clients can call request interceptors inside this hook.\n */\n onRequest?: (url: string, init: RequestInit) => Promise<Request>;\n /**\n * Callback invoked when a network or parsing error occurs during streaming.\n *\n * This option applies only if the endpoint returns a stream of events.\n *\n * @param error The error that occurred.\n */\n onSseError?: (error: unknown) => void;\n /**\n * Callback invoked when an event is streamed from the server.\n *\n * This option applies only if the endpoint returns a stream of events.\n *\n * @param event Event streamed from the server.\n * @returns Nothing (void).\n */\n onSseEvent?: (event: StreamEvent<TData>) => void;\n serializedBody?: RequestInit[\"body\"];\n /**\n * Default retry delay in milliseconds.\n *\n * This option applies only if the endpoint returns a stream of events.\n *\n * @default 3000\n */\n sseDefaultRetryDelay?: number;\n /**\n * Maximum number of retry attempts before giving up.\n */\n sseMaxRetryAttempts?: number;\n /**\n * Maximum retry delay in milliseconds.\n *\n * Applies only when exponential backoff is used.\n *\n * This option applies only if the endpoint returns a stream of events.\n *\n * @default 30000\n */\n sseMaxRetryDelay?: number;\n /**\n * Optional sleep function for retry backoff.\n *\n * Defaults to using `setTimeout`.\n */\n sseSleepFn?: (ms: number) => Promise<void>;\n url: string;\n };\n\nexport interface StreamEvent<TData = unknown> {\n data: TData;\n event?: string;\n id?: string;\n retry?: number;\n}\n\nexport type ServerSentEventsResult<\n TData = unknown,\n TReturn = void,\n TNext = unknown,\n> = {\n stream: AsyncGenerator<\n TData extends Record<string, unknown> ? TData[keyof TData] : TData,\n TReturn,\n TNext\n >;\n};\n\nexport function createSseClient<TData = unknown>({\n onRequest,\n onSseError,\n onSseEvent,\n responseTransformer,\n responseValidator,\n sseDefaultRetryDelay,\n sseMaxRetryAttempts,\n sseMaxRetryDelay,\n sseSleepFn,\n url,\n ...options\n}: ServerSentEventsOptions): ServerSentEventsResult<TData> {\n let lastEventId: string | undefined;\n\n const sleep =\n sseSleepFn ??\n ((ms: number) => new Promise((resolve) => setTimeout(resolve, ms)));\n\n const createStream = async function* () {\n let retryDelay: number = sseDefaultRetryDelay ?? 3000;\n let attempt = 0;\n const signal = options.signal ?? new AbortController().signal;\n\n while (true) {\n if (signal.aborted) break;\n\n attempt++;\n\n const headers =\n options.headers instanceof Headers\n ? options.headers\n : new Headers(options.headers as Record<string, string> | undefined);\n\n if (lastEventId !== undefined) {\n headers.set(\"Last-Event-ID\", lastEventId);\n }\n\n try {\n const requestInit: RequestInit = {\n redirect: \"follow\",\n ...options,\n body: options.serializedBody,\n headers,\n signal,\n };\n let request = new Request(url, requestInit);\n if (onRequest) {\n request = await onRequest(url, requestInit);\n }\n // fetch must be assigned here, otherwise it would throw the error:\n // TypeError: Failed to execute 'fetch' on 'Window': Illegal invocation\n const _fetch = options.fetch ?? globalThis.fetch;\n const response = await _fetch(request);\n\n if (!response.ok)\n throw new Error(\n `SSE failed: ${response.status} ${response.statusText}`,\n );\n\n if (!response.body) throw new Error(\"No body in SSE response\");\n\n const reader = response.body\n .pipeThrough(new TextDecoderStream())\n .getReader();\n\n let buffer = \"\";\n\n const abortHandler = () => {\n try {\n reader.cancel();\n } catch {\n // noop\n }\n };\n\n signal.addEventListener(\"abort\", abortHandler);\n\n try {\n while (true) {\n const { done, value } = await reader.read();\n if (done) break;\n buffer += value;\n buffer = buffer.replace(/\\r\\n?/g, \"\\n\"); // normalize line endings\n\n const chunks = buffer.split(\"\\n\\n\");\n buffer = chunks.pop() ?? \"\";\n\n for (const chunk of chunks) {\n const lines = chunk.split(\"\\n\");\n const dataLines: Array<string> = [];\n let eventName: string | undefined;\n\n for (const line of lines) {\n if (line.startsWith(\"data:\")) {\n dataLines.push(line.replace(/^data:\\s*/, \"\"));\n } else if (line.startsWith(\"event:\")) {\n eventName = line.replace(/^event:\\s*/, \"\");\n } else if (line.startsWith(\"id:\")) {\n lastEventId = line.replace(/^id:\\s*/, \"\");\n } else if (line.startsWith(\"retry:\")) {\n const parsed = Number.parseInt(\n line.replace(/^retry:\\s*/, \"\"),\n 10,\n );\n if (!Number.isNaN(parsed)) {\n retryDelay = parsed;\n }\n }\n }\n\n let data: unknown;\n let parsedJson = false;\n\n if (dataLines.length) {\n const rawData = dataLines.join(\"\\n\");\n try {\n data = JSON.parse(rawData);\n parsedJson = true;\n } catch {\n data = rawData;\n }\n }\n\n if (parsedJson) {\n if (responseValidator) {\n await responseValidator(data);\n }\n\n if (responseTransformer) {\n data = await responseTransformer(data);\n }\n }\n\n onSseEvent?.({\n data,\n event: eventName,\n id: lastEventId,\n retry: retryDelay,\n });\n\n if (dataLines.length) {\n yield data as any;\n }\n }\n }\n } finally {\n signal.removeEventListener(\"abort\", abortHandler);\n reader.releaseLock();\n }\n\n break; // exit loop on normal completion\n } catch (error) {\n // connection failed or aborted; retry after delay\n onSseError?.(error);\n\n if (\n sseMaxRetryAttempts !== undefined &&\n attempt >= sseMaxRetryAttempts\n ) {\n break; // stop after firing error\n }\n\n // exponential backoff: double retry each attempt, cap at 30s\n const backoff = Math.min(\n retryDelay * 2 ** (attempt - 1),\n sseMaxRetryDelay ?? 30000,\n );\n await sleep(backoff);\n }\n }\n };\n\n const stream = createStream();\n\n return { stream };\n}\n","// This file is auto-generated by @hey-api/openapi-ts\n\ninterface SerializeOptions<T>\n extends SerializePrimitiveOptions, SerializerOptions<T> {}\n\ninterface SerializePrimitiveOptions {\n allowReserved?: boolean;\n name: string;\n}\n\nexport interface SerializerOptions<T> {\n /**\n * @default true\n */\n explode: boolean;\n style: T;\n}\n\nexport type ArrayStyle = \"form\" | \"spaceDelimited\" | \"pipeDelimited\";\nexport type ArraySeparatorStyle = ArrayStyle | MatrixStyle;\ntype MatrixStyle = \"label\" | \"matrix\" | \"simple\";\nexport type ObjectStyle = \"form\" | \"deepObject\";\ntype ObjectSeparatorStyle = ObjectStyle | MatrixStyle;\n\ninterface SerializePrimitiveParam extends SerializePrimitiveOptions {\n value: string;\n}\n\nexport const separatorArrayExplode = (style: ArraySeparatorStyle) => {\n switch (style) {\n case \"label\":\n return \".\";\n case \"matrix\":\n return \";\";\n case \"simple\":\n return \",\";\n default:\n return \"&\";\n }\n};\n\nexport const separatorArrayNoExplode = (style: ArraySeparatorStyle) => {\n switch (style) {\n case \"form\":\n return \",\";\n case \"pipeDelimited\":\n return \"|\";\n case \"spaceDelimited\":\n return \"%20\";\n default:\n return \",\";\n }\n};\n\nexport const separatorObjectExplode = (style: ObjectSeparatorStyle) => {\n switch (style) {\n case \"label\":\n return \".\";\n case \"matrix\":\n return \";\";\n case \"simple\":\n return \",\";\n default:\n return \"&\";\n }\n};\n\nexport const serializeArrayParam = ({\n allowReserved,\n explode,\n name,\n style,\n value,\n}: SerializeOptions<ArraySeparatorStyle> & {\n value: unknown[];\n}) => {\n if (!explode) {\n const joinedValues = (\n allowReserved ? value : value.map((v) => encodeURIComponent(v as string))\n ).join(separatorArrayNoExplode(style));\n switch (style) {\n case \"label\":\n return `.${joinedValues}`;\n case \"matrix\":\n return `;${name}=${joinedValues}`;\n case \"simple\":\n return joinedValues;\n default:\n return `${name}=${joinedValues}`;\n }\n }\n\n const separator = separatorArrayExplode(style);\n const joinedValues = value\n .map((v) => {\n if (style === \"label\" || style === \"simple\") {\n return allowReserved ? v : encodeURIComponent(v as string);\n }\n\n return serializePrimitiveParam({\n allowReserved,\n name,\n value: v as string,\n });\n })\n .join(separator);\n return style === \"label\" || style === \"matrix\"\n ? separator + joinedValues\n : joinedValues;\n};\n\nexport const serializePrimitiveParam = ({\n allowReserved,\n name,\n value,\n}: SerializePrimitiveParam) => {\n if (value === undefined || value === null) {\n return \"\";\n }\n\n if (typeof value === \"object\") {\n throw new Error(\n \"Deeply-nested arrays/objects aren’t supported. Provide your own `querySerializer()` to handle these.\",\n );\n }\n\n return `${name}=${allowReserved ? value : encodeURIComponent(value)}`;\n};\n\nexport const serializeObjectParam = ({\n allowReserved,\n explode,\n name,\n style,\n value,\n valueOnly,\n}: SerializeOptions<ObjectSeparatorStyle> & {\n value: Record<string, unknown> | Date;\n valueOnly?: boolean;\n}) => {\n if (value instanceof Date) {\n return valueOnly ? value.toISOString() : `${name}=${value.toISOString()}`;\n }\n\n if (style !== \"deepObject\" && !explode) {\n let values: string[] = [];\n Object.entries(value).forEach(([key, v]) => {\n values = [\n ...values,\n key,\n allowReserved ? (v as string) : encodeURIComponent(v as string),\n ];\n });\n const joinedValues = values.join(\",\");\n switch (style) {\n case \"form\":\n return `${name}=${joinedValues}`;\n case \"label\":\n return `.${joinedValues}`;\n case \"matrix\":\n return `;${name}=${joinedValues}`;\n default:\n return joinedValues;\n }\n }\n\n const separator = separatorObjectExplode(style);\n const joinedValues = Object.entries(value)\n .map(([key, v]) =>\n serializePrimitiveParam({\n allowReserved,\n name: style === \"deepObject\" ? `${name}[${key}]` : key,\n value: v as string,\n }),\n )\n .join(separator);\n return style === \"label\" || style === \"matrix\"\n ? separator + joinedValues\n : joinedValues;\n};\n","// This file is auto-generated by @hey-api/openapi-ts\n\nimport type { BodySerializer, QuerySerializer } from \"./bodySerializer.gen\";\nimport {\n type ArraySeparatorStyle,\n serializeArrayParam,\n serializeObjectParam,\n serializePrimitiveParam,\n} from \"./pathSerializer.gen\";\n\nexport interface PathSerializer {\n path: Record<string, unknown>;\n url: string;\n}\n\nexport const PATH_PARAM_RE = /\\{[^{}]+\\}/g;\n\nexport const defaultPathSerializer = ({ path, url: _url }: PathSerializer) => {\n let url = _url;\n const matches = _url.match(PATH_PARAM_RE);\n if (matches) {\n for (const match of matches) {\n let explode = false;\n let name = match.substring(1, match.length - 1);\n let style: ArraySeparatorStyle = \"simple\";\n\n if (name.endsWith(\"*\")) {\n explode = true;\n name = name.substring(0, name.length - 1);\n }\n\n if (name.startsWith(\".\")) {\n name = name.substring(1);\n style = \"label\";\n } else if (name.startsWith(\";\")) {\n name = name.substring(1);\n style = \"matrix\";\n }\n\n const value = path[name];\n\n if (value === undefined || value === null) {\n continue;\n }\n\n if (Array.isArray(value)) {\n url = url.replace(\n match,\n serializeArrayParam({ explode, name, style, value }),\n );\n continue;\n }\n\n if (typeof value === \"object\") {\n url = url.replace(\n match,\n serializeObjectParam({\n explode,\n name,\n style,\n value: value as Record<string, unknown>,\n valueOnly: true,\n }),\n );\n continue;\n }\n\n if (style === \"matrix\") {\n url = url.replace(\n match,\n `;${serializePrimitiveParam({\n name,\n value: value as string,\n })}`,\n );\n continue;\n }\n\n const replaceValue = encodeURIComponent(\n style === \"label\" ? `.${value as string}` : (value as string),\n );\n url = url.replace(match, replaceValue);\n }\n }\n return url;\n};\n\nexport const getUrl = ({\n baseUrl,\n path,\n query,\n querySerializer,\n url: _url,\n}: {\n baseUrl?: string;\n path?: Record<string, unknown>;\n query?: Record<string, unknown>;\n querySerializer: QuerySerializer;\n url: string;\n}) => {\n const pathUrl = _url.startsWith(\"/\") ? _url : `/${_url}`;\n let url = (baseUrl ?? \"\") + pathUrl;\n if (path) {\n url = defaultPathSerializer({ path, url });\n }\n let search = query ? querySerializer(query) : \"\";\n if (search.startsWith(\"?\")) {\n search = search.substring(1);\n }\n if (search) {\n url += `?${search}`;\n }\n return url;\n};\n\nexport function getValidRequestBody(options: {\n body?: unknown;\n bodySerializer?: BodySerializer | null;\n serializedBody?: unknown;\n}) {\n const hasBody = options.body !== undefined;\n const isSerializedBody = hasBody && options.bodySerializer;\n\n if (isSerializedBody) {\n if (\"serializedBody\" in options) {\n const hasSerializedBody =\n options.serializedBody !== undefined && options.serializedBody !== \"\";\n\n return hasSerializedBody ? options.serializedBody : null;\n }\n\n // not all clients implement a serializedBody property (i.e., client-axios)\n return options.body !== \"\" ? options.body : null;\n }\n\n // plain/text body\n if (hasBody) {\n return options.body;\n }\n\n // no body was provided\n return undefined;\n}\n","// This file is auto-generated by @hey-api/openapi-ts\n\nexport type AuthToken = string | undefined;\n\nexport interface Auth {\n /**\n * Which part of the request do we use to send the auth?\n *\n * @default 'header'\n */\n in?: \"header\" | \"query\" | \"cookie\";\n /**\n * Header or query parameter name.\n *\n * @default 'Authorization'\n */\n name?: string;\n scheme?: \"basic\" | \"bearer\";\n type: \"apiKey\" | \"http\";\n}\n\nexport const getAuthToken = async (\n auth: Auth,\n callback: ((auth: Auth) => Promise<AuthToken> | AuthToken) | AuthToken,\n): Promise<string | undefined> => {\n const token =\n typeof callback === \"function\" ? await callback(auth) : callback;\n\n if (!token) {\n return;\n }\n\n if (auth.scheme === \"bearer\") {\n return `Bearer ${token}`;\n }\n\n if (auth.scheme === \"basic\") {\n return `Basic ${btoa(token)}`;\n }\n\n return token;\n};\n","// This file is auto-generated by @hey-api/openapi-ts\n\nimport { getAuthToken } from \"../core/auth.gen\";\nimport type { QuerySerializerOptions } from \"../core/bodySerializer.gen\";\nimport { jsonBodySerializer } from \"../core/bodySerializer.gen\";\nimport {\n serializeArrayParam,\n serializeObjectParam,\n serializePrimitiveParam,\n} from \"../core/pathSerializer.gen\";\nimport { getUrl } from \"../core/utils.gen\";\nimport type {\n Client,\n ClientOptions,\n Config,\n RequestOptions,\n} from \"./types.gen\";\n\nexport const createQuerySerializer = <T = unknown>({\n parameters = {},\n ...args\n}: QuerySerializerOptions = {}) => {\n const querySerializer = (queryParams: T) => {\n const search: string[] = [];\n if (queryParams && typeof queryParams === \"object\") {\n for (const name in queryParams) {\n const value = queryParams[name];\n\n if (value === undefined || value === null) {\n continue;\n }\n\n const options = parameters[name] || args;\n\n if (Array.isArray(value)) {\n const serializedArray = serializeArrayParam({\n allowReserved: options.allowReserved,\n explode: true,\n name,\n style: \"form\",\n value,\n ...options.array,\n });\n if (serializedArray) search.push(serializedArray);\n } else if (typeof value === \"object\") {\n const serializedObject = serializeObjectParam({\n allowReserved: options.allowReserved,\n explode: true,\n name,\n style: \"deepObject\",\n value: value as Record<string, unknown>,\n ...options.object,\n });\n if (serializedObject) search.push(serializedObject);\n } else {\n const serializedPrimitive = serializePrimitiveParam({\n allowReserved: options.allowReserved,\n name,\n value: value as string,\n });\n if (serializedPrimitive) search.push(serializedPrimitive);\n }\n }\n }\n return search.join(\"&\");\n };\n return querySerializer;\n};\n\n/**\n * Infers parseAs value from provided Content-Type header.\n */\nexport const getParseAs = (\n contentType: string | null,\n): Exclude<Config[\"parseAs\"], \"auto\"> => {\n if (!contentType) {\n // If no Content-Type header is provided, the best we can do is return the raw response body,\n // which is effectively the same as the 'stream' option.\n return \"stream\";\n }\n\n const cleanContent = contentType.split(\";\")[0]?.trim();\n\n if (!cleanContent) {\n return;\n }\n\n if (\n cleanContent.startsWith(\"application/json\") ||\n cleanContent.endsWith(\"+json\")\n ) {\n return \"json\";\n }\n\n if (cleanContent === \"multipart/form-data\") {\n return \"formData\";\n }\n\n if (\n [\"application/\", \"audio/\", \"image/\", \"video/\"].some((type) =>\n cleanContent.startsWith(type),\n )\n ) {\n return \"blob\";\n }\n\n if (cleanContent.startsWith(\"text/\")) {\n return \"text\";\n }\n\n return;\n};\n\nconst checkForExistence = (\n options: Pick<RequestOptions, \"auth\" | \"query\"> & {\n headers: Headers;\n },\n name?: string,\n): boolean => {\n if (!name) {\n return false;\n }\n if (\n options.headers.has(name) ||\n options.query?.[name] ||\n options.headers.get(\"Cookie\")?.includes(`${name}=`)\n ) {\n return true;\n }\n return false;\n};\n\nexport async function setAuthParams(\n options: Pick<RequestOptions, \"auth\" | \"query\" | \"security\"> & {\n headers: Headers;\n },\n): Promise<void> {\n for (const auth of options.security ?? []) {\n if (checkForExistence(options, auth.name)) {\n continue;\n }\n\n const token = await getAuthToken(auth, options.auth);\n\n if (!token) {\n continue;\n }\n\n const name = auth.name ?? \"Authorization\";\n\n switch (auth.in) {\n case \"query\":\n if (!options.query) {\n options.query = {};\n }\n options.query[name] = token;\n break;\n case \"cookie\":\n options.headers.append(\"Cookie\", `${name}=${token}`);\n break;\n case \"header\":\n default:\n options.headers.set(name, token);\n break;\n }\n }\n}\n\nexport const buildUrl: Client[\"buildUrl\"] = (options) =>\n getUrl({\n baseUrl: options.baseUrl as string,\n path: options.path,\n query: options.query,\n querySerializer:\n typeof options.querySerializer === \"function\"\n ? options.querySerializer\n : createQuerySerializer(options.querySerializer),\n url: options.url,\n });\n\nexport const mergeConfigs = (a: Config, b: Config): Config => {\n const config = { ...a, ...b };\n if (config.baseUrl?.endsWith(\"/\")) {\n config.baseUrl = config.baseUrl.substring(0, config.baseUrl.length - 1);\n }\n config.headers = mergeHeaders(a.headers, b.headers);\n return config;\n};\n\nconst headersEntries = (headers: Headers): Array<[string, string]> => {\n const entries: Array<[string, string]> = [];\n headers.forEach((value, key) => {\n entries.push([key, value]);\n });\n return entries;\n};\n\nexport const mergeHeaders = (\n ...headers: Array<Required<Config>[\"headers\"] | undefined>\n): Headers => {\n const mergedHeaders = new Headers();\n for (const header of headers) {\n if (!header) {\n continue;\n }\n\n const iterator =\n header instanceof Headers\n ? headersEntries(header)\n : Object.entries(header);\n\n for (const [key, value] of iterator) {\n if (value === null) {\n mergedHeaders.delete(key);\n } else if (Array.isArray(value)) {\n for (const v of value) {\n mergedHeaders.append(key, v as string);\n }\n } else if (value !== undefined) {\n // assume object headers are meant to be JSON stringified, i.e., their\n // content value in OpenAPI specification is 'application/json'\n mergedHeaders.set(\n key,\n typeof value === \"object\" ? JSON.stringify(value) : (value as string),\n );\n }\n }\n }\n return mergedHeaders;\n};\n\ntype ErrInterceptor<Err, Res, Req, Options> = (\n error: Err,\n /** response may be undefined due to a network error where no response object is produced */\n response: Res | undefined,\n /** request may be undefined, because error may be from building the request object itself */\n request: Req | undefined,\n options: Options,\n) => Err | Promise<Err>;\n\ntype ReqInterceptor<Req, Options> = (\n request: Req,\n options: Options,\n) => Req | Promise<Req>;\n\ntype ResInterceptor<Res, Req, Options> = (\n response: Res,\n request: Req,\n options: Options,\n) => Res | Promise<Res>;\n\nclass Interceptors<Interceptor> {\n fns: Array<Interceptor | null> = [];\n\n clear(): void {\n this.fns = [];\n }\n\n eject(id: number | Interceptor): void {\n const index = this.getInterceptorIndex(id);\n if (this.fns[index]) {\n this.fns[index] = null;\n }\n }\n\n exists(id: number | Interceptor): boolean {\n const index = this.getInterceptorIndex(id);\n return Boolean(this.fns[index]);\n }\n\n getInterceptorIndex(id: number | Interceptor): number {\n if (typeof id === \"number\") {\n return this.fns[id] ? id : -1;\n }\n return this.fns.indexOf(id);\n }\n\n update(\n id: number | Interceptor,\n fn: Interceptor,\n ): number | Interceptor | false {\n const index = this.getInterceptorIndex(id);\n if (this.fns[index]) {\n this.fns[index] = fn;\n return id;\n }\n return false;\n }\n\n use(fn: Interceptor): number {\n this.fns.push(fn);\n return this.fns.length - 1;\n }\n}\n\nexport interface Middleware<Req, Res, Err, Options> {\n error: Interceptors<ErrInterceptor<Err, Res, Req, Options>>;\n request: Interceptors<ReqInterceptor<Req, Options>>;\n response: Interceptors<ResInterceptor<Res, Req, Options>>;\n}\n\nexport const createInterceptors = <Req, Res, Err, Options>(): Middleware<\n Req,\n Res,\n Err,\n Options\n> => ({\n error: new Interceptors<ErrInterceptor<Err, Res, Req, Options>>(),\n request: new Interceptors<ReqInterceptor<Req, Options>>(),\n response: new Interceptors<ResInterceptor<Res, Req, Options>>(),\n});\n\nconst defaultQuerySerializer = createQuerySerializer({\n allowReserved: false,\n array: {\n explode: true,\n style: \"form\",\n },\n object: {\n explode: true,\n style: \"deepObject\",\n },\n});\n\nconst defaultHeaders = {\n \"Content-Type\": \"application/json\",\n};\n\nexport const createConfig = <T extends ClientOptions = ClientOptions>(\n override: Config<Omit<ClientOptions, keyof T> & T> = {},\n): Config<Omit<ClientOptions, keyof T> & T> => ({\n ...jsonBodySerializer,\n headers: defaultHeaders,\n parseAs: \"auto\",\n querySerializer: defaultQuerySerializer,\n ...override,\n});\n","// This file is auto-generated by @hey-api/openapi-ts\n\nimport { createSseClient } from \"../core/serverSentEvents.gen\";\nimport type { HttpMethod } from \"../core/types.gen\";\nimport { getValidRequestBody } from \"../core/utils.gen\";\nimport type {\n Client,\n Config,\n RequestOptions,\n ResolvedRequestOptions,\n} from \"./types.gen\";\nimport {\n buildUrl,\n createConfig,\n createInterceptors,\n getParseAs,\n mergeConfigs,\n mergeHeaders,\n setAuthParams,\n} from \"./utils.gen\";\n\ntype ReqInit = Omit<RequestInit, \"body\" | \"headers\"> & {\n body?: any;\n headers: ReturnType<typeof mergeHeaders>;\n};\n\nexport const createClient = (config: Config = {}): Client => {\n let _config = mergeConfigs(createConfig(), config);\n\n const getConfig = (): Config => ({ ..._config });\n\n const setConfig = (config: Config): Config => {\n _config = mergeConfigs(_config, config);\n return getConfig();\n };\n\n const interceptors = createInterceptors<\n Request,\n Response,\n unknown,\n ResolvedRequestOptions\n >();\n\n const beforeRequest = async <\n TData = unknown,\n TResponseStyle extends \"data\" | \"fields\" = \"fields\",\n ThrowOnError extends boolean = boolean,\n Url extends string = string,\n >(\n options: RequestOptions<TData, TResponseStyle, ThrowOnError, Url>,\n ) => {\n const opts = {\n ..._config,\n ...options,\n fetch: options.fetch ?? _config.fetch ?? globalThis.fetch,\n headers: mergeHeaders(_config.headers, options.headers),\n serializedBody: undefined as string | undefined,\n };\n\n if (opts.security) {\n await setAuthParams(opts);\n }\n\n if (opts.requestValidator) {\n await opts.requestValidator(opts);\n }\n\n if (opts.body !== undefined && opts.bodySerializer) {\n opts.serializedBody = opts.bodySerializer(opts.body) as\n string | undefined;\n }\n\n // remove Content-Type header if body is empty to avoid sending invalid requests\n if (opts.body === undefined || opts.serializedBody === \"\") {\n opts.headers.delete(\"Content-Type\");\n }\n\n const resolvedOpts = opts as typeof opts &\n ResolvedRequestOptions<TResponseStyle, ThrowOnError, Url>;\n const url = buildUrl(resolvedOpts);\n\n return { opts: resolvedOpts, url };\n };\n\n const request: Client[\"request\"] = async (options) => {\n const throwOnError = options.throwOnError ?? _config.throwOnError;\n const responseStyle = options.responseStyle ?? _config.responseStyle;\n\n let request: Request | undefined;\n let response: Response | undefined;\n\n try {\n const { opts, url } = await beforeRequest(options);\n const requestInit: ReqInit = {\n redirect: \"follow\",\n ...opts,\n body: getValidRequestBody(opts),\n };\n\n request = new Request(url, requestInit);\n\n for (const fn of interceptors.request.fns) {\n if (fn) {\n request = await fn(request, opts);\n }\n }\n\n // fetch must be assigned here, otherwise it would throw the error:\n // TypeError: Failed to execute 'fetch' on 'Window': Illegal invocation\n const _fetch = opts.fetch!;\n\n response = await _fetch(request);\n\n for (const fn of interceptors.response.fns) {\n if (fn) {\n response = await fn(response, request, opts);\n }\n }\n\n const result = {\n request,\n response,\n };\n\n if (response.ok) {\n const parseAs =\n (opts.parseAs === \"auto\"\n ? getParseAs(response.headers.get(\"Content-Type\"))\n : opts.parseAs) ?? \"json\";\n\n if (\n response.status === 204 ||\n response.headers.get(\"Content-Length\") === \"0\"\n ) {\n let emptyData: any;\n switch (parseAs) {\n case \"arrayBuffer\":\n case \"blob\":\n case \"text\":\n emptyData = await response[parseAs]();\n break;\n case \"formData\":\n emptyData = new FormData();\n break;\n case \"stream\":\n emptyData = response.body;\n break;\n case \"json\":\n default:\n emptyData = {};\n break;\n }\n return opts.responseStyle === \"data\"\n ? emptyData\n : {\n data: emptyData,\n ...result,\n };\n }\n\n let data: any;\n switch (parseAs) {\n case \"arrayBuffer\":\n case \"blob\":\n case \"formData\":\n case \"text\":\n data = await response[parseAs]();\n break;\n case \"json\": {\n // Some servers return 200 with no Content-Length and empty body.\n // response.json() would throw; read as text and parse if non-empty.\n const text = await response.text();\n data = text ? JSON.parse(text) : {};\n break;\n }\n case \"stream\":\n return opts.responseStyle === \"data\"\n ? response.body\n : {\n data: response.body,\n ...result,\n };\n }\n\n if (parseAs === \"json\") {\n if (opts.responseValidator) {\n await opts.responseValidator(data);\n }\n\n if (opts.responseTransformer) {\n data = await opts.responseTransformer(data);\n }\n }\n\n return opts.responseStyle === \"data\"\n ? data\n : {\n data,\n ...result,\n };\n }\n\n const textError = await response.text();\n let jsonError: unknown;\n\n try {\n jsonError = JSON.parse(textError);\n } catch {\n // noop\n }\n\n throw jsonError ?? textError;\n } catch (error) {\n let finalError = error;\n\n for (const fn of interceptors.error.fns) {\n if (fn) {\n finalError = await fn(\n finalError,\n response,\n request,\n options as ResolvedRequestOptions,\n );\n }\n }\n\n finalError = finalError || {};\n\n if (throwOnError) {\n throw finalError;\n }\n\n // TODO: we probably want to return error and improve types\n return responseStyle === \"data\"\n ? undefined\n : {\n error: finalError,\n request,\n response,\n };\n }\n };\n\n const makeMethodFn =\n (method: Uppercase<HttpMethod>) => (options: RequestOptions) =>\n request({ ...options, method });\n\n const makeSseFn =\n (method: Uppercase<HttpMethod>) => async (options: RequestOptions) => {\n const { opts, url } = await beforeRequest(options);\n return createSseClient({\n ...opts,\n body: opts.body as BodyInit | null | undefined,\n method,\n onRequest: async (url, init) => {\n let request = new Request(url, init);\n for (const fn of interceptors.request.fns) {\n if (fn) {\n request = await fn(request, opts);\n }\n }\n return request;\n },\n serializedBody: getValidRequestBody(opts) as\n BodyInit | null | undefined,\n url,\n });\n };\n\n const _buildUrl: Client[\"buildUrl\"] = (options) =>\n buildUrl({ ..._config, ...options });\n\n return {\n buildUrl: _buildUrl,\n connect: makeMethodFn(\"CONNECT\"),\n delete: makeMethodFn(\"DELETE\"),\n get: makeMethodFn(\"GET\"),\n getConfig,\n head: makeMethodFn(\"HEAD\"),\n interceptors,\n options: makeMethodFn(\"OPTIONS\"),\n patch: makeMethodFn(\"PATCH\"),\n post: makeMethodFn(\"POST\"),\n put: makeMethodFn(\"PUT\"),\n request,\n setConfig,\n sse: {\n connect: makeSseFn(\"CONNECT\"),\n delete: makeSseFn(\"DELETE\"),\n get: makeSseFn(\"GET\"),\n head: makeSseFn(\"HEAD\"),\n options: makeSseFn(\"OPTIONS\"),\n patch: makeSseFn(\"PATCH\"),\n post: makeSseFn(\"POST\"),\n put: makeSseFn(\"PUT\"),\n trace: makeSseFn(\"TRACE\"),\n },\n trace: makeMethodFn(\"TRACE\"),\n } as Client;\n};\n","// API keys encode their region as bk_{region}_{token}, so the client can route\n// to {region}.platform.bird.com automatically.\n\nconst REGION_PATTERN = /^[a-z]{2}[0-9]+$/;\n\n/** Extracts the region code from a `bk_{region}_{token}` key, or undefined. */\nexport function regionFromApiKey(apiKey: string): string | undefined {\n const [prefix, region, token] = apiKey.split(\"_\");\n if (prefix !== \"bk\" || !region || !token) return undefined;\n return REGION_PATTERN.test(region) ? region : undefined;\n}\n\nexport function baseUrlForRegion(region: string): string {\n return `https://${region}.platform.bird.com`;\n}\n","// Code generated by beak gen:caller-detection from clients/caller-detection.yaml. DO NOT EDIT.\n\nexport interface CallerRule {\n env: string;\n equals?: string;\n name?: string;\n passthrough?: boolean;\n}\n\nexport const callerRules: CallerRule[] = [\n { env: \"CLAUDECODE\", name: \"claude-code\" },\n { env: \"CODEX_CI\", name: \"codex\" },\n { env: \"GEMINI_CLI\", name: \"gemini\" },\n { env: \"QWEN_CODE\", name: \"qwen\" },\n { env: \"PI_CODING_AGENT\", name: \"pi\" },\n { env: \"OPENCODE\", name: \"opencode\" },\n { env: \"CLINE_ACTIVE\", name: \"cline\" },\n { env: \"ROO_ACTIVE\", name: \"roo\" },\n { env: \"CURSOR_TRACE_ID\", name: \"cursor\" },\n { env: \"CURSOR_AGENT\", name: \"cursor\" },\n { env: \"ANTIGRAVITY_AGENT\", name: \"antigravity\" },\n { env: \"AUGMENT_AGENT\", name: \"augment\" },\n { env: \"AGENT\", passthrough: true },\n { env: \"AI_AGENT\", passthrough: true },\n { env: \"REPL_ID\", name: \"replit\" },\n { env: \"CI\", name: \"ci\" },\n { env: \"GITHUB_ACTIONS\", name: \"ci\" },\n { env: \"TERM_PROGRAM\", equals: \"zed\", name: \"zed\" },\n { env: \"ZED_TERM\", name: \"zed\" },\n { env: \"TERM_PROGRAM\", equals: \"kiro\", name: \"kiro\" },\n { env: \"TERM_PROGRAM\", equals: \"WarpTerminal\", name: \"warp\" },\n { env: \"TERMINAL_EMULATOR\", equals: \"JetBrains-JediTerm\", name: \"jetbrains\" },\n { env: \"__CFBundleIdentifier\", equals: \"com.exafunction.windsurf\", name: \"windsurf\" },\n { env: \"TERM_PROGRAM\", equals: \"vscode\", name: \"vscode\" },\n];\n\nexport const callerBooleanishSkip: ReadonlySet<string> = new Set([\"1\", \"0\", \"true\", \"false\", \"yes\", \"no\", \"on\", \"off\"]);\n\nexport const callerDefault = \"shell\";\n","import { callerRules, callerBooleanishSkip, callerDefault } from \"./caller-rules.gen.js\";\n\n/**\n * Infers the environment driving the SDK for the `Bird-Caller` usage-telemetry\n * label by walking the generated rules in order (single source of truth:\n * `clients/caller-detection.yaml`, shared with the CLI and the other SDKs).\n * Best-effort and non-authoritative — it only labels traffic, never gates\n * behavior.\n *\n * Edge-safe: `process` is read only through a `typeof`-style `globalThis` guard,\n * so on a browser (no `process.env`) it returns `\"\"` and the client sends no\n * `Bird-Caller` header. `env` is injected in tests.\n */\nexport function detectCaller(env?: Record<string, string | undefined>): string {\n // Tests / explicit callers pass `env`. Otherwise derive it from a *real* Node\n // process only: a browser — including one whose bundler polyfills an empty\n // `process.env` — has no agent, so we return \"\" (no header) rather than falling\n // through to the shell default. A genuine Node process always sets\n // `process.versions.node`; polyfills do not.\n let source = env;\n if (source === undefined) {\n const proc = (\n globalThis as {\n process?: { env?: Record<string, string | undefined>; versions?: { node?: string } };\n }\n ).process;\n if (proc?.versions?.node === undefined) return \"\";\n source = proc.env ?? {};\n }\n for (const rule of callerRules) {\n const value = source[rule.env];\n if (value === undefined || value === \"\" || (rule.equals !== undefined && value !== rule.equals)) {\n continue;\n }\n if (!rule.passthrough) return rule.name as string;\n const sanitized = sanitizeCaller(value);\n if (sanitized) return sanitized;\n }\n return callerDefault;\n}\n\n// Lowercases and bounds a passthrough (AGENT=<name>) value the same charset+length\n// way as the other Bird-* labels, dropping boolean-ish values that carry no\n// harness identity (e.g. OpenCode sets AGENT=1).\nfunction sanitizeCaller(value: string): string {\n const s = value.trim().toLowerCase();\n if (s === \"\" || s.length > 32 || callerBooleanishSkip.has(s)) return \"\";\n return /^[a-z0-9._-]+$/.test(s) ? s : \"\";\n}\n","// Error hierarchy for the Bird SDK.\n//\n// One class per error `type` (clients branch on the coarse `type`,\n// never on individual codes). Two transport classes cover failures with no HTTP\n// response. Scalar fields on the error objects are camelCase — these are\n// SDK-constructed objects, not wire data (the Stripe/OpenAI-node convention:\n// snake data, camel code). Nested wire payloads (validation `details`) pass\n// through as-is.\n//\n// `mapResponseToError` is the single place a non-2xx response becomes a thrown\n// error; the request core calls it once a response is terminal.\n\n/** Root of the hierarchy. Catch this to catch anything the SDK throws. */\nexport class BirdError extends Error {\n constructor(message: string) {\n super(message);\n this.name = \"BirdError\";\n Object.setPrototypeOf(this, new.target.prototype);\n }\n}\n\n/** Network-level failure with no HTTP response (DNS, refused, socket hangup). */\nexport class BirdConnectionError extends BirdError {\n constructor(message: string) {\n super(message);\n this.name = \"BirdConnectionError\";\n Object.setPrototypeOf(this, new.target.prototype);\n }\n}\n\n/** A single attempt exceeded its timeout. Retryable. */\nexport class BirdTimeoutError extends BirdError {\n readonly timeoutMs: number;\n constructor(message: string, timeoutMs: number) {\n super(message);\n this.name = \"BirdTimeoutError\";\n this.timeoutMs = timeoutMs;\n Object.setPrototypeOf(this, new.target.prototype);\n }\n}\n\n/** A webhook payload failed signature verification (bad signature, stale timestamp, malformed headers). */\nexport class BirdWebhookVerificationError extends BirdError {\n constructor(message: string) {\n super(message);\n this.name = \"BirdWebhookVerificationError\";\n Object.setPrototypeOf(this, new.target.prototype);\n }\n}\n\n/** One per-field validation failure (the `details` array on a 422). */\nexport interface ErrorDetail {\n /** Dotted field path, e.g. `to[0].email`, `subject`, `.`. */\n param: string;\n /** What is wrong with this field. */\n message: string;\n}\n\n/** One recovery step: an operation to call to resolve the error. */\nexport interface ErrorNextAction {\n /** operationId of the follow-up operation that resolves this error. */\n operation: string;\n /** Short human-readable label for the recovery step. */\n description?: string;\n /** Permission scope the recovery operation requires, when it is scoped. */\n scope?: string;\n}\n\n/** One verification requirement blocking the action, with the flow that resolves it. */\nexport interface UnmetGate {\n /** Stable identifier for the verification requirement. */\n slug: string;\n /** Human-readable name of the verification requirement. */\n name: string;\n /** The requirement's current state. */\n status: string;\n /** How to resolve this requirement. */\n remediation_kind: string;\n}\n\n/** Constructor fields shared by every API error, mapped from the wire body. */\nexport interface BirdAPIErrorFields {\n statusCode: number;\n /** Opaque, stable error code (`E#####`). */\n code: string;\n /** Coarse category — the value callers branch on. */\n type: string;\n /** Human-readable slug for logs. Paired with `code`, never replaces it. */\n errorName: string;\n message: string;\n /** Stable link to the docs page for this code. */\n docUrl: string;\n /** Correlation ID — also the `X-Request-Id` response header. */\n requestId: string;\n /** Offending field, when applicable. */\n param?: string;\n /** Verbatim code from a downstream system (SMTP reply, payment decline). */\n vendorCode?: string;\n /** Human recovery line for this error, when a recovery is known. */\n remediation?: string;\n /** Operations that resolve this error, in the order to try them. */\n next?: ErrorNextAction[];\n /** Verification requirements blocking this action, when it is blocked pending verification. */\n unmetGates?: UnmetGate[];\n}\n\n/** The server returned an error body. Base for every `type`-specific class. */\nexport class BirdAPIError extends BirdError {\n readonly statusCode: number;\n readonly code: string;\n readonly type: string;\n readonly errorName: string;\n readonly docUrl: string;\n readonly requestId: string;\n readonly param?: string;\n readonly vendorCode?: string;\n readonly remediation?: string;\n readonly next?: ErrorNextAction[];\n readonly unmetGates?: UnmetGate[];\n\n constructor(fields: BirdAPIErrorFields) {\n super(fields.message);\n this.name = \"BirdAPIError\";\n this.statusCode = fields.statusCode;\n this.code = fields.code;\n this.type = fields.type;\n this.errorName = fields.errorName;\n this.docUrl = fields.docUrl;\n this.requestId = fields.requestId;\n this.param = fields.param;\n this.vendorCode = fields.vendorCode;\n this.remediation = fields.remediation;\n this.next = fields.next;\n this.unmetGates = fields.unmetGates;\n Object.setPrototypeOf(this, new.target.prototype);\n }\n}\n\n// One class per `type` enum value. The plain ones add nothing beyond the base;\n// they exist so callers can `instanceof BirdNotFoundError` rather than compare\n// strings, and so the special-field classes have peers.\n\n/** 401 — authentication failed or missing. */\nexport class BirdAuthError extends BirdAPIError {\n constructor(fields: BirdAPIErrorFields) {\n super(fields);\n this.name = \"BirdAuthError\";\n Object.setPrototypeOf(this, new.target.prototype);\n }\n}\n\n/** 403 — authenticated but not allowed. */\nexport class BirdPermissionError extends BirdAPIError {\n constructor(fields: BirdAPIErrorFields) {\n super(fields);\n this.name = \"BirdPermissionError\";\n Object.setPrototypeOf(this, new.target.prototype);\n }\n}\n\n/** 404 — resource does not exist. */\nexport class BirdNotFoundError extends BirdAPIError {\n constructor(fields: BirdAPIErrorFields) {\n super(fields);\n this.name = \"BirdNotFoundError\";\n Object.setPrototypeOf(this, new.target.prototype);\n }\n}\n\n/** 409 — semantic conflict (e.g. a unique value already taken). */\nexport class BirdConflictError extends BirdAPIError {\n constructor(fields: BirdAPIErrorFields) {\n super(fields);\n this.name = \"BirdConflictError\";\n Object.setPrototypeOf(this, new.target.prototype);\n }\n}\n\n/** 400 — malformed request. */\nexport class BirdBadRequestError extends BirdAPIError {\n constructor(fields: BirdAPIErrorFields) {\n super(fields);\n this.name = \"BirdBadRequestError\";\n Object.setPrototypeOf(this, new.target.prototype);\n }\n}\n\n/** 402 — billing/balance problem. */\nexport class BirdBillingError extends BirdAPIError {\n constructor(fields: BirdAPIErrorFields) {\n super(fields);\n this.name = \"BirdBillingError\";\n Object.setPrototypeOf(this, new.target.prototype);\n }\n}\n\n/** 412/428 — a precondition was not met. */\nexport class BirdPreconditionError extends BirdAPIError {\n constructor(fields: BirdAPIErrorFields) {\n super(fields);\n this.name = \"BirdPreconditionError\";\n Object.setPrototypeOf(this, new.target.prototype);\n }\n}\n\n/** 413 — request body too large. */\nexport class BirdPayloadTooLargeError extends BirdAPIError {\n constructor(fields: BirdAPIErrorFields) {\n super(fields);\n this.name = \"BirdPayloadTooLargeError\";\n Object.setPrototypeOf(this, new.target.prototype);\n }\n}\n\n/** 500 — unexpected server error. */\nexport class BirdInternalError extends BirdAPIError {\n constructor(fields: BirdAPIErrorFields) {\n super(fields);\n this.name = \"BirdInternalError\";\n Object.setPrototypeOf(this, new.target.prototype);\n }\n}\n\n/** 501 — endpoint not implemented. */\nexport class BirdNotImplementedError extends BirdAPIError {\n constructor(fields: BirdAPIErrorFields) {\n super(fields);\n this.name = \"BirdNotImplementedError\";\n Object.setPrototypeOf(this, new.target.prototype);\n }\n}\n\n/** 421 — request reached the wrong region. */\nexport class BirdMisdirectedError extends BirdAPIError {\n constructor(fields: BirdAPIErrorFields) {\n super(fields);\n this.name = \"BirdMisdirectedError\";\n Object.setPrototypeOf(this, new.target.prototype);\n }\n}\n\n/** 503 — service temporarily unavailable. */\nexport class BirdServiceUnavailableError extends BirdAPIError {\n constructor(fields: BirdAPIErrorFields) {\n super(fields);\n this.name = \"BirdServiceUnavailableError\";\n Object.setPrototypeOf(this, new.target.prototype);\n }\n}\n\n/** 422 — field validation failed; `details` carries the per-field errors. */\nexport class BirdValidationError extends BirdAPIError {\n readonly details: ErrorDetail[];\n constructor(fields: BirdAPIErrorFields & { details: ErrorDetail[] }) {\n super(fields);\n this.name = \"BirdValidationError\";\n this.details = fields.details;\n Object.setPrototypeOf(this, new.target.prototype);\n }\n}\n\n/** 429 — rate limited; `retryAfter` is the server-advised wait in seconds. */\nexport class BirdRateLimitError extends BirdAPIError {\n readonly retryAfter?: number;\n constructor(fields: BirdAPIErrorFields & { retryAfter?: number }) {\n super(fields);\n this.name = \"BirdRateLimitError\";\n this.retryAfter = fields.retryAfter;\n Object.setPrototypeOf(this, new.target.prototype);\n }\n}\n\n/** Shape of the wire error body (`ErrorBody`), snake_case as sent. */\ninterface WireErrorBody {\n type?: string;\n code?: string;\n name?: string;\n message?: string;\n doc_url?: string;\n request_id?: string;\n param?: string;\n vendor_code?: string;\n details?: ErrorDetail[];\n remediation?: string;\n next?: ErrorNextAction[];\n unmet_gates?: UnmetGate[];\n}\n\n/**\n * Parse `Retry-After` (delta-seconds or HTTP-date) into whole seconds. A\n * negative or unparseable value yields `undefined` — a negative wait is\n * meaningless, so both the user-facing `retryAfter` and the retry loop treat it\n * as \"no server advice\". The single Retry-After parser; `retryDelay` builds on it.\n */\nexport function parseRetryAfter(headers?: Headers): number | undefined {\n const header = headers?.get(\"Retry-After\");\n if (!header) return undefined;\n const seconds = Number(header);\n const value = Number.isFinite(seconds)\n ? seconds\n : (Date.parse(header) - Date.now()) / 1000;\n return Number.isFinite(value) && value >= 0 ? Math.round(value) : undefined;\n}\n\n// Status → type fallback for non-JSON error bodies (proxy 502s, etc.) where the\n// body carries no `type`.\nfunction inferType(status: number): string {\n switch (status) {\n case 400:\n return \"bad_request_error\";\n case 401:\n return \"auth_error\";\n case 402:\n return \"billing_error\";\n case 403:\n return \"permission_error\";\n case 404:\n return \"not_found_error\";\n case 409:\n return \"conflict_error\";\n case 412:\n case 428:\n return \"precondition_error\";\n case 413:\n return \"payload_too_large_error\";\n case 421:\n return \"misdirected_error\";\n case 422:\n return \"validation_error\";\n case 429:\n return \"rate_limit_error\";\n case 501:\n return \"not_implemented_error\";\n case 503:\n return \"service_unavailable_error\";\n default:\n return status >= 500 ? \"internal_error\" : \"bad_request_error\";\n }\n}\n\n/**\n * Map a non-2xx response to the right `BirdAPIError` subclass. The single place\n * the SDK turns a wire error into a thrown error.\n */\nexport function mapResponseToError(\n status: number,\n body: unknown,\n headers?: Headers,\n): BirdAPIError {\n // The API wraps errors as `{ \"error\": { … } }`; unwrap it (tolerating a bare\n // top-level body and a non-object body) so the wire type/code/message/request_id\n // are read, not defaulted. Without this the type was only ever inferred from the\n // HTTP status and code/request_id were dropped.\n const raw = (body ?? {}) as Record<string, unknown>;\n const b =\n (raw.error as WireErrorBody | undefined) ?? (raw as WireErrorBody) ?? {};\n const fields: BirdAPIErrorFields = {\n statusCode: status,\n code: b.code ?? \"unknown\",\n type: b.type ?? inferType(status),\n errorName: b.name ?? \"\",\n message: b.message ?? `Request failed with status ${status}`,\n docUrl: b.doc_url ?? \"\",\n requestId: b.request_id ?? headers?.get(\"X-Request-Id\") ?? \"\",\n param: b.param,\n vendorCode: b.vendor_code,\n remediation: b.remediation,\n next: b.next ?? [], // normalize a null/absent wire `next` to [] so callers can always iterate\n unmetGates: b.unmet_gates ?? [], // normalize a null/absent wire `unmet_gates` to [] so callers can always iterate\n };\n\n switch (fields.type) {\n case \"auth_error\":\n return new BirdAuthError(fields);\n case \"permission_error\":\n return new BirdPermissionError(fields);\n case \"not_found_error\":\n return new BirdNotFoundError(fields);\n case \"conflict_error\":\n return new BirdConflictError(fields);\n case \"bad_request_error\":\n return new BirdBadRequestError(fields);\n case \"billing_error\":\n return new BirdBillingError(fields);\n case \"precondition_error\":\n return new BirdPreconditionError(fields);\n case \"payload_too_large_error\":\n return new BirdPayloadTooLargeError(fields);\n case \"internal_error\":\n return new BirdInternalError(fields);\n case \"not_implemented_error\":\n return new BirdNotImplementedError(fields);\n case \"misdirected_error\":\n return new BirdMisdirectedError(fields);\n case \"service_unavailable_error\":\n return new BirdServiceUnavailableError(fields);\n case \"rate_limit_error\":\n return new BirdRateLimitError({\n ...fields,\n retryAfter: parseRetryAfter(headers),\n });\n case \"validation_error\":\n return new BirdValidationError({ ...fields, details: b.details ?? [] });\n default:\n return new BirdAPIError(fields);\n }\n}\n","// The request lifecycle: retries, timeouts, and idempotency.\n//\n// BirdHTTPClient owns the attempt loop and wraps a generated hey-api SDK call\n// (passed as a thunk) so resources keep the generated call-site typing while\n// the loop owns: idempotency-key generate-once-and-reuse, per-attempt timeout,\n// AbortSignal, backoff with full jitter + Retry-After, and turning a terminal\n// response into a thrown BirdError via mapResponseToError.\n//\n// The hey-api client is configured WITHOUT throwOnError: a non-2xx returns\n// `{ error, response }` so this loop can inspect status and decide\n// retry-vs-throw. Network failures reject and are caught here.\n\nimport {\n BirdConnectionError,\n BirdError,\n BirdTimeoutError,\n mapResponseToError,\n parseRetryAfter,\n} from \"../errors.js\";\n\n/** Transport metadata exposed to callers via `.withResponse()`. */\nexport interface BirdResponse {\n status: number;\n headers: Headers;\n /** Correlation ID — the `X-Request-Id` header. */\n requestId: string;\n}\n\n/** Per-request lifecycle inputs, supplied by the resource method. */\nexport interface RequestLifecycleOptions {\n /** HTTP method — decides idempotency-key generation and retry safety. */\n method: string;\n /** Caller-supplied idempotency key; auto-generated for mutations if absent. */\n idempotencyKey?: string;\n /** Caller cancellation. */\n signal?: AbortSignal;\n /** Per-attempt timeout (ms). Overrides the client default. */\n timeout?: number;\n /** Max retry attempts. Overrides the client default. */\n maxRetries?: number;\n}\n\n/** The shape a generated hey-api SDK call resolves to. */\nexport interface FetchOutcome<T> {\n data?: T;\n error?: unknown;\n /** Present whenever the HTTP round-trip completed; absent only on a rejected call. */\n response?: Response;\n}\n\n/** Context handed to the call thunk on each attempt. */\nexport interface AttemptContext {\n signal: AbortSignal;\n idempotencyKey?: string;\n}\n\nexport interface CoreDefaults {\n /** Per-attempt timeout (ms). */\n timeout: number;\n /** Max retry attempts. */\n maxRetries: number;\n /**\n * Extra credentials some operations require on top of the API key, keyed by the\n * security scheme that names them. A generated method names the schemes its\n * operation declares; the core resolves them, so a credential reaches only\n * those operations and never an unrelated request.\n */\n credentials?: Record<string, { header: string; value?: string; how: string }>;\n}\n\nconst BACKOFF_BASE_MS = 500;\nconst BACKOFF_CAP_MS = 8_000;\nconst RETRY_AFTER_CAP_MS = 60_000;\n\nexport class BirdHTTPClient {\n constructor(private readonly defaults: CoreDefaults) {}\n\n /**\n * Resolve the credential headers an operation's security schemes require.\n * Throws before the request when one is unconfigured, so a caller gets a named\n * error instead of a 401.\n */\n credentialHeaders(\n schemes: string[] | undefined,\n override?: Record<string, string>,\n ): Record<string, string> {\n if (!schemes?.length) return {};\n const out: Record<string, string> = {};\n for (const scheme of schemes) {\n const cred = this.defaults.credentials?.[scheme];\n if (!cred) throw new Error(`Unknown credential scheme \"${scheme}\"`);\n const value = override?.[scheme] ?? cred.value;\n if (!value) throw new Error(`${cred.header} is required for this operation. ${cred.how}`);\n out[cred.header] = value;\n }\n return out;\n }\n\n /**\n * Run a generated hey-api SDK call through the request lifecycle.\n *\n * @param call Invokes the SDK function; receives the per-attempt signal and\n * the idempotency key to set as a header.\n * @returns the parsed body plus transport metadata.\n * @throws a `BirdError` subclass on terminal failure; the native\n * `AbortError` if the caller's signal aborts.\n */\n async request<T>(\n call: (ctx: AttemptContext) => Promise<FetchOutcome<T>>,\n options: RequestLifecycleOptions,\n ): Promise<{ data: T; response: BirdResponse }> {\n const maxRetries = options.maxRetries ?? this.defaults.maxRetries;\n const timeout = options.timeout ?? this.defaults.timeout;\n // Generated once, reused on every attempt — regenerating would double-execute.\n const idempotencyKey =\n options.idempotencyKey ??\n (isMutation(options.method) ? crypto.randomUUID() : undefined);\n\n for (let attempt = 0; ; attempt++) {\n throwIfAborted(options.signal);\n\n // Retry a transient failure with backoff if attempts remain; otherwise\n // throw the terminal error. Caller `continue`s the loop after this returns.\n const retryOrThrow = async (terminal: () => BirdError): Promise<void> => {\n if (attempt >= maxRetries) throw terminal();\n await sleep(backoffDelay(attempt), options.signal);\n };\n\n const timeoutSignal = AbortSignal.timeout(timeout);\n const signal = options.signal\n ? AbortSignal.any([options.signal, timeoutSignal])\n : timeoutSignal;\n\n let outcome: FetchOutcome<T> | undefined;\n try {\n outcome = await call({ signal, idempotencyKey });\n } catch (err) {\n // The fetch rejected: caller abort, per-attempt timeout, or network.\n throwIfAborted(options.signal); // caller abort wins, terminal\n await retryOrThrow(() =>\n timeoutSignal.aborted\n ? new BirdTimeoutError(`Request timed out after ${timeout}ms`, timeout)\n : new BirdConnectionError(errorMessage(err)),\n );\n continue;\n }\n\n const res = outcome.response;\n if (!res) {\n // A resolved call with no response is a transport failure (the client\n // normally rejects instead) — treat it like a network error.\n await retryOrThrow(() => new BirdConnectionError(\"No response received from the server\"));\n continue;\n }\n if (res.ok) {\n return { data: outcome.data as T, response: toBirdResponse(res) };\n }\n if (!isRetryableStatus(res.status) || attempt >= maxRetries) {\n throw mapResponseToError(res.status, outcome.error, res.headers);\n }\n await sleep(retryDelay(attempt, res.headers), options.signal);\n }\n }\n}\n\nfunction isMutation(method: string): boolean {\n return [\"POST\", \"PATCH\", \"DELETE\"].includes(method.toUpperCase());\n}\n\n// Retry network failures, per-attempt timeouts, and transient statuses. 409 is a\n// semantic conflict a retry can't resolve; 501 is permanent; other 4xx are\n// deterministic.\nfunction isRetryableStatus(status: number): boolean {\n return [408, 429, 500, 502, 503, 504].includes(status);\n}\n\n/** Full-jitter exponential backoff: random in [0, min(cap, base·2^attempt)). */\nfunction backoffDelay(attempt: number): number {\n const ceiling = Math.min(BACKOFF_CAP_MS, BACKOFF_BASE_MS * 2 ** attempt);\n return Math.random() * ceiling;\n}\n\n/** Honor Retry-After on a retryable response, else fall back to backoff. */\nfunction retryDelay(attempt: number, headers: Headers): number {\n const seconds = parseRetryAfter(headers);\n return seconds === undefined ? backoffDelay(attempt) : Math.min(seconds * 1000, RETRY_AFTER_CAP_MS);\n}\n\nfunction toBirdResponse(res: Response): BirdResponse {\n return {\n status: res.status,\n headers: res.headers,\n requestId: res.headers.get(\"X-Request-Id\") ?? \"\",\n };\n}\n\n// The abort contract: surface the caller's `signal.reason` so a caller-initiated\n// abort stays the native AbortError, falling back to a synthetic one.\nfunction abortReason(signal: AbortSignal | undefined): unknown {\n return signal?.reason ?? new DOMException(\"Aborted\", \"AbortError\");\n}\n\nfunction throwIfAborted(signal: AbortSignal | undefined): void {\n if (signal?.aborted) throw abortReason(signal);\n}\n\n/** Sleep, rejecting immediately if the caller's signal aborts. */\nfunction sleep(ms: number, signal: AbortSignal | undefined): Promise<void> {\n return new Promise((resolve, reject) => {\n if (signal?.aborted) {\n reject(abortReason(signal));\n return;\n }\n const timer = setTimeout(() => {\n signal?.removeEventListener(\"abort\", onAbort);\n resolve();\n }, ms);\n const onAbort = () => {\n clearTimeout(timer);\n reject(abortReason(signal));\n };\n signal?.addEventListener(\"abort\", onAbort, { once: true });\n });\n}\n\nfunction errorMessage(err: unknown): string {\n if (err instanceof Error) return err.message;\n return String(err);\n}\n","// What resource methods return: a Promise you can await for the value, plus\n// `.withResponse()` for transport metadata and `.safe()` for a non-throwing\n// `{ data, error, response }` result (errors throw by default,\n// `.safe()` is the opt-in result form). Pagination follows R1: awaiting a list yields the\n// first page; `for await` walks every item across pages, fetching lazily.\n\nimport type { BirdResponse } from \"./http.js\";\nimport { BirdError } from \"../errors.js\";\n\n/** Per-request overrides accepted by every resource method. */\nexport interface RequestOptions {\n /**\n * Per-call override for the extra credentials an operation requires, keyed by\n * security scheme (`{ RealtimeKey: \"…\", RealtimeSecret: \"…\" }`). Overrides the\n * client config for this call, so one client can address several apps.\n */\n credentials?: Record<string, string>;\n\n /** Idempotency key; auto-generated for mutations if omitted, reused on retry. */\n idempotencyKey?: string;\n /** Caller cancellation. Rejects with the native `AbortError`. */\n signal?: AbortSignal;\n /** Per-attempt timeout (ms). Overrides the client default. */\n timeout?: number;\n /** Max retry attempts. Overrides the client default. */\n maxRetries?: number;\n /** Extra headers for this request. SDK-internal headers win on conflict. */\n headers?: Record<string, string>;\n}\n\n/**\n * The result of `.safe()` — the value or the error, never thrown. On success\n * `data` and the `response` envelope are present and `error` is `null`. On\n * failure `error` is a `BirdError` you can `instanceof`-narrow, and `data`/\n * `response` are `null` — the metadata you need (status, request id) is on the\n * error itself. A caller-initiated abort is not a Bird failure and still throws\n * (the native `AbortError`).\n */\nexport type SafeResult<T> =\n | { data: T; error: null; response: BirdResponse }\n | { data: null; error: BirdError; response: null };\n\n/** Single-result return: `await` for the value, `.withResponse()` for metadata. */\nexport interface APIPromise<T> extends Promise<T> {\n withResponse(): Promise<{ data: T; response: BirdResponse }>;\n /** Resolve to `{ data, error }` instead of throwing. */\n safe(): Promise<SafeResult<T>>;\n}\n\n// Build the base `await`→data promise shared by both wrappers and wire its\n// `.withResponse()`/`.safe()` views onto `inner`.\n//\n// `.withResponse()` and `.safe()` consume `inner` directly, so when a caller\n// uses one of those (or fires-and-forgets) this base promise is never awaited.\n// Mark its rejection handled — the chosen view still surfaces the error — so a\n// failed call isn't flagged as an unhandled rejection.\nfunction basePromise<T, P extends APIPromise<T>>(\n inner: Promise<{ data: T; response: BirdResponse }>,\n): P {\n const promise = inner.then((r) => r.data) as P;\n void promise.catch(() => {});\n promise.withResponse = () => inner;\n promise.safe = () => toSafe(inner);\n return promise;\n}\n\nexport function apiPromise<T>(\n inner: Promise<{ data: T; response: BirdResponse }>,\n): APIPromise<T> {\n return basePromise(inner);\n}\n\n/** One cursor-paginated page — the wire envelope shape (snake), verbatim. */\nexport interface CursorPage<T> {\n data: T[];\n /** Pass back as `starting_after` to advance. Null at the end. */\n next_cursor: string | null;\n /** Pass back as `ending_before` to step back. Null at the start. */\n prev_cursor: string | null;\n /** Refresh anchor; pass as `ending_before` later for items since this page. */\n refresh_cursor: string | null;\n /** Total across all pages — only when `include_total=true` was passed. */\n total?: number | null;\n}\n\n/**\n * List return (R1): `await` resolves the first page; `for await` walks every\n * item across all pages, fetching subsequent pages lazily.\n */\nexport interface PaginatedPromise<T> extends Promise<CursorPage<T>>, AsyncIterable<T> {\n withResponse(): Promise<{ data: CursorPage<T>; response: BirdResponse }>;\n /** Resolve the first page as `{ data, error }` instead of throwing. */\n safe(): Promise<SafeResult<CursorPage<T>>>;\n}\n\nexport function paginate<T>(\n fetchPage: (cursor?: string) => Promise<{ data: CursorPage<T>; response: BirdResponse }>,\n): PaginatedPromise<T> {\n const first = fetchPage();\n const promise = basePromise<CursorPage<T>, PaginatedPromise<T>>(first);\n promise[Symbol.asyncIterator] = async function* () {\n let result = await first;\n for (;;) {\n for (const item of result.data.data) yield item;\n if (result.data.next_cursor == null) return;\n result = await fetchPage(result.data.next_cursor);\n }\n };\n return promise;\n}\n\n// `.safe()` turns Bird failures (the BirdError hierarchy) into values. Anything\n// else — a caller-initiated AbortError, or an unexpected non-Bird throw — keeps\n// propagating, so `error` stays soundly typed as `BirdError`.\nfunction toSafe<V>(\n inner: Promise<{ data: V; response: BirdResponse }>,\n): Promise<SafeResult<V>> {\n return inner.then(\n ({ data, response }): SafeResult<V> => ({ data, error: null, response }),\n (error): SafeResult<V> => {\n if (error instanceof BirdError) return { data: null, error, response: null };\n throw error;\n },\n );\n}\n","// This file is auto-generated by @hey-api/openapi-ts\n\nimport {\n type ClientOptions,\n type Config,\n createClient,\n createConfig,\n} from \"./client\";\nimport type { ClientOptions as ClientOptions2 } from \"./types.gen\";\n\n/**\n * The `createClientConfig()` function will be called on client initialization\n * and the returned object will become the client's initial configuration.\n *\n * You may want to initialize your client this way instead of calling\n * `setConfig()`. This is useful for example if you're using Next.js\n * to ensure your client always has the correct values.\n */\nexport type CreateClientConfig<T extends ClientOptions = ClientOptions2> = (\n override?: Config<ClientOptions & T>,\n) => Config<Required<ClientOptions> & T>;\n\nexport const client = createClient(createConfig<ClientOptions2>());\n","// This file is auto-generated by @hey-api/openapi-ts\n\nimport type { Client, Options as Options2, TDataShape } from \"./client\";\nimport { client } from \"./client.gen\";\nimport type {\n ArchiveContactPropertyData,\n ArchiveContactPropertyErrors,\n ArchiveContactPropertyResponses,\n AssignAudienceContactsData,\n AssignAudienceContactsErrors,\n AssignAudienceContactsResponses,\n CancelEmailMessageData,\n CancelEmailMessageErrors,\n CancelEmailMessageResponses,\n CreateAudienceData,\n CreateAudienceErrors,\n CreateAudienceResponses,\n CreateContactBatchData,\n CreateContactBatchErrors,\n CreateContactBatchResponses,\n CreateContactData,\n CreateContactErrors,\n CreateContactPropertyData,\n CreateContactPropertyErrors,\n CreateContactPropertyResponses,\n CreateContactResponses,\n CreateDomainData,\n CreateDomainErrors,\n CreateDomainResponses,\n CreateEmailMessageBatchData,\n CreateEmailMessageBatchErrors,\n CreateEmailMessageBatchResponses,\n CreateEmailMessageData,\n CreateEmailMessageErrors,\n CreateEmailMessageResponses,\n CreateMailboxData,\n CreateMailboxErrors,\n CreateMailboxMessageData,\n CreateMailboxMessageErrors,\n CreateMailboxMessageResponses,\n CreateMailboxReceiveRuleData,\n CreateMailboxReceiveRuleErrors,\n CreateMailboxReceiveRuleResponses,\n CreateMailboxResponses,\n CreateSmsMessageBatchData,\n CreateSmsMessageBatchErrors,\n CreateSmsMessageBatchResponses,\n CreateSmsMessageData,\n CreateSmsMessageErrors,\n CreateSmsMessageResponses,\n CreateVerificationCheckData,\n CreateVerificationCheckErrors,\n CreateVerificationCheckResponses,\n CreateVerificationData,\n CreateVerificationErrors,\n CreateVerificationNextChannelData,\n CreateVerificationNextChannelErrors,\n CreateVerificationNextChannelResponses,\n CreateVerificationResponses,\n CreateWhatsAppMessageData,\n CreateWhatsAppMessageErrors,\n CreateWhatsAppMessageResponses,\n DeleteAudienceData,\n DeleteAudienceErrors,\n DeleteAudienceResponses,\n DeleteContactData,\n DeleteContactErrors,\n DeleteContactResponses,\n DeleteDomainData,\n DeleteDomainErrors,\n DeleteDomainResponses,\n DeleteEmailThreadData,\n DeleteEmailThreadErrors,\n DeleteEmailThreadResponses,\n DeleteMailboxData,\n DeleteMailboxErrors,\n DeleteMailboxReceiveRuleData,\n DeleteMailboxReceiveRuleErrors,\n DeleteMailboxReceiveRuleResponses,\n DeleteMailboxResponses,\n DisconnectRealtimeAppMemberData,\n DisconnectRealtimeAppMemberErrors,\n DisconnectRealtimeAppMemberResponses,\n GetAudienceData,\n GetAudienceErrors,\n GetAudienceResponses,\n GetContactData,\n GetContactErrors,\n GetContactPropertyData,\n GetContactPropertyErrors,\n GetContactPropertyResponses,\n GetContactResponses,\n GetDomainData,\n GetDomainErrors,\n GetDomainResponses,\n GetEmailMessageData,\n GetEmailMessageErrors,\n GetEmailMessageResponses,\n GetEmailStatsByBounceCodeData,\n GetEmailStatsByBounceCodeErrors,\n GetEmailStatsByBounceCodeResponses,\n GetEmailStatsByBroadcastData,\n GetEmailStatsByBroadcastErrors,\n GetEmailStatsByBroadcastResponses,\n GetEmailStatsByCategoryData,\n GetEmailStatsByCategoryErrors,\n GetEmailStatsByCategoryResponses,\n GetEmailStatsByClientData,\n GetEmailStatsByClientErrors,\n GetEmailStatsByClientResponses,\n GetEmailStatsByComplaintTypeData,\n GetEmailStatsByComplaintTypeErrors,\n GetEmailStatsByComplaintTypeResponses,\n GetEmailStatsByLocationData,\n GetEmailStatsByLocationErrors,\n GetEmailStatsByLocationResponses,\n GetEmailStatsByMailboxProviderData,\n GetEmailStatsByMailboxProviderErrors,\n GetEmailStatsByMailboxProviderRegionData,\n GetEmailStatsByMailboxProviderRegionErrors,\n GetEmailStatsByMailboxProviderRegionResponses,\n GetEmailStatsByMailboxProviderResponses,\n GetEmailStatsByRecipientDomainData,\n GetEmailStatsByRecipientDomainErrors,\n GetEmailStatsByRecipientDomainResponses,\n GetEmailStatsBySendingDomainData,\n GetEmailStatsBySendingDomainErrors,\n GetEmailStatsBySendingDomainResponses,\n GetEmailStatsBySendingIpData,\n GetEmailStatsBySendingIpErrors,\n GetEmailStatsBySendingIpResponses,\n GetEmailStatsByTagData,\n GetEmailStatsByTagErrors,\n GetEmailStatsByTagResponses,\n GetEmailStatsByTemplateData,\n GetEmailStatsByTemplateErrors,\n GetEmailStatsByTemplateResponses,\n GetEmailStatsDailyData,\n GetEmailStatsDailyErrors,\n GetEmailStatsDailyResponses,\n GetEmailStatsHourlyData,\n GetEmailStatsHourlyErrors,\n GetEmailStatsHourlyResponses,\n GetEmailStatsSummaryData,\n GetEmailStatsSummaryErrors,\n GetEmailStatsSummaryResponses,\n GetEmailThreadData,\n GetEmailThreadErrors,\n GetEmailThreadMessageBodyData,\n GetEmailThreadMessageBodyErrors,\n GetEmailThreadMessageBodyResponses,\n GetEmailThreadMessageData,\n GetEmailThreadMessageErrors,\n GetEmailThreadMessageResponses,\n GetEmailThreadResponses,\n GetMailboxData,\n GetMailboxErrors,\n GetMailboxResponses,\n GetMailboxStatsData,\n GetMailboxStatsErrors,\n GetMailboxStatsResponses,\n GetRealtimeAppChannelData,\n GetRealtimeAppChannelErrors,\n GetRealtimeAppChannelResponses,\n GetSmsMessageData,\n GetSmsMessageErrors,\n GetSmsMessageResponses,\n GetSmsTemplateData,\n GetSmsTemplateErrors,\n GetSmsTemplateResponses,\n GetVoiceCallData,\n GetVoiceCallErrors,\n GetVoiceCallResponses,\n GetWhatsAppMessageData,\n GetWhatsAppMessageErrors,\n GetWhatsAppMessageResponses,\n ListAudienceContactsData,\n ListAudienceContactsErrors,\n ListAudienceContactsResponses,\n ListAudiencesData,\n ListAudiencesErrors,\n ListAudiencesResponses,\n ListContactPropertiesData,\n ListContactPropertiesErrors,\n ListContactPropertiesResponses,\n ListContactsData,\n ListContactsErrors,\n ListContactsResponses,\n ListDomainsData,\n ListDomainsErrors,\n ListDomainsResponses,\n ListEmailMessagesData,\n ListEmailMessagesErrors,\n ListEmailMessagesResponses,\n ListEmailThreadMessageAttachmentsData,\n ListEmailThreadMessageAttachmentsErrors,\n ListEmailThreadMessageAttachmentsResponses,\n ListEmailThreadMessagesData,\n ListEmailThreadMessagesErrors,\n ListEmailThreadMessagesResponses,\n ListEmailThreadsData,\n ListEmailThreadsErrors,\n ListEmailThreadsResponses,\n ListMailboxesData,\n ListMailboxesErrors,\n ListMailboxesResponses,\n ListMailboxLabelsData,\n ListMailboxLabelsErrors,\n ListMailboxLabelsResponses,\n ListMailboxReceiveRulesData,\n ListMailboxReceiveRulesErrors,\n ListMailboxReceiveRulesResponses,\n ListRealtimeAppChannelMembersData,\n ListRealtimeAppChannelMembersErrors,\n ListRealtimeAppChannelMembersResponses,\n ListRealtimeAppChannelsData,\n ListRealtimeAppChannelsErrors,\n ListRealtimeAppChannelsResponses,\n ListSmsMessagesData,\n ListSmsMessagesErrors,\n ListSmsMessagesResponses,\n ListSmsTemplatesData,\n ListSmsTemplatesErrors,\n ListSmsTemplatesResponses,\n ListVoiceCallsData,\n ListVoiceCallsErrors,\n ListVoiceCallsResponses,\n ListWhatsAppMessageEventsData,\n ListWhatsAppMessageEventsErrors,\n ListWhatsAppMessageEventsResponses,\n ListWhatsAppMessagesData,\n ListWhatsAppMessagesErrors,\n ListWhatsAppMessagesResponses,\n PublishRealtimeAppBatchData,\n PublishRealtimeAppBatchErrors,\n PublishRealtimeAppBatchResponses,\n PublishRealtimeAppEventData,\n PublishRealtimeAppEventErrors,\n PublishRealtimeAppEventResponses,\n ReplyEmailThreadMessageData,\n ReplyEmailThreadMessageErrors,\n ReplyEmailThreadMessageResponses,\n RestoreMailboxData,\n RestoreMailboxErrors,\n RestoreMailboxResponses,\n ResumeMailboxData,\n ResumeMailboxErrors,\n ResumeMailboxResponses,\n SendRealtimeAppMemberEventData,\n SendRealtimeAppMemberEventErrors,\n SendRealtimeAppMemberEventResponses,\n UnarchiveContactPropertyData,\n UnarchiveContactPropertyErrors,\n UnarchiveContactPropertyResponses,\n UnassignAudienceContactData,\n UnassignAudienceContactErrors,\n UnassignAudienceContactResponses,\n UnassignAudienceContactsData,\n UnassignAudienceContactsErrors,\n UnassignAudienceContactsResponses,\n UpdateAudienceData,\n UpdateAudienceErrors,\n UpdateAudienceResponses,\n UpdateContactData,\n UpdateContactErrors,\n UpdateContactPropertyData,\n UpdateContactPropertyErrors,\n UpdateContactPropertyResponses,\n UpdateContactResponses,\n UpdateDomainData,\n UpdateDomainErrors,\n UpdateDomainResponses,\n UpdateEmailThreadData,\n UpdateEmailThreadErrors,\n UpdateEmailThreadResponses,\n UpdateMailboxData,\n UpdateMailboxErrors,\n UpdateMailboxResponses,\n VerifyDomainData,\n VerifyDomainErrors,\n VerifyDomainResponses,\n} from \"./types.gen\";\n\nexport type Options<\n TData extends TDataShape = TDataShape,\n ThrowOnError extends boolean = boolean,\n TResponse = unknown,\n> = Options2<TData, ThrowOnError, TResponse> & {\n /**\n * You can provide a client instance returned by `createClient()` instead of\n * individual options. This might be also useful if you want to implement a\n * custom client.\n */\n client?: Client;\n /**\n * You can pass arbitrary values through the `meta` object. This can be\n * used to access values that aren't defined as part of the SDK function.\n */\n meta?: Record<string, unknown>;\n};\n\n/**\n * Publish a Realtime event\n *\n * Publishes an event to one or more channels of a Realtime app. Listing several channels broadcasts the event to all of them in one call. Connected clients subscribed to those channels receive it in real time.\n */\nexport const publishRealtimeAppEvent = <ThrowOnError extends boolean = false>(\n options: Options<PublishRealtimeAppEventData, ThrowOnError>,\n) =>\n (options.client ?? client).post<\n PublishRealtimeAppEventResponses,\n PublishRealtimeAppEventErrors,\n ThrowOnError\n >({\n security: [\n { scheme: \"bearer\", type: \"http\" },\n { name: \"X-Realtime-Key\", type: \"apiKey\" },\n { name: \"X-Realtime-Secret\", type: \"apiKey\" },\n {\n in: \"cookie\",\n name: \"bird_session\",\n type: \"apiKey\",\n },\n ],\n url: \"/v1/realtime/apps/{realtime_app_id}/events\",\n ...options,\n headers: {\n \"Content-Type\": \"application/json\",\n ...options.headers,\n },\n });\n\n/**\n * Publish a batch of Realtime events\n *\n * Publishes up to 10 events (each to one channel) in a single request.\n */\nexport const publishRealtimeAppBatch = <ThrowOnError extends boolean = false>(\n options: Options<PublishRealtimeAppBatchData, ThrowOnError>,\n) =>\n (options.client ?? client).post<\n PublishRealtimeAppBatchResponses,\n PublishRealtimeAppBatchErrors,\n ThrowOnError\n >({\n security: [\n { scheme: \"bearer\", type: \"http\" },\n { name: \"X-Realtime-Key\", type: \"apiKey\" },\n { name: \"X-Realtime-Secret\", type: \"apiKey\" },\n {\n in: \"cookie\",\n name: \"bird_session\",\n type: \"apiKey\",\n },\n ],\n url: \"/v1/realtime/apps/{realtime_app_id}/batch-events\",\n ...options,\n headers: {\n \"Content-Type\": \"application/json\",\n ...options.headers,\n },\n });\n\n/**\n * List Realtime channels\n *\n * Lists the app's currently occupied channels, optionally filtered by name prefix.\n */\nexport const listRealtimeAppChannels = <ThrowOnError extends boolean = false>(\n options: Options<ListRealtimeAppChannelsData, ThrowOnError>,\n) =>\n (options.client ?? client).get<\n ListRealtimeAppChannelsResponses,\n ListRealtimeAppChannelsErrors,\n ThrowOnError\n >({\n security: [\n { scheme: \"bearer\", type: \"http\" },\n { name: \"X-Realtime-Key\", type: \"apiKey\" },\n { name: \"X-Realtime-Secret\", type: \"apiKey\" },\n {\n in: \"cookie\",\n name: \"bird_session\",\n type: \"apiKey\",\n },\n ],\n url: \"/v1/realtime/apps/{realtime_app_id}/channels\",\n ...options,\n });\n\n/**\n * Get a Realtime channel\n *\n * Returns a single channel's occupancy and (on request) counts. Channels exist implicitly — a channel appears when the first connection subscribes and vanishes when the last one leaves — so this endpoint reports state, not existence: an unknown or never-used name returns 200 with `occupied: false`, never 404.\n */\nexport const getRealtimeAppChannel = <ThrowOnError extends boolean = false>(\n options: Options<GetRealtimeAppChannelData, ThrowOnError>,\n) =>\n (options.client ?? client).get<\n GetRealtimeAppChannelResponses,\n GetRealtimeAppChannelErrors,\n ThrowOnError\n >({\n security: [\n { scheme: \"bearer\", type: \"http\" },\n { name: \"X-Realtime-Key\", type: \"apiKey\" },\n { name: \"X-Realtime-Secret\", type: \"apiKey\" },\n {\n in: \"cookie\",\n name: \"bird_session\",\n type: \"apiKey\",\n },\n ],\n url: \"/v1/realtime/apps/{realtime_app_id}/channels/{channel_name}\",\n ...options,\n });\n\n/**\n * List members on a presence channel\n *\n * Lists the member ids currently subscribed to a presence channel. Ids only: `member_info` (the profile data attached by your authorization endpoint) is delivered to subscribed clients over the realtime connection and is not available over REST.\n */\nexport const listRealtimeAppChannelMembers = <\n ThrowOnError extends boolean = false,\n>(\n options: Options<ListRealtimeAppChannelMembersData, ThrowOnError>,\n) =>\n (options.client ?? client).get<\n ListRealtimeAppChannelMembersResponses,\n ListRealtimeAppChannelMembersErrors,\n ThrowOnError\n >({\n security: [\n { scheme: \"bearer\", type: \"http\" },\n { name: \"X-Realtime-Key\", type: \"apiKey\" },\n { name: \"X-Realtime-Secret\", type: \"apiKey\" },\n {\n in: \"cookie\",\n name: \"bird_session\",\n type: \"apiKey\",\n },\n ],\n url: \"/v1/realtime/apps/{realtime_app_id}/channels/{channel_name}/members\",\n ...options,\n });\n\n/**\n * Disconnect a member\n *\n * Disconnects all of a member's active connections (e.g. on sign-out or ban).\n */\nexport const disconnectRealtimeAppMember = <\n ThrowOnError extends boolean = false,\n>(\n options: Options<DisconnectRealtimeAppMemberData, ThrowOnError>,\n) =>\n (options.client ?? client).post<\n DisconnectRealtimeAppMemberResponses,\n DisconnectRealtimeAppMemberErrors,\n ThrowOnError\n >({\n security: [\n { scheme: \"bearer\", type: \"http\" },\n { name: \"X-Realtime-Key\", type: \"apiKey\" },\n { name: \"X-Realtime-Secret\", type: \"apiKey\" },\n {\n in: \"cookie\",\n name: \"bird_session\",\n type: \"apiKey\",\n },\n ],\n url: \"/v1/realtime/apps/{realtime_app_id}/members/{member_id}/disconnect\",\n ...options,\n });\n\n/**\n * Send an event to a member\n *\n * Delivers an event to one member of a Realtime app, addressing the person rather than a channel. Every connection that member currently holds receives it, across tabs and devices, so there is no need to track their connections or give them a channel of their own.\n * The member must have signed in on the connection for it to be addressable. Delivery is best-effort and not queued: a member holding no connections at the moment of the call simply does not receive the event.\n */\nexport const sendRealtimeAppMemberEvent = <\n ThrowOnError extends boolean = false,\n>(\n options: Options<SendRealtimeAppMemberEventData, ThrowOnError>,\n) =>\n (options.client ?? client).post<\n SendRealtimeAppMemberEventResponses,\n SendRealtimeAppMemberEventErrors,\n ThrowOnError\n >({\n security: [\n { scheme: \"bearer\", type: \"http\" },\n { name: \"X-Realtime-Key\", type: \"apiKey\" },\n { name: \"X-Realtime-Secret\", type: \"apiKey\" },\n {\n in: \"cookie\",\n name: \"bird_session\",\n type: \"apiKey\",\n },\n ],\n url: \"/v1/realtime/apps/{realtime_app_id}/members/{member_id}/events\",\n ...options,\n headers: {\n \"Content-Type\": \"application/json\",\n ...options.headers,\n },\n });\n\n/**\n * List messages\n *\n * Returns the workspace's sent and scheduled messages, newest first, as a cursor page. Each item carries the aggregate delivery `status` and per-state recipient counts, not the message body. Combine filters to narrow the page: `status`, `category`, `tag`, exact `to`/`from` address, and a `created_after`/`created_before` time window.\n *\n */\nexport const listEmailMessages = <ThrowOnError extends boolean = false>(\n options?: Options<ListEmailMessagesData, ThrowOnError>,\n) =>\n (options?.client ?? client).get<\n ListEmailMessagesResponses,\n ListEmailMessagesErrors,\n ThrowOnError\n >({\n security: [\n { scheme: \"bearer\", type: \"http\" },\n {\n in: \"cookie\",\n name: \"bird_session\",\n type: \"apiKey\",\n },\n ],\n url: \"/v1/email/messages\",\n ...options,\n });\n\n/**\n * Send an email message\n *\n * Sends an email to the recipients you list explicitly in `to`/`cc`/`bcc`. Use it for\n * transactional sends (receipts, password resets, alerts) and for marketing sends where\n * you have the recipient addresses on hand; to submit many independent messages in one\n * request, use [Send a batch of messages](/docs/api/reference/create-email-message-batch)\n * instead. The `category` field controls suppression policy independently of content:\n * set it to `marketing` when sending marketing content from this endpoint.\n *\n * The `202` response means the message is safely accepted for delivery, not yet\n * delivered. Fetch it by `id` or subscribe to webhook events to follow delivery. The\n * request never half-succeeds: an unverified sender domain or any field-level\n * validation failure rejects it immediately with a `422` naming the reason.\n * Suppression is evaluated per recipient after acceptance: suppressed recipients\n * surface as `rejected` on the message's recipient list, never as a synchronous\n * error. New workspaces can send from the shared onboarding domain before verifying\n * their own; the [quickstart](/docs/get-started/send-your-first-email) covers its\n * recipient and volume limits.\n *\n */\nexport const createEmailMessage = <ThrowOnError extends boolean = false>(\n options: Options<CreateEmailMessageData, ThrowOnError>,\n) =>\n (options.client ?? client).post<\n CreateEmailMessageResponses,\n CreateEmailMessageErrors,\n ThrowOnError\n >({\n security: [\n { scheme: \"bearer\", type: \"http\" },\n {\n in: \"cookie\",\n name: \"bird_session\",\n type: \"apiKey\",\n },\n ],\n url: \"/v1/email/messages\",\n ...options,\n headers: {\n \"Content-Type\": \"application/json\",\n ...options.headers,\n },\n });\n\n/**\n * Send a batch of messages\n *\n * Accepts up to 100 independent email messages and queues them for delivery. All items are validated before any are queued: if one fails validation, the entire batch is rejected. Field-level validation failures and business-rule failures (such as `domain_not_verified`) both return `422`. Suppression is evaluated per recipient after acceptance, never as a synchronous error. The `202` response returns one entry per message in submission order, each with its own `id` to fetch or correlate webhook events against. Attachments are allowed per message. Each message must stay within the 20 MB estimated generated message-size cap, and the serialized JSON request body for the whole batch has a hard 20 MB cap.\n *\n */\nexport const createEmailMessageBatch = <ThrowOnError extends boolean = false>(\n options: Options<CreateEmailMessageBatchData, ThrowOnError>,\n) =>\n (options.client ?? client).post<\n CreateEmailMessageBatchResponses,\n CreateEmailMessageBatchErrors,\n ThrowOnError\n >({\n security: [\n { scheme: \"bearer\", type: \"http\" },\n {\n in: \"cookie\",\n name: \"bird_session\",\n type: \"apiKey\",\n },\n ],\n url: \"/v1/email/batches\",\n ...options,\n headers: {\n \"Content-Type\": \"application/json\",\n ...options.headers,\n },\n });\n\n/**\n * Get a message\n *\n * Returns a single message with its aggregate delivery `status` and per-state recipient counts. The response never includes the `html`/`text` bodies; when content storage is enabled for the send, fetch the stored bodies with [Get stored message content](/docs/api/reference/get-email-message-content). Per-recipient statuses and the event timeline are separate sub-resources.\n *\n */\nexport const getEmailMessage = <ThrowOnError extends boolean = false>(\n options: Options<GetEmailMessageData, ThrowOnError>,\n) =>\n (options.client ?? client).get<\n GetEmailMessageResponses,\n GetEmailMessageErrors,\n ThrowOnError\n >({\n security: [\n { scheme: \"bearer\", type: \"http\" },\n {\n in: \"cookie\",\n name: \"bird_session\",\n type: \"apiKey\",\n },\n ],\n url: \"/v1/email/messages/{message_id}\",\n ...options,\n });\n\n/**\n * Cancel a scheduled message\n *\n * Cancels a message that was scheduled with `scheduled_at` before it sends. Only a message that is still scheduled can be canceled; a message that already started sending, was delivered, or was previously canceled returns a conflict error. The message's status becomes `canceled` and an `email.canceled` webhook event fires. Canceling does not return consumed scheduled-send quota.\n *\n */\nexport const cancelEmailMessage = <ThrowOnError extends boolean = false>(\n options: Options<CancelEmailMessageData, ThrowOnError>,\n) =>\n (options.client ?? client).post<\n CancelEmailMessageResponses,\n CancelEmailMessageErrors,\n ThrowOnError\n >({\n security: [\n { scheme: \"bearer\", type: \"http\" },\n {\n in: \"cookie\",\n name: \"bird_session\",\n type: \"apiKey\",\n },\n ],\n url: \"/v1/email/messages/{message_id}/cancel\",\n ...options,\n });\n\n/**\n * List contacts\n *\n * Returns a paginated list of contacts in the workspace, newest first. Look up a single contact by its exact `email`, `phone`, or `external_id`, or search by email, first name, last name, or phone substring with `q`. Pass `include_total=true` to add the total number of matching contacts to the response.\n *\n */\nexport const listContacts = <ThrowOnError extends boolean = false>(\n options?: Options<ListContactsData, ThrowOnError>,\n) =>\n (options?.client ?? client).get<\n ListContactsResponses,\n ListContactsErrors,\n ThrowOnError\n >({\n security: [\n { scheme: \"bearer\", type: \"http\" },\n {\n in: \"cookie\",\n name: \"bird_session\",\n type: \"apiKey\",\n },\n ],\n url: \"/v1/contacts\",\n ...options,\n });\n\n/**\n * Create a contact\n *\n * Creates a contact in the workspace, identified by an email address, a phone number, or both; at least one is required. Email is stored trimmed and lowercased, and phone in its canonical international form. Creating a second contact with the same email or phone number, or reusing another contact's `external_id`, returns a conflict error.\n *\n * To create or update many contacts in one request, or to write a contact without knowing whether the address already exists, use [Create or update contacts in bulk](/docs/api/reference/create-contact-batch) instead.\n *\n */\nexport const createContact = <ThrowOnError extends boolean = false>(\n options: Options<CreateContactData, ThrowOnError>,\n) =>\n (options.client ?? client).post<\n CreateContactResponses,\n CreateContactErrors,\n ThrowOnError\n >({\n security: [\n { scheme: \"bearer\", type: \"http\" },\n {\n in: \"cookie\",\n name: \"bird_session\",\n type: \"apiKey\",\n },\n ],\n url: \"/v1/contacts\",\n ...options,\n headers: {\n \"Content-Type\": \"application/json\",\n ...options.headers,\n },\n });\n\n/**\n * Create or update contacts in bulk\n *\n * Creates or updates up to 1,000 contacts in one request. Each entry is matched automatically against every identifier it supplies: its email address (trimmed and lowercased before matching), its phone number (normalized to international form), and your own `external_id`. An entry that matches no existing contact creates one; an entry whose identifiers all point at one contact updates it with the fields it supplies, and omitted fields keep their stored values, so a contact's email address can change under a stable `external_id` without creating a second record. An entry whose identifiers belong to more than one contact fails with an error naming each matched contact, since Bird never merges contacts or picks between them. Supplying `match_on` overrides the automatic matching: every entry is matched by that one field only, and must carry it. Optionally adds every contact in the request to up to 10 audiences.\n *\n * Each entry succeeds or fails on its own: the response lists one result per contact in submission order (`created`, `updated`, or `failed` with the reason), and a failed entry does not abort the rest. If the request itself is invalid, for example when an entry in `audience_ids` does not exist, the whole request fails with a validation error and no contacts are written.\n *\n */\nexport const createContactBatch = <ThrowOnError extends boolean = false>(\n options: Options<CreateContactBatchData, ThrowOnError>,\n) =>\n (options.client ?? client).post<\n CreateContactBatchResponses,\n CreateContactBatchErrors,\n ThrowOnError\n >({\n security: [\n { scheme: \"bearer\", type: \"http\" },\n {\n in: \"cookie\",\n name: \"bird_session\",\n type: \"apiKey\",\n },\n ],\n url: \"/v1/contacts/batch\",\n ...options,\n headers: {\n \"Content-Type\": \"application/json\",\n ...options.headers,\n },\n });\n\n/**\n * Delete a contact\n *\n * Deletes a contact permanently and removes it from every audience it belongs to. Suppression records for the address are not affected: an unsubscribed or bounced address stays suppressed even after the contact is deleted.\n *\n */\nexport const deleteContact = <ThrowOnError extends boolean = false>(\n options: Options<DeleteContactData, ThrowOnError>,\n) =>\n (options.client ?? client).delete<\n DeleteContactResponses,\n DeleteContactErrors,\n ThrowOnError\n >({\n security: [\n { scheme: \"bearer\", type: \"http\" },\n {\n in: \"cookie\",\n name: \"bird_session\",\n type: \"apiKey\",\n },\n ],\n url: \"/v1/contacts/{contact_id}\",\n ...options,\n });\n\n/**\n * Get a contact\n *\n * Returns a single contact, including its custom `data` values and the channels it can be reached on. To find a contact's ID by email address or `external_id`, use [List contacts](/docs/api/reference/list-contacts).\n *\n */\nexport const getContact = <ThrowOnError extends boolean = false>(\n options: Options<GetContactData, ThrowOnError>,\n) =>\n (options.client ?? client).get<\n GetContactResponses,\n GetContactErrors,\n ThrowOnError\n >({\n security: [\n { scheme: \"bearer\", type: \"http\" },\n {\n in: \"cookie\",\n name: \"bird_session\",\n type: \"apiKey\",\n },\n ],\n url: \"/v1/contacts/{contact_id}\",\n ...options,\n });\n\n/**\n * Update a contact\n *\n * Updates a contact. Supplied fields are changed and omitted fields are left unchanged; set `first_name`, `last_name`, or `external_id` to null to clear them. Custom values in `data` are merged: keys you supply are set, keys set to null are removed, and keys you omit are unchanged.\n *\n * Changing the email address, phone number, or `external_id` to a value already used by another contact returns a conflict error, and a contact always keeps at least one identifier: clearing both email and phone in the same contact is rejected.\n *\n */\nexport const updateContact = <ThrowOnError extends boolean = false>(\n options: Options<UpdateContactData, ThrowOnError>,\n) =>\n (options.client ?? client).patch<\n UpdateContactResponses,\n UpdateContactErrors,\n ThrowOnError\n >({\n security: [\n { scheme: \"bearer\", type: \"http\" },\n {\n in: \"cookie\",\n name: \"bird_session\",\n type: \"apiKey\",\n },\n ],\n url: \"/v1/contacts/{contact_id}\",\n ...options,\n headers: {\n \"Content-Type\": \"application/json\",\n ...options.headers,\n },\n });\n\n/**\n * List contact properties\n *\n * Returns a paginated list of the workspace's contact properties, newest first. Archived properties are included; check each entry's `archived` flag.\n *\n */\nexport const listContactProperties = <ThrowOnError extends boolean = false>(\n options?: Options<ListContactPropertiesData, ThrowOnError>,\n) =>\n (options?.client ?? client).get<\n ListContactPropertiesResponses,\n ListContactPropertiesErrors,\n ThrowOnError\n >({\n security: [\n { scheme: \"bearer\", type: \"http\" },\n {\n in: \"cookie\",\n name: \"bird_session\",\n type: \"apiKey\",\n },\n ],\n url: \"/v1/contact-properties\",\n ...options,\n });\n\n/**\n * Create a contact property\n *\n * Defines a custom property that contacts in the workspace can carry. The key becomes available in contact `data` and as a template variable in broadcasts. The key and type cannot be changed after creation.\n *\n * A key already in use returns a conflict error. A workspace can hold at most 200 properties; archived properties keep their key and count toward that limit.\n *\n */\nexport const createContactProperty = <ThrowOnError extends boolean = false>(\n options: Options<CreateContactPropertyData, ThrowOnError>,\n) =>\n (options.client ?? client).post<\n CreateContactPropertyResponses,\n CreateContactPropertyErrors,\n ThrowOnError\n >({\n security: [\n { scheme: \"bearer\", type: \"http\" },\n {\n in: \"cookie\",\n name: \"bird_session\",\n type: \"apiKey\",\n },\n ],\n url: \"/v1/contact-properties\",\n ...options,\n headers: {\n \"Content-Type\": \"application/json\",\n ...options.headers,\n },\n });\n\n/**\n * Get a contact property\n *\n * Returns a single contact property: its immutable key and type, the fallback value, and whether it is archived.\n *\n */\nexport const getContactProperty = <ThrowOnError extends boolean = false>(\n options: Options<GetContactPropertyData, ThrowOnError>,\n) =>\n (options.client ?? client).get<\n GetContactPropertyResponses,\n GetContactPropertyErrors,\n ThrowOnError\n >({\n security: [\n { scheme: \"bearer\", type: \"http\" },\n {\n in: \"cookie\",\n name: \"bird_session\",\n type: \"apiKey\",\n },\n ],\n url: \"/v1/contact-properties/{property_id}\",\n ...options,\n });\n\n/**\n * Update a contact property\n *\n * Updates a contact property's fallback value, the only mutable field. The key and type cannot be changed after creation; create a new property instead.\n *\n */\nexport const updateContactProperty = <ThrowOnError extends boolean = false>(\n options: Options<UpdateContactPropertyData, ThrowOnError>,\n) =>\n (options.client ?? client).patch<\n UpdateContactPropertyResponses,\n UpdateContactPropertyErrors,\n ThrowOnError\n >({\n security: [\n { scheme: \"bearer\", type: \"http\" },\n {\n in: \"cookie\",\n name: \"bird_session\",\n type: \"apiKey\",\n },\n ],\n url: \"/v1/contact-properties/{property_id}\",\n ...options,\n headers: {\n \"Content-Type\": \"application/json\",\n ...options.headers,\n },\n });\n\n/**\n * Archive a contact property\n *\n * Archives a contact property. The key stops being accepted in contact writes and stops rendering in templates, but every value already stored on your contacts is preserved and still returned when you read a contact.\n *\n * The key stays reserved and still counts toward the workspace's 200-property limit, so it cannot be re-created with a different type. Archiving an already-archived property returns a conflict error; reverse it with [Unarchive a contact property](/docs/api/reference/unarchive-contact-property).\n *\n */\nexport const archiveContactProperty = <ThrowOnError extends boolean = false>(\n options: Options<ArchiveContactPropertyData, ThrowOnError>,\n) =>\n (options.client ?? client).post<\n ArchiveContactPropertyResponses,\n ArchiveContactPropertyErrors,\n ThrowOnError\n >({\n security: [\n { scheme: \"bearer\", type: \"http\" },\n {\n in: \"cookie\",\n name: \"bird_session\",\n type: \"apiKey\",\n },\n ],\n url: \"/v1/contact-properties/{property_id}/archive\",\n ...options,\n });\n\n/**\n * Unarchive a contact property\n *\n * Reactivates an archived contact property. The key is accepted in contact writes and renders in templates again; stored values were never removed, so they are unchanged. Unarchiving a property that is not archived returns a conflict error.\n *\n */\nexport const unarchiveContactProperty = <ThrowOnError extends boolean = false>(\n options: Options<UnarchiveContactPropertyData, ThrowOnError>,\n) =>\n (options.client ?? client).post<\n UnarchiveContactPropertyResponses,\n UnarchiveContactPropertyErrors,\n ThrowOnError\n >({\n security: [\n { scheme: \"bearer\", type: \"http\" },\n {\n in: \"cookie\",\n name: \"bird_session\",\n type: \"apiKey\",\n },\n ],\n url: \"/v1/contact-properties/{property_id}/unarchive\",\n ...options,\n });\n\n/**\n * List audiences\n *\n * Returns a paginated list of audiences in the workspace, newest first. Filter to audiences whose name contains a substring with `q`.\n *\n */\nexport const listAudiences = <ThrowOnError extends boolean = false>(\n options?: Options<ListAudiencesData, ThrowOnError>,\n) =>\n (options?.client ?? client).get<\n ListAudiencesResponses,\n ListAudiencesErrors,\n ThrowOnError\n >({\n security: [\n { scheme: \"bearer\", type: \"http\" },\n {\n in: \"cookie\",\n name: \"bird_session\",\n type: \"apiKey\",\n },\n ],\n url: \"/v1/audiences\",\n ...options,\n });\n\n/**\n * Create an audience\n *\n * Creates an audience in the workspace. New audiences start empty: add members with [Add contacts to an audience](/docs/api/reference/assign-audience-contacts) or through [Create or update contacts in bulk](/docs/api/reference/create-contact-batch). Only `static` audiences can be created today; requesting `dynamic` or `external` returns a validation error.\n *\n */\nexport const createAudience = <ThrowOnError extends boolean = false>(\n options: Options<CreateAudienceData, ThrowOnError>,\n) =>\n (options.client ?? client).post<\n CreateAudienceResponses,\n CreateAudienceErrors,\n ThrowOnError\n >({\n security: [\n { scheme: \"bearer\", type: \"http\" },\n {\n in: \"cookie\",\n name: \"bird_session\",\n type: \"apiKey\",\n },\n ],\n url: \"/v1/audiences\",\n ...options,\n headers: {\n \"Content-Type\": \"application/json\",\n ...options.headers,\n },\n });\n\n/**\n * Delete an audience\n *\n * Deletes an audience and its memberships. Contacts themselves are not deleted. An audience cannot be deleted while a broadcast targeting it is scheduled, accepted, sending, or canceling; cancel that broadcast first, then retry.\n *\n */\nexport const deleteAudience = <ThrowOnError extends boolean = false>(\n options: Options<DeleteAudienceData, ThrowOnError>,\n) =>\n (options.client ?? client).delete<\n DeleteAudienceResponses,\n DeleteAudienceErrors,\n ThrowOnError\n >({\n security: [\n { scheme: \"bearer\", type: \"http\" },\n {\n in: \"cookie\",\n name: \"bird_session\",\n type: \"apiKey\",\n },\n ],\n url: \"/v1/audiences/{audience_id}\",\n ...options,\n });\n\n/**\n * Get an audience\n *\n * Returns a single audience: its name, description, and type. The member list is separate; fetch it with [List an audience's contacts](/docs/api/reference/list-audience-contacts).\n *\n */\nexport const getAudience = <ThrowOnError extends boolean = false>(\n options: Options<GetAudienceData, ThrowOnError>,\n) =>\n (options.client ?? client).get<\n GetAudienceResponses,\n GetAudienceErrors,\n ThrowOnError\n >({\n security: [\n { scheme: \"bearer\", type: \"http\" },\n {\n in: \"cookie\",\n name: \"bird_session\",\n type: \"apiKey\",\n },\n ],\n url: \"/v1/audiences/{audience_id}\",\n ...options,\n });\n\n/**\n * Update an audience\n *\n * Updates an audience's name or description. Omitted fields are left unchanged; set `description` to null to clear it.\n *\n */\nexport const updateAudience = <ThrowOnError extends boolean = false>(\n options: Options<UpdateAudienceData, ThrowOnError>,\n) =>\n (options.client ?? client).patch<\n UpdateAudienceResponses,\n UpdateAudienceErrors,\n ThrowOnError\n >({\n security: [\n { scheme: \"bearer\", type: \"http\" },\n {\n in: \"cookie\",\n name: \"bird_session\",\n type: \"apiKey\",\n },\n ],\n url: \"/v1/audiences/{audience_id}\",\n ...options,\n headers: {\n \"Content-Type\": \"application/json\",\n ...options.headers,\n },\n });\n\n/**\n * List an audience's contacts\n *\n * Lists the contacts in a static audience as a cursor page, ordered by the time each contact joined the audience, most recent first. Each entry is the contact together with the time it joined.\n *\n */\nexport const listAudienceContacts = <ThrowOnError extends boolean = false>(\n options: Options<ListAudienceContactsData, ThrowOnError>,\n) =>\n (options.client ?? client).get<\n ListAudienceContactsResponses,\n ListAudienceContactsErrors,\n ThrowOnError\n >({\n security: [\n { scheme: \"bearer\", type: \"http\" },\n {\n in: \"cookie\",\n name: \"bird_session\",\n type: \"apiKey\",\n },\n ],\n url: \"/v1/audiences/{audience_id}/contacts\",\n ...options,\n });\n\n/**\n * Add contacts to an audience\n *\n * Adds up to 1,000 contacts to an audience. Adding is idempotent: contacts that are already members are left in place and keep their original join time. If any contact ID does not exist in the workspace, the whole request fails with a validation error and no contacts are added.\n *\n */\nexport const assignAudienceContacts = <ThrowOnError extends boolean = false>(\n options: Options<AssignAudienceContactsData, ThrowOnError>,\n) =>\n (options.client ?? client).post<\n AssignAudienceContactsResponses,\n AssignAudienceContactsErrors,\n ThrowOnError\n >({\n security: [\n { scheme: \"bearer\", type: \"http\" },\n {\n in: \"cookie\",\n name: \"bird_session\",\n type: \"apiKey\",\n },\n ],\n url: \"/v1/audiences/{audience_id}/contacts\",\n ...options,\n headers: {\n \"Content-Type\": \"application/json\",\n ...options.headers,\n },\n });\n\n/**\n * Remove contacts from an audience\n *\n * Removes up to 1,000 contacts from an audience. Contacts that are not members are skipped. If any contact ID does not exist in the workspace, the whole request fails with a validation error and no memberships are removed. The contacts themselves are not deleted and remain members of any other audiences.\n *\n */\nexport const unassignAudienceContacts = <ThrowOnError extends boolean = false>(\n options: Options<UnassignAudienceContactsData, ThrowOnError>,\n) =>\n (options.client ?? client).post<\n UnassignAudienceContactsResponses,\n UnassignAudienceContactsErrors,\n ThrowOnError\n >({\n security: [\n { scheme: \"bearer\", type: \"http\" },\n {\n in: \"cookie\",\n name: \"bird_session\",\n type: \"apiKey\",\n },\n ],\n url: \"/v1/audiences/{audience_id}/contacts/remove\",\n ...options,\n headers: {\n \"Content-Type\": \"application/json\",\n ...options.headers,\n },\n });\n\n/**\n * Remove a contact from an audience\n *\n * Removes a contact's membership in an audience. The contact itself is not deleted and remains a member of any other audiences. Removing a contact that is not a member of the audience succeeds with no effect (204); an unknown audience or contact returns a not-found error.\n *\n */\nexport const unassignAudienceContact = <ThrowOnError extends boolean = false>(\n options: Options<UnassignAudienceContactData, ThrowOnError>,\n) =>\n (options.client ?? client).delete<\n UnassignAudienceContactResponses,\n UnassignAudienceContactErrors,\n ThrowOnError\n >({\n security: [\n { scheme: \"bearer\", type: \"http\" },\n {\n in: \"cookie\",\n name: \"bird_session\",\n type: \"apiKey\",\n },\n ],\n url: \"/v1/audiences/{audience_id}/contacts/{contact_id}\",\n ...options,\n });\n\n/**\n * List SMS messages\n *\n * Returns the workspace's SMS messages as a cursor-paginated list, newest first. Filter by direction, status, category, recipient, sender, failure reason, tag, or creation time; pass the response's `next_cursor` back as `starting_after` to fetch the next page. To follow a single message's delivery, use [Get an SMS message](/docs/api/reference/get-sms-message) instead.\n *\n * Messages are retained for **30 days**. A `created_after` earlier than that is accepted and raised to the retention bound rather than rejected, so a wider window returns what is still retained instead of failing. There is no way to read messages older than the window.\n *\n */\nexport const listSmsMessages = <ThrowOnError extends boolean = false>(\n options?: Options<ListSmsMessagesData, ThrowOnError>,\n) =>\n (options?.client ?? client).get<\n ListSmsMessagesResponses,\n ListSmsMessagesErrors,\n ThrowOnError\n >({\n security: [\n { scheme: \"bearer\", type: \"http\" },\n {\n in: \"cookie\",\n name: \"bird_session\",\n type: \"apiKey\",\n },\n ],\n url: \"/v1/sms/messages\",\n ...options,\n });\n\n/**\n * Send an SMS message\n *\n * Sends one SMS message to a single recipient. A send carries exactly one\n * content form: `text` (free text, which also requires `category`) or\n * `template` (a stored template that supplies the body and category). To\n * submit up to 100 independent messages in one request, use\n * [Send a batch of SMS messages](/docs/api/reference/create-sms-message-batch)\n * instead.\n *\n * The `202` response means Bird durably accepted the message for asynchronous\n * delivery, not that it was delivered. Follow delivery with\n * [Get an SMS message](/docs/api/reference/get-sms-message) or by subscribing\n * to `sms.*` webhook events.\n *\n * Sends fail with a `422` when a field is invalid, the body exceeds the\n * 12-segment cap, the destination country is not enabled for the workspace,\n * or the sender is not permitted for the destination; a send from a\n * workspace with no wallet balance fails with a `402`.\n *\n */\nexport const createSmsMessage = <ThrowOnError extends boolean = false>(\n options: Options<CreateSmsMessageData, ThrowOnError>,\n) =>\n (options.client ?? client).post<\n CreateSmsMessageResponses,\n CreateSmsMessageErrors,\n ThrowOnError\n >({\n security: [\n { scheme: \"bearer\", type: \"http\" },\n {\n in: \"cookie\",\n name: \"bird_session\",\n type: \"apiKey\",\n },\n ],\n url: \"/v1/sms/messages\",\n ...options,\n headers: {\n \"Content-Type\": \"application/json\",\n ...options.headers,\n },\n });\n\n/**\n * Send a batch of SMS messages\n *\n * Sends up to 100 independent SMS messages in one request. Each item is a\n * complete send request with its own recipient, content, id, status, and\n * cost. For a single message, use\n * [Send an SMS message](/docs/api/reference/create-sms-message) instead.\n *\n * Acceptance is all-or-nothing: every item is validated before any is queued,\n * and one invalid item rejects the whole batch with a `422` (nothing is\n * sent). A batch from a workspace with no wallet balance fails with a `402`.\n * The `202` response lists the accepted messages in submission order; each\n * delivers asynchronously and is tracked individually, like a single send.\n *\n */\nexport const createSmsMessageBatch = <ThrowOnError extends boolean = false>(\n options: Options<CreateSmsMessageBatchData, ThrowOnError>,\n) =>\n (options.client ?? client).post<\n CreateSmsMessageBatchResponses,\n CreateSmsMessageBatchErrors,\n ThrowOnError\n >({\n security: [\n { scheme: \"bearer\", type: \"http\" },\n {\n in: \"cookie\",\n name: \"bird_session\",\n type: \"apiKey\",\n },\n ],\n url: \"/v1/sms/batches\",\n ...options,\n headers: {\n \"Content-Type\": \"application/json\",\n ...options.headers,\n },\n });\n\n/**\n * Get an SMS message\n *\n * Returns a single SMS message: its current delivery status, segment breakdown, cost, and failure detail when it failed. The `status` advances asynchronously as delivery progresses, and `cost` is null until the message has been priced, so poll this endpoint (or subscribe to `sms.*` webhook events) after a send to confirm delivery. To scan messages in bulk, use [List SMS messages](/docs/api/reference/list-sms-messages) instead.\n *\n */\nexport const getSmsMessage = <ThrowOnError extends boolean = false>(\n options: Options<GetSmsMessageData, ThrowOnError>,\n) =>\n (options.client ?? client).get<\n GetSmsMessageResponses,\n GetSmsMessageErrors,\n ThrowOnError\n >({\n security: [\n { scheme: \"bearer\", type: \"http\" },\n {\n in: \"cookie\",\n name: \"bird_session\",\n type: \"apiKey\",\n },\n ],\n url: \"/v1/sms/messages/{message_id}\",\n ...options,\n });\n\n/**\n * List SMS templates\n *\n * Returns the SMS templates you can send from, including Bird's built-in templates. Filter by scope, category, or language; the catalogue is small and returned in full, so this list is not paginated. To read one template's variables before sending with it, use [Get an SMS template](/docs/api/reference/get-sms-template).\n *\n */\nexport const listSmsTemplates = <ThrowOnError extends boolean = false>(\n options?: Options<ListSmsTemplatesData, ThrowOnError>,\n) =>\n (options?.client ?? client).get<\n ListSmsTemplatesResponses,\n ListSmsTemplatesErrors,\n ThrowOnError\n >({\n security: [\n { scheme: \"bearer\", type: \"http\" },\n {\n in: \"cookie\",\n name: \"bird_session\",\n type: \"apiKey\",\n },\n ],\n url: \"/v1/sms/templates\",\n ...options,\n });\n\n/**\n * Get an SMS template\n *\n * Returns a single SMS template: its body preview, category, the `variables` it expects (each with its accepted format), and the languages it is available in. Fetch a template before sending with it to see which `parameters` keys are required; an unknown reference returns a `404`. To browse the whole catalogue, use [List SMS templates](/docs/api/reference/list-sms-templates) instead.\n *\n */\nexport const getSmsTemplate = <ThrowOnError extends boolean = false>(\n options: Options<GetSmsTemplateData, ThrowOnError>,\n) =>\n (options.client ?? client).get<\n GetSmsTemplateResponses,\n GetSmsTemplateErrors,\n ThrowOnError\n >({\n security: [\n { scheme: \"bearer\", type: \"http\" },\n {\n in: \"cookie\",\n name: \"bird_session\",\n type: \"apiKey\",\n },\n ],\n url: \"/v1/sms/templates/{template_ref}\",\n ...options,\n });\n\n/**\n * Create a verification\n *\n * Creates a verification for a recipient and sends them a one-time passcode. Provide the recipient in `to`: an email address (verified over email), a phone number (verified over the phone channels enabled for its destination country), or both. The passcode is sent over one channel at a time and delivery falls over to the next channel in the plan if one fails; it is never sent over two channels at once.\n *\n * Calling this again for the same recipient resumes the verification in progress rather than starting a second one: within the resend cooldown the request returns the current state without sending, and after it a fresh passcode is sent. Use the same call to send and to resend.\n *\n * The `200` response is the verification's current state; the passcode itself is never returned. Submit the passcode the recipient enters with POST /v1/verify/verifications/check before the verification's `expires_at`. An invalid recipient returns `422`, and requesting passcodes for the same recipient too often returns `429`.\n *\n */\nexport const createVerification = <ThrowOnError extends boolean = false>(\n options: Options<CreateVerificationData, ThrowOnError>,\n) =>\n (options.client ?? client).post<\n CreateVerificationResponses,\n CreateVerificationErrors,\n ThrowOnError\n >({\n security: [\n { scheme: \"bearer\", type: \"http\" },\n {\n in: \"cookie\",\n name: \"bird_session\",\n type: \"apiKey\",\n },\n ],\n url: \"/v1/verify/verifications\",\n ...options,\n headers: {\n \"Content-Type\": \"application/json\",\n ...options.headers,\n },\n });\n\n/**\n * Check a verification passcode\n *\n * Checks a passcode for a recipient and returns the outcome together with the verification's current state. Identify the verification by the same `to` used to create it; you do not need to store a verification ID.\n *\n * A wrong or expired passcode is a normal outcome, not an HTTP error: the response is `200` with `success` set to `false` and a `reason` such as `incorrect_code` or `expired`. `success: true` means the verification is complete. Each verification reports its final outcome exactly once and is no longer checkable afterwards.\n *\n * An error status is returned only when the check cannot be evaluated: `404` when no verification matches the recipient or the matching one already reached its final state, `422` for an invalid recipient, and `429` when passcodes for a recipient are checked too quickly.\n *\n */\nexport const createVerificationCheck = <ThrowOnError extends boolean = false>(\n options: Options<CreateVerificationCheckData, ThrowOnError>,\n) =>\n (options.client ?? client).post<\n CreateVerificationCheckResponses,\n CreateVerificationCheckErrors,\n ThrowOnError\n >({\n security: [\n { scheme: \"bearer\", type: \"http\" },\n {\n in: \"cookie\",\n name: \"bird_session\",\n type: \"apiKey\",\n },\n ],\n url: \"/v1/verify/verifications/check\",\n ...options,\n headers: {\n \"Content-Type\": \"application/json\",\n ...options.headers,\n },\n });\n\n/**\n * Advance a verification to its next channel\n *\n * Advances an in-progress verification to the next channel in its plan and sends a fresh passcode there, for a recipient who reports not receiving the code. Identify the verification by the same `to` used to create it; you do not need to store a verification ID.\n *\n * The send bypasses the resend cooldown (a deliberate channel switch is a different act from a same-channel resend), and every passcode already sent stays valid, so a code that arrives late can still be checked. The response is the verification with `last_channel` set to the channel the new passcode went to. Concurrent requests for the same recipient are safe: each advances the plan at most one step. When two race, the request that completes the newer send is the authoritative one; the other returns the verification's committed state, whose `last_channel` still names the most recent send that completed. A later read of the verification always reflects the settled outcome.\n *\n * An error status is returned when the verification cannot be advanced: `404` when no verification is in progress for the recipient, `422` with `NoNextChannel` when the plan has no further channel (fall back to a plain resend), `422` with `NoAvailableChannel` when every remaining channel failed to send, and `429` when sends for the account are requested too quickly.\n *\n */\nexport const createVerificationNextChannel = <\n ThrowOnError extends boolean = false,\n>(\n options: Options<CreateVerificationNextChannelData, ThrowOnError>,\n) =>\n (options.client ?? client).post<\n CreateVerificationNextChannelResponses,\n CreateVerificationNextChannelErrors,\n ThrowOnError\n >({\n security: [\n { scheme: \"bearer\", type: \"http\" },\n {\n in: \"cookie\",\n name: \"bird_session\",\n type: \"apiKey\",\n },\n ],\n url: \"/v1/verify/verifications/next-channel\",\n ...options,\n headers: {\n \"Content-Type\": \"application/json\",\n ...options.headers,\n },\n });\n\n/**\n * List WhatsApp messages\n *\n * Returns the workspace's WhatsApp messages as a cursor-paginated list, newest first. Filter by direction, status, contact phone number, business-scoped user ID, template category, tag, or creation time; pass the response's `next_cursor` back as `starting_after` to fetch the next page. To follow a single message's delivery, use [Get a WhatsApp message](/docs/api/reference/get-whats-app-message) instead.\n *\n * Messages are retained for **30 days**. A `created_after` earlier than that is accepted and raised to the retention bound rather than rejected, so a wider window returns what is still retained instead of failing. There is no way to read messages older than the window.\n *\n */\nexport const listWhatsAppMessages = <ThrowOnError extends boolean = false>(\n options?: Options<ListWhatsAppMessagesData, ThrowOnError>,\n) =>\n (options?.client ?? client).get<\n ListWhatsAppMessagesResponses,\n ListWhatsAppMessagesErrors,\n ThrowOnError\n >({\n security: [\n { scheme: \"bearer\", type: \"http\" },\n {\n in: \"cookie\",\n name: \"bird_session\",\n type: \"apiKey\",\n },\n ],\n url: \"/v1/whatsapp/messages\",\n ...options,\n });\n\n/**\n * Send a WhatsApp message\n *\n * Sends a WhatsApp message built from a message template to one recipient.\n * Name the template, optionally pick its language variant, and fill its\n * placeholders in `components`; a Bird-managed template selects its sender\n * number from its category, so the request carries no sender field. A request\n * that carries no content is rejected with a `422`. Browse your workspace's\n * templates in the Bird dashboard.\n *\n * The `202` response is the accepted message, echoing the resolved template\n * and language; it is not a delivery confirmation. Follow delivery with\n * [Get a WhatsApp message](/docs/api/reference/get-whats-app-message), the\n * per-message timeline from\n * [List events for a WhatsApp message](/docs/api/reference/list-whats-app-message-events),\n * or `whatsapp.*` webhook events.\n *\n * A template slug or language the catalogue does not stock, parameter values\n * that do not match the template's declared placeholders, and a recipient\n * that is not a valid phone number each return a `422`, as does a request\n * that carries no content at all.\n *\n */\nexport const createWhatsAppMessage = <ThrowOnError extends boolean = false>(\n options: Options<CreateWhatsAppMessageData, ThrowOnError>,\n) =>\n (options.client ?? client).post<\n CreateWhatsAppMessageResponses,\n CreateWhatsAppMessageErrors,\n ThrowOnError\n >({\n security: [\n { scheme: \"bearer\", type: \"http\" },\n {\n in: \"cookie\",\n name: \"bird_session\",\n type: \"apiKey\",\n },\n ],\n url: \"/v1/whatsapp/messages\",\n ...options,\n headers: {\n \"Content-Type\": \"application/json\",\n ...options.headers,\n },\n });\n\n/**\n * Get a WhatsApp message\n *\n * Returns a single WhatsApp message: its current delivery status, per-stage timestamps (`sent_at`, `delivered_at`, `read_at`), the template it was sent from, and failure detail when it failed. The `status` advances asynchronously as delivery progresses, so poll this endpoint (or subscribe to `whatsapp.*` webhook events) after a send to confirm delivery. For the per-event timeline, use [List events for a WhatsApp message](/docs/api/reference/list-whats-app-message-events) instead.\n *\n */\nexport const getWhatsAppMessage = <ThrowOnError extends boolean = false>(\n options: Options<GetWhatsAppMessageData, ThrowOnError>,\n) =>\n (options.client ?? client).get<\n GetWhatsAppMessageResponses,\n GetWhatsAppMessageErrors,\n ThrowOnError\n >({\n security: [\n { scheme: \"bearer\", type: \"http\" },\n {\n in: \"cookie\",\n name: \"bird_session\",\n type: \"apiKey\",\n },\n ],\n url: \"/v1/whatsapp/messages/{message_id}\",\n ...options,\n });\n\n/**\n * List events for a WhatsApp message\n *\n * Returns a WhatsApp message's lifecycle events in chronological order, one entry per delivery transition (`whatsapp.accepted`, `whatsapp.sent`, `whatsapp.delivered`, `whatsapp.read`, `whatsapp.failed`). The timeline is bounded and returned in full, so this list is not paginated; an unknown message id returns a `404`. For the message's current state in a single field, use [Get a WhatsApp message](/docs/api/reference/get-whats-app-message) instead.\n *\n */\nexport const listWhatsAppMessageEvents = <ThrowOnError extends boolean = false>(\n options: Options<ListWhatsAppMessageEventsData, ThrowOnError>,\n) =>\n (options.client ?? client).get<\n ListWhatsAppMessageEventsResponses,\n ListWhatsAppMessageEventsErrors,\n ThrowOnError\n >({\n security: [\n { scheme: \"bearer\", type: \"http\" },\n {\n in: \"cookie\",\n name: \"bird_session\",\n type: \"apiKey\",\n },\n ],\n url: \"/v1/whatsapp/messages/{message_id}/events\",\n ...options,\n });\n\n/**\n * Daily sending statistics\n *\n * Returns one row of aggregate sending statistics per calendar day for the workspace: UTC days by default, or your local days when `timezone` is set. Days with no activity are included with zero counts, so the series charts without client-side gap handling. Suited to charts and trend lines; for per-message exact accounting use the message detail endpoints.\n *\n * Rows are bucketed by event time, not send time: a complaint received on Wednesday for a message sent the prior Monday is counted in Wednesday's row.\n *\n * The maximum window is 365 days; requesting a longer range returns 422.\n *\n */\nexport const getEmailStatsDaily = <ThrowOnError extends boolean = false>(\n options?: Options<GetEmailStatsDailyData, ThrowOnError>,\n) =>\n (options?.client ?? client).get<\n GetEmailStatsDailyResponses,\n GetEmailStatsDailyErrors,\n ThrowOnError\n >({\n security: [\n { scheme: \"bearer\", type: \"http\" },\n {\n in: \"cookie\",\n name: \"bird_session\",\n type: \"apiKey\",\n },\n ],\n url: \"/v1/email/stats/daily\",\n ...options,\n });\n\n/**\n * Hourly sending statistics\n *\n * Returns one row of aggregate sending statistics per hour for the workspace: UTC hours by default, or your local hours when `timezone` is set (a timezone with a sub-hour offset gets correctly aligned hours). Useful for inspecting send rate, deliverability, and engagement inside a single day or a recent window; hours with no activity are included with zero counts.\n *\n * Rows are bucketed by event time, not send time: a click recorded at 14:07 for a message sent at 09:00 lands in the 14:00 row.\n *\n * A single request may span at most 30 days (720 hourly rows); for longer ranges use the daily endpoint, which has a 365-day window. An hourly window longer than 30 days, or a `from` after `to`, returns 422.\n *\n */\nexport const getEmailStatsHourly = <ThrowOnError extends boolean = false>(\n options?: Options<GetEmailStatsHourlyData, ThrowOnError>,\n) =>\n (options?.client ?? client).get<\n GetEmailStatsHourlyResponses,\n GetEmailStatsHourlyErrors,\n ThrowOnError\n >({\n security: [\n { scheme: \"bearer\", type: \"http\" },\n {\n in: \"cookie\",\n name: \"bird_session\",\n type: \"apiKey\",\n },\n ],\n url: \"/v1/email/stats/hourly\",\n ...options,\n });\n\n/**\n * Stats by tag\n *\n * Returns aggregate delivery and engagement counts grouped by tag for the requested period. Rows are ranked by the `sort` metric (default `processed`) descending and capped at the requested `limit` (default 50, hard maximum 200). Use this to compare campaign performance across tags you set at send time.\n *\n * Rows are computed against event time (not send time), so engagement received during the period for messages sent earlier is included.\n *\n * The maximum window is 365 days; requesting a longer range returns 422.\n *\n */\nexport const getEmailStatsByTag = <ThrowOnError extends boolean = false>(\n options?: Options<GetEmailStatsByTagData, ThrowOnError>,\n) =>\n (options?.client ?? client).get<\n GetEmailStatsByTagResponses,\n GetEmailStatsByTagErrors,\n ThrowOnError\n >({\n security: [\n { scheme: \"bearer\", type: \"http\" },\n {\n in: \"cookie\",\n name: \"bird_session\",\n type: \"apiKey\",\n },\n ],\n url: \"/v1/email/stats/tags\",\n ...options,\n });\n\n/**\n * Aggregate stats summary\n *\n * Returns a single-row aggregate across the requested period covering delivery, bounce, complaint, open, and click counts plus the derived rates, along with processing, delivery, and total latency percentiles (p50/p95/p99). Suitable for KPI tiles, campaign reports, and email digests; the daily and hourly endpoints carry the same metrics per time bucket.\n *\n * The aggregate is computed against event time (not send time), so engagement received during the period for messages sent earlier is included. Rate fields are null when their denominator is zero.\n *\n * The window grain follows the form of `from` and `to`: calendar days (`YYYY-MM-DD`, up to 365 days) or RFC 3339 instants (hour grain, up to 720 hours, 30 days), so a rolling window such as the last 24 hours is a single request. Mixing the two forms returns 422. Set `timezone` to compute day and hour boundaries in a local zone instead of UTC, and `compare=previous_period` to include the preceding equal-length window in the same response.\n *\n */\nexport const getEmailStatsSummary = <ThrowOnError extends boolean = false>(\n options?: Options<GetEmailStatsSummaryData, ThrowOnError>,\n) =>\n (options?.client ?? client).get<\n GetEmailStatsSummaryResponses,\n GetEmailStatsSummaryErrors,\n ThrowOnError\n >({\n security: [\n { scheme: \"bearer\", type: \"http\" },\n {\n in: \"cookie\",\n name: \"bird_session\",\n type: \"apiKey\",\n },\n ],\n url: \"/v1/email/stats/summary\",\n ...options,\n });\n\n/**\n * Stats by sending IP\n *\n * Returns delivery and deliverability counts grouped by the specific IP address used to send each message. Use this to identify per-IP reputation issues: block bounces concentrated on a single IP usually indicate a reputation problem on that IP, and `sort=bounces.block` surfaces those IPs first.\n *\n * A sending IP is known only once the upstream mail system reports delivery, bounce, deferral, or a late bounce, so rows cover the delivery stage onward: `accepted` and `processed` counts, processing latency, engagement, and complaint attribution are not available per IP. For workspace-wide figures use `GET /v1/email/stats/daily`. Rows are computed against event time (not send time).\n *\n * Rows are ranked by the `sort` field (default `delivered`) descending and capped at the requested `limit` (default 50, hard maximum 200). The maximum window is 365 days; requesting a longer range returns 422.\n *\n */\nexport const getEmailStatsBySendingIp = <ThrowOnError extends boolean = false>(\n options?: Options<GetEmailStatsBySendingIpData, ThrowOnError>,\n) =>\n (options?.client ?? client).get<\n GetEmailStatsBySendingIpResponses,\n GetEmailStatsBySendingIpErrors,\n ThrowOnError\n >({\n security: [\n { scheme: \"bearer\", type: \"http\" },\n {\n in: \"cookie\",\n name: \"bird_session\",\n type: \"apiKey\",\n },\n ],\n url: \"/v1/email/stats/sending-ips\",\n ...options,\n });\n\n/**\n * Stats by sending domain\n *\n * Returns delivery, engagement, and deliverability counts grouped by sending domain (the portion of the `From` address after the `@`). Use this to compare deliverability across multiple verified domains in your workspace, for example transactional versus marketing domains, or sub-domain segregation during IP warming.\n *\n * Rows are computed against event time (not send time), so engagement and bounces received during the period for messages sent earlier are included.\n *\n * Rows are ranked by the `sort` metric (default `processed`) descending and capped at the requested `limit` (default 50, hard maximum 200). The maximum window is 365 days; requesting a longer range returns 422.\n *\n */\nexport const getEmailStatsBySendingDomain = <\n ThrowOnError extends boolean = false,\n>(\n options?: Options<GetEmailStatsBySendingDomainData, ThrowOnError>,\n) =>\n (options?.client ?? client).get<\n GetEmailStatsBySendingDomainResponses,\n GetEmailStatsBySendingDomainErrors,\n ThrowOnError\n >({\n security: [\n { scheme: \"bearer\", type: \"http\" },\n {\n in: \"cookie\",\n name: \"bird_session\",\n type: \"apiKey\",\n },\n ],\n url: \"/v1/email/stats/sending-domains\",\n ...options,\n });\n\n/**\n * Stats by category\n *\n * Returns aggregate delivery and engagement counts grouped by category for the requested period. Rows are ranked by the `sort` metric (default `processed`) descending and capped at the requested `limit` (default 50, hard maximum 200). Use this to compare deliverability and engagement between your transactional and marketing traffic.\n *\n * Rows are computed against event time (not send time), so engagement received during the period for messages sent earlier is included.\n *\n * The maximum window is 365 days; requesting a longer range returns 422.\n *\n */\nexport const getEmailStatsByCategory = <ThrowOnError extends boolean = false>(\n options?: Options<GetEmailStatsByCategoryData, ThrowOnError>,\n) =>\n (options?.client ?? client).get<\n GetEmailStatsByCategoryResponses,\n GetEmailStatsByCategoryErrors,\n ThrowOnError\n >({\n security: [\n { scheme: \"bearer\", type: \"http\" },\n {\n in: \"cookie\",\n name: \"bird_session\",\n type: \"apiKey\",\n },\n ],\n url: \"/v1/email/stats/categories\",\n ...options,\n });\n\n/**\n * Stats by mailbox provider\n *\n * Returns delivery, engagement, and deliverability counts grouped by recipient mailbox provider (for example `gmail`, `yahoo`, `microsoft`, `apple`): the deliverability-by-inbox-provider view. Use this to compare how each major inbox provider treats your mail, for example to spot a delivered-rate dip or complaint spike at one provider before it spreads; for a per-region split within a provider, use the mailbox-provider-region breakdown.\n *\n * A recipient's mailbox provider is known only once the receiving mail system reports an outcome, so rows cover the delivery stage onward: `accepted`, `processed`, and `rejected` counts and processing latency are not included. Rows are computed against event time (not send time).\n *\n * Rows are ranked by the `sort` metric (default `delivered`) descending and capped at the requested `limit` (default 50, hard maximum 200). The maximum window is 365 days; requesting a longer range returns 422.\n *\n */\nexport const getEmailStatsByMailboxProvider = <\n ThrowOnError extends boolean = false,\n>(\n options?: Options<GetEmailStatsByMailboxProviderData, ThrowOnError>,\n) =>\n (options?.client ?? client).get<\n GetEmailStatsByMailboxProviderResponses,\n GetEmailStatsByMailboxProviderErrors,\n ThrowOnError\n >({\n security: [\n { scheme: \"bearer\", type: \"http\" },\n {\n in: \"cookie\",\n name: \"bird_session\",\n type: \"apiKey\",\n },\n ],\n url: \"/v1/email/stats/mailbox-providers\",\n ...options,\n });\n\n/**\n * Stats by mailbox provider region\n *\n * Returns delivery, engagement, and deliverability counts grouped by mailbox provider and provider region pair, for example `gmail` in `NA` or `microsoft` in `EU`. The provider region is the regional pod the receiving mail system reports for the recipient's provider; pairing it with the provider disambiguates a region label that several providers share. Use this to spot a deliverability problem isolated to one provider in one region; for a per-provider view without the region split, use the mailbox-provider breakdown.\n *\n * A provider region is known only once the receiving mail system reports an outcome, so rows cover the delivery stage onward: `accepted`, `processed`, and `rejected` counts and processing latency are not included. Rows are computed against event time (not send time).\n *\n * Rows are ranked by the `sort` metric (default `delivered`) descending and capped at the requested `limit` (default 50, hard maximum 200). The maximum window is 365 days; requesting a longer range returns 422.\n *\n */\nexport const getEmailStatsByMailboxProviderRegion = <\n ThrowOnError extends boolean = false,\n>(\n options?: Options<GetEmailStatsByMailboxProviderRegionData, ThrowOnError>,\n) =>\n (options?.client ?? client).get<\n GetEmailStatsByMailboxProviderRegionResponses,\n GetEmailStatsByMailboxProviderRegionErrors,\n ThrowOnError\n >({\n security: [\n { scheme: \"bearer\", type: \"http\" },\n {\n in: \"cookie\",\n name: \"bird_session\",\n type: \"apiKey\",\n },\n ],\n url: \"/v1/email/stats/mailbox-provider-regions\",\n ...options,\n });\n\n/**\n * Stats by recipient domain\n *\n * Returns aggregate delivery and engagement counts grouped by recipient mailbox domain (the part of each recipient address after the `@`, for example `gmail.com`, `yahoo.com`, `outlook.com`) for the requested period. This is the finest-grained deliverability view: where the mailbox-provider breakdown groups recipients into provider buckets such as `gmail` or `microsoft`, this keys on the exact destination domain. Use it to spot a delivery-rate dip or complaint spike at a specific domain.\n *\n * Rows are ranked by the `sort` metric (default `processed`) descending and capped at the requested `limit` (default 50, hard maximum 200). Rows are computed against event time (not send time), so engagement received during the period for messages sent earlier is included.\n *\n * The maximum window is 365 days; requesting a longer range returns 422.\n *\n */\nexport const getEmailStatsByRecipientDomain = <\n ThrowOnError extends boolean = false,\n>(\n options?: Options<GetEmailStatsByRecipientDomainData, ThrowOnError>,\n) =>\n (options?.client ?? client).get<\n GetEmailStatsByRecipientDomainResponses,\n GetEmailStatsByRecipientDomainErrors,\n ThrowOnError\n >({\n security: [\n { scheme: \"bearer\", type: \"http\" },\n {\n in: \"cookie\",\n name: \"bird_session\",\n type: \"apiKey\",\n },\n ],\n url: \"/v1/email/stats/recipient-domains\",\n ...options,\n });\n\n/**\n * Stats by template\n *\n * Returns aggregate delivery and engagement counts grouped by the template each message was sent with, so a template's deliverability and engagement can be compared side by side. Attribution is by the template used at send time; only messages sent with a template appear here, so a workspace that has sent none returns an empty list rather than an error. Each row is keyed by the template ID (`emt_…`); a template deleted after sending still appears by its ID.\n *\n * Rows are ranked by the `sort` metric (default `processed`) descending and capped at the requested `limit` (default 50, hard maximum 200). Rows are computed against event time (not send time), so engagement received during the period for messages sent earlier is included.\n *\n * The maximum window is 365 days; requesting a longer range returns 422.\n *\n */\nexport const getEmailStatsByTemplate = <ThrowOnError extends boolean = false>(\n options?: Options<GetEmailStatsByTemplateData, ThrowOnError>,\n) =>\n (options?.client ?? client).get<\n GetEmailStatsByTemplateResponses,\n GetEmailStatsByTemplateErrors,\n ThrowOnError\n >({\n security: [\n { scheme: \"bearer\", type: \"http\" },\n {\n in: \"cookie\",\n name: \"bird_session\",\n type: \"apiKey\",\n },\n ],\n url: \"/v1/email/stats/templates\",\n ...options,\n });\n\n/**\n * Engagement by location\n *\n * Returns engagement counts (opens and clicks) grouped by the location they were recorded from, for the requested period. Use it to see where your audience engages, for example the top countries by unique opens. Location is known from open and click events only, so rows carry engagement counts but no delivery counts or rates.\n *\n * Use `group_by` to choose the granularity: `country` (default), `region`, or `city`. Each row carries the location hierarchy down to the requested level (a `city` grouping also reports the row's region and country). Rows are ranked by the `sort` metric (default `unique_opens`) descending and capped at the requested `limit` (default 50, hard maximum 200).\n *\n * Rows are computed against event time (not send time). The maximum window is 365 days; requesting a longer range returns 422.\n *\n */\nexport const getEmailStatsByLocation = <ThrowOnError extends boolean = false>(\n options?: Options<GetEmailStatsByLocationData, ThrowOnError>,\n) =>\n (options?.client ?? client).get<\n GetEmailStatsByLocationResponses,\n GetEmailStatsByLocationErrors,\n ThrowOnError\n >({\n security: [\n { scheme: \"bearer\", type: \"http\" },\n {\n in: \"cookie\",\n name: \"bird_session\",\n type: \"apiKey\",\n },\n ],\n url: \"/v1/email/stats/locations\",\n ...options,\n });\n\n/**\n * Engagement by email client\n *\n * Returns engagement counts (opens and clicks) grouped by the email client, operating system, or device type they were recorded from, for the requested period. Use it for the classic \"opens by mail client\" view, for example the share of opens from Apple Mail versus Gmail versus Outlook. The reading environment is known from open and click events only, so rows carry engagement counts but no delivery counts or rates.\n *\n * Use `group_by` to choose the facet: `email_client` (default), `os`, or `device_type`. Each row populates the chosen facet and leaves the other two null. Rows are ranked by the `sort` metric (default `unique_opens`) descending and capped at the requested `limit` (default 50, hard maximum 200).\n *\n * Rows are computed against event time (not send time). The maximum window is 365 days; requesting a longer range returns 422.\n *\n */\nexport const getEmailStatsByClient = <ThrowOnError extends boolean = false>(\n options?: Options<GetEmailStatsByClientData, ThrowOnError>,\n) =>\n (options?.client ?? client).get<\n GetEmailStatsByClientResponses,\n GetEmailStatsByClientErrors,\n ThrowOnError\n >({\n security: [\n { scheme: \"bearer\", type: \"http\" },\n {\n in: \"cookie\",\n name: \"bird_session\",\n type: \"apiKey\",\n },\n ],\n url: \"/v1/email/stats/clients\",\n ...options,\n });\n\n/**\n * Bounces by SMTP error code\n *\n * Returns bounce counts grouped by the SMTP error code the receiving mail server returned, for the requested period: the deliverability-debugging view that answers \"which SMTP responses are driving my bounces\". Each row reports the bounced recipients for one code plus the hard/soft/admin/block/undetermined split.\n *\n * This breakdown reports the failure side only: it has no delivered, open, click, or rate fields, because a bounce code is recorded only on bounce events.\n *\n * Rows are ranked by the `sort` metric (default `bounced`) descending, capped at the requested `limit` (default 50, hard maximum 200), and computed against event time (not send time). The maximum window is 365 days; requesting a longer range returns 422.\n *\n */\nexport const getEmailStatsByBounceCode = <ThrowOnError extends boolean = false>(\n options?: Options<GetEmailStatsByBounceCodeData, ThrowOnError>,\n) =>\n (options?.client ?? client).get<\n GetEmailStatsByBounceCodeResponses,\n GetEmailStatsByBounceCodeErrors,\n ThrowOnError\n >({\n security: [\n { scheme: \"bearer\", type: \"http\" },\n {\n in: \"cookie\",\n name: \"bird_session\",\n type: \"apiKey\",\n },\n ],\n url: \"/v1/email/stats/bounce-codes\",\n ...options,\n });\n\n/**\n * Complaints by type\n *\n * Returns spam-complaint counts grouped by the feedback-loop complaint type reported by the mailbox provider (for example `abuse`, `fraud`, `virus`), for the requested period. Use it to understand what kind of complaints your mail attracts.\n *\n * This breakdown reports the complaint side only: each row carries the complained count for one type and nothing else, because a complaint type is recorded only on spam-complaint events.\n *\n * Rows are ranked by `complained` descending, capped at the requested `limit` (default 50, hard maximum 200), and computed against event time (not send time). The maximum window is 365 days; requesting a longer range returns 422.\n *\n */\nexport const getEmailStatsByComplaintType = <\n ThrowOnError extends boolean = false,\n>(\n options?: Options<GetEmailStatsByComplaintTypeData, ThrowOnError>,\n) =>\n (options?.client ?? client).get<\n GetEmailStatsByComplaintTypeResponses,\n GetEmailStatsByComplaintTypeErrors,\n ThrowOnError\n >({\n security: [\n { scheme: \"bearer\", type: \"http\" },\n {\n in: \"cookie\",\n name: \"bird_session\",\n type: \"apiKey\",\n },\n ],\n url: \"/v1/email/stats/complaint-types\",\n ...options,\n });\n\n/**\n * Stats by broadcast\n *\n * Returns aggregate delivery and engagement counts grouped by broadcast for the requested period, so each broadcast's deliverability and engagement can be compared side by side. Only messages sent as part of a broadcast appear here; one-off and transactional sends are not included, so a workspace that has not sent broadcasts returns an empty list rather than an error.\n *\n * Rows are ranked by the `sort` metric (default `processed`) descending and capped at the requested `limit` (default 50, hard maximum 200). Rows are computed against event time (not send time), so engagement received during the period for messages sent earlier is included.\n *\n * The maximum window is 365 days; requesting a longer range returns 422. This breakdown is computed from per-message activity retained for 30 days, so it reflects roughly the last 30 days of activity even when the requested window reaches further back.\n *\n */\nexport const getEmailStatsByBroadcast = <ThrowOnError extends boolean = false>(\n options?: Options<GetEmailStatsByBroadcastData, ThrowOnError>,\n) =>\n (options?.client ?? client).get<\n GetEmailStatsByBroadcastResponses,\n GetEmailStatsByBroadcastErrors,\n ThrowOnError\n >({\n security: [\n { scheme: \"bearer\", type: \"http\" },\n {\n in: \"cookie\",\n name: \"bird_session\",\n type: \"apiKey\",\n },\n ],\n url: \"/v1/email/stats/broadcasts\",\n ...options,\n });\n\n/**\n * List sending domains\n *\n * Returns all sending domains for the current workspace, newest first by default. Each item is the full domain object, including capability statuses and `dns_records`, so no per-domain follow-up read is needed. Filter with `name` to find a specific domain.\n *\n */\nexport const listDomains = <ThrowOnError extends boolean = false>(\n options?: Options<ListDomainsData, ThrowOnError>,\n) =>\n (options?.client ?? client).get<\n ListDomainsResponses,\n ListDomainsErrors,\n ThrowOnError\n >({\n security: [\n { scheme: \"bearer\", type: \"http\" },\n {\n in: \"cookie\",\n name: \"bird_session\",\n type: \"apiKey\",\n },\n ],\n url: \"/v1/email/domains\",\n ...options,\n });\n\n/**\n * Add a sending domain\n *\n * Registers a new sending domain and returns the DNS records to publish\n * for it. The DKIM TXT record proves ownership, and together with the\n * return-path CNAME (which also covers SPF; no separate SPF record is\n * needed) and a DMARC policy it gates sending. The tracking CNAME is\n * optional and gates branded link tracking only. Publish the records at\n * your DNS provider, then check progress with\n * [Trigger domain verification](/docs/api/reference/verify-domain); Bird\n * also re-checks published records automatically. Setup walkthrough:\n * [Sending domains](/docs/guides/email/sending-domains).\n *\n * The domain starts in `pending` status. A domain already registered in\n * this workspace returns `409`, and creation beyond your organization's\n * domain quota returns `422` `E10000`. A domain that never verifies\n * ownership is removed after about 14 days, with a reminder email first.\n *\n */\nexport const createDomain = <ThrowOnError extends boolean = false>(\n options: Options<CreateDomainData, ThrowOnError>,\n) =>\n (options.client ?? client).post<\n CreateDomainResponses,\n CreateDomainErrors,\n ThrowOnError\n >({\n security: [\n { scheme: \"bearer\", type: \"http\" },\n {\n in: \"cookie\",\n name: \"bird_session\",\n type: \"apiKey\",\n },\n ],\n url: \"/v1/email/domains\",\n ...options,\n headers: {\n \"Content-Type\": \"application/json\",\n ...options.headers,\n },\n });\n\n/**\n * Delete a sending domain\n *\n * Removes the domain and revokes its sender authorization. New sends from a deleted domain are rejected. Historical statistics and events for past sends from this domain are preserved.\n *\n */\nexport const deleteDomain = <ThrowOnError extends boolean = false>(\n options: Options<DeleteDomainData, ThrowOnError>,\n) =>\n (options.client ?? client).delete<\n DeleteDomainResponses,\n DeleteDomainErrors,\n ThrowOnError\n >({\n security: [\n { scheme: \"bearer\", type: \"http\" },\n {\n in: \"cookie\",\n name: \"bird_session\",\n type: \"apiKey\",\n },\n ],\n url: \"/v1/email/domains/{domain_id}\",\n ...options,\n });\n\n/**\n * Get a sending domain\n *\n * Returns the domain with its capability statuses and every DNS record's current verification state. This read reports the stored result of the last check; to run a fresh DNS check, use [Trigger domain verification](/docs/api/reference/verify-domain).\n *\n */\nexport const getDomain = <ThrowOnError extends boolean = false>(\n options: Options<GetDomainData, ThrowOnError>,\n) =>\n (options.client ?? client).get<\n GetDomainResponses,\n GetDomainErrors,\n ThrowOnError\n >({\n security: [\n { scheme: \"bearer\", type: \"http\" },\n {\n in: \"cookie\",\n name: \"bird_session\",\n type: \"apiKey\",\n },\n ],\n url: \"/v1/email/domains/{domain_id}\",\n ...options,\n });\n\n/**\n * Update a sending domain\n *\n * Updates settings and configuration on a sending domain. `settings`\n * changes apply immediately. Changes to `return_path`, `tracking`, or\n * `dkim` on a verified capability are staged: the current configuration\n * keeps serving until the new one's DNS records verify, then the change\n * is promoted automatically. Staged values are visible under\n * `capabilities.*.pending`; the records to publish appear in\n * `dns_records` with `state: pending`.\n *\n * Invalid combinations are rejected: enabling tracking toggles without a\n * tracking domain, or removing the tracking domain while a toggle is on,\n * returns `409`; enabling inbound receiving has verification\n * prerequisites that return `422`. Each rule is detailed on its field.\n *\n */\nexport const updateDomain = <ThrowOnError extends boolean = false>(\n options: Options<UpdateDomainData, ThrowOnError>,\n) =>\n (options.client ?? client).patch<\n UpdateDomainResponses,\n UpdateDomainErrors,\n ThrowOnError\n >({\n security: [\n { scheme: \"bearer\", type: \"http\" },\n {\n in: \"cookie\",\n name: \"bird_session\",\n type: \"apiKey\",\n },\n ],\n url: \"/v1/email/domains/{domain_id}\",\n ...options,\n headers: {\n \"Content-Type\": \"application/json\",\n ...options.headers,\n },\n });\n\n/**\n * Trigger domain verification\n *\n * Runs a fresh DNS check across the domain's records (DKIM, return path,\n * DMARC, tracking, inbound MX, and any staged changes) and returns the\n * updated domain. Use it for an immediate result after publishing or\n * correcting records; [Get a sending domain](/docs/api/reference/get-domain)\n * only reports the last stored result, and Bird re-checks published\n * records automatically in the background.\n *\n * A `200` with records still `pending` is not a failure: the records were\n * not found yet, which is normal while DNS propagates (minutes to hours).\n * Recently verified records are not re-queried, so the call is safe to\n * repeat while you wait.\n *\n */\nexport const verifyDomain = <ThrowOnError extends boolean = false>(\n options: Options<VerifyDomainData, ThrowOnError>,\n) =>\n (options.client ?? client).post<\n VerifyDomainResponses,\n VerifyDomainErrors,\n ThrowOnError\n >({\n security: [\n { scheme: \"bearer\", type: \"http\" },\n {\n in: \"cookie\",\n name: \"bird_session\",\n type: \"apiKey\",\n },\n ],\n url: \"/v1/email/domains/{domain_id}/verify\",\n ...options,\n });\n\n/**\n * List mailboxes\n *\n * Returns a paginated list of the workspace's mailboxes, newest first. Search across addresses and display names with `q`, look a mailbox up by its exact address, or filter by lifecycle state or domain.\n *\n */\nexport const listMailboxes = <ThrowOnError extends boolean = false>(\n options?: Options<ListMailboxesData, ThrowOnError>,\n) =>\n (options?.client ?? client).get<\n ListMailboxesResponses,\n ListMailboxesErrors,\n ThrowOnError\n >({\n security: [\n { scheme: \"bearer\", type: \"http\" },\n {\n in: \"cookie\",\n name: \"bird_session\",\n type: \"apiKey\",\n },\n ],\n url: \"/v1/email/mailboxes\",\n ...options,\n });\n\n/**\n * Create a mailbox\n *\n * Creates a mailbox. The address is `local_part@domain`. The domain defaults to `inbox.ai`, Bird's shared mailbox domain, where creating the mailbox claims the address for your organization — first come, first served, and reserved to your organization even after the mailbox is deleted. You may instead name one of your own domains that is enabled for receiving email. An omitted local part is generated. On a custom domain, addresses of deleted mailboxes are quarantined: the same workspace can rebind one 30 days after deletion, other workspaces never can.\n *\n */\nexport const createMailbox = <ThrowOnError extends boolean = false>(\n options: Options<CreateMailboxData, ThrowOnError>,\n) =>\n (options.client ?? client).post<\n CreateMailboxResponses,\n CreateMailboxErrors,\n ThrowOnError\n >({\n security: [\n { scheme: \"bearer\", type: \"http\" },\n {\n in: \"cookie\",\n name: \"bird_session\",\n type: \"apiKey\",\n },\n ],\n url: \"/v1/email/mailboxes\",\n ...options,\n headers: {\n \"Content-Type\": \"application/json\",\n ...options.headers,\n },\n });\n\n/**\n * Delete a mailbox\n *\n * Deletes a mailbox. The address stops receiving mail immediately and enters quarantine: the same workspace can bind it to a new mailbox after 30 days, other workspaces never can. The mailbox and its remembered messages are kept for a 30-day restore window — restore it with `POST /email/mailboxes/{mailbox_id}/restore` — and are permanently deleted once the window closes.\n *\n */\nexport const deleteMailbox = <ThrowOnError extends boolean = false>(\n options: Options<DeleteMailboxData, ThrowOnError>,\n) =>\n (options.client ?? client).delete<\n DeleteMailboxResponses,\n DeleteMailboxErrors,\n ThrowOnError\n >({\n security: [\n { scheme: \"bearer\", type: \"http\" },\n {\n in: \"cookie\",\n name: \"bird_session\",\n type: \"apiKey\",\n },\n ],\n url: \"/v1/email/mailboxes/{mailbox_id}\",\n ...options,\n });\n\n/**\n * Get a mailbox\n *\n * Returns a single mailbox by ID. A mailbox deleted within its 30-day restore window is still returned, with a non-null `deleted_at`; once the window closes it is permanently removed and returns 404.\n *\n */\nexport const getMailbox = <ThrowOnError extends boolean = false>(\n options: Options<GetMailboxData, ThrowOnError>,\n) =>\n (options.client ?? client).get<\n GetMailboxResponses,\n GetMailboxErrors,\n ThrowOnError\n >({\n security: [\n { scheme: \"bearer\", type: \"http\" },\n {\n in: \"cookie\",\n name: \"bird_session\",\n type: \"apiKey\",\n },\n ],\n url: \"/v1/email/mailboxes/{mailbox_id}\",\n ...options,\n });\n\n/**\n * Update a mailbox\n *\n * Updates a mailbox. The address and domain are immutable. Lowering the retention tier deletes remembered messages older than the new horizon — pass `confirm=true` to acknowledge.\n *\n */\nexport const updateMailbox = <ThrowOnError extends boolean = false>(\n options: Options<UpdateMailboxData, ThrowOnError>,\n) =>\n (options.client ?? client).patch<\n UpdateMailboxResponses,\n UpdateMailboxErrors,\n ThrowOnError\n >({\n security: [\n { scheme: \"bearer\", type: \"http\" },\n {\n in: \"cookie\",\n name: \"bird_session\",\n type: \"apiKey\",\n },\n ],\n url: \"/v1/email/mailboxes/{mailbox_id}\",\n ...options,\n headers: {\n \"Content-Type\": \"application/json\",\n ...options.headers,\n },\n });\n\n/**\n * Restore a deleted mailbox\n *\n * Restores a mailbox deleted less than 30 days ago. The address is bound back to the mailbox and starts receiving again, and the remembered messages and conversations are available as before the delete. Once the 30-day window has passed the mailbox and its messages are permanently deleted and can no longer be restored (404). Restoring a mailbox that is not deleted returns a conflict, as does an address that is no longer available.\n *\n */\nexport const restoreMailbox = <ThrowOnError extends boolean = false>(\n options: Options<RestoreMailboxData, ThrowOnError>,\n) =>\n (options.client ?? client).post<\n RestoreMailboxResponses,\n RestoreMailboxErrors,\n ThrowOnError\n >({\n security: [\n { scheme: \"bearer\", type: \"http\" },\n {\n in: \"cookie\",\n name: \"bird_session\",\n type: \"apiKey\",\n },\n ],\n url: \"/v1/email/mailboxes/{mailbox_id}/restore\",\n ...options,\n });\n\n/**\n * Mailbox email statistics\n *\n * Returns the mailbox's sent and received email statistics over a time window: a period-wide summary plus a bucketed series. Sent-mail metrics carry the same delivery, engagement, and latency breakdowns as the email stats endpoints; `received` counts mail that arrived at the mailbox.\n * Rows are bucketed by event time, not send time — engagement received during the period for messages sent earlier is included. Statistics start when the mailbox starts sending and receiving; the mailbox's all-time `message_count` and `thread_count` live on the mailbox resource itself.\n * `from` and `to` accept either calendar days (YYYY-MM-DD, `day` granularity only) or RFC 3339 instants (`hour` granularity only). Both bounds must use the same form. Window caps depend on `granularity`: 365 days at `day`, 30 days at `hour`. Set `timezone` to report in a local zone instead of UTC.\n *\n */\nexport const getMailboxStats = <ThrowOnError extends boolean = false>(\n options: Options<GetMailboxStatsData, ThrowOnError>,\n) =>\n (options.client ?? client).get<\n GetMailboxStatsResponses,\n GetMailboxStatsErrors,\n ThrowOnError\n >({\n security: [\n { scheme: \"bearer\", type: \"http\" },\n {\n in: \"cookie\",\n name: \"bird_session\",\n type: \"apiKey\",\n },\n ],\n url: \"/v1/email/mailboxes/{mailbox_id}/stats\",\n ...options,\n });\n\n/**\n * Resume a suspended mailbox\n *\n * Reactivates a mailbox that was suspended because the organization dropped below the plan needed to keep it active. The mailbox can send and receive again and its threads and messages become visible. Activation is refused when the organization has no room for another active mailbox, or for another custom inbox.ai handle, on its current plan — free up a slot by deleting an active mailbox, or upgrade the plan. Activating a mailbox that is not suspended returns a conflict.\n *\n */\nexport const resumeMailbox = <ThrowOnError extends boolean = false>(\n options: Options<ResumeMailboxData, ThrowOnError>,\n) =>\n (options.client ?? client).post<\n ResumeMailboxResponses,\n ResumeMailboxErrors,\n ThrowOnError\n >({\n security: [\n { scheme: \"bearer\", type: \"http\" },\n {\n in: \"cookie\",\n name: \"bird_session\",\n type: \"apiKey\",\n },\n ],\n url: \"/v1/email/mailboxes/{mailbox_id}/resume\",\n ...options,\n });\n\n/**\n * List receive rules\n *\n * Returns a paginated list of the mailbox's receive rules, oldest first. Filter by action to see only allow or only block entries.\n *\n */\nexport const listMailboxReceiveRules = <ThrowOnError extends boolean = false>(\n options: Options<ListMailboxReceiveRulesData, ThrowOnError>,\n) =>\n (options.client ?? client).get<\n ListMailboxReceiveRulesResponses,\n ListMailboxReceiveRulesErrors,\n ThrowOnError\n >({\n security: [\n { scheme: \"bearer\", type: \"http\" },\n {\n in: \"cookie\",\n name: \"bird_session\",\n type: \"apiKey\",\n },\n ],\n url: \"/v1/email/mailboxes/{mailbox_id}/receive-rules\",\n ...options,\n });\n\n/**\n * Add a receive rule\n *\n * Adds an allow or block rule to the mailbox. Rules match the message's envelope sender; domain entries also match subdomains. Block rules always win — over allow rules and over the reply admission on allowlist mailboxes. An entry is either allow or block. Rules have no update operation, so a rule that needs the other action is a new rule and the old one is removed. A mailbox holds up to 200 rules.\n *\n */\nexport const createMailboxReceiveRule = <ThrowOnError extends boolean = false>(\n options: Options<CreateMailboxReceiveRuleData, ThrowOnError>,\n) =>\n (options.client ?? client).post<\n CreateMailboxReceiveRuleResponses,\n CreateMailboxReceiveRuleErrors,\n ThrowOnError\n >({\n security: [\n { scheme: \"bearer\", type: \"http\" },\n {\n in: \"cookie\",\n name: \"bird_session\",\n type: \"apiKey\",\n },\n ],\n url: \"/v1/email/mailboxes/{mailbox_id}/receive-rules\",\n ...options,\n headers: {\n \"Content-Type\": \"application/json\",\n ...options.headers,\n },\n });\n\n/**\n * Delete a receive rule\n *\n * Removes a receive rule from the mailbox. There is no update operation for rules, so a rule's allow or block action cannot be changed after it is created.\n *\n */\nexport const deleteMailboxReceiveRule = <ThrowOnError extends boolean = false>(\n options: Options<DeleteMailboxReceiveRuleData, ThrowOnError>,\n) =>\n (options.client ?? client).delete<\n DeleteMailboxReceiveRuleResponses,\n DeleteMailboxReceiveRuleErrors,\n ThrowOnError\n >({\n security: [\n { scheme: \"bearer\", type: \"http\" },\n {\n in: \"cookie\",\n name: \"bird_session\",\n type: \"apiKey\",\n },\n ],\n url: \"/v1/email/mailboxes/{mailbox_id}/receive-rules/{rule_id}\",\n ...options,\n });\n\n/**\n * List threads\n *\n * Returns a paginated list of conversations across the workspace's mailboxes, most recently active first. `label` selects the view: the inbox (the default when omitted), `archive`, `spam`, `blocked`, or any custom label. Filter by mailbox, linked contact, or last-activity time, or pass `q` to full-text search conversations by their messages' subject and text. Conversations whose every message has been trashed are omitted; restoring a message returns its conversation to the list. `before` and `after` filter by time; to page through results pass the response cursors back as `starting_after` or `ending_before`.\n *\n */\nexport const listEmailThreads = <ThrowOnError extends boolean = false>(\n options?: Options<ListEmailThreadsData, ThrowOnError>,\n) =>\n (options?.client ?? client).get<\n ListEmailThreadsResponses,\n ListEmailThreadsErrors,\n ThrowOnError\n >({\n security: [\n { scheme: \"bearer\", type: \"http\" },\n {\n in: \"cookie\",\n name: \"bird_session\",\n type: \"apiKey\",\n },\n ],\n url: \"/v1/email/threads\",\n ...options,\n });\n\n/**\n * Delete a thread\n *\n * Moves the conversation and all of its messages to the trash. Trashed messages are permanently deleted after 30 days. Pass `permanent=true` to permanently delete the conversation and its messages immediately.\n *\n */\nexport const deleteEmailThread = <ThrowOnError extends boolean = false>(\n options: Options<DeleteEmailThreadData, ThrowOnError>,\n) =>\n (options.client ?? client).delete<\n DeleteEmailThreadResponses,\n DeleteEmailThreadErrors,\n ThrowOnError\n >({\n security: [\n { scheme: \"bearer\", type: \"http\" },\n {\n in: \"cookie\",\n name: \"bird_session\",\n type: \"apiKey\",\n },\n ],\n url: \"/v1/email/threads/{thread_id}\",\n ...options,\n });\n\n/**\n * Get a thread\n *\n * Returns a single conversation. Fetch the messages in the conversation with `GET /v1/email/threads/{thread_id}/messages`. A thread whose retention period has ended returns `410 Gone`.\n *\n */\nexport const getEmailThread = <ThrowOnError extends boolean = false>(\n options: Options<GetEmailThreadData, ThrowOnError>,\n) =>\n (options.client ?? client).get<\n GetEmailThreadResponses,\n GetEmailThreadErrors,\n ThrowOnError\n >({\n security: [\n { scheme: \"bearer\", type: \"http\" },\n {\n in: \"cookie\",\n name: \"bird_session\",\n type: \"apiKey\",\n },\n ],\n url: \"/v1/email/threads/{thread_id}\",\n ...options,\n });\n\n/**\n * Update a thread\n *\n * Applies label changes to a conversation and links or unlinks a contact. System labels move the conversation: adding `spam` files it (and its received messages) as spam, adding `archive` files it away without deleting it, and adding `inbox` — or removing `spam`, `blocked`, or `archive` — returns it to the inbox; unread counts recompute to match. An archived conversation returns to the inbox by itself when a new message arrives. To block a sender going forward, add a receive rule instead. Omitted fields are left unchanged.\n *\n */\nexport const updateEmailThread = <ThrowOnError extends boolean = false>(\n options: Options<UpdateEmailThreadData, ThrowOnError>,\n) =>\n (options.client ?? client).patch<\n UpdateEmailThreadResponses,\n UpdateEmailThreadErrors,\n ThrowOnError\n >({\n security: [\n { scheme: \"bearer\", type: \"http\" },\n {\n in: \"cookie\",\n name: \"bird_session\",\n type: \"apiKey\",\n },\n ],\n url: \"/v1/email/threads/{thread_id}\",\n ...options,\n headers: {\n \"Content-Type\": \"application/json\",\n ...options.headers,\n },\n });\n\n/**\n * List messages in a thread\n *\n * Returns the messages in a conversation newest first, both received and sent; page older messages with `starting_after` (fixed sort — render conversation order by reversing the page). By default every message that is not in the trash is returned, whichever folder the conversation is in; pass `label` to narrow the view instead — `trash` for trashed messages, or any custom label. Pass `include=extracted_text` to inline each message's extracted plain text. A thread whose retention period has ended returns `410 Gone`.\n *\n */\nexport const listEmailThreadMessages = <ThrowOnError extends boolean = false>(\n options: Options<ListEmailThreadMessagesData, ThrowOnError>,\n) =>\n (options.client ?? client).get<\n ListEmailThreadMessagesResponses,\n ListEmailThreadMessagesErrors,\n ThrowOnError\n >({\n security: [\n { scheme: \"bearer\", type: \"http\" },\n {\n in: \"cookie\",\n name: \"bird_session\",\n type: \"apiKey\",\n },\n ],\n url: \"/v1/email/threads/{thread_id}/messages\",\n ...options,\n });\n\n/**\n * Get a message in a thread\n *\n * Returns a single message in a conversation, including its extracted plain text. Metadata and extracted text remain readable for the mailbox's retention period; a message that has passed it returns `410 Gone`. A message that exists but does not belong to this thread returns `404`.\n *\n */\nexport const getEmailThreadMessage = <ThrowOnError extends boolean = false>(\n options: Options<GetEmailThreadMessageData, ThrowOnError>,\n) =>\n (options.client ?? client).get<\n GetEmailThreadMessageResponses,\n GetEmailThreadMessageErrors,\n ThrowOnError\n >({\n security: [\n { scheme: \"bearer\", type: \"http\" },\n {\n in: \"cookie\",\n name: \"bird_session\",\n type: \"apiKey\",\n },\n ],\n url: \"/v1/email/threads/{thread_id}/messages/{message_id}\",\n ...options,\n });\n\n/**\n * Get a thread message's original body\n *\n * Returns the original rendered HTML and plain-text body of a message in a conversation. The original body is available for 30 days after the message occurred; after that this endpoint returns `410 Gone` while the message's extracted text remains readable on the message itself.\n *\n */\nexport const getEmailThreadMessageBody = <ThrowOnError extends boolean = false>(\n options: Options<GetEmailThreadMessageBodyData, ThrowOnError>,\n) =>\n (options.client ?? client).get<\n GetEmailThreadMessageBodyResponses,\n GetEmailThreadMessageBodyErrors,\n ThrowOnError\n >({\n security: [\n { scheme: \"bearer\", type: \"http\" },\n {\n in: \"cookie\",\n name: \"bird_session\",\n type: \"apiKey\",\n },\n ],\n url: \"/v1/email/threads/{thread_id}/messages/{message_id}/body\",\n ...options,\n });\n\n/**\n * List a thread message's attachments\n *\n * Returns the attachments on a message in a conversation. Attachment bytes are downloadable for 30 days after the message occurred; after that this endpoint returns `410 Gone` while the attachment metadata remains readable on the message's `attachment_manifest`.\n *\n */\nexport const listEmailThreadMessageAttachments = <\n ThrowOnError extends boolean = false,\n>(\n options: Options<ListEmailThreadMessageAttachmentsData, ThrowOnError>,\n) =>\n (options.client ?? client).get<\n ListEmailThreadMessageAttachmentsResponses,\n ListEmailThreadMessageAttachmentsErrors,\n ThrowOnError\n >({\n security: [\n { scheme: \"bearer\", type: \"http\" },\n {\n in: \"cookie\",\n name: \"bird_session\",\n type: \"apiKey\",\n },\n ],\n url: \"/v1/email/threads/{thread_id}/messages/{message_id}/attachments\",\n ...options,\n });\n\n/**\n * Reply to a thread message\n *\n * Sends a reply to a specific message in a conversation, from the mailbox's own address. Recipients are derived from the message being replied to — its Reply-To address when present, otherwise its From address; set `reply_all` to also include the original To and Cc recipients. The subject and the threading headers that keep the reply in this conversation are set automatically, and the reply is recorded in the conversation. To reply to a conversation as a whole, target its newest received message.\n *\n */\nexport const replyEmailThreadMessage = <ThrowOnError extends boolean = false>(\n options: Options<ReplyEmailThreadMessageData, ThrowOnError>,\n) =>\n (options.client ?? client).post<\n ReplyEmailThreadMessageResponses,\n ReplyEmailThreadMessageErrors,\n ThrowOnError\n >({\n security: [\n { scheme: \"bearer\", type: \"http\" },\n {\n in: \"cookie\",\n name: \"bird_session\",\n type: \"apiKey\",\n },\n ],\n url: \"/v1/email/threads/{thread_id}/messages/{message_id}/reply\",\n ...options,\n headers: {\n \"Content-Type\": \"application/json\",\n ...options.headers,\n },\n });\n\n/**\n * Send a message from a mailbox\n *\n * Sends a new message from the mailbox's own address and starts a new conversation with it. The request mirrors the plain send request minus `from` — the mailbox is the sender identity — and Bird mints the RFC 5322 Message-ID, so later replies from the recipients thread back into the conversation automatically. The send is recorded in the mailbox's durable memory and returned as the conversation's first message. Scheduled sends are not accepted on the mailbox surface. A suspended mailbox cannot send and returns `403`.\n *\n */\nexport const createMailboxMessage = <ThrowOnError extends boolean = false>(\n options: Options<CreateMailboxMessageData, ThrowOnError>,\n) =>\n (options.client ?? client).post<\n CreateMailboxMessageResponses,\n CreateMailboxMessageErrors,\n ThrowOnError\n >({\n security: [\n { scheme: \"bearer\", type: \"http\" },\n {\n in: \"cookie\",\n name: \"bird_session\",\n type: \"apiKey\",\n },\n ],\n url: \"/v1/email/mailboxes/{mailbox_id}/messages\",\n ...options,\n headers: {\n \"Content-Type\": \"application/json\",\n ...options.headers,\n },\n });\n\n/**\n * List a mailbox's labels\n *\n * Returns the labels available in a mailbox: the built-in system labels — the placements `inbox`, `archive`, `spam`, `blocked`, and `sent`, plus `trash` and `unread` — followed by every custom label currently in use on its conversations and messages. Apply and remove labels through the conversation and message update endpoints; custom labels exist by being applied, so this list is discovery, not management.\n *\n */\nexport const listMailboxLabels = <ThrowOnError extends boolean = false>(\n options: Options<ListMailboxLabelsData, ThrowOnError>,\n) =>\n (options.client ?? client).get<\n ListMailboxLabelsResponses,\n ListMailboxLabelsErrors,\n ThrowOnError\n >({\n security: [\n { scheme: \"bearer\", type: \"http\" },\n {\n in: \"cookie\",\n name: \"bird_session\",\n type: \"apiKey\",\n },\n ],\n url: \"/v1/email/mailboxes/{mailbox_id}/labels\",\n ...options,\n });\n\n/**\n * List calls\n *\n * Returns a paginated list of the workspace's calls, ordered by start time descending.\n *\n * The `status` filter selects where in the lifecycle you look, and any combination is a single page: in-flight statuses (`ringing`, `in_progress`), final ones, or both together. Omit it and you get completed calls, which is what this list has always returned.\n *\n * A call in flight carries no economics yet: `duration_ms`, `billable_ms`, `ended_at`, and `cost` are null until it ends. It keeps the same `id` throughout, so the same call answers under one identity from the first ring to settlement.\n *\n */\nexport const listVoiceCalls = <ThrowOnError extends boolean = false>(\n options?: Options<ListVoiceCallsData, ThrowOnError>,\n) =>\n (options?.client ?? client).get<\n ListVoiceCallsResponses,\n ListVoiceCallsErrors,\n ThrowOnError\n >({\n querySerializer: { parameters: { status: { array: { explode: false } } } },\n security: [\n { scheme: \"bearer\", type: \"http\" },\n {\n in: \"cookie\",\n name: \"bird_session\",\n type: \"apiKey\",\n },\n ],\n url: \"/v1/voice/calls\",\n ...options,\n });\n\n/**\n * Get a call\n *\n * Returns a single call at any point in its lifecycle. A call that is still ringing or connected answers with its in-flight `status` and no economics: `duration_ms`, `billable_ms`, `ended_at`, and `cost` fill in once it ends, at this same URL. Returns a 404 `not_found_error` if the call does not exist in the workspace.\n *\n */\nexport const getVoiceCall = <ThrowOnError extends boolean = false>(\n options: Options<GetVoiceCallData, ThrowOnError>,\n) =>\n (options.client ?? client).get<\n GetVoiceCallResponses,\n GetVoiceCallErrors,\n ThrowOnError\n >({\n security: [\n { scheme: \"bearer\", type: \"http\" },\n {\n in: \"cookie\",\n name: \"bird_session\",\n type: \"apiKey\",\n },\n ],\n url: \"/v1/voice/calls/{call_id}\",\n ...options,\n });\n","// Base for resource wrappers. Each public method builds a typed hey-api SDK\n// call and runs it through the lifecycle core, returning an APIPromise (single)\n// or PaginatedPromise (list). Resources stay thin over `call`/`paginated` so the\n// per-operation logic could later be extracted to standalone tree-shakeable\n// functions without a rewrite.\n\nimport type { Client } from \"../generated/client/index.js\";\nimport type { AttemptContext, BirdHTTPClient, FetchOutcome, RequestLifecycleOptions } from \"../core/http.js\";\nimport {\n apiPromise,\n paginate,\n type APIPromise,\n type CursorPage,\n type PaginatedPromise,\n type RequestOptions,\n} from \"../core/result.js\";\n\n/** Resolved per-attempt inputs handed to the hey-api SDK call. */\nexport interface CallContext {\n signal: AbortSignal;\n /** Merged headers: caller `headers` plus the resolved `Idempotency-Key`. */\n headers: Record<string, string>;\n}\n\nexport abstract class Resource {\n constructor(\n protected readonly core: BirdHTTPClient,\n protected readonly client: Client,\n ) {}\n\n /** Run a single typed call through the lifecycle. */\n protected call<T>(\n method: string,\n options: RequestOptions | undefined,\n invoke: (ctx: CallContext) => Promise<FetchOutcome<T>>,\n schemes?: string[],\n ): APIPromise<T> {\n // Resolved eagerly so a missing credential throws before the lifecycle starts,\n // never as a rejected promise with a request already in flight.\n const credentials = this.core.credentialHeaders(schemes, options?.credentials);\n return apiPromise(\n this.core.request<T>(\n (ctx) => invoke(callContext(ctx, options, credentials)),\n lifecycle(method, options),\n ),\n );\n }\n\n /** Run a cursor-paginated list through the lifecycle (each page retried independently). */\n protected paginated<T>(\n method: string,\n options: RequestOptions | undefined,\n invoke: (ctx: CallContext, cursor: string | undefined) => Promise<FetchOutcome<CursorPage<T>>>,\n schemes?: string[],\n ): PaginatedPromise<T> {\n const credentials = this.core.credentialHeaders(schemes, options?.credentials);\n return paginate<T>((cursor) =>\n this.core.request<CursorPage<T>>(\n (ctx) => invoke(callContext(ctx, options, credentials), cursor),\n lifecycle(method, options),\n ),\n );\n }\n}\n\nfunction callContext(\n ctx: AttemptContext,\n options: RequestOptions | undefined,\n credentials: Record<string, string> = {},\n): CallContext {\n return {\n signal: ctx.signal,\n headers: { ...mergeHeaders(ctx.idempotencyKey, options?.headers), ...credentials },\n };\n}\n\nfunction lifecycle(method: string, options: RequestOptions | undefined): RequestLifecycleOptions {\n return {\n method,\n idempotencyKey: options?.idempotencyKey,\n signal: options?.signal,\n timeout: options?.timeout,\n maxRetries: options?.maxRetries,\n };\n}\n\nfunction mergeHeaders(\n idempotencyKey: string | undefined,\n extra: Record<string, string> | undefined,\n): Record<string, string> {\n return {\n ...extra,\n ...(idempotencyKey ? { \"Idempotency-Key\": idempotencyKey } : {}),\n };\n}\n","// Code generated by surface-gen; DO NOT EDIT.\nimport { cancelEmailMessage, getEmailMessage, listEmailMessages } from \"../generated/sdk.gen.js\";\nimport type { CancelEmailMessageData, EmailMessage, GetEmailMessageData, ListEmailMessagesData } from \"../generated/types.gen.js\";\nimport { Resource } from \"./base.js\";\nimport type { APIPromise, PaginatedPromise, RequestOptions } from \"../core/result.js\";\n\nexport type { EmailMessage };\nexport type EmailListQuery = NonNullable<ListEmailMessagesData[\"query\"]>;\n\nexport class EmailResourceBase extends Resource {\n /**\n * Fetch one email message by id, with aggregate delivery status and per-state recipient counts. The message body (html, text) is not returned. Per-recipient delivery statuses and the event log are separate sub-resources: GET /v1/email/messages/{message_id}/recipients and GET /v1/email/messages/{message_id}/events.\n *\n * @example \n * const msg = await bird.email.get(\"em_abc123\");\n * msg.status; // \"accepted\" | \"processed\" | \"delivered\" | \"bounced\" | …\n * msg.delivered_count;\n * msg.bounced_count;\n */\n get(messageId: string, options?: RequestOptions): APIPromise<EmailMessage> {\n return this.call<EmailMessage>(\"GET\", options, ({ signal, headers }) =>\n getEmailMessage({ client: this.client, path: { message_id: messageId }, headers, signal }));\n }\n\n /**\n * List sent email messages, newest first, as a cursor page ({data, next_cursor, …}). Pass next_cursor back as starting_after to fetch the next page. Filter by creation time with the half-open range created_after (inclusive) / created_before (exclusive). For a single UTC day, created_after is that day at 00:00:00Z and created_before is the next day at 00:00:00Z.\n *\n * @example \n * for await (const message of bird.email.list({ status: \"bounced\" })) {\n * console.log(message.id);\n * }\n */\n list(query?: EmailListQuery, options?: RequestOptions): PaginatedPromise<EmailMessage> {\n return this.paginated<EmailMessage>(\"GET\", options, ({ signal, headers }, cursor) =>\n listEmailMessages({ client: this.client, query: { ...query, starting_after: cursor ?? query?.starting_after }, headers, signal }));\n }\n\n /**\n * Cancel a scheduled email before it sends. Only works while the message is still scheduled (status `scheduled`); once it starts sending, or was already canceled, the call returns a conflict error. Canceling does not return consumed scheduled-send quota.\n *\n * @example \n * await bird.email.cancel(\"em_abc123\");\n */\n cancel(messageId: string, options?: RequestOptions): APIPromise<void> {\n return this.call<void>(\"POST\", options, ({ signal, headers }) =>\n cancelEmailMessage({ client: this.client, path: { message_id: messageId }, headers, signal }));\n }\n}\n","// Code generated by surface-gen; DO NOT EDIT.\nimport { getEmailStatsByBounceCode, getEmailStatsByBroadcast, getEmailStatsByCategory, getEmailStatsByClient, getEmailStatsByComplaintType, getEmailStatsByLocation, getEmailStatsByMailboxProvider, getEmailStatsByMailboxProviderRegion, getEmailStatsByRecipientDomain, getEmailStatsBySendingDomain, getEmailStatsBySendingIp, getEmailStatsByTag, getEmailStatsByTemplate, getEmailStatsDaily, getEmailStatsHourly, getEmailStatsSummary } from \"../generated/sdk.gen.js\";\nimport type { EmailStatsByBounceCodeResponse, EmailStatsByBroadcastResponse, EmailStatsByCategoryResponse, EmailStatsByClientResponse, EmailStatsByComplaintTypeResponse, EmailStatsByLocationResponse, EmailStatsByMailboxProviderRegionResponse, EmailStatsByMailboxProviderResponse, EmailStatsByRecipientDomainResponse, EmailStatsBySendingDomainResponse, EmailStatsBySendingIpResponse, EmailStatsByTemplateResponse, EmailStatsResponse, EmailStatsSummary, EmailStatsTagsResponse, GetEmailStatsByBounceCodeData, GetEmailStatsByBroadcastData, GetEmailStatsByCategoryData, GetEmailStatsByClientData, GetEmailStatsByComplaintTypeData, GetEmailStatsByLocationData, GetEmailStatsByMailboxProviderData, GetEmailStatsByMailboxProviderRegionData, GetEmailStatsByRecipientDomainData, GetEmailStatsBySendingDomainData, GetEmailStatsBySendingIpData, GetEmailStatsByTagData, GetEmailStatsByTemplateData, GetEmailStatsDailyData, GetEmailStatsHourlyData, GetEmailStatsSummaryData } from \"../generated/types.gen.js\";\nimport { Resource } from \"./base.js\";\nimport type { APIPromise, RequestOptions } from \"../core/result.js\";\n\nexport type { EmailStatsSummary };\nexport type { EmailStatsResponse };\nexport type { EmailStatsTagsResponse };\nexport type { EmailStatsByCategoryResponse };\nexport type { EmailStatsBySendingIpResponse };\nexport type { EmailStatsBySendingDomainResponse };\nexport type { EmailStatsByRecipientDomainResponse };\nexport type { EmailStatsByMailboxProviderResponse };\nexport type { EmailStatsByMailboxProviderRegionResponse };\nexport type { EmailStatsByTemplateResponse };\nexport type { EmailStatsByLocationResponse };\nexport type { EmailStatsByClientResponse };\nexport type { EmailStatsByBounceCodeResponse };\nexport type { EmailStatsByComplaintTypeResponse };\nexport type { EmailStatsByBroadcastResponse };\nexport type EmailStatsSummaryQuery = NonNullable<GetEmailStatsSummaryData[\"query\"]>;\nexport type EmailStatsDailyQuery = NonNullable<GetEmailStatsDailyData[\"query\"]>;\nexport type EmailStatsHourlyQuery = NonNullable<GetEmailStatsHourlyData[\"query\"]>;\nexport type EmailStatsByTagQuery = NonNullable<GetEmailStatsByTagData[\"query\"]>;\nexport type EmailStatsByCategoryQuery = NonNullable<GetEmailStatsByCategoryData[\"query\"]>;\nexport type EmailStatsBySendingIpQuery = NonNullable<GetEmailStatsBySendingIpData[\"query\"]>;\nexport type EmailStatsBySendingDomainQuery = NonNullable<GetEmailStatsBySendingDomainData[\"query\"]>;\nexport type EmailStatsByRecipientDomainQuery = NonNullable<GetEmailStatsByRecipientDomainData[\"query\"]>;\nexport type EmailStatsByMailboxProviderQuery = NonNullable<GetEmailStatsByMailboxProviderData[\"query\"]>;\nexport type EmailStatsByMailboxProviderRegionQuery = NonNullable<GetEmailStatsByMailboxProviderRegionData[\"query\"]>;\nexport type EmailStatsByTemplateQuery = NonNullable<GetEmailStatsByTemplateData[\"query\"]>;\nexport type EmailStatsByLocationQuery = NonNullable<GetEmailStatsByLocationData[\"query\"]>;\nexport type EmailStatsByClientQuery = NonNullable<GetEmailStatsByClientData[\"query\"]>;\nexport type EmailStatsByBounceCodeQuery = NonNullable<GetEmailStatsByBounceCodeData[\"query\"]>;\nexport type EmailStatsByComplaintTypeQuery = NonNullable<GetEmailStatsByComplaintTypeData[\"query\"]>;\nexport type EmailStatsByBroadcastQuery = NonNullable<GetEmailStatsByBroadcastData[\"query\"]>;\n\nexport class EmailStatsResource extends Resource {\n /**\n * Aggregate email KPIs for one period: sends, delivered, bounces, complaints, opens, clicks, their rates, and latency percentiles. `from`/`to` are both YYYY-MM-DD days or both RFC 3339 instants (hour grain); add `compare=previous_period` for deltas versus the prior window. For a per-day or per-hour series use email_stats_daily or email_stats_hourly.\n *\n * @example Summary for a month\n * const s = await bird.email.stats.summary({ from: \"2026-05-01\", to: \"2026-05-31\" });\n * console.log(s.sends_accepted, s.delivery.delivered);\n */\n summary(query?: EmailStatsSummaryQuery, options?: RequestOptions): APIPromise<EmailStatsSummary> {\n return this.call<EmailStatsSummary>(\"GET\", options, ({ signal, headers }) =>\n getEmailStatsSummary({ client: this.client, query, headers, signal }));\n }\n\n /**\n * Per-day email stats series (counts, rates, latency percentiles), gap-filled with zero rows, max 365 days. At most one filter of `category`, `sending_domain`, `tag`, `sending_ip`, `recipient_domain`, `template`. For hour resolution use email_stats_hourly; for one aggregate row use email_stats_summary.\n *\n * @example \n * const series = await bird.email.stats.daily({ from: \"2026-05-01\", to: \"2026-05-31\" });\n * for (const row of series.data) console.log(row.bucket, row.delivery.delivered);\n */\n daily(query?: EmailStatsDailyQuery, options?: RequestOptions): APIPromise<EmailStatsResponse> {\n return this.call<EmailStatsResponse>(\"GET\", options, ({ signal, headers }) =>\n getEmailStatsDaily({ client: this.client, query, headers, signal }));\n }\n\n /**\n * Per-hour email stats series, gap-filled with zero rows, max 720 hours (30 days). Takes the same single-dimension filters as email_stats_daily; for longer ranges use email_stats_daily, for one aggregate row use email_stats_summary.\n *\n * @example \n * const series = await bird.email.stats.hourly({ from: \"2026-05-01\", to: \"2026-05-02\" });\n * for (const row of series.data) console.log(row.bucket, row.delivery.delivered);\n */\n hourly(query?: EmailStatsHourlyQuery, options?: RequestOptions): APIPromise<EmailStatsResponse> {\n return this.call<EmailStatsResponse>(\"GET\", options, ({ signal, headers }) =>\n getEmailStatsHourly({ client: this.client, query, headers, signal }));\n }\n\n /**\n * Email delivery and engagement stats grouped by tag, one row per `name:value` pair set at send time; ranked by `sort` (default `processed`). `include_trend=true` adds a per-bucket rate series to each row.\n *\n * @example Top 10 tags by delivered\n * const { data } = await bird.email.stats.byTag({\n * from: \"2026-05-01\",\n * to: \"2026-05-31\",\n * sort: \"delivered\",\n * limit: 10,\n * });\n * for (const row of data) console.log(row.tag, row.delivery.delivered);\n */\n byTag(query?: EmailStatsByTagQuery, options?: RequestOptions): APIPromise<EmailStatsTagsResponse> {\n return this.call<EmailStatsTagsResponse>(\"GET\", options, ({ signal, headers }) =>\n getEmailStatsByTag({ client: this.client, query, headers, signal }));\n }\n\n /**\n * Email delivery and engagement stats grouped by category (`transactional` versus `marketing`), ranked by `sort` (default `processed`). `include_trend=true` adds a per-bucket rate series to each row.\n *\n * @example \n * const { data } = await bird.email.stats.byCategory({ from: \"2026-05-01\", to: \"2026-05-31\" });\n * for (const row of data) console.log(row.category, row.delivery.delivered);\n */\n byCategory(query?: EmailStatsByCategoryQuery, options?: RequestOptions): APIPromise<EmailStatsByCategoryResponse> {\n return this.call<EmailStatsByCategoryResponse>(\"GET\", options, ({ signal, headers }) =>\n getEmailStatsByCategory({ client: this.client, query, headers, signal }));\n }\n\n /**\n * Delivery and bounce stats grouped by sending IP; `sort=bounces.block` surfaces reputation-damaged IPs first. No engagement, complaint, or accepted/processed counts per IP; use email_stats_daily for workspace-wide figures.\n *\n * @example \n * const { data } = await bird.email.stats.bySendingIp({\n * from: \"2026-05-01\",\n * to: \"2026-05-31\",\n * sort: \"bounces.block\",\n * limit: 20,\n * });\n * for (const row of data) console.log(row.sending_ip, row.delivery.delivered);\n */\n bySendingIp(query?: EmailStatsBySendingIpQuery, options?: RequestOptions): APIPromise<EmailStatsBySendingIpResponse> {\n return this.call<EmailStatsBySendingIpResponse>(\"GET\", options, ({ signal, headers }) =>\n getEmailStatsBySendingIp({ client: this.client, query, headers, signal }));\n }\n\n /**\n * Email delivery and engagement stats grouped by sending (`From`) domain; compare deliverability across the workspace's verified domains. For per-IP reputation use email_stats_by_sending_ip.\n *\n * @example \n * const { data } = await bird.email.stats.bySendingDomain({\n * from: \"2026-05-01\",\n * to: \"2026-05-31\",\n * sort: \"delivery_rate\",\n * limit: 25,\n * });\n * for (const row of data) console.log(row.sending_domain, row.delivery.delivery_rate);\n */\n bySendingDomain(query?: EmailStatsBySendingDomainQuery, options?: RequestOptions): APIPromise<EmailStatsBySendingDomainResponse> {\n return this.call<EmailStatsBySendingDomainResponse>(\"GET\", options, ({ signal, headers }) =>\n getEmailStatsBySendingDomain({ client: this.client, query, headers, signal }));\n }\n\n /**\n * Email delivery and engagement stats grouped by exact recipient mailbox domain (for example `gmail.com`). Finer-grained than email_stats_by_mailbox_provider, which buckets domains into providers.\n *\n * @example \n * const { data } = await bird.email.stats.byRecipientDomain({\n * from: \"2026-05-01\",\n * to: \"2026-05-31\",\n * sort: \"bounce_rate\",\n * limit: 25,\n * });\n * for (const row of data) console.log(row.recipient_domain, row.delivery.bounce_rate);\n */\n byRecipientDomain(query?: EmailStatsByRecipientDomainQuery, options?: RequestOptions): APIPromise<EmailStatsByRecipientDomainResponse> {\n return this.call<EmailStatsByRecipientDomainResponse>(\"GET\", options, ({ signal, headers }) =>\n getEmailStatsByRecipientDomain({ client: this.client, query, headers, signal }));\n }\n\n /**\n * Email delivery and engagement stats grouped by recipient mailbox provider (`gmail`, `microsoft`, `yahoo`, ...); covers the delivery stage onward, no accepted/processed counts. For a per-region split use email_stats_by_mailbox_provider_region; for exact destination domains use email_stats_by_recipient_domain.\n *\n * @example \n * const { data } = await bird.email.stats.byMailboxProvider({\n * from: \"2026-05-01\",\n * to: \"2026-05-31\",\n * limit: 25,\n * });\n * for (const row of data) console.log(row.mailbox_provider, row.delivery.delivered);\n */\n byMailboxProvider(query?: EmailStatsByMailboxProviderQuery, options?: RequestOptions): APIPromise<EmailStatsByMailboxProviderResponse> {\n return this.call<EmailStatsByMailboxProviderResponse>(\"GET\", options, ({ signal, headers }) =>\n getEmailStatsByMailboxProvider({ client: this.client, query, headers, signal }));\n }\n\n /**\n * Email delivery and engagement stats grouped by mailbox provider and provider region pair (for example `gmail` in `NA`); covers the delivery stage onward, no accepted/processed counts. For the provider-level view use email_stats_by_mailbox_provider.\n *\n * @example \n * const { data } = await bird.email.stats.byMailboxProviderRegion({\n * from: \"2026-05-01\",\n * to: \"2026-05-31\",\n * limit: 25,\n * });\n * for (const row of data) console.log(row.mailbox_provider, row.mailbox_provider_region, row.delivery.delivered);\n */\n byMailboxProviderRegion(query?: EmailStatsByMailboxProviderRegionQuery, options?: RequestOptions): APIPromise<EmailStatsByMailboxProviderRegionResponse> {\n return this.call<EmailStatsByMailboxProviderRegionResponse>(\"GET\", options, ({ signal, headers }) =>\n getEmailStatsByMailboxProviderRegion({ client: this.client, query, headers, signal }));\n }\n\n /**\n * Email delivery and engagement stats grouped by the template used at send time, keyed by template id (`emt_…`); only templated sends appear. A single template's trend over time comes from email_stats_daily with its `template` filter.\n *\n * @example \n * const { data } = await bird.email.stats.byTemplate({\n * from: \"2026-05-01\",\n * to: \"2026-05-31\",\n * sort: \"open_rate\",\n * limit: 25,\n * });\n * for (const row of data) console.log(row.template_id, row.engagement.open_rate);\n */\n byTemplate(query?: EmailStatsByTemplateQuery, options?: RequestOptions): APIPromise<EmailStatsByTemplateResponse> {\n return this.call<EmailStatsByTemplateResponse>(\"GET\", options, ({ signal, headers }) =>\n getEmailStatsByTemplate({ client: this.client, query, headers, signal }));\n }\n\n /**\n * Opens and clicks grouped by country, region, or city (`group_by`); engagement counts only, no delivery counts or rates. For engagement by mail client or device use email_stats_by_client.\n *\n * @example \n * const { data } = await bird.email.stats.byLocation({\n * from: \"2026-05-01\",\n * to: \"2026-05-31\",\n * limit: 25,\n * });\n * for (const row of data) console.log(row.country, row.engagement.unique_opens);\n */\n byLocation(query?: EmailStatsByLocationQuery, options?: RequestOptions): APIPromise<EmailStatsByLocationResponse> {\n return this.call<EmailStatsByLocationResponse>(\"GET\", options, ({ signal, headers }) =>\n getEmailStatsByLocation({ client: this.client, query, headers, signal }));\n }\n\n /**\n * Opens and clicks grouped by mail client, OS, or device type (`group_by`); engagement counts only, no delivery counts or rates. For engagement by geography use email_stats_by_location.\n *\n * @example \n * const { data } = await bird.email.stats.byClient({\n * from: \"2026-05-01\",\n * to: \"2026-05-31\",\n * limit: 25,\n * });\n * for (const row of data) console.log(row.email_client, row.engagement.unique_opens);\n */\n byClient(query?: EmailStatsByClientQuery, options?: RequestOptions): APIPromise<EmailStatsByClientResponse> {\n return this.call<EmailStatsByClientResponse>(\"GET\", options, ({ signal, headers }) =>\n getEmailStatsByClient({ client: this.client, query, headers, signal }));\n }\n\n /**\n * Bounce counts grouped by the SMTP error code the receiving server returned, with the hard/soft/admin/block/undetermined split; failure side only. It shows what is driving bounces, while bounces by destination come from email_stats_by_recipient_domain or email_stats_by_mailbox_provider.\n *\n * @example \n * const { data } = await bird.email.stats.byBounceCode({\n * from: \"2026-05-01\",\n * to: \"2026-05-31\",\n * sort: \"bounced\",\n * limit: 25,\n * });\n * for (const row of data) console.log(row.smtp_error_code, row.bounced);\n */\n byBounceCode(query?: EmailStatsByBounceCodeQuery, options?: RequestOptions): APIPromise<EmailStatsByBounceCodeResponse> {\n return this.call<EmailStatsByBounceCodeResponse>(\"GET\", options, ({ signal, headers }) =>\n getEmailStatsByBounceCode({ client: this.client, query, headers, signal }));\n }\n\n /**\n * Spam-complaint counts grouped by the feedback-loop complaint type (for example `abuse`, `fraud`, `virus`); complaint side only. For complaints by destination use email_stats_by_mailbox_provider or email_stats_by_recipient_domain.\n *\n * @example \n * const { data } = await bird.email.stats.byComplaintType({ from: \"2026-05-01\", to: \"2026-05-31\" });\n * for (const row of data) console.log(row.feedback_type, row.complained);\n */\n byComplaintType(query?: EmailStatsByComplaintTypeQuery, options?: RequestOptions): APIPromise<EmailStatsByComplaintTypeResponse> {\n return this.call<EmailStatsByComplaintTypeResponse>(\"GET\", options, ({ signal, headers }) =>\n getEmailStatsByComplaintType({ client: this.client, query, headers, signal }));\n }\n\n /**\n * Email delivery and engagement stats grouped by broadcast; only broadcast sends appear. Reflects roughly the last 30 days of activity.\n *\n * @example \n * const { data } = await bird.email.stats.byBroadcast({\n * from: \"2026-05-01\",\n * to: \"2026-05-31\",\n * sort: \"click_rate\",\n * limit: 25,\n * });\n * for (const row of data) console.log(row.broadcast_id, row.engagement.click_rate);\n */\n byBroadcast(query?: EmailStatsByBroadcastQuery, options?: RequestOptions): APIPromise<EmailStatsByBroadcastResponse> {\n return this.call<EmailStatsByBroadcastResponse>(\"GET\", options, ({ signal, headers }) =>\n getEmailStatsByBroadcast({ client: this.client, query, headers, signal }));\n }\n}\n","// Code generated by surface-gen; DO NOT EDIT.\nimport { createMailbox, deleteMailbox, getMailbox, getMailboxStats, listMailboxLabels, listMailboxes, restoreMailbox, resumeMailbox, updateMailbox } from \"../generated/sdk.gen.js\";\nimport type { CreateMailboxData, DeleteMailboxData, EmailMailboxLabelList, GetMailboxData, GetMailboxStatsData, ListMailboxLabelsData, ListMailboxesData, Mailbox, MailboxStatsResponse, RestoreMailboxData, ResumeMailboxData, UpdateMailboxData } from \"../generated/types.gen.js\";\nimport { Resource } from \"./base.js\";\nimport type { APIPromise, PaginatedPromise, RequestOptions } from \"../core/result.js\";\n\nexport type { Mailbox };\nexport type { MailboxStatsResponse };\nexport type { EmailMailboxLabelList };\nexport type EmailMailboxesListQuery = NonNullable<ListMailboxesData[\"query\"]>;\nexport type EmailMailboxesCreateParams = NonNullable<CreateMailboxData[\"body\"]>;\nexport type EmailMailboxesUpdateParams = NonNullable<UpdateMailboxData[\"body\"]>;\nexport type EmailMailboxesUpdateQuery = NonNullable<UpdateMailboxData[\"query\"]>;\nexport type EmailMailboxesStatsQuery = NonNullable<GetMailboxStatsData[\"query\"]>;\n\nexport class EmailMailboxesResourceBase extends Resource {\n /**\n * List the workspace's mailboxes as a cursor page, newest first. Search addresses and display names with q, or filter by exact address, state, or domain.\n *\n * @example List mailboxes\n * for await (const mailbox of bird.email.mailboxes.list()) {\n * console.log(mailbox.address);\n * }\n */\n list(query?: EmailMailboxesListQuery, options?: RequestOptions): PaginatedPromise<Mailbox> {\n return this.paginated<Mailbox>(\"GET\", options, ({ signal, headers }, cursor) =>\n listMailboxes({ client: this.client, query: { ...query, starting_after: cursor ?? query?.starting_after }, headers, signal }));\n }\n\n /**\n * Create a mailbox: a durable agent identity that owns an email address, groups mail into threads, and remembers conversations for its retention tier.\n *\n * @example Create a mailbox\n * const mailbox = await bird.email.mailboxes.create({ display_name: \"Support\" });\n * console.log(mailbox.address); // \"abc123@inbox.ai\"\n */\n create(params: EmailMailboxesCreateParams = {}, options?: RequestOptions): APIPromise<Mailbox> {\n return this.call<Mailbox>(\"POST\", options, ({ signal, headers }) =>\n createMailbox({ client: this.client, body: params, headers, signal }));\n }\n\n /**\n * Read one mailbox by id. A mailbox deleted within its 30-day restore window is still returned, carrying a non-null `deleted_at`; once that window closes it is gone and this returns 404.\n *\n * @example Get a mailbox\n * const mailbox = await bird.email.mailboxes.get(\"mbx_01abc\");\n * console.log(mailbox.state); // \"active\"\n */\n get(mailboxId: string, options?: RequestOptions): APIPromise<Mailbox> {\n return this.call<Mailbox>(\"GET\", options, ({ signal, headers }) =>\n getMailbox({ client: this.client, path: { mailbox_id: mailboxId }, headers, signal }));\n }\n\n /**\n * Update a mailbox's display name, reply-to, receive policy, retention tier, IP pool, or metadata. Lowering the retention tier onto remembered messages older than the new horizon requires confirm=true.\n *\n * @example Change a mailbox's receive policy\n * const mailbox = await bird.email.mailboxes.update(\"mbx_01abc\", {\n * receive_policy: \"open\",\n * });\n * console.log(mailbox.id, mailbox.receive_policy);\n */\n update(mailboxId: string, params: EmailMailboxesUpdateParams = {}, query?: EmailMailboxesUpdateQuery, options?: RequestOptions): APIPromise<Mailbox> {\n return this.call<Mailbox>(\"PATCH\", options, ({ signal, headers }) =>\n updateMailbox({ client: this.client, path: { mailbox_id: mailboxId }, body: params, query, headers, signal }));\n }\n\n /**\n * Delete a mailbox. The address stops receiving immediately and is quarantined; the mailbox and its remembered messages stay restorable for 30 days via the restore endpoint, then are permanently deleted.\n *\n * @example Delete a mailbox\n * await bird.email.mailboxes.delete(\"mbx_01abc\");\n */\n delete(mailboxId: string, options?: RequestOptions): APIPromise<void> {\n return this.call<void>(\"DELETE\", options, ({ signal, headers }) =>\n deleteMailbox({ client: this.client, path: { mailbox_id: mailboxId }, headers, signal }));\n }\n\n /**\n * Restore a mailbox deleted less than 30 days ago: the address starts receiving again and the remembered messages are back. Past the window the mailbox is permanently deleted and returns 404; a mailbox that is not deleted returns 409.\n *\n * @example Restore a deleted mailbox\n * const mailbox = await bird.email.mailboxes.restore(\"mbx_01abc\");\n * console.log(mailbox.deleted_at); // null\n */\n restore(mailboxId: string, options?: RequestOptions): APIPromise<Mailbox> {\n return this.call<Mailbox>(\"POST\", options, ({ signal, headers }) =>\n restoreMailbox({ client: this.client, path: { mailbox_id: mailboxId }, headers, signal }));\n }\n\n /**\n * Reactivate a suspended mailbox so it can send and receive again and its threads become visible. Fails if your plan does not have room for another active mailbox (or another custom inbox.ai handle); delete an active mailbox or upgrade first. A mailbox that is not suspended returns 409.\n *\n * @example Resume a suspended mailbox\n * const mailbox = await bird.email.mailboxes.resume(\"mbx_01abc\");\n * console.log(mailbox.state); // \"active\"\n */\n resume(mailboxId: string, options?: RequestOptions): APIPromise<Mailbox> {\n return this.call<Mailbox>(\"POST\", options, ({ signal, headers }) =>\n resumeMailbox({ client: this.client, path: { mailbox_id: mailboxId }, headers, signal }));\n }\n\n /**\n * Read a mailbox's sent and received email statistics over a window: a period summary plus a bucketed series. Rows are bucketed by event time rather than send time, so engagement that arrived during the period for messages sent earlier is counted here. Both window bounds must use the same form, calendar days or RFC 3339 instants, matching the granularity.\n *\n * @example Get mailbox stats\n * const stats = await bird.email.mailboxes.stats(\"mbx_01abc\");\n * console.log(stats.summary?.sends_accepted);\n */\n stats(mailboxId: string, query?: EmailMailboxesStatsQuery, options?: RequestOptions): APIPromise<MailboxStatsResponse> {\n return this.call<MailboxStatsResponse>(\"GET\", options, ({ signal, headers }) =>\n getMailboxStats({ client: this.client, path: { mailbox_id: mailboxId }, query, headers, signal }));\n }\n\n /**\n * List the labels available in a mailbox: the built-in system labels (inbox, archive, spam, blocked, sent, trash, unread) plus every custom label in use.\n *\n * @example List a mailbox's labels\n * const labels = await bird.email.mailboxes.labels(\"mbx_01abc\");\n * console.log(labels.data.map((label) => label.name));\n */\n labels(mailboxId: string, options?: RequestOptions): APIPromise<EmailMailboxLabelList> {\n return this.call<EmailMailboxLabelList>(\"GET\", options, ({ signal, headers }) =>\n listMailboxLabels({ client: this.client, path: { mailbox_id: mailboxId }, headers, signal }));\n }\n}\n","// `bird.email.mailboxes.messages` — the override residue over the generated\n// mailbox facade: create (address-list body).\n\nimport { createMailboxMessage } from \"../generated/sdk.gen.js\";\nimport type {\n EmailMailboxComposeRequest,\n EmailThreadMessage,\n} from \"../generated/types.gen.js\";\nimport { Resource } from \"./base.js\";\nimport type { APIPromise, RequestOptions } from \"../core/result.js\";\n\n/** Parameters for sending a new message from a mailbox. */\nexport type EmailMailboxesMessagesCreateParams = EmailMailboxComposeRequest;\n/** A message returned from create or reply. */\nexport type { EmailThreadMessage };\n\nexport class EmailMailboxesMessagesResource extends Resource {\n /**\n * Send a new email from this mailbox, starting a new conversation.\n *\n * @example Send from a mailbox\n * const msg = await bird.email.mailboxes.messages.create(\"mbx_01abc\", {\n * to: [\"customer@example.com\"],\n * subject: \"Hello\",\n * text: \"Hi there!\",\n * });\n */\n create(\n mailboxId: string,\n params: EmailMailboxesMessagesCreateParams,\n options?: RequestOptions,\n ): APIPromise<EmailThreadMessage> {\n return this.call<EmailThreadMessage>(\"POST\", options, ({ signal, headers }) =>\n createMailboxMessage({\n client: this.client,\n path: { mailbox_id: mailboxId },\n body: params,\n headers,\n signal,\n }),\n );\n }\n}\n","// Code generated by surface-gen; DO NOT EDIT.\nimport { createMailboxReceiveRule, deleteMailboxReceiveRule, listMailboxReceiveRules } from \"../generated/sdk.gen.js\";\nimport type { CreateMailboxReceiveRuleData, DeleteMailboxReceiveRuleData, ListMailboxReceiveRulesData, ReceiveRule } from \"../generated/types.gen.js\";\nimport { Resource } from \"./base.js\";\nimport type { APIPromise, PaginatedPromise, RequestOptions } from \"../core/result.js\";\n\nexport type { ReceiveRule };\nexport type EmailMailboxesReceiveRulesListQuery = NonNullable<ListMailboxReceiveRulesData[\"query\"]>;\nexport type EmailMailboxesReceiveRulesCreateParams = NonNullable<CreateMailboxReceiveRuleData[\"body\"]>;\n\nexport class EmailMailboxesReceiveRulesResource extends Resource {\n /**\n * List a mailbox's allow/block receive rules as a cursor page, oldest first. Filter by action.\n *\n * @example List a mailbox's receive rules\n * for await (const rule of bird.email.mailboxes.receiveRules.list(\"mbx_01abc\")) {\n * console.log(rule.action, rule.entry);\n * }\n */\n list(mailboxId: string, query?: EmailMailboxesReceiveRulesListQuery, options?: RequestOptions): PaginatedPromise<ReceiveRule> {\n return this.paginated<ReceiveRule>(\"GET\", options, ({ signal, headers }, cursor) =>\n listMailboxReceiveRules({ client: this.client, path: { mailbox_id: mailboxId }, query: { ...query, starting_after: cursor ?? query?.starting_after }, headers, signal }));\n }\n\n /**\n * Add an allow or block rule for a sender address or domain to a mailbox. Block always wins; up to 200 rules per mailbox.\n *\n * @example Block a domain\n * const rule = await bird.email.mailboxes.receiveRules.create(\"mbx_01abc\", {\n * action: \"block\",\n * entry: \"spam.example.com\",\n * });\n * console.log(rule.id);\n */\n create(mailboxId: string, params: EmailMailboxesReceiveRulesCreateParams, options?: RequestOptions): APIPromise<ReceiveRule> {\n return this.call<ReceiveRule>(\"POST\", options, ({ signal, headers }) =>\n createMailboxReceiveRule({ client: this.client, path: { mailbox_id: mailboxId }, body: params, headers, signal }));\n }\n\n /**\n * Remove a receive rule from a mailbox. Rules have no update operation, so a rule's allow or block action cannot be changed after it is created.\n *\n * @example Delete a rule\n * await bird.email.mailboxes.receiveRules.delete(\"mbx_01abc\", \"erl_01xyz\");\n */\n delete(mailboxId: string, ruleId: string, options?: RequestOptions): APIPromise<void> {\n return this.call<void>(\"DELETE\", options, ({ signal, headers }) =>\n deleteMailboxReceiveRule({ client: this.client, path: { mailbox_id: mailboxId, rule_id: ruleId }, headers, signal }));\n }\n}\n","// `bird.email.mailboxes` — the generated mailbox facade plus its nested\n// collections (messages, receiveRules), which a generated class can't declare.\n\nimport { Resource } from \"./base.js\";\nimport { EmailMailboxesResourceBase } from \"./emailMailboxes.gen.js\";\nimport { EmailMailboxesMessagesResource } from \"./emailMailboxesMessages.js\";\nimport { EmailMailboxesReceiveRulesResource } from \"./emailMailboxesReceiveRules.gen.js\";\n\nexport class EmailMailboxesResource extends EmailMailboxesResourceBase {\n /** Messages sent from the mailbox's own address — `bird.email.mailboxes.messages.create(...)`. */\n readonly messages: EmailMailboxesMessagesResource;\n\n /** Per-sender allow/block rules — `bird.email.mailboxes.receiveRules.create(...)`, `.list(...)`, `.delete(...)`. */\n readonly receiveRules: EmailMailboxesReceiveRulesResource;\n\n constructor(...args: ConstructorParameters<typeof Resource>) {\n super(...args);\n this.messages = new EmailMailboxesMessagesResource(...args);\n this.receiveRules = new EmailMailboxesReceiveRulesResource(...args);\n }\n}\n","// Code generated by surface-gen; DO NOT EDIT.\nimport { deleteEmailThread, getEmailThread, listEmailThreads, updateEmailThread } from \"../generated/sdk.gen.js\";\nimport type { DeleteEmailThreadData, EmailThread, GetEmailThreadData, ListEmailThreadsData, UpdateEmailThreadData } from \"../generated/types.gen.js\";\nimport { Resource } from \"./base.js\";\nimport type { APIPromise, PaginatedPromise, RequestOptions } from \"../core/result.js\";\n\nexport type { EmailThread };\nexport type EmailThreadsListQuery = NonNullable<ListEmailThreadsData[\"query\"]>;\nexport type EmailThreadsUpdateParams = NonNullable<UpdateEmailThreadData[\"body\"]>;\nexport type EmailThreadsDeleteQuery = NonNullable<DeleteEmailThreadData[\"query\"]>;\n\nexport class EmailThreadsResourceBase extends Resource {\n /**\n * List mailbox conversations as a cursor page, most recently active first. `label` selects the view: inbox (default), archive, spam, blocked, or a custom label. Filter by mailbox, contact, participant address, or subject substring.\n *\n * @example List conversation threads\n * for await (const thread of bird.email.threads.list({ mailbox_id: \"mbx_01abc\" })) {\n * console.log(thread.id, thread.subject);\n * }\n */\n list(query?: EmailThreadsListQuery, options?: RequestOptions): PaginatedPromise<EmailThread> {\n return this.paginated<EmailThread>(\"GET\", options, ({ signal, headers }, cursor) =>\n listEmailThreads({ client: this.client, query: { ...query, starting_after: cursor ?? query?.starting_after }, headers, signal }));\n }\n\n /**\n * Get one conversation: participants, counts, labels, read state. Fetch its messages with the thread messages endpoint.\n *\n * @example Get a thread\n * const thread = await bird.email.threads.get(\"thr_01abc\");\n * console.log(thread.subject);\n */\n get(threadId: string, options?: RequestOptions): APIPromise<EmailThread> {\n return this.call<EmailThread>(\"GET\", options, ({ signal, headers }) =>\n getEmailThread({ client: this.client, path: { thread_id: threadId }, headers, signal }));\n }\n\n /**\n * Add or remove labels on a conversation, or link and unlink a contact. Adding `spam` files it as spam, `archive` clears it out of the inbox, and `inbox` brings it back.\n *\n * @example Apply label changes to a thread\n * const thread = await bird.email.threads.update(\"thr_01abc\", {\n * labels: { add: [\"archive\"] },\n * });\n * console.log(thread.id);\n */\n update(threadId: string, params: EmailThreadsUpdateParams = {}, options?: RequestOptions): APIPromise<EmailThread> {\n return this.call<EmailThread>(\"PATCH\", options, ({ signal, headers }) =>\n updateEmailThread({ client: this.client, path: { thread_id: threadId }, body: params, headers, signal }));\n }\n\n /**\n * Move a conversation and all its messages to trash (purged after 30 days), or delete permanently with ?permanent=true.\n *\n * @example Delete a thread\n * await bird.email.threads.delete(\"thr_01abc\", { permanent: true });\n */\n delete(threadId: string, query?: EmailThreadsDeleteQuery, options?: RequestOptions): APIPromise<void> {\n return this.call<void>(\"DELETE\", options, ({ signal, headers }) =>\n deleteEmailThread({ client: this.client, path: { thread_id: threadId }, query, headers, signal }));\n }\n}\n","// Code generated by surface-gen; DO NOT EDIT.\nimport { getEmailThreadMessage, getEmailThreadMessageBody, listEmailThreadMessageAttachments, listEmailThreadMessages, replyEmailThreadMessage } from \"../generated/sdk.gen.js\";\nimport type { EmailThreadMessage, EmailThreadMessageAttachmentList, EmailThreadMessageBody, GetEmailThreadMessageBodyData, GetEmailThreadMessageData, ListEmailThreadMessageAttachmentsData, ListEmailThreadMessagesData, ReplyEmailThreadMessageData } from \"../generated/types.gen.js\";\nimport { Resource } from \"./base.js\";\nimport type { APIPromise, PaginatedPromise, RequestOptions } from \"../core/result.js\";\n\nexport type { EmailThreadMessage };\nexport type { EmailThreadMessageBody };\nexport type { EmailThreadMessageAttachmentList };\nexport type EmailThreadsMessagesListQuery = NonNullable<ListEmailThreadMessagesData[\"query\"]>;\nexport type EmailThreadsMessagesReplyParams = NonNullable<ReplyEmailThreadMessageData[\"body\"]>;\n\nexport class EmailThreadsMessagesResource extends Resource {\n /**\n * List the messages in a conversation newest first, both directions. Page older messages with starting_after, and pass include=extracted_text to inline each message's durable plain text.\n *\n * @example List a thread's messages\n * for await (const msg of bird.email.threads.messages.list(\"thr_01abc\")) {\n * console.log(msg.id, msg.direction);\n * }\n */\n list(threadId: string, query?: EmailThreadsMessagesListQuery, options?: RequestOptions): PaginatedPromise<EmailThreadMessage> {\n return this.paginated<EmailThreadMessage>(\"GET\", options, ({ signal, headers }, cursor) =>\n listEmailThreadMessages({ client: this.client, path: { thread_id: threadId }, query: { ...query, starting_after: cursor ?? query?.starting_after }, headers, signal }));\n }\n\n /**\n * Get one conversation message with its extracted plain text, readable for the mailbox's full retention period without MIME parsing.\n *\n * @example Get a message\n * const msg = await bird.email.threads.messages.get(\"thr_01abc\", \"rem_01xyz\");\n * console.log(msg.direction); // \"inbound\"\n */\n get(threadId: string, messageId: string, options?: RequestOptions): APIPromise<EmailThreadMessage> {\n return this.call<EmailThreadMessage>(\"GET\", options, ({ signal, headers }) =>\n getEmailThreadMessage({ client: this.client, path: { thread_id: threadId, message_id: messageId }, headers, signal }));\n }\n\n /**\n * Get the original rendered HTML and plain-text body of a conversation message. Available 30 days; after that use the message's extracted_text.\n *\n * @example Get a message body\n * const body = await bird.email.threads.messages.body(\"thr_01abc\", \"rem_01xyz\");\n * console.log(body.text);\n */\n body(threadId: string, messageId: string, options?: RequestOptions): APIPromise<EmailThreadMessageBody> {\n return this.call<EmailThreadMessageBody>(\"GET\", options, ({ signal, headers }) =>\n getEmailThreadMessageBody({ client: this.client, path: { thread_id: threadId, message_id: messageId }, headers, signal }));\n }\n\n /**\n * Reply to a specific conversation message from the mailbox's own address. To reply to a conversation, target its newest received message. Recipients, subject, and threading headers are derived automatically.\n *\n * @example Reply to a message\n * const reply = await bird.email.threads.messages.reply(\"thr_01abc\", \"rem_01xyz\", {\n * text: \"Thanks for reaching out!\",\n * });\n * console.log(reply.id);\n */\n reply(threadId: string, messageId: string, params: EmailThreadsMessagesReplyParams = {}, options?: RequestOptions): APIPromise<EmailThreadMessage> {\n return this.call<EmailThreadMessage>(\"POST\", options, ({ signal, headers }) =>\n replyEmailThreadMessage({ client: this.client, path: { thread_id: threadId, message_id: messageId }, body: params, headers, signal }));\n }\n\n /**\n * List the attachments on a conversation message. Bytes are downloadable for 30 days; the metadata also rides the message's attachment_manifest durably.\n *\n * @example List a message's attachments\n * const atts = await bird.email.threads.messages.attachments(\"thr_01abc\", \"rem_01xyz\");\n * console.log(atts.data.map((a) => a.filename));\n */\n attachments(threadId: string, messageId: string, options?: RequestOptions): APIPromise<EmailThreadMessageAttachmentList> {\n return this.call<EmailThreadMessageAttachmentList>(\"GET\", options, ({ signal, headers }) =>\n listEmailThreadMessageAttachments({ client: this.client, path: { thread_id: threadId, message_id: messageId }, headers, signal }));\n }\n}\n","// `bird.email.threads` — the generated thread facade plus its nested messages\n// collection, which a generated class can't declare.\n\nimport { Resource } from \"./base.js\";\nimport { EmailThreadsResourceBase } from \"./emailThreads.gen.js\";\nimport { EmailThreadsMessagesResource } from \"./emailThreadsMessages.gen.js\";\n\nexport class EmailThreadsResource extends EmailThreadsResourceBase {\n /** Messages in a conversation — `bird.email.threads.messages.list(...)`, `.reply(...)`, … */\n readonly messages: EmailThreadsMessagesResource;\n\n constructor(...args: ConstructorParameters<typeof Resource>) {\n super(...args);\n this.messages = new EmailThreadsMessagesResource(...args);\n }\n}\n","// `bird.email` — the email channel: send email messages and read their delivery status.\n\nimport {\n cancelEmailMessage,\n createEmailMessage,\n createEmailMessageBatch,\n getEmailMessage,\n listEmailMessages,\n} from \"../generated/sdk.gen.js\";\nimport type {\n EmailMessage,\n EmailMessageBatchRequest,\n EmailMessageBatchResponse,\n EmailMessageSendRequest,\n ListEmailMessagesData,\n} from \"../generated/types.gen.js\";\nimport { Resource } from \"./base.js\";\nimport { EmailResourceBase } from \"./email.gen.js\";\nimport { EmailStatsResource } from \"./emailStats.gen.js\";\nimport { EmailMailboxesResource } from \"./emailMailboxes.js\";\nimport { EmailThreadsResource } from \"./emailThreads.js\";\nimport type {\n APIPromise,\n PaginatedPromise,\n RequestOptions,\n} from \"../core/result.js\";\n\n/** An email message with aggregate delivery status. */\nexport type { EmailMessage };\n/** Body for `bird.email.send`. */\nexport type EmailSendParams = EmailMessageSendRequest;\n/** Body for `bird.email.sendBatch` — an array of send params, validated as a unit. */\nexport type EmailSendBatchParams = EmailMessageBatchRequest;\n/** Result of `bird.email.sendBatch` — one accepted item per submitted message. */\nexport type EmailSendBatchResult = EmailMessageBatchResponse;\n/** Filters and cursor params for `bird.email.list`. */\nexport type EmailListQuery = NonNullable<ListEmailMessagesData[\"query\"]>;\n\n/**\n * Channel-level defaults set at client construction. Field names mirror the\n * send params (so they read as pre-filled fields). Any field set here becomes\n * optional in `send` and is filled when omitted (per-send value wins).\n */\nexport type EmailChannelDefaults = Partial<\n Pick<\n EmailSendParams,\n | \"from\"\n | \"reply_to\"\n | \"category\"\n | \"track_opens\"\n | \"track_clicks\"\n | \"headers\"\n | \"tags\"\n | \"metadata\"\n >\n>;\n\ntype PartialBy<T, K extends keyof T> = Omit<T, K> & Partial<Pick<T, K>>;\n/** Keys that carry a configured default — made optional in `send`. */\ntype DefaultedKeys<D> = D extends object\n ? Extract<keyof D, keyof EmailSendParams>\n : never;\n/** `send` params with defaulted fields made optional. */\nexport type EmailSend<D> = PartialBy<EmailSendParams, DefaultedKeys<D>>;\n\nexport class EmailResource<\n D extends EmailChannelDefaults | undefined = undefined,\n> extends EmailResourceBase {\n #defaults?: D;\n\n /** Email statistics — `bird.email.stats.summary(...)`, `.daily(...)`, `.byTag(...)`, … */\n readonly stats: EmailStatsResource;\n\n /** Durable agent mailboxes — `bird.email.mailboxes.list(...)`, `.create(...)`, … */\n readonly mailboxes: EmailMailboxesResource;\n\n /** Conversations across every mailbox — `bird.email.threads.list(...)`, `.get(...)`, … */\n readonly threads: EmailThreadsResource;\n\n constructor(\n core: ConstructorParameters<typeof Resource>[0],\n client: ConstructorParameters<typeof Resource>[1],\n defaults?: D,\n ) {\n super(core, client);\n this.#defaults = defaults;\n this.stats = new EmailStatsResource(core, client);\n this.mailboxes = new EmailMailboxesResource(core, client);\n this.threads = new EmailThreadsResource(core, client);\n }\n\n /**\n * Send an email message. Resolves once the message is accepted for delivery\n * (the API's 202). Throws on failure — a 422 (unverified sender, all\n * recipients suppressed, validation) is a `BirdValidationError`. Fields set as\n * channel defaults may be omitted (per-send value wins).\n *\n * @example Send a message\n * const msg = await bird.email.send({\n * from: { email: \"onboarding@messagebird.dev\", name: \"Bird\" },\n * to: [\"delivered@messagebird.dev\"],\n * subject: \"Hello from Bird\",\n * html: \"<p>My first Bird email.</p>\",\n * });\n * console.log(msg.id, msg.status); // \"em_…\", \"accepted\"\n *\n * @example A richer send — cc/bcc, reply-to, tags, metadata, click-tracking off, and an idempotency key (safe to retry; the server dedupes)\n * await bird.email.send(\n * {\n * from: \"hello@acme.com\",\n * to: [\"a@example.com\", \"b@example.com\"],\n * cc: [\"manager@example.com\"],\n * reply_to: [\"support@acme.com\"],\n * subject: \"Your March invoice\",\n * html: \"<p>Attached.</p>\",\n * tags: [{ name: \"category\", value: \"billing\" }],\n * metadata: { invoice_id: \"inv_123\" },\n * track_clicks: false,\n * },\n * { idempotencyKey: \"invoice-march/cust_1\" },\n * );\n *\n * @example Branch on the typed error hierarchy\n * import { BirdRateLimitError, BirdValidationError, BirdAPIError } from \"@messagebird/sdk\";\n *\n * try {\n * await bird.email.send({\n * from: { email: \"onboarding@messagebird.dev\", name: \"Bird\" },\n * to: [\"delivered@messagebird.dev\"],\n * subject: \"Hello from Bird\",\n * html: \"<p>My first Bird email.</p>\",\n * });\n * } catch (err) {\n * if (err instanceof BirdRateLimitError) console.log(`rate limited — retry in ${err.retryAfter}s`);\n * else if (err instanceof BirdValidationError) console.error(err.details);\n * else if (err instanceof BirdAPIError) console.error(err.code, err.requestId);\n * else throw err;\n * }\n *\n * @example Errors as values with `.safe()`\n * const { data, error } = await bird.email\n * .send({\n * from: { email: \"onboarding@messagebird.dev\", name: \"Bird\" },\n * to: [\"delivered@messagebird.dev\"],\n * subject: \"Hello from Bird\",\n * html: \"<p>My first Bird email.</p>\",\n * })\n * .safe();\n * if (error) console.error(error.message);\n * else console.log(data.id);\n */\n send(\n params: EmailSend<D>,\n options?: RequestOptions,\n ): APIPromise<EmailMessage> {\n // EmailSend<D> guarantees the caller supplied every field not covered by a\n // default, so the merge is a complete EmailSendParams. TS can't reprove that\n // across a spread, so the assertion is necessary here (and only here).\n const body = { ...this.#defaults, ...params } as EmailSendParams;\n return this.call<EmailMessage>(\"POST\", options, ({ signal, headers }) =>\n createEmailMessage({ client: this.client, body, headers, signal }),\n );\n }\n\n /**\n * Send a batch of up to 100 independent email messages in one request. The\n * batch is validated as a unit — if any item fails validation (unverified\n * sender, all recipients suppressed, field-level errors) the whole batch is\n * rejected with a `BirdValidationError` and nothing is queued. Resolves with\n * one accepted item per submitted message, in submission order, once the batch\n * is accepted (the API's 202). Channel defaults are applied per item.\n *\n * @example Send a batch of messages\n * const batch = await bird.email.sendBatch([\n * {\n * from: { email: \"onboarding@messagebird.dev\", name: \"Bird\" },\n * to: [\"alice@example.com\"],\n * subject: \"Your receipt\",\n * html: \"<p>Thanks, Alice.</p>\",\n * },\n * {\n * from: { email: \"onboarding@messagebird.dev\", name: \"Bird\" },\n * to: [\"bob@example.com\"],\n * subject: \"Your receipt\",\n * html: \"<p>Thanks, Bob.</p>\",\n * },\n * ]);\n * for (const item of batch.data) console.log(item.id, item.status);\n */\n sendBatch(\n params: EmailSendBatchParams,\n options?: RequestOptions,\n ): APIPromise<EmailSendBatchResult> {\n const body = params.map((item) => ({\n ...this.#defaults,\n ...item,\n })) as EmailSendBatchParams;\n return this.call<EmailSendBatchResult>(\n \"POST\",\n options,\n ({ signal, headers }) =>\n createEmailMessageBatch({ client: this.client, body, headers, signal }),\n );\n }\n\n}\n","// Code generated by surface-gen; DO NOT EDIT.\nimport { assignAudienceContacts, createAudience, deleteAudience, getAudience, listAudienceContacts, listAudiences, unassignAudienceContact, unassignAudienceContacts, updateAudience } from \"../generated/sdk.gen.js\";\nimport type { AssignAudienceContactsData, Audience, AudienceMember, CreateAudienceData, DeleteAudienceData, GetAudienceData, ListAudienceContactsData, ListAudiencesData, UnassignAudienceContactData, UnassignAudienceContactsData, UpdateAudienceData } from \"../generated/types.gen.js\";\nimport { Resource } from \"./base.js\";\nimport type { APIPromise, PaginatedPromise, RequestOptions } from \"../core/result.js\";\n\nexport type { Audience };\nexport type { AudienceMember };\nexport type AudienceListQuery = NonNullable<ListAudiencesData[\"query\"]>;\nexport type AudienceCreateParams = NonNullable<CreateAudienceData[\"body\"]>;\nexport type AudienceUpdateParams = NonNullable<UpdateAudienceData[\"body\"]>;\nexport type AudienceListContactsQuery = NonNullable<ListAudienceContactsData[\"query\"]>;\nexport type AudienceAddContactsParams = NonNullable<AssignAudienceContactsData[\"body\"]>;\nexport type AudienceRemoveContactsParams = NonNullable<UnassignAudienceContactsData[\"body\"]>;\n\nexport class AudiencesResource extends Resource {\n /**\n * List the workspace's audiences as a cursor page, newest first. Filter by name substring with `q`.\n *\n * @example Iterate every audience, or take one page\n * for await (const audience of bird.audiences.list()) {\n * console.log(audience.id, audience.name);\n * }\n */\n list(query?: AudienceListQuery, options?: RequestOptions): PaginatedPromise<Audience> {\n return this.paginated<Audience>(\"GET\", options, ({ signal, headers }, cursor) =>\n listAudiences({ client: this.client, query: { ...query, starting_after: cursor ?? query?.starting_after }, headers, signal }));\n }\n\n /**\n * Get a single audience by ID: name, description, and type. Members are listed separately with `audiences.list_contacts`.\n *\n * @example Fetch an audience by id\n * const audience = await bird.audiences.get(\"adn_01krdgeqcxet5s7t44vh8rt9mg\");\n * console.log(audience.name);\n */\n get(audienceId: string, options?: RequestOptions): APIPromise<Audience> {\n return this.call<Audience>(\"GET\", options, ({ signal, headers }) =>\n getAudience({ client: this.client, path: { audience_id: audienceId }, headers, signal }));\n }\n\n /**\n * Create an audience in the workspace. New audiences start empty; add contacts with `audiences.add_contacts` or `contacts.batch`. Only static audiences can be created today.\n *\n * @example Create an audience\n * const audience = await bird.audiences.create({ name: \"Newsletter subscribers\" });\n * console.log(audience.id); // \"adn_…\"\n */\n create(params: AudienceCreateParams, options?: RequestOptions): APIPromise<Audience> {\n return this.call<Audience>(\"POST\", options, ({ signal, headers }) =>\n createAudience({ client: this.client, body: params, headers, signal }));\n }\n\n /**\n * Update an audience's name or description. Omitted fields are unchanged; a null description clears it.\n *\n * @example Rename an audience\n * await bird.audiences.update(\"adn_01krdgeqcxet5s7t44vh8rt9mg\", { name: \"Renamed\" });\n */\n update(audienceId: string, params: AudienceUpdateParams = {}, options?: RequestOptions): APIPromise<Audience> {\n return this.call<Audience>(\"PATCH\", options, ({ signal, headers }) =>\n updateAudience({ client: this.client, path: { audience_id: audienceId }, body: params, headers, signal }));\n }\n\n /**\n * Delete an audience and its memberships; contacts themselves are not deleted. Fails while a broadcast targeting the audience is scheduled, accepted, sending, or canceling.\n *\n * @example Delete an audience by id\n * await bird.audiences.delete(\"adn_01krdgeqcxet5s7t44vh8rt9mg\");\n */\n delete(audienceId: string, options?: RequestOptions): APIPromise<void> {\n return this.call<void>(\"DELETE\", options, ({ signal, headers }) =>\n deleteAudience({ client: this.client, path: { audience_id: audienceId }, headers, signal }));\n }\n\n /**\n * List the contacts in a static audience by ID, as a cursor page ordered by when each contact joined (most recent first). Each entry pairs the contact with its join time.\n *\n * @example Iterate an audience's members\n * for await (const member of bird.audiences.listContacts(\"adn_01krdgeqcxet5s7t44vh8rt9mg\")) {\n * console.log(member.contact.id, member.joined_at);\n * }\n */\n listContacts(audienceId: string, query?: AudienceListContactsQuery, options?: RequestOptions): PaginatedPromise<AudienceMember> {\n return this.paginated<AudienceMember>(\"GET\", options, ({ signal, headers }, cursor) =>\n listAudienceContacts({ client: this.client, path: { audience_id: audienceId }, query: { ...query, starting_after: cursor ?? query?.starting_after }, headers, signal }));\n }\n\n /**\n * Add up to 1,000 existing contacts to a static audience by ID. Fails entirely if any contact ID does not exist.\n *\n * @example Add contacts to an audience\n * await bird.audiences.addContacts(\"adn_01krdgeqcxet5s7t44vh8rt9mg\", {\n * contact_ids: [\"con_01krdgeqcxet5s7t44vh8rt9mg\"],\n * });\n */\n addContacts(audienceId: string, params: AudienceAddContactsParams, options?: RequestOptions): APIPromise<void> {\n return this.call<void>(\"POST\", options, ({ signal, headers }) =>\n assignAudienceContacts({ client: this.client, path: { audience_id: audienceId }, body: params, headers, signal }));\n }\n\n /**\n * Remove up to 1,000 contacts from a static audience by ID. Fails entirely if any contact ID does not exist; contacts are not deleted.\n *\n * @example Remove contacts from an audience\n * await bird.audiences.removeContacts(\"adn_01krdgeqcxet5s7t44vh8rt9mg\", {\n * contact_ids: [\"con_01krdgeqcxet5s7t44vh8rt9mg\"],\n * });\n */\n removeContacts(audienceId: string, params: AudienceRemoveContactsParams, options?: RequestOptions): APIPromise<void> {\n return this.call<void>(\"POST\", options, ({ signal, headers }) =>\n unassignAudienceContacts({ client: this.client, path: { audience_id: audienceId }, body: params, headers, signal }));\n }\n\n /**\n * Remove one contact's membership from an audience. The contact itself is not deleted and stays a member of any other audiences.\n *\n * @example Remove one contact's membership\n * await bird.audiences.removeContact(\n * \"adn_01krdgeqcxet5s7t44vh8rt9mg\",\n * \"con_01krdgeqcxet5s7t44vh8rt9mg\",\n * );\n */\n removeContact(audienceId: string, contactId: string, options?: RequestOptions): APIPromise<void> {\n return this.call<void>(\"DELETE\", options, ({ signal, headers }) =>\n unassignAudienceContact({ client: this.client, path: { audience_id: audienceId, contact_id: contactId }, headers, signal }));\n }\n}\n","// Code generated by surface-gen; DO NOT EDIT.\nimport { createDomain, deleteDomain, getDomain, listDomains, updateDomain, verifyDomain } from \"../generated/sdk.gen.js\";\nimport type { CreateDomainData, DeleteDomainData, Domain, GetDomainData, ListDomainsData, UpdateDomainData, VerifyDomainData } from \"../generated/types.gen.js\";\nimport { Resource } from \"./base.js\";\nimport type { APIPromise, PaginatedPromise, RequestOptions } from \"../core/result.js\";\n\nexport type { Domain };\nexport type DomainListQuery = NonNullable<ListDomainsData[\"query\"]>;\nexport type DomainCreateParams = NonNullable<CreateDomainData[\"body\"]>;\nexport type DomainUpdateParams = NonNullable<UpdateDomainData[\"body\"]>;\n\nexport class DomainsResource extends Resource {\n /**\n * List the workspace's sending domains with their verification status, as a cursor page.\n *\n * @example Iterate every sending domain\n * for await (const domain of bird.domains.list()) {\n * console.log(domain.id, domain.status);\n * }\n */\n list(query?: DomainListQuery, options?: RequestOptions): PaginatedPromise<Domain> {\n return this.paginated<Domain>(\"GET\", options, ({ signal, headers }, cursor) =>\n listDomains({ client: this.client, query: { ...query, starting_after: cursor ?? query?.starting_after }, headers, signal }));\n }\n\n /**\n * Fetch one sending domain: verification status and the DNS records with their individual verification states.\n *\n * @example Fetch a sending domain by id\n * const domain = await bird.domains.get(\"dom_01krdgeqcxet5s7t44vh8rt9mg\");\n * console.log(domain.domain);\n */\n get(domainId: string, options?: RequestOptions): APIPromise<Domain> {\n return this.call<Domain>(\"GET\", options, ({ signal, headers }) =>\n getDomain({ client: this.client, path: { domain_id: domainId }, headers, signal }));\n }\n\n /**\n * Register a new sending domain and get the DNS records to publish. Verification is a second step: the records go live at the DNS provider, then email_domains_verify confirms them. Propagation takes minutes to hours, so the first verify often still reports unverified and a later one succeeds.\n *\n * @example Register a sending domain\n * const domain = await bird.domains.create({ domain: \"mail.acme.com\" });\n * console.log(domain.id, domain.status); // \"dom_…\", \"pending\"\n */\n create(params: DomainCreateParams, options?: RequestOptions): APIPromise<Domain> {\n return this.call<Domain>(\"POST\", options, ({ signal, headers }) =>\n createDomain({ client: this.client, body: params, headers, signal }));\n }\n\n /**\n * Trigger a DNS verification check for a sending domain and return the refreshed domain with per-record results. Safe to repeat while waiting for DNS propagation.\n *\n * @example Re-run the DNS verification check\n * const domain = await bird.domains.verify(\"dom_01krdgeqcxet5s7t44vh8rt9mg\");\n * console.log(domain.status); // \"verified\" once DNS is in place\n */\n verify(domainId: string, options?: RequestOptions): APIPromise<Domain> {\n return this.call<Domain>(\"POST\", options, ({ signal, headers }) =>\n verifyDomain({ client: this.client, path: { domain_id: domainId }, headers, signal }));\n }\n\n /**\n * Update a sending domain's tracking and inbound configuration. Tracking: click_tracking and open_tracking apply immediately to new sends, and the tracking domain can be set, changed, or removed (the name part only; Bird appends the sending domain). Enabling either toggle with no tracking domain configured returns 409, and removing the tracking domain while either toggle is still on also returns 409. Tracking-domain changes on a verified domain are staged behind DNS verification, so the current config keeps serving until the new records verify. Inbound receiving: inbound.enabled starts or stops receiving mail for the domain. Enabling requires the domain's DKIM to be verified first (a fresh enable on an unverified domain returns 422), and a domain already receiving inbound for another organization returns 422. The MX records to publish are always listed in dns_records regardless, so receiving starts only once inbound.enabled is set, even when those records are already published.\n *\n * @example Enable tracking on a domain\n * await bird.domains.update(\"dom_01krdgeqcxet5s7t44vh8rt9mg\", {\n * settings: { click_tracking: true, open_tracking: true },\n * tracking: { name: \"links\" },\n * });\n */\n update(domainId: string, params: DomainUpdateParams = {}, options?: RequestOptions): APIPromise<Domain> {\n return this.call<Domain>(\"PATCH\", options, ({ signal, headers }) =>\n updateDomain({ client: this.client, path: { domain_id: domainId }, body: params, headers, signal }));\n }\n\n /**\n * Delete a sending domain by id. Revokes its sender authorization: new sends from the domain are rejected afterward, while historical statistics and events for past sends are preserved. Destructive.\n *\n * @example Delete a sending domain by id\n * await bird.domains.delete(\"dom_01krdgeqcxet5s7t44vh8rt9mg\");\n */\n delete(domainId: string, options?: RequestOptions): APIPromise<void> {\n return this.call<void>(\"DELETE\", options, ({ signal, headers }) =>\n deleteDomain({ client: this.client, path: { domain_id: domainId }, headers, signal }));\n }\n}\n","// Code generated by surface-gen; DO NOT EDIT.\nimport { archiveContactProperty, createContactProperty, getContactProperty, listContactProperties, unarchiveContactProperty, updateContactProperty } from \"../generated/sdk.gen.js\";\nimport type { ArchiveContactPropertyData, ContactProperty, CreateContactPropertyData, GetContactPropertyData, ListContactPropertiesData, UnarchiveContactPropertyData, UpdateContactPropertyData } from \"../generated/types.gen.js\";\nimport { Resource } from \"./base.js\";\nimport type { APIPromise, PaginatedPromise, RequestOptions } from \"../core/result.js\";\n\nexport type { ContactProperty };\nexport type ContactPropertyListQuery = NonNullable<ListContactPropertiesData[\"query\"]>;\nexport type ContactPropertyCreateParams = NonNullable<CreateContactPropertyData[\"body\"]>;\nexport type ContactPropertyUpdateParams = NonNullable<UpdateContactPropertyData[\"body\"]>;\n\nexport class ContactPropertiesResource extends Resource {\n /**\n * List the workspace's contact properties as a cursor page, newest first. Archived properties are included, marked by their archived flag.\n *\n * @example Iterate every contact property, or take one page\n * for await (const prop of bird.contactProperties.list()) {\n * console.log(prop.key, prop.type);\n * }\n * const page = await bird.contactProperties.list({ limit: 50 }); // page.data, page.next_cursor\n */\n list(query?: ContactPropertyListQuery, options?: RequestOptions): PaginatedPromise<ContactProperty> {\n return this.paginated<ContactProperty>(\"GET\", options, ({ signal, headers }, cursor) =>\n listContactProperties({ client: this.client, query: { ...query, starting_after: cursor ?? query?.starting_after }, headers, signal }));\n }\n\n /**\n * Get a single contact property by ID: key, type, fallback value, and archived state.\n *\n * @example Fetch a contact property by id\n * const prop = await bird.contactProperties.get(\"cp_01krdgeqcxet5s7t44vh8rt9mg\");\n * console.log(prop.key, prop.type);\n */\n get(propertyId: string, options?: RequestOptions): APIPromise<ContactProperty> {\n return this.call<ContactProperty>(\"GET\", options, ({ signal, headers }) =>\n getContactProperty({ client: this.client, path: { property_id: propertyId }, headers, signal }));\n }\n\n /**\n * Define a custom contact property (key + value type) that becomes available in contact data and as a broadcast template variable. The key and type cannot change after creation; a workspace holds at most 200 properties, archived included.\n *\n * @example Define a custom property\n * const prop = await bird.contactProperties.create({ key: \"plan\", type: \"string\" });\n * console.log(prop.id); // \"cp_…\"\n */\n create(params: ContactPropertyCreateParams, options?: RequestOptions): APIPromise<ContactProperty> {\n return this.call<ContactProperty>(\"POST\", options, ({ signal, headers }) =>\n createContactProperty({ client: this.client, body: params, headers, signal }));\n }\n\n /**\n * Update a contact property's fallback value. Only the fallback value can change; the key and type are fixed at creation, so a different key or type needs a new property.\n *\n * @example Change a property's fallback value\n * await bird.contactProperties.update(\"cp_01krdgeqcxet5s7t44vh8rt9mg\", { fallback_value: \"free\" });\n */\n update(propertyId: string, params: ContactPropertyUpdateParams = {}, options?: RequestOptions): APIPromise<ContactProperty> {\n return this.call<ContactProperty>(\"PATCH\", options, ({ signal, headers }) =>\n updateContactProperty({ client: this.client, path: { property_id: propertyId }, body: params, headers, signal }));\n }\n\n /**\n * Archive a contact property: the key is rejected in new contact writes and stops rendering in templates, while stored values remain readable. The key stays reserved and counts toward the 200-property limit; reverse with `contact_properties.unarchive`.\n *\n * @example Archive a property, retiring the field without deleting its data\n * const prop = await bird.contactProperties.archive(\"cp_01krdgeqcxet5s7t44vh8rt9mg\");\n * console.log(prop.key, prop.archived);\n */\n archive(propertyId: string, options?: RequestOptions): APIPromise<ContactProperty> {\n return this.call<ContactProperty>(\"POST\", options, ({ signal, headers }) =>\n archiveContactProperty({ client: this.client, path: { property_id: propertyId }, headers, signal }));\n }\n\n /**\n * Reactivate an archived contact property so its key is accepted in contact writes and renders in templates again. Fails with a conflict if the property is not archived.\n *\n * @example Restore an archived property\n * await bird.contactProperties.unarchive(\"cp_01krdgeqcxet5s7t44vh8rt9mg\");\n */\n unarchive(propertyId: string, options?: RequestOptions): APIPromise<ContactProperty> {\n return this.call<ContactProperty>(\"POST\", options, ({ signal, headers }) =>\n unarchiveContactProperty({ client: this.client, path: { property_id: propertyId }, headers, signal }));\n }\n}\n","// Code generated by surface-gen; DO NOT EDIT.\nimport { createContact, createContactBatch, deleteContact, getContact, listContacts, updateContact } from \"../generated/sdk.gen.js\";\nimport type { Contact, ContactUpsertResult, CreateContactBatchData, CreateContactData, DeleteContactData, GetContactData, ListContactsData, UpdateContactData } from \"../generated/types.gen.js\";\nimport { Resource } from \"./base.js\";\nimport type { APIPromise, PaginatedPromise, RequestOptions } from \"../core/result.js\";\n\nexport type { Contact };\nexport type { ContactUpsertResult };\nexport type ContactListQuery = NonNullable<ListContactsData[\"query\"]>;\nexport type ContactCreateParams = NonNullable<CreateContactData[\"body\"]>;\nexport type ContactUpdateParams = NonNullable<UpdateContactData[\"body\"]>;\nexport type ContactBatchParams = NonNullable<CreateContactBatchData[\"body\"]>;\n\nexport class ContactsResource extends Resource {\n /**\n * List the workspace's contacts as a cursor page, newest first. Look one up by exact email, phone, or external_id, or search by email, name, or phone substring. Pass include_total for a total count.\n *\n * @example Iterate every contact, or take one page\n * for await (const contact of bird.contacts.list({ q: \"acme.com\" })) {\n * console.log(contact.id, contact.email);\n * }\n * const page = await bird.contacts.list({ limit: 50 }); // page.data, page.next_cursor\n */\n list(query?: ContactListQuery, options?: RequestOptions): PaginatedPromise<Contact> {\n return this.paginated<Contact>(\"GET\", options, ({ signal, headers }, cursor) =>\n listContacts({ client: this.client, query: { ...query, starting_after: cursor ?? query?.starting_after }, headers, signal }));\n }\n\n /**\n * Get a single contact by ID (`con_`-prefixed). Look up an ID by exact email, phone, or external_id with `contacts.list`.\n *\n * @example Fetch a contact by id\n * const contact = await bird.contacts.get(\"con_01krdgeqcxet5s7t44vh8rt9mg\");\n * console.log(contact.email, contact.first_name);\n */\n get(contactId: string, options?: RequestOptions): APIPromise<Contact> {\n return this.call<Contact>(\"GET\", options, ({ signal, headers }) =>\n getContact({ client: this.client, path: { contact_id: contactId }, headers, signal }));\n }\n\n /**\n * Create a contact identified by an email address, an E.164 phone number, or both. Fails with a conflict if the email, phone, or external_id is already used by another contact. For bulk import or create-or-update semantics use `contacts.batch`.\n *\n * @example Create a contact\n * const contact = await bird.contacts.create({\n * email: \"jane@acme.com\",\n * first_name: \"Jane\",\n * });\n * console.log(contact.id); // \"con_…\"\n */\n create(params: ContactCreateParams = {}, options?: RequestOptions): APIPromise<Contact> {\n return this.call<Contact>(\"POST\", options, ({ signal, headers }) =>\n createContact({ client: this.client, body: params, headers, signal }));\n }\n\n /**\n * Update a contact's name, external_id, email, phone, or custom data. Only supplied fields change; custom data keys are merged, with null removing a key. A contact keeps at least one identifier: clearing both email and phone is rejected.\n *\n * @example Change a contact's fields\n * const contact = await bird.contacts.update(\"con_01krdgeqcxet5s7t44vh8rt9mg\", {\n * first_name: \"Jane\",\n * });\n * console.log(contact.first_name);\n */\n update(contactId: string, params: ContactUpdateParams = {}, options?: RequestOptions): APIPromise<Contact> {\n return this.call<Contact>(\"PATCH\", options, ({ signal, headers }) =>\n updateContact({ client: this.client, path: { contact_id: contactId }, body: params, headers, signal }));\n }\n\n /**\n * Delete a contact and remove it from every audience it belongs to. Suppression records for the address are unaffected.\n *\n * @example Delete a contact by id\n * await bird.contacts.delete(\"con_01krdgeqcxet5s7t44vh8rt9mg\");\n */\n delete(contactId: string, options?: RequestOptions): APIPromise<void> {\n return this.call<void>(\"DELETE\", options, ({ signal, headers }) =>\n deleteContact({ client: this.client, path: { contact_id: contactId }, headers, signal }));\n }\n\n /**\n * Create or update up to 1,000 contacts in one request, each entry matched automatically against every identifier it supplies (email, phone, external_id) or, with match_on, by that one field only, and optionally add them all to one or more audiences. Per-contact results are returned in submission order.\n *\n * @example Create or update many contacts at once, matched by the identifiers each entry carries\n * const result = await bird.contacts.batch({\n * contacts: [{ email: \"jane@acme.com\", first_name: \"Jane\" }],\n * });\n * for (const item of result.data) {\n * console.log(item.entry.email, item.status);\n * }\n */\n batch(params: ContactBatchParams, options?: RequestOptions): APIPromise<ContactUpsertResult> {\n return this.call<ContactUpsertResult>(\"POST\", options, ({ signal, headers }) =>\n createContactBatch({ client: this.client, body: params, headers, signal }));\n }\n}\n","// Code generated by surface-gen; DO NOT EDIT.\nimport { getSmsMessage, listSmsMessages } from \"../generated/sdk.gen.js\";\nimport type { GetSmsMessageData, ListSmsMessagesData, SmsMessage } from \"../generated/types.gen.js\";\nimport { Resource } from \"./base.js\";\nimport type { APIPromise, PaginatedPromise, RequestOptions } from \"../core/result.js\";\n\nexport type { SmsMessage };\nexport type SmsListQuery = NonNullable<ListSmsMessagesData[\"query\"]>;\n\nexport class SmsResourceBase extends Resource {\n /**\n * Get one SMS message by id: its current delivery status, segment breakdown, cost, and failure detail if it failed.\n *\n * @example Read a message back\n * const msg = await bird.sms.get(\"sms_abc123\");\n * msg.status; // \"accepted\" | \"delivered\" | …\n */\n get(messageId: string, options?: RequestOptions): APIPromise<SmsMessage> {\n return this.call<SmsMessage>(\"GET\", options, ({ signal, headers }) =>\n getSmsMessage({ client: this.client, path: { message_id: messageId }, headers, signal }));\n }\n\n /**\n * List SMS messages, newest first, as a cursor page ({data, next_cursor, …}). Pass next_cursor back as starting_after to fetch the next page. Filter by direction, status, category, recipient, sender, or tag.\n *\n * @example Iterate outbound messages\n * for await (const msg of bird.sms.list({ direction: \"outbound\" })) {\n * console.log(msg.id, msg.status);\n * }\n */\n list(query?: SmsListQuery, options?: RequestOptions): PaginatedPromise<SmsMessage> {\n return this.paginated<SmsMessage>(\"GET\", options, ({ signal, headers }, cursor) =>\n listSmsMessages({ client: this.client, query: { ...query, starting_after: cursor ?? query?.starting_after }, headers, signal }));\n }\n}\n","// `bird.sms` — the SMS channel: send SMS messages and read their status.\n\nimport {\n createSmsMessage,\n createSmsMessageBatch,\n} from \"../generated/sdk.gen.js\";\nimport type {\n SmsMessage,\n SmsMessageBatchRequest,\n SmsMessageBatchResponse,\n SmsMessageSendRequest,\n} from \"../generated/types.gen.js\";\nimport { SmsResourceBase } from \"./sms.gen.js\";\nimport type { APIPromise, RequestOptions } from \"../core/result.js\";\n\n/** Body for `bird.sms.send` — supply either `text` (with `category`) or `template`. */\nexport type SmsSendParams = SmsMessageSendRequest;\n/** Body for `bird.sms.sendBatch` — an array of up to 100 sends. */\nexport type SmsSendBatchParams = SmsMessageBatchRequest;\n/** Result of `bird.sms.sendBatch`. */\nexport type SmsSendBatchResult = SmsMessageBatchResponse;\n/** Filters and cursor params for `bird.sms.list`. */\n\nexport class SmsResource extends SmsResourceBase {\n /**\n * Send one SMS to a single recipient. Supply either `text` (with a `category`)\n * or a stored `template` (by `id` or `name`, with its `parameters`). The\n * result is `accepted`, not yet delivered — read it back with `get` to confirm.\n *\n * @example Send free text\n * const msg = await bird.sms.send({\n * from: \"MyBrand\",\n * to: \"+14155550100\",\n * text: \"Your verification code is 123456.\",\n * category: \"authentication\",\n * });\n * console.log(msg.id, msg.status);\n *\n * @example Send by template\n * await bird.sms.send({\n * to: \"+14155550100\",\n * template: { name: \"bird_otp_verification\", parameters: { code: \"123456\" } },\n * });\n */\n send(\n params: SmsSendParams,\n options?: RequestOptions,\n ): APIPromise<SmsMessage> {\n return this.call<SmsMessage>(\"POST\", options, ({ signal, headers }) =>\n createSmsMessage({ client: this.client, body: params, headers, signal }),\n );\n }\n\n /**\n * Send up to 100 independent SMS messages in one call. Each item is a full send\n * (free text or template); all items are validated before any are queued.\n *\n * @example\n * const result = await bird.sms.sendBatch([\n * { to: \"+15551111111\", text: \"Hi Alice!\", category: \"marketing\" },\n * { to: \"+15552222222\", text: \"Hi Bob!\", category: \"marketing\" },\n * ]);\n */\n sendBatch(\n params: SmsSendBatchParams,\n options?: RequestOptions,\n ): APIPromise<SmsSendBatchResult> {\n return this.call<SmsSendBatchResult>(\n \"POST\",\n options,\n ({ signal, headers }) =>\n createSmsMessageBatch({\n client: this.client,\n body: params,\n headers,\n signal,\n }),\n );\n }\n}\n","// Code generated by surface-gen; DO NOT EDIT.\nimport { getSmsTemplate, listSmsTemplates } from \"../generated/sdk.gen.js\";\nimport type { GetSmsTemplateData, ListSmsTemplatesData, SmsTemplate, SmsTemplateList } from \"../generated/types.gen.js\";\nimport { Resource } from \"./base.js\";\nimport type { APIPromise, RequestOptions } from \"../core/result.js\";\n\nexport type { SmsTemplateList };\nexport type { SmsTemplate };\nexport type SmsTemplateListQuery = NonNullable<ListSmsTemplatesData[\"query\"]>;\n\nexport class SmsTemplatesResource extends Resource {\n /**\n * List the SMS templates available to your workspace, including Bird's built-in templates. Filter by scope, category, or language. The catalogue is small and returned in full; this list is not paginated. Use sms_templates_get to read one template's variables before sending with it.\n *\n * @example List the built-in templates\n * const { data } = await bird.smsTemplates.list({ scope: \"system\" });\n * for (const tpl of data) console.log(tpl.id, tpl.name);\n */\n list(query?: SmsTemplateListQuery, options?: RequestOptions): APIPromise<SmsTemplateList> {\n return this.call<SmsTemplateList>(\"GET\", options, ({ signal, headers }) =>\n listSmsTemplates({ client: this.client, query, headers, signal }));\n }\n\n /**\n * Get one SMS template by its name or id, including its body and the variables it expects. Fetch it before sms_send to see which parameter keys a template send requires.\n *\n * @example Read one template by name or id\n * const tpl = await bird.smsTemplates.get(\"bird_otp_verification\");\n * console.log(tpl.body, tpl.variables);\n */\n get(templateRef: string, options?: RequestOptions): APIPromise<SmsTemplate> {\n return this.call<SmsTemplate>(\"GET\", options, ({ signal, headers }) =>\n getSmsTemplate({ client: this.client, path: { template_ref: templateRef }, headers, signal }));\n }\n}\n","// Code generated by surface-gen; DO NOT EDIT.\nimport { getWhatsAppMessage, listWhatsAppMessageEvents, listWhatsAppMessages } from \"../generated/sdk.gen.js\";\nimport type { GetWhatsAppMessageData, ListWhatsAppMessageEventsData, ListWhatsAppMessagesData, WhatsAppEventList, WhatsAppMessage } from \"../generated/types.gen.js\";\nimport { Resource } from \"./base.js\";\nimport type { APIPromise, PaginatedPromise, RequestOptions } from \"../core/result.js\";\n\nexport type { WhatsAppMessage };\nexport type { WhatsAppEventList };\nexport type WhatsappListQuery = NonNullable<ListWhatsAppMessagesData[\"query\"]>;\nexport type WhatsappListEventsQuery = NonNullable<ListWhatsAppMessageEventsData[\"query\"]>;\n\nexport class WhatsappResourceBase extends Resource {\n /**\n * Get one WhatsApp message by id: current delivery status, sent/delivered/read timestamps, the template it was sent from, and failure detail if it failed. For the per-event timeline use whatsapp_list_events.\n *\n * @example Read a message back\n * const msg = await bird.whatsapp.get(\"wa_abc123\");\n * msg.status; // \"accepted\" | \"delivered\" | …\n */\n get(messageId: string, options?: RequestOptions): APIPromise<WhatsAppMessage> {\n return this.call<WhatsAppMessage>(\"GET\", options, ({ signal, headers }) =>\n getWhatsAppMessage({ client: this.client, path: { message_id: messageId }, headers, signal }));\n }\n\n /**\n * List WhatsApp messages, newest first, as a cursor page ({data, next_cursor, …}). Pass next_cursor back as starting_after to fetch the next page. Filter by direction, status, contact phone number, bsuid, template category, or tag. Use whatsapp_get for one message's current state.\n *\n * @example Iterate delivered messages\n * for await (const msg of bird.whatsapp.list({ status: [\"delivered\"] })) {\n * console.log(msg.id, msg.status);\n * }\n */\n list(query?: WhatsappListQuery, options?: RequestOptions): PaginatedPromise<WhatsAppMessage> {\n return this.paginated<WhatsAppMessage>(\"GET\", options, ({ signal, headers }, cursor) =>\n listWhatsAppMessages({ client: this.client, query: { ...query, starting_after: cursor ?? query?.starting_after }, headers, signal }));\n }\n\n /**\n * Get one WhatsApp message's delivery timeline, oldest first: whatsapp.accepted, whatsapp.sent, whatsapp.delivered, whatsapp.read, and whatsapp.failed events, with failure detail on failed events. Not paginated; an unknown message id is a 404. Use whatsapp_get for the condensed current status.\n *\n * @example Read one message's delivery timeline\n * const { data } = await bird.whatsapp.listEvents(\"wa_abc123\");\n * for (const event of data) console.log(event.type, event.occurred_at);\n */\n listEvents(messageId: string, query?: WhatsappListEventsQuery, options?: RequestOptions): APIPromise<WhatsAppEventList> {\n return this.call<WhatsAppEventList>(\"GET\", options, ({ signal, headers }) =>\n listWhatsAppMessageEvents({ client: this.client, path: { message_id: messageId }, query, headers, signal }));\n }\n}\n","// `bird.whatsapp` — the WhatsApp channel: send WhatsApp messages and read their\n// status and events.\n\nimport { createWhatsAppMessage } from \"../generated/sdk.gen.js\";\nimport type {\n WhatsAppMessageSendRequest,\n WhatsAppMessage,\n} from \"../generated/types.gen.js\";\nimport { WhatsappResourceBase } from \"./whatsapp.gen.js\";\nimport type { APIPromise, RequestOptions } from \"../core/result.js\";\n\n/** Body for `bird.whatsapp.send` — a template send; Bird picks the sender from the template's category. */\nexport type WhatsappSendParams = WhatsAppMessageSendRequest;\n\nexport class WhatsappResource extends WhatsappResourceBase {\n /**\n * Send a template message. Bird selects the sender number from the\n * template's category, so there is no sender field on the request. The\n * result is `accepted`, not yet delivered — read it back with `get` to\n * confirm.\n *\n * @example\n * const msg = await bird.whatsapp.send({\n * to: \"+15551234567\",\n * template: {\n * slug: \"bird_otp\",\n * components: [\n * { type: \"body\", parameters: [{ type: \"text\", text: \"123456\" }] },\n * ],\n * },\n * });\n * console.log(msg.id, msg.status);\n */\n send(\n params: WhatsappSendParams,\n options?: RequestOptions,\n ): APIPromise<WhatsAppMessage> {\n return this.call<WhatsAppMessage>(\"POST\", options, ({ signal, headers }) =>\n createWhatsAppMessage({\n client: this.client,\n body: params,\n headers,\n signal,\n }),\n );\n }\n}\n","// Code generated by surface-gen; DO NOT EDIT.\nimport { getVoiceCall, listVoiceCalls } from \"../generated/sdk.gen.js\";\nimport type { GetVoiceCallData, ListVoiceCallsData, VoiceCall } from \"../generated/types.gen.js\";\nimport { Resource } from \"./base.js\";\nimport type { APIPromise, PaginatedPromise, RequestOptions } from \"../core/result.js\";\n\nexport type { VoiceCall };\nexport type VoiceListQuery = NonNullable<ListVoiceCallsData[\"query\"]>;\n\nexport class VoiceResource extends Resource {\n /**\n * List the workspace's calls, newest first. Filter to `ringing`/`in_progress` for the calls in progress right now, to final statuses for completed records, or to any mix of the two. Use `from`/`to` for one known party number in international form, and `number` to search either side by fragment. These are per-call records: for rates and totals over a period use voice_stats_summary rather than summing them here, and voice_get to follow one call to settlement.\n *\n * @example Iterate the calls happening right now\n * for await (const call of bird.voice.list({ status: [\"ringing\", \"in_progress\"] })) {\n * console.log(call.id, call.status);\n * }\n */\n list(query?: VoiceListQuery, options?: RequestOptions): PaginatedPromise<VoiceCall> {\n return this.paginated<VoiceCall>(\"GET\", options, ({ signal, headers }, cursor) =>\n listVoiceCalls({ client: this.client, query: { ...query, starting_after: cursor ?? query?.starting_after }, headers, signal }));\n }\n\n /**\n * Fetch one call by id, at any point in its lifecycle. A call still ringing or connected carries no economics yet: `duration_ms`, `billable_ms`, `ended_at`, and `cost` are null until it ends, and this same id then answers with the settled record. Poll here to watch one known call; use voice_list to find calls in the first place. When a call was refused, `rejection_reason` names the gate that turned it away.\n *\n * @example Read one call back\n * const call = await bird.voice.get(\"vcl_01k0p3v9wera3v6q6xw3e9y2mh\");\n * // A call still ringing or connected carries no economics yet.\n * call.status; // \"answered\" | \"no_answer\" | \"ringing\" | …\n */\n get(callId: string, options?: RequestOptions): APIPromise<VoiceCall> {\n return this.call<VoiceCall>(\"GET\", options, ({ signal, headers }) =>\n getVoiceCall({ client: this.client, path: { call_id: callId }, headers, signal }));\n }\n}\n","// Code generated by surface-gen; DO NOT EDIT.\nimport { createVerification, createVerificationCheck, createVerificationNextChannel } from \"../generated/sdk.gen.js\";\nimport type { CreateVerificationCheckData, CreateVerificationData, CreateVerificationNextChannelData, Verification, VerificationCheckResult } from \"../generated/types.gen.js\";\nimport { Resource } from \"./base.js\";\nimport type { APIPromise, RequestOptions } from \"../core/result.js\";\n\nexport type { Verification };\nexport type { VerificationCheckResult };\nexport type VerifyVerificationsCreateParams = NonNullable<CreateVerificationData[\"body\"]>;\nexport type VerifyVerificationsCheckParams = NonNullable<CreateVerificationCheckData[\"body\"]>;\nexport type VerifyVerificationsNextChannelParams = NonNullable<CreateVerificationNextChannelData[\"body\"]>;\n\nexport class VerifyVerificationsResource extends Resource {\n /**\n * Start a verification: generate a one-time passcode and send it to the recipient in `to` (a phone number over the phone channels enabled for its destination country; an email address over email; or both). It is sent over one channel at a time and fails over to the next in the plan, never over two at once. Calling again for the same recipient reuses the in-progress verification and sends a fresh code after the resend cooldown; it does not start a second one, so use this both to send and to resend. The passcode is never returned; submit what the recipient enters with verify_verifications_check. SMS delivery draws on the workspace's SMS balance.\n *\n * @example Start a verification over SMS\n * const verification = await bird.verify.verifications.create({\n * to: { phone_number: \"+15551234567\" },\n * });\n * console.log(verification.id, verification.status);\n */\n create(params: VerifyVerificationsCreateParams, options?: RequestOptions): APIPromise<Verification> {\n return this.call<Verification>(\"POST\", options, ({ signal, headers }) =>\n createVerification({ client: this.client, body: params, headers, signal }));\n }\n\n /**\n * Check a passcode a recipient submitted. Identify the verification by the same `to` recipient used to start it; no verification id needed. A wrong or expired code returns HTTP 200 with `success: false` and a `reason` (for example `incorrect_code` or `expired`), not an error. A verification that has already reached a final state is no longer checkable and returns 404, as does a missing verification; malformed input or rate limiting is also an error status.\n *\n * @example Check a submitted passcode\n * const result = await bird.verify.verifications.check({\n * to: { phone_number: \"+15551234567\" },\n * code: \"123456\",\n * });\n * console.log(result.success);\n */\n check(params: VerifyVerificationsCheckParams, options?: RequestOptions): APIPromise<VerificationCheckResult> {\n return this.call<VerificationCheckResult>(\"POST\", options, ({ signal, headers }) =>\n createVerificationCheck({ client: this.client, body: params, headers, signal }));\n }\n\n /**\n * Advance an in-progress verification to the next channel in its plan and send a fresh passcode there: the \"I didn't receive my code\" action. The verification is identified by the same `to` recipient used to start it, with no verification id needed. The send bypasses the resend cooldown, and earlier passcodes stay valid. Returns the verification with `last_channel` set to the channel the new code went to; when concurrent advances race for the same recipient, the response reflects committed state: `last_channel` names the most recent completed send, and the racing call that completed the newer send is authoritative. A plan with no further channel returns a 422 named NoNextChannel, after which only re-creating the verification will resend.\n *\n * @example Send the code again on the next channel\n * const verification = await bird.verify.verifications.nextChannel({\n * to: { phone_number: \"+15551234567\" },\n * });\n * console.log(verification.last_channel);\n */\n nextChannel(params: VerifyVerificationsNextChannelParams, options?: RequestOptions): APIPromise<Verification> {\n return this.call<Verification>(\"POST\", options, ({ signal, headers }) =>\n createVerificationNextChannel({ client: this.client, body: params, headers, signal }));\n }\n}\n","// `bird.verify` — the Verify product. `bird.verify.verifications.create(...)` starts\n// a verification (sends a one-time passcode); `.check(...)` checks the passcode a\n// recipient submits.\n\nimport { Resource } from \"./base.js\";\nimport { VerifyVerificationsResource } from \"./verifyVerifications.gen.js\";\n\n/** The Verify product namespace — holds the `verifications` collection. */\nexport class VerifyResource {\n readonly verifications: VerifyVerificationsResource;\n constructor(...args: ConstructorParameters<typeof Resource>) {\n this.verifications = new VerifyVerificationsResource(...args);\n }\n}\n","// `bird.webhooks` — verifies a delivered payload's Standard Webhooks signature\n// and returns it as a typed, discriminated event union. Pure crypto: it never\n// touches the transport layer, so it carries no client/core dependency.\n\nimport { Webhook } from \"standardwebhooks\";\nimport type { WebhookEvent } from \"../generated/types.gen.js\";\nimport { BirdWebhookVerificationError } from \"../errors.js\";\n\n/** A verified webhook event, discriminated on `type`. */\nexport type BirdWebhookEvent = WebhookEvent;\n\n/** Inbound request headers, as a `Headers` object or a plain record. */\nexport type WebhookHeaders = Headers | Record<string, string>;\n\n/** Client-level webhooks config (`new BirdClient({ webhooks: { secret } })`). */\nexport interface WebhookOptions {\n /** Signing secret used by `unwrap`; a per-call `secret` overrides it. */\n secret?: string;\n}\n\nexport class WebhooksResource {\n readonly #secret?: string;\n\n constructor(config?: WebhookOptions) {\n this.#secret = config?.secret;\n }\n\n /**\n * Verify a webhook delivery and return the typed event.\n *\n * **Pass the raw request body**, exactly as received — do NOT parse it first.\n * The Standard Webhooks signature is computed over the raw bytes, so parsing\n * and re-serializing before verifying is the classic webhook bug.\n *\n * The secret comes from `webhooks.secret` on the client; pass `{ secret }` to\n * override per call. Throws {@link BirdWebhookVerificationError} on a bad\n * signature, a stale timestamp, or missing/malformed headers. Unknown event\n * types are returned as-is (handle them in a `default` case) so a newer server\n * event can't break an older SDK.\n *\n * @example One call verifies the signature and returns the typed event\n * // Pass the RAW request body; set the secret via new BirdClient({ webhooks: { secret } }).\n * const event = bird.webhooks.unwrap(rawBody, headers);\n * console.log(event.type); // discriminated union: narrow on event.type\n *\n * @example Verify and dispatch: pass the raw request body, never the parsed JSON\n * // new BirdClient({ apiKey, webhooks: { secret } })\n * try {\n * const event = bird.webhooks.unwrap(rawBody, req.headers);\n * switch (event.type) {\n * case \"email.delivered\":\n * markDelivered(event.data.email_id, event.data.recipient); // narrowed by event.type\n * break;\n * case \"email.bounced\":\n * case \"email.complained\":\n * suppress(event.data.recipient);\n * break;\n * default: // unknown future event types — an older SDK won't break on a new one\n * }\n * } catch (err) {\n * if (err instanceof BirdWebhookVerificationError) {\n * // reject with 400 — bad signature, stale timestamp, or missing/malformed headers\n * } else throw err;\n * }\n */\n unwrap(\n payload: string,\n headers: WebhookHeaders,\n options?: WebhookOptions,\n ): BirdWebhookEvent {\n const secret = options?.secret ?? this.#secret;\n if (!secret) {\n throw new Error(\n \"No webhook secret. Set `webhooks: { secret }` on the client, or pass `{ secret }` to unwrap.\",\n );\n }\n const wh = new Webhook(secret);\n let verified: unknown;\n try {\n verified = wh.verify(payload, toHeaderRecord(headers));\n } catch (err) {\n throw new BirdWebhookVerificationError(\n err instanceof Error\n ? err.message\n : \"Webhook signature verification failed\",\n );\n }\n // `verify` returns `unknown`; the payload is authenticated and the wire\n // schema is `additionalProperties: false`, so the assertion is sound here.\n return verified as BirdWebhookEvent;\n }\n}\n\nfunction toHeaderRecord(headers: WebhookHeaders): Record<string, string> {\n return headers instanceof Headers ? Object.fromEntries(headers) : headers;\n}\n","// Code generated by surface-gen; DO NOT EDIT.\nimport { publishRealtimeAppBatch, publishRealtimeAppEvent } from \"../generated/sdk.gen.js\";\nimport type { PublishRealtimeAppBatchData, PublishRealtimeAppEventData, RealtimeBatchPublishResult, RealtimePublishResult } from \"../generated/types.gen.js\";\nimport { Resource } from \"./base.js\";\nimport type { APIPromise, RequestOptions } from \"../core/result.js\";\n\nexport type { RealtimePublishResult };\nexport type { RealtimeBatchPublishResult };\nexport type RealtimePublishParams = NonNullable<PublishRealtimeAppEventData[\"body\"]>;\nexport type RealtimePublishBatchParams = NonNullable<PublishRealtimeAppBatchData[\"body\"]>;\n\nexport class RealtimeResourceBase extends Resource {\n /**\n * @example Broadcast an event to a channel\n * const result = await bird.realtime.publish(\"rap_01krdgeqcxet5s7t44vh8rt9mg\", {\n * event: \"order.updated\",\n * channels: [\"orders\", \"presence-lobby\"],\n * data: { order_id: \"ord_123\", status: \"shipped\" },\n * });\n * console.log(result.data?.length); // one entry per channel\n */\n publish(realtimeAppId: string, params: RealtimePublishParams, options?: RequestOptions): APIPromise<RealtimePublishResult> {\n return this.call<RealtimePublishResult>(\"POST\", options, ({ signal, headers }) =>\n publishRealtimeAppEvent({ client: this.client, path: { realtime_app_id: realtimeAppId }, body: params, headers, signal }), [\"RealtimeKey\", \"RealtimeSecret\"]);\n }\n\n /**\n * @example Publish two events in one call\n * await bird.realtime.publishBatch(\"rap_01krdgeqcxet5s7t44vh8rt9mg\", {\n * events: [\n * { event: \"order.created\", channel: \"orders\", data: { id: 1 } },\n * { event: \"order.updated\", channel: \"orders\", data: { id: 2 } },\n * ],\n * });\n */\n publishBatch(realtimeAppId: string, params: RealtimePublishBatchParams, options?: RequestOptions): APIPromise<RealtimeBatchPublishResult> {\n return this.call<RealtimeBatchPublishResult>(\"POST\", options, ({ signal, headers }) =>\n publishRealtimeAppBatch({ client: this.client, path: { realtime_app_id: realtimeAppId }, body: params, headers, signal }), [\"RealtimeKey\", \"RealtimeSecret\"]);\n }\n}\n","// Code generated by surface-gen; DO NOT EDIT.\nimport { getRealtimeAppChannel, listRealtimeAppChannelMembers, listRealtimeAppChannels } from \"../generated/sdk.gen.js\";\nimport type { GetRealtimeAppChannelData, ListRealtimeAppChannelMembersData, ListRealtimeAppChannelsData, RealtimeChannelInfo, RealtimeChannelMembers, RealtimeChannelsList } from \"../generated/types.gen.js\";\nimport { Resource } from \"./base.js\";\nimport type { APIPromise, RequestOptions } from \"../core/result.js\";\n\nexport type { RealtimeChannelsList };\nexport type { RealtimeChannelInfo };\nexport type { RealtimeChannelMembers };\nexport type RealtimeChannelListQuery = NonNullable<ListRealtimeAppChannelsData[\"query\"]>;\nexport type RealtimeChannelGetQuery = NonNullable<GetRealtimeAppChannelData[\"query\"]>;\n\nexport class RealtimeChannelsResource extends Resource {\n /**\n * @example List the occupied presence channels with their member counts\n * const { data } = await bird.realtime.channels.list(\"rap_01krdgeqcxet5s7t44vh8rt9mg\", {\n * prefix: \"presence-\",\n * include: [\"member_count\"],\n * });\n * for (const channel of data) console.log(channel.name, channel.member_count);\n */\n list(realtimeAppId: string, query?: RealtimeChannelListQuery, options?: RequestOptions): APIPromise<RealtimeChannelsList> {\n return this.call<RealtimeChannelsList>(\"GET\", options, ({ signal, headers }) =>\n listRealtimeAppChannels({ client: this.client, path: { realtime_app_id: realtimeAppId }, query, headers, signal }), [\"RealtimeKey\", \"RealtimeSecret\"]);\n }\n\n /**\n * @example Check whether anyone is in a channel\n * const channel = await bird.realtime.channels.get(\"rap_01krdgeqcxet5s7t44vh8rt9mg\", \"presence-lobby\", {\n * include: [\"member_count\"],\n * });\n * console.log(channel.occupied, channel.member_count);\n */\n get(realtimeAppId: string, channelName: string, query?: RealtimeChannelGetQuery, options?: RequestOptions): APIPromise<RealtimeChannelInfo> {\n return this.call<RealtimeChannelInfo>(\"GET\", options, ({ signal, headers }) =>\n getRealtimeAppChannel({ client: this.client, path: { realtime_app_id: realtimeAppId, channel_name: channelName }, query, headers, signal }), [\"RealtimeKey\", \"RealtimeSecret\"]);\n }\n\n /**\n * @example Who is in the lobby\n * const { members } = await bird.realtime.channels.members(\"rap_01krdgeqcxet5s7t44vh8rt9mg\", \"presence-lobby\");\n * for (const member of members) console.log(member.member_id);\n */\n members(realtimeAppId: string, channelName: string, options?: RequestOptions): APIPromise<RealtimeChannelMembers> {\n return this.call<RealtimeChannelMembers>(\"GET\", options, ({ signal, headers }) =>\n listRealtimeAppChannelMembers({ client: this.client, path: { realtime_app_id: realtimeAppId, channel_name: channelName }, headers, signal }), [\"RealtimeKey\", \"RealtimeSecret\"]);\n }\n}\n","// Code generated by surface-gen; DO NOT EDIT.\nimport { disconnectRealtimeAppMember, sendRealtimeAppMemberEvent } from \"../generated/sdk.gen.js\";\nimport type { DisconnectRealtimeAppMemberData, SendRealtimeAppMemberEventData } from \"../generated/types.gen.js\";\nimport { Resource } from \"./base.js\";\nimport type { APIPromise, RequestOptions } from \"../core/result.js\";\n\nexport type RealtimeMemberSendParams = NonNullable<SendRealtimeAppMemberEventData[\"body\"]>;\n\nexport class RealtimeMembersResource extends Resource {\n /**\n * @example Notify one person wherever they are signed in\n * await bird.realtime.members.send(\"rap_01krdgeqcxet5s7t44vh8rt9mg\", \"user_42\", {\n * event: \"order-shipped\",\n * data: { order_id: \"ord_123\" },\n * });\n */\n send(realtimeAppId: string, memberId: string, params: RealtimeMemberSendParams, options?: RequestOptions): APIPromise<void> {\n return this.call<void>(\"POST\", options, ({ signal, headers }) =>\n sendRealtimeAppMemberEvent({ client: this.client, path: { realtime_app_id: realtimeAppId, member_id: memberId }, body: params, headers, signal }), [\"RealtimeKey\", \"RealtimeSecret\"]);\n }\n\n /**\n * @example Kick a member off every connection\n * await bird.realtime.members.disconnect(\"rap_01krdgeqcxet5s7t44vh8rt9mg\", \"user_42\");\n */\n disconnect(realtimeAppId: string, memberId: string, options?: RequestOptions): APIPromise<void> {\n return this.call<void>(\"POST\", options, ({ signal, headers }) =>\n disconnectRealtimeAppMember({ client: this.client, path: { realtime_app_id: realtimeAppId, member_id: memberId }, headers, signal }), [\"RealtimeKey\", \"RealtimeSecret\"]);\n }\n}\n","// `bird.realtime` — publish to Realtime channels, plus the `channels` and\n// `members` collections nested under it.\n//\n// Every Realtime operation authenticates to the Realtime edge with the app's own\n// key/secret pair on top of the workspace API key. Those are credentials, so pass\n// them as client config (`realtime: { key, secret }`); the request core stamps\n// them on the operations that declare them.\n\nimport type {\n RealtimeChannelInclude,\n RealtimeChannelListItem,\n RealtimeChannelMember,\n} from \"../generated/types.gen.js\";\nimport { RealtimeResourceBase } from \"./realtime.gen.js\";\nimport { RealtimeChannelsResource } from \"./realtimeChannels.gen.js\";\nimport { RealtimeMembersResource } from \"./realtimeMembers.gen.js\";\nimport { Resource } from \"./base.js\";\n\nexport type {\n RealtimePublishBatchParams,\n RealtimeBatchPublishResult,\n} from \"./realtime.gen.js\";\n\n// The rest of the Realtime surface, re-exported here so `bird.realtime`'s public\n// types have one import site regardless of which file generates them.\nexport type { RealtimeChannelInclude, RealtimeChannelListItem, RealtimeChannelMember };\nexport type {\n RealtimePublishParams,\n RealtimePublishResult,\n} from \"./realtime.gen.js\";\nexport type {\n RealtimeChannelsList,\n RealtimeChannelInfo,\n RealtimeChannelMembers,\n RealtimeChannelListQuery,\n RealtimeChannelGetQuery,\n} from \"./realtimeChannels.gen.js\";\nexport type { RealtimeMemberSendParams } from \"./realtimeMembers.gen.js\";\n\n/**\n * Realtime app credentials — `new BirdClient({ realtime: { key, secret } })`.\n * They come from the app's credentials (shown once at creation) and must belong\n * to the calling workspace.\n */\nexport interface RealtimeOptions {\n /** The Realtime app key, sent as `X-Realtime-Key`. */\n key?: string;\n /** The Realtime app secret, sent as `X-Realtime-Secret`. */\n secret?: string;\n}\n\n/**\n * `bird.realtime` — publish events to a Realtime app's channels and inspect its\n * live state. Reached as `bird.realtime.*`.\n */\nexport class RealtimeResource extends RealtimeResourceBase {\n /** Channel state — `bird.realtime.channels.list(...)`, `.get(...)`, `.members(...)`. */\n readonly channels: RealtimeChannelsResource;\n\n /** Members — `bird.realtime.members.send(...)`, `.disconnect(...)`. */\n readonly members: RealtimeMembersResource;\n\n constructor(\n core: ConstructorParameters<typeof Resource>[0],\n client: ConstructorParameters<typeof Resource>[1],\n ) {\n super(core, client);\n this.channels = new RealtimeChannelsResource(core, client);\n this.members = new RealtimeMembersResource(core, client);\n }\n\n}\n","import {\n createClient,\n createConfig,\n type Client,\n} from \"./generated/client/index.js\";\nimport { baseUrlForRegion, regionFromApiKey } from \"./region.js\";\nimport { detectCaller } from \"./detect-caller.js\";\nimport {\n BirdHTTPClient,\n type AttemptContext,\n type FetchOutcome,\n} from \"./core/http.js\";\nimport {\n apiPromise,\n type APIPromise,\n type RequestOptions,\n} from \"./core/result.js\";\nimport { EmailResource, type EmailChannelDefaults } from \"./resources/email.js\";\nimport { AudiencesResource } from \"./resources/audiences.gen.js\";\nimport { DomainsResource } from \"./resources/domains.gen.js\";\nimport { ContactPropertiesResource } from \"./resources/contactProperties.gen.js\";\nimport { ContactsResource } from \"./resources/contacts.gen.js\";\nimport { SmsResource } from \"./resources/sms.js\";\nimport { SmsTemplatesResource } from \"./resources/smsTemplates.gen.js\";\nimport { WhatsappResource } from \"./resources/whatsapp.js\";\nimport { VoiceResource } from \"./resources/voice.gen.js\";\nimport { VerifyResource } from \"./resources/verify.js\";\nimport { WebhooksResource, type WebhookOptions } from \"./resources/webhooks.js\";\nimport { RealtimeResource, type RealtimeOptions } from \"./resources/realtime.js\";\n\n// The SDK's own version, sent as User-Agent. Injected at build time from\n// package.json (tsdown/vitest `define`) so it never drifts from the published\n// version. Distinct from the Bird API version (X-Bird-API-Version)\n// which is deferred — see sdk-build-ledger #3.\ndeclare const __SDK_VERSION__: string;\nconst DEFAULT_TIMEOUT_MS = 60_000;\nconst DEFAULT_MAX_RETRIES = 2;\n\nexport interface BirdClientOptions {\n apiKey: string;\n /** Explicit base URL; overrides region resolution. For local/self-hosted use. */\n baseUrl?: string;\n /** Region override (e.g. `\"eu1\"`); the API key prefix is used by default. */\n region?: string;\n /** Per-attempt timeout in ms. Default 60_000. */\n timeout?: number;\n /** Max retry attempts on retryable failures (429, 5xx, network). Default 2. */\n maxRetries?: number;\n /** Custom fetch — testing, proxying, edge-runtime adapters. Default global fetch. */\n fetch?: typeof fetch;\n /** Headers added to every request. SDK-internal headers win on conflict. */\n defaultHeaders?: Record<string, string>;\n /**\n * Email channel defaults. Any field set here may be omitted in\n * `bird.email.send` (the type enforces this); the per-send value wins.\n */\n email?: EmailChannelDefaults;\n /** Webhooks config — `secret` is the default used by `bird.webhooks.unwrap`. */\n webhooks?: WebhookOptions;\n /**\n * Realtime app credentials. Every `bird.realtime.*` call authenticates to the\n * Realtime edge with this key/secret pair; a call's options can override it.\n */\n realtime?: RealtimeOptions;\n}\n\n/** A raw request for the `bird.request` escape hatch. */\nexport interface BirdRequest {\n method: \"GET\" | \"POST\" | \"PUT\" | \"PATCH\" | \"DELETE\";\n /**\n * Absolute path on the API host, e.g. `/v1/email/domains`; must start\n * with a single `/`.\n */\n path: string;\n query?: Record<string, string | number | boolean | undefined>;\n /** JSON request body. */\n body?: unknown;\n headers?: Record<string, string>;\n}\n\n// Extract the email-channel defaults from the (literal) options type, or\n// `undefined` when none were set — drives whether `send` requires `from` etc.\ntype EmailDefaultsOf<O> = O extends {\n email: infer E extends EmailChannelDefaults;\n}\n ? E\n : undefined;\n\n// Precedence: explicit baseUrl, then explicit region, then the key's region\n// prefix. There is no region-less data-plane host, so an unresolvable region throws.\nfunction resolveBaseUrl(options: BirdClientOptions): string {\n if (options.baseUrl) return options.baseUrl;\n const region = options.region ?? regionFromApiKey(options.apiKey);\n if (!region) {\n throw new Error(\n \"Unable to determine region: API key is not in the expected \" +\n \"bk_{region}_{token} format. Pass an explicit `region` or `baseUrl`.\",\n );\n }\n return baseUrlForRegion(region);\n}\n\n// The raw escape hatch accepts caller-supplied paths. Require an absolute path\n// segment (not an authority-relative URL) and assert the final origin before\n// attaching SDK auth headers.\nfunction resolveRawRequestUrl(baseUrl: string, path: string): URL {\n if (!path.startsWith(\"/\") || path.startsWith(\"//\")) {\n throw new TypeError(\n \"bird.request path must be an absolute path starting with a single `/`\",\n );\n }\n const base = new URL(baseUrl);\n const url = new URL(baseUrl + path);\n if (url.origin !== base.origin) {\n throw new TypeError(\n \"bird.request path must stay on the configured Bird API origin\",\n );\n }\n return url;\n}\n\n/**\n * The Bird API client. Construct it with an API key; the region is taken from\n * the key's prefix (`bk_{region}_…`) — pass `baseUrl` or `region` to override.\n *\n * @example Construct and send\n * const bird = new BirdClient({ apiKey: process.env.BIRD_API_KEY! });\n * const msg = await bird.email.send({\n * from: \"hello@acme.com\",\n * to: [\"customer@example.com\"],\n * subject: \"Welcome aboard\",\n * html: \"<h1>Hi there 👋</h1>\",\n * });\n * console.log(msg.id);\n *\n * @example Channel defaults — set common send fields once; a per-send value always wins\n * const bird = new BirdClient({\n * apiKey: process.env.BIRD_API_KEY!,\n * email: { from: \"hello@acme.com\", category: \"transactional\" },\n * });\n * // `from` and `category` are filled from the defaults; both stay optional in `send`.\n * await bird.email.send({ to: [\"customer@example.com\"], subject: \"Hi\", html: \"<p>hi</p>\" });\n *\n * @example All client options\n * const bird = new BirdClient({\n * apiKey: process.env.BIRD_API_KEY!,\n * region: \"eu1\", // optional — override the region from the key prefix\n * baseUrl: \"http://localhost:8080\", // optional — overrides region entirely (local/self-hosted)\n * timeout: 60_000, // per-attempt timeout in ms (default 60_000)\n * maxRetries: 2, // retry budget for transient failures (default 2)\n * });\n */\nexport class BirdClient<const O extends BirdClientOptions = BirdClientOptions> {\n protected readonly core: BirdHTTPClient;\n\n // The generated hey-api client, configured with this instance's base URL,\n // auth, and fetch. Resources call the generated SDK functions through it.\n readonly #client: Client;\n readonly #baseUrl: string;\n readonly #fetch: typeof fetch;\n readonly #headers: Record<string, string>;\n\n /** The email channel — `bird.email.send(...)`, `.get(...)`, `.list(...)`. */\n readonly email: EmailResource<EmailDefaultsOf<O>>;\n\n\n /** The SMS channel — `bird.sms.send(...)`, `.get(...)`, `.list(...)`. */\n readonly sms: SmsResource;\n\n /** SMS templates — `bird.smsTemplates.list(...)`, `.get(...)`. */\n readonly smsTemplates: SmsTemplatesResource;\n\n /** The WhatsApp channel — `bird.whatsapp.send(...)`, `.get(...)`, `.list(...)`, `.listEvents(...)`. */\n readonly whatsapp: WhatsappResource;\n\n /** The Voice call log — `bird.voice.list(...)`, `.get(...)`. Calls are placed by your own SIP equipment, so this is a read surface. */\n readonly voice: VoiceResource;\n\n /** The Verify product — `bird.verify.verifications.create(...)`, `.check(...)`. */\n readonly verify: VerifyResource;\n\n /** Contacts — `bird.contacts.create(...)`, `.list(...)`, `.get(...)`, `.batch(...)`, … */\n readonly contacts: ContactsResource;\n\n /** Audiences — `bird.audiences.create(...)`, `.list(...)`, `.addContacts(...)`, … */\n readonly audiences: AudiencesResource;\n\n /** Contact properties — `bird.contactProperties.create(...)`, `.list(...)`, `.archive(...)`, … */\n readonly contactProperties: ContactPropertiesResource;\n\n /** Sending domains — `bird.domains.create(...)`, `.list(...)`, `.verify(...)`, … */\n readonly domains: DomainsResource;\n\n /** Webhooks — `bird.webhooks.unwrap(payload, headers)` verifies an inbound delivery. */\n readonly webhooks: WebhooksResource;\n\n\n\n\n /** Realtime — `bird.realtime.publish(...)`, `.channels.list(...)`, `.members.disconnect(...)`, … */\n readonly realtime: RealtimeResource;\n\n constructor(options: O) {\n const opts: BirdClientOptions = options; // widen for safe optional access\n this.#baseUrl = resolveBaseUrl(opts);\n this.#fetch = opts.fetch ?? fetch;\n this.#headers = {\n ...opts.defaultHeaders,\n Authorization: `Bearer ${opts.apiKey}`,\n \"User-Agent\": `bird-sdk-js/${__SDK_VERSION__}`,\n // Bird-* client-identity headers: the API attributes the SDK\n // surface from these, not the User-Agent. Edge-safe, so no os/arch/runtime\n // (those need Node globals this SDK must not touch); surface + version only.\n \"Bird-Surface\": \"sdk-js\",\n \"Bird-Version\": __SDK_VERSION__,\n };\n // Bird-Caller (the driving agent harness) — empty on a browser / when no\n // agent env is present, in which case the header is omitted.\n const caller = detectCaller();\n if (caller) this.#headers[\"Bird-Caller\"] = caller;\n this.#client = createClient(\n createConfig({\n baseUrl: this.#baseUrl,\n fetch: this.#fetch,\n headers: this.#headers,\n }),\n );\n this.core = new BirdHTTPClient({\n timeout: opts.timeout ?? DEFAULT_TIMEOUT_MS,\n maxRetries: opts.maxRetries ?? DEFAULT_MAX_RETRIES,\n credentials: {\n RealtimeKey: {\n header: \"X-Realtime-Key\",\n value: opts.realtime?.key,\n how: \"Set `realtime: { key, secret }` on the client.\",\n },\n RealtimeSecret: {\n header: \"X-Realtime-Secret\",\n value: opts.realtime?.secret,\n how: \"Set `realtime: { key, secret }` on the client.\",\n },\n },\n });\n // The runtime value is the configured defaults (or undefined); the precise\n // conditional type can't be reproved from the widened access, so assert it.\n this.email = new EmailResource<EmailDefaultsOf<O>>(\n this.core,\n this.#client,\n opts.email as EmailDefaultsOf<O>,\n );\n this.sms = new SmsResource(this.core, this.#client);\n this.smsTemplates = new SmsTemplatesResource(this.core, this.#client);\n this.whatsapp = new WhatsappResource(this.core, this.#client);\n this.voice = new VoiceResource(this.core, this.#client);\n this.verify = new VerifyResource(this.core, this.#client);\n this.contacts = new ContactsResource(this.core, this.#client);\n this.audiences = new AudiencesResource(this.core, this.#client);\n this.contactProperties = new ContactPropertiesResource(\n this.core,\n this.#client,\n );\n this.domains = new DomainsResource(this.core, this.#client);\n this.webhooks = new WebhooksResource(opts.webhooks);\n this.realtime = new RealtimeResource(this.core, this.#client);\n }\n\n /**\n * Escape hatch for endpoints the typed resources don't cover. Runs the full\n * lifecycle (auth, retries, idempotency, error mapping); you supply the\n * response type. Prefer a typed resource method where one exists.\n *\n * @throws {TypeError} if `req.path` does not start with exactly one `/` or\n * resolves to a different origin than the configured Bird API base URL.\n *\n * @example Reach an endpoint outside the curated surface — you supply the response type\n * type Suppressions = { data: Array<{ recipient: string }> };\n * const suppressions = await bird.request<Suppressions>({ method: \"GET\", path: \"/v1/email/suppressions\" });\n * console.log(suppressions.data.length);\n */\n request<T = unknown>(\n req: BirdRequest,\n options?: RequestOptions,\n ): APIPromise<T> {\n const url = resolveRawRequestUrl(this.#baseUrl, req.path);\n return apiPromise(\n this.core.request<T>(\n (ctx) => this.#raw<T>(url, req, ctx, options?.headers),\n {\n method: req.method,\n idempotencyKey: options?.idempotencyKey,\n signal: options?.signal,\n timeout: options?.timeout,\n maxRetries: options?.maxRetries,\n },\n ),\n );\n }\n\n async #raw<T>(\n url: URL,\n req: BirdRequest,\n ctx: AttemptContext,\n extraHeaders?: Record<string, string>,\n ): Promise<FetchOutcome<T>> {\n url = new URL(url);\n if (req.query) {\n for (const [key, value] of Object.entries(req.query)) {\n if (value !== undefined) url.searchParams.set(key, String(value));\n }\n }\n // SDK-internal headers (auth, idempotency) win over caller-supplied ones.\n const headers: Record<string, string> = {\n ...extraHeaders,\n ...this.#headers,\n };\n if (ctx.idempotencyKey) headers[\"Idempotency-Key\"] = ctx.idempotencyKey;\n if (req.body !== undefined) headers[\"Content-Type\"] = \"application/json\";\n\n const response = await this.#fetch(url, {\n method: req.method,\n headers,\n body: req.body !== undefined ? JSON.stringify(req.body) : undefined,\n signal: ctx.signal,\n });\n\n if (response.ok) {\n const data =\n response.status === 204\n ? undefined\n : await response.json().catch(() => undefined);\n // Caller supplies T; the raw JSON is asserted to it (escape hatch — untyped path).\n return { data: data as T, response };\n }\n const error = await response\n .clone()\n .json()\n .catch(() => undefined);\n return { error, response };\n }\n}\n","// Code generated by beak gen:event-consts. DO NOT EDIT.\n\n/**\n * Webhook event types known at this SDK version. The wire value is an open\n * string: a value added by a newer server is returned by `unwrap` unchanged,\n * so switch on these with a `default` branch.\n */\nexport const WebhookEventType = {\n DomainFailed: \"domain.failed\",\n DomainVerified: \"domain.verified\",\n EmailAccepted: \"email.accepted\",\n EmailBounced: \"email.bounced\",\n EmailCanceled: \"email.canceled\",\n EmailClicked: \"email.clicked\",\n EmailComplained: \"email.complained\",\n EmailDeferred: \"email.deferred\",\n EmailDelivered: \"email.delivered\",\n EmailListUnsubscribed: \"email.list_unsubscribed\",\n EmailMailboxMessageDelivered: \"email_mailbox.message_delivered\",\n EmailMailboxMessageFailed: \"email_mailbox.message_failed\",\n EmailMailboxMessageReceived: \"email_mailbox.message_received\",\n EmailMailboxMessageSent: \"email_mailbox.message_sent\",\n EmailMailboxSuspended: \"email_mailbox.suspended\",\n EmailMailboxThreadCreated: \"email_mailbox.thread_created\",\n EmailOpened: \"email.opened\",\n EmailOutOfBandBounce: \"email.out_of_band_bounce\",\n EmailProcessed: \"email.processed\",\n EmailReceived: \"email.received\",\n EmailRejected: \"email.rejected\",\n EmailScheduled: \"email.scheduled\",\n EmailSuppressionCreated: \"email_suppression.created\",\n EmailUnsubscribed: \"email.unsubscribed\",\n SmsAccepted: \"sms.accepted\",\n SmsDelivered: \"sms.delivered\",\n SmsExpired: \"sms.expired\",\n SmsFailed: \"sms.failed\",\n SmsReceived: \"sms.received\",\n SmsRejected: \"sms.rejected\",\n SmsSent: \"sms.sent\",\n SmsUndelivered: \"sms.undelivered\",\n VerifyAttemptDelivered: \"verify.attempt.delivered\",\n VerifyAttemptSent: \"verify.attempt.sent\",\n VerifyAttemptUndelivered: \"verify.attempt.undelivered\",\n VerifyVerificationCreated: \"verify.verification.created\",\n VerifyVerificationVerified: \"verify.verification.verified\",\n VoiceCallAnswered: \"voice_call.answered\",\n VoiceCallEnded: \"voice_call.ended\",\n VoiceCallInitiated: \"voice_call.initiated\",\n WhatsappAccepted: \"whatsapp.accepted\",\n WhatsappDelivered: \"whatsapp.delivered\",\n WhatsappFailed: \"whatsapp.failed\",\n WhatsappRead: \"whatsapp.read\",\n WhatsappRejected: \"whatsapp.rejected\",\n WhatsappSent: \"whatsapp.sent\",\n} as const;\n\n/** A known webhook event type value. */\nexport type WebhookEventTypeValue =\n (typeof WebhookEventType)[keyof typeof WebhookEventType];\n","// Code generated by beak gen:event-consts. DO NOT EDIT.\n\n/**\n * Values of EmailEventType known at this SDK version. The wire value is an open\n * string: a value added by a newer server deserializes unchanged, so switch on\n * these with a `default` branch rather than treating the set as closed.\n */\nexport const EmailEventType = {\n EmailAccepted: \"email.accepted\",\n EmailBounced: \"email.bounced\",\n EmailCanceled: \"email.canceled\",\n EmailClicked: \"email.clicked\",\n EmailComplained: \"email.complained\",\n EmailDeferred: \"email.deferred\",\n EmailDelivered: \"email.delivered\",\n EmailListUnsubscribed: \"email.list_unsubscribed\",\n EmailOpened: \"email.opened\",\n EmailOutOfBandBounce: \"email.out_of_band_bounce\",\n EmailProcessed: \"email.processed\",\n EmailRejected: \"email.rejected\",\n EmailScheduled: \"email.scheduled\",\n EmailUnsubscribed: \"email.unsubscribed\",\n} as const;\n\n/** A known EmailEventType value. */\nexport type EmailEventTypeValue = (typeof EmailEventType)[keyof typeof EmailEventType];\n\n/**\n * Values of SMSErrorCode known at this SDK version. The wire value is an open\n * string: a value added by a newer server deserializes unchanged, so switch on\n * these with a `default` branch rather than treating the set as closed.\n */\nexport const SMSErrorCode = {\n BlockedByCarrier: \"blocked_by_carrier\",\n BlockedByRecipient: \"blocked_by_recipient\",\n ContentRejected: \"content_rejected\",\n InsufficientBalance: \"insufficient_balance\",\n InvalidDestination: \"invalid_destination\",\n LandlineUnreachable: \"landline_unreachable\",\n ProviderUnavailable: \"provider_unavailable\",\n RecipientOptedOut: \"recipient_opted_out\",\n SenderUnregistered: \"sender_unregistered\",\n Unknown: \"unknown\",\n Unreachable: \"unreachable\",\n} as const;\n\n/** A known SMSErrorCode value. */\nexport type SMSErrorCodeValue = (typeof SMSErrorCode)[keyof typeof SMSErrorCode];\n\n/**\n * Values of VerificationAttemptFailureReason known at this SDK version. The wire value is an open\n * string: a value added by a newer server deserializes unchanged, so switch on\n * these with a `default` branch rather than treating the set as closed.\n */\nexport const VerificationAttemptFailureReason = {\n CarrierRejected: \"carrier_rejected\",\n ChannelDisabled: \"channel_disabled\",\n ChannelUnavailable: \"channel_unavailable\",\n DeliveryTimeout: \"delivery_timeout\",\n HardBounce: \"hard_bounce\",\n SoftBounce: \"soft_bounce\",\n Undelivered: \"undelivered\",\n} as const;\n\n/** A known VerificationAttemptFailureReason value. */\nexport type VerificationAttemptFailureReasonValue = (typeof VerificationAttemptFailureReason)[keyof typeof VerificationAttemptFailureReason];\n\n/**\n * Values of VerificationChannel known at this SDK version. The wire value is an open\n * string: a value added by a newer server deserializes unchanged, so switch on\n * these with a `default` branch rather than treating the set as closed.\n */\nexport const VerificationChannel = {\n Email: \"email\",\n Sms: \"sms\",\n Whatsapp: \"whatsapp\",\n} as const;\n\n/** A known VerificationChannel value. */\nexport type VerificationChannelValue = (typeof VerificationChannel)[keyof typeof VerificationChannel];\n\n/**\n * Values of VerificationTerminalReason known at this SDK version. The wire value is an open\n * string: a value added by a newer server deserializes unchanged, so switch on\n * these with a `default` branch rather than treating the set as closed.\n */\nexport const VerificationTerminalReason = {\n AttemptsExhausted: \"attempts_exhausted\",\n TtlElapsed: \"ttl_elapsed\",\n} as const;\n\n/** A known VerificationTerminalReason value. */\nexport type VerificationTerminalReasonValue = (typeof VerificationTerminalReason)[keyof typeof VerificationTerminalReason];\n\n/**\n * Values of WhatsAppErrorCode known at this SDK version. The wire value is an open\n * string: a value added by a newer server deserializes unchanged, so switch on\n * these with a `default` branch rather than treating the set as closed.\n */\nexport const WhatsAppErrorCode = {\n InsufficientBalance: \"insufficient_balance\",\n InternalError: \"internal_error\",\n PriceNotFound: \"price_not_found\",\n RateLimited: \"rate_limited\",\n RecipientSuppressed: \"recipient_suppressed\",\n ServiceWindowExpired: \"service_window_expired\",\n Undeliverable: \"undeliverable\",\n} as const;\n\n/** A known WhatsAppErrorCode value. */\nexport type WhatsAppErrorCodeValue = (typeof WhatsAppErrorCode)[keyof typeof WhatsAppErrorCode];\n\n/**\n * Values of WhatsAppTemplateCategory known at this SDK version. The wire value is an open\n * string: a value added by a newer server deserializes unchanged, so switch on\n * these with a `default` branch rather than treating the set as closed.\n */\nexport const WhatsAppTemplateCategory = {\n Authentication: \"authentication\",\n Marketing: \"marketing\",\n Utility: \"utility\",\n} as const;\n\n/** A known WhatsAppTemplateCategory value. */\nexport type WhatsAppTemplateCategoryValue = (typeof WhatsAppTemplateCategory)[keyof typeof WhatsAppTemplateCategory];\n\n/**\n * Values of WhatsAppTemplateParameterType known at this SDK version. The wire value is an open\n * string: a value added by a newer server deserializes unchanged, so switch on\n * these with a `default` branch rather than treating the set as closed.\n */\nexport const WhatsAppTemplateParameterType = {\n Document: \"document\",\n Gif: \"gif\",\n Image: \"image\",\n Location: \"location\",\n Text: \"text\",\n Video: \"video\",\n} as const;\n\n/** A known WhatsAppTemplateParameterType value. */\nexport type WhatsAppTemplateParameterTypeValue = (typeof WhatsAppTemplateParameterType)[keyof typeof WhatsAppTemplateParameterType];\n"],"mappings":";;AAuEA,MAAa,qBAAqB,EAChC,iBAAiB,SACf,KAAK,UAAU,OAAO,MAAM,UAC1B,OAAO,UAAU,WAAW,MAAM,SAAS,IAAI,KACjD,EACJ;;;ACYA,SAAgB,gBAAiC,EAC/C,WACA,YACA,YACA,qBACA,mBACA,sBACA,qBACA,kBACA,YACA,KACA,GAAG,WACsD;CACzD,IAAI;CAEJ,MAAM,QACJ,gBACE,OAAe,IAAI,SAAS,YAAY,WAAW,SAAS,EAAE,CAAC;CAEnE,MAAM,eAAe,mBAAmB;EACtC,IAAI,aAAqB,wBAAwB;EACjD,IAAI,UAAU;EACd,MAAM,SAAS,QAAQ,UAAU,IAAI,gBAAgB,CAAC,CAAC;EAEvD,OAAO,MAAM;GACX,IAAI,OAAO,SAAS;GAEpB;GAEA,MAAM,UACJ,QAAQ,mBAAmB,UACvB,QAAQ,UACR,IAAI,QAAQ,QAAQ,OAA6C;GAEvE,IAAI,gBAAgB,KAAA,GAClB,QAAQ,IAAI,iBAAiB,WAAW;GAG1C,IAAI;IACF,MAAM,cAA2B;KAC/B,UAAU;KACV,GAAG;KACH,MAAM,QAAQ;KACd;KACA;IACF;IACA,IAAI,UAAU,IAAI,QAAQ,KAAK,WAAW;IAC1C,IAAI,WACF,UAAU,MAAM,UAAU,KAAK,WAAW;IAK5C,MAAM,WAAW,OADF,QAAQ,SAAS,WAAW,MAAA,CACb,OAAO;IAErC,IAAI,CAAC,SAAS,IACZ,MAAM,IAAI,MACR,eAAe,SAAS,OAAO,GAAG,SAAS,YAC7C;IAEF,IAAI,CAAC,SAAS,MAAM,MAAM,IAAI,MAAM,yBAAyB;IAE7D,MAAM,SAAS,SAAS,KACrB,YAAY,IAAI,kBAAkB,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AAa;CACb,qBAAqB;CACrB,sBAAsB;CACtB,eAAe;AACjB;;;;;;AAUA,MAAa,2BAA2B;CACtC,gBAAgB;CAChB,WAAW;CACX,SAAS;AACX;;;;;;AAUA,MAAa,gCAAgC;CAC3C,UAAU;CACV,KAAK;CACL,OAAO;CACP,UAAU;CACV,MAAM;CACN,OAAO;AACT"}
1
+ {"version":3,"file":"index.mjs","names":["mergeHeaders","mergeHeaders","#defaults","#secret","#client","#baseUrl","#fetch","#headers","#raw"],"sources":["../src/generated/core/bodySerializer.gen.ts","../src/generated/core/serverSentEvents.gen.ts","../src/generated/core/pathSerializer.gen.ts","../src/generated/core/utils.gen.ts","../src/generated/core/auth.gen.ts","../src/generated/client/utils.gen.ts","../src/generated/client/client.gen.ts","../src/region.ts","../src/caller-rules.gen.ts","../src/detect-caller.ts","../src/errors.ts","../src/core/http.ts","../src/core/result.ts","../src/generated/client.gen.ts","../src/generated/sdk.gen.ts","../src/resources/base.ts","../src/resources/email.gen.ts","../src/resources/emailStats.gen.ts","../src/resources/emailMailboxes.gen.ts","../src/resources/emailMailboxesMessages.ts","../src/resources/emailMailboxesReceiveRules.gen.ts","../src/resources/emailMailboxes.ts","../src/resources/emailThreads.gen.ts","../src/resources/emailThreadsMessages.gen.ts","../src/resources/emailThreads.ts","../src/resources/email.ts","../src/resources/audiences.gen.ts","../src/resources/domains.gen.ts","../src/resources/contactProperties.gen.ts","../src/resources/contacts.gen.ts","../src/resources/sms.gen.ts","../src/resources/sms.ts","../src/resources/smsTemplates.gen.ts","../src/resources/whatsapp.gen.ts","../src/resources/whatsapp.ts","../src/resources/voice.gen.ts","../src/resources/verifyVerifications.gen.ts","../src/resources/verify.ts","../src/resources/webhooks.ts","../src/resources/realtime.gen.ts","../src/resources/realtimeChannels.gen.ts","../src/resources/realtimeMembers.gen.ts","../src/resources/realtime.ts","../src/resources/lookup.gen.ts","../src/client.ts","../src/event-types.gen.ts","../src/open-enums.gen.ts"],"sourcesContent":["// This file is auto-generated by @hey-api/openapi-ts\n\nimport type {\n ArrayStyle,\n ObjectStyle,\n SerializerOptions,\n} from \"./pathSerializer.gen\";\n\nexport type QuerySerializer = (query: Record<string, unknown>) => string;\n\nexport type BodySerializer = (body: unknown) => unknown;\n\ntype QuerySerializerOptionsObject = {\n allowReserved?: boolean;\n array?: Partial<SerializerOptions<ArrayStyle>>;\n object?: Partial<SerializerOptions<ObjectStyle>>;\n};\n\nexport type QuerySerializerOptions = QuerySerializerOptionsObject & {\n /**\n * Per-parameter serialization overrides. When provided, these settings\n * override the global array/object settings for specific parameter names.\n */\n parameters?: Record<string, QuerySerializerOptionsObject>;\n};\n\nconst serializeFormDataPair = (\n data: FormData,\n key: string,\n value: unknown,\n): void => {\n if (typeof value === \"string\" || value instanceof Blob) {\n data.append(key, value);\n } else if (value instanceof Date) {\n data.append(key, value.toISOString());\n } else {\n data.append(key, JSON.stringify(value));\n }\n};\n\nconst serializeUrlSearchParamsPair = (\n data: URLSearchParams,\n key: string,\n value: unknown,\n): void => {\n if (typeof value === \"string\") {\n data.append(key, value);\n } else {\n data.append(key, JSON.stringify(value));\n }\n};\n\nexport const formDataBodySerializer = {\n bodySerializer: (body: unknown): FormData => {\n const data = new FormData();\n\n Object.entries(body as Record<string, unknown>).forEach(([key, value]) => {\n if (value === undefined || value === null) {\n return;\n }\n if (Array.isArray(value)) {\n value.forEach((v) => serializeFormDataPair(data, key, v));\n } else {\n serializeFormDataPair(data, key, value);\n }\n });\n\n return data;\n },\n};\n\nexport const jsonBodySerializer = {\n bodySerializer: (body: unknown): string =>\n JSON.stringify(body, (_key, value) =>\n typeof value === \"bigint\" ? value.toString() : value,\n ),\n};\n\nexport const urlSearchParamsBodySerializer = {\n bodySerializer: (body: unknown): string => {\n const data = new URLSearchParams();\n\n Object.entries(body as Record<string, unknown>).forEach(([key, value]) => {\n if (value === undefined || value === null) {\n return;\n }\n if (Array.isArray(value)) {\n value.forEach((v) => serializeUrlSearchParamsPair(data, key, v));\n } else {\n serializeUrlSearchParamsPair(data, key, value);\n }\n });\n\n return data.toString();\n },\n};\n","// This file is auto-generated by @hey-api/openapi-ts\n\nimport type { Config } from \"./types.gen\";\n\nexport type ServerSentEventsOptions<TData = unknown> = Omit<\n RequestInit,\n \"method\"\n> &\n Pick<Config, \"method\" | \"responseTransformer\" | \"responseValidator\"> & {\n /**\n * Fetch API implementation. You can use this option to provide a custom\n * fetch instance.\n *\n * @default globalThis.fetch\n */\n fetch?: typeof fetch;\n /**\n * Implementing clients can call request interceptors inside this hook.\n */\n onRequest?: (url: string, init: RequestInit) => Promise<Request>;\n /**\n * Callback invoked when a network or parsing error occurs during streaming.\n *\n * This option applies only if the endpoint returns a stream of events.\n *\n * @param error The error that occurred.\n */\n onSseError?: (error: unknown) => void;\n /**\n * Callback invoked when an event is streamed from the server.\n *\n * This option applies only if the endpoint returns a stream of events.\n *\n * @param event Event streamed from the server.\n * @returns Nothing (void).\n */\n onSseEvent?: (event: StreamEvent<TData>) => void;\n serializedBody?: RequestInit[\"body\"];\n /**\n * Default retry delay in milliseconds.\n *\n * This option applies only if the endpoint returns a stream of events.\n *\n * @default 3000\n */\n sseDefaultRetryDelay?: number;\n /**\n * Maximum number of retry attempts before giving up.\n */\n sseMaxRetryAttempts?: number;\n /**\n * Maximum retry delay in milliseconds.\n *\n * Applies only when exponential backoff is used.\n *\n * This option applies only if the endpoint returns a stream of events.\n *\n * @default 30000\n */\n sseMaxRetryDelay?: number;\n /**\n * Optional sleep function for retry backoff.\n *\n * Defaults to using `setTimeout`.\n */\n sseSleepFn?: (ms: number) => Promise<void>;\n url: string;\n };\n\nexport interface StreamEvent<TData = unknown> {\n data: TData;\n event?: string;\n id?: string;\n retry?: number;\n}\n\nexport type ServerSentEventsResult<\n TData = unknown,\n TReturn = void,\n TNext = unknown,\n> = {\n stream: AsyncGenerator<\n TData extends Record<string, unknown> ? TData[keyof TData] : TData,\n TReturn,\n TNext\n >;\n};\n\nexport function createSseClient<TData = unknown>({\n onRequest,\n onSseError,\n onSseEvent,\n responseTransformer,\n responseValidator,\n sseDefaultRetryDelay,\n sseMaxRetryAttempts,\n sseMaxRetryDelay,\n sseSleepFn,\n url,\n ...options\n}: ServerSentEventsOptions): ServerSentEventsResult<TData> {\n let lastEventId: string | undefined;\n\n const sleep =\n sseSleepFn ??\n ((ms: number) => new Promise((resolve) => setTimeout(resolve, ms)));\n\n const createStream = async function* () {\n let retryDelay: number = sseDefaultRetryDelay ?? 3000;\n let attempt = 0;\n const signal = options.signal ?? new AbortController().signal;\n\n while (true) {\n if (signal.aborted) break;\n\n attempt++;\n\n const headers =\n options.headers instanceof Headers\n ? options.headers\n : new Headers(options.headers as Record<string, string> | undefined);\n\n if (lastEventId !== undefined) {\n headers.set(\"Last-Event-ID\", lastEventId);\n }\n\n try {\n const requestInit: RequestInit = {\n redirect: \"follow\",\n ...options,\n body: options.serializedBody,\n headers,\n signal,\n };\n let request = new Request(url, requestInit);\n if (onRequest) {\n request = await onRequest(url, requestInit);\n }\n // fetch must be assigned here, otherwise it would throw the error:\n // TypeError: Failed to execute 'fetch' on 'Window': Illegal invocation\n const _fetch = options.fetch ?? globalThis.fetch;\n const response = await _fetch(request);\n\n if (!response.ok)\n throw new Error(\n `SSE failed: ${response.status} ${response.statusText}`,\n );\n\n if (!response.body) throw new Error(\"No body in SSE response\");\n\n const reader = response.body\n .pipeThrough(new TextDecoderStream())\n .getReader();\n\n let buffer = \"\";\n\n const abortHandler = () => {\n try {\n reader.cancel();\n } catch {\n // noop\n }\n };\n\n signal.addEventListener(\"abort\", abortHandler);\n\n try {\n while (true) {\n const { done, value } = await reader.read();\n if (done) break;\n buffer += value;\n buffer = buffer.replace(/\\r\\n?/g, \"\\n\"); // normalize line endings\n\n const chunks = buffer.split(\"\\n\\n\");\n buffer = chunks.pop() ?? \"\";\n\n for (const chunk of chunks) {\n const lines = chunk.split(\"\\n\");\n const dataLines: Array<string> = [];\n let eventName: string | undefined;\n\n for (const line of lines) {\n if (line.startsWith(\"data:\")) {\n dataLines.push(line.replace(/^data:\\s*/, \"\"));\n } else if (line.startsWith(\"event:\")) {\n eventName = line.replace(/^event:\\s*/, \"\");\n } else if (line.startsWith(\"id:\")) {\n lastEventId = line.replace(/^id:\\s*/, \"\");\n } else if (line.startsWith(\"retry:\")) {\n const parsed = Number.parseInt(\n line.replace(/^retry:\\s*/, \"\"),\n 10,\n );\n if (!Number.isNaN(parsed)) {\n retryDelay = parsed;\n }\n }\n }\n\n let data: unknown;\n let parsedJson = false;\n\n if (dataLines.length) {\n const rawData = dataLines.join(\"\\n\");\n try {\n data = JSON.parse(rawData);\n parsedJson = true;\n } catch {\n data = rawData;\n }\n }\n\n if (parsedJson) {\n if (responseValidator) {\n await responseValidator(data);\n }\n\n if (responseTransformer) {\n data = await responseTransformer(data);\n }\n }\n\n onSseEvent?.({\n data,\n event: eventName,\n id: lastEventId,\n retry: retryDelay,\n });\n\n if (dataLines.length) {\n yield data as any;\n }\n }\n }\n } finally {\n signal.removeEventListener(\"abort\", abortHandler);\n reader.releaseLock();\n }\n\n break; // exit loop on normal completion\n } catch (error) {\n // connection failed or aborted; retry after delay\n onSseError?.(error);\n\n if (\n sseMaxRetryAttempts !== undefined &&\n attempt >= sseMaxRetryAttempts\n ) {\n break; // stop after firing error\n }\n\n // exponential backoff: double retry each attempt, cap at 30s\n const backoff = Math.min(\n retryDelay * 2 ** (attempt - 1),\n sseMaxRetryDelay ?? 30000,\n );\n await sleep(backoff);\n }\n }\n };\n\n const stream = createStream();\n\n return { stream };\n}\n","// This file is auto-generated by @hey-api/openapi-ts\n\ninterface SerializeOptions<T>\n extends SerializePrimitiveOptions, SerializerOptions<T> {}\n\ninterface SerializePrimitiveOptions {\n allowReserved?: boolean;\n name: string;\n}\n\nexport interface SerializerOptions<T> {\n /**\n * @default true\n */\n explode: boolean;\n style: T;\n}\n\nexport type ArrayStyle = \"form\" | \"spaceDelimited\" | \"pipeDelimited\";\nexport type ArraySeparatorStyle = ArrayStyle | MatrixStyle;\ntype MatrixStyle = \"label\" | \"matrix\" | \"simple\";\nexport type ObjectStyle = \"form\" | \"deepObject\";\ntype ObjectSeparatorStyle = ObjectStyle | MatrixStyle;\n\ninterface SerializePrimitiveParam extends SerializePrimitiveOptions {\n value: string;\n}\n\nexport const separatorArrayExplode = (style: ArraySeparatorStyle) => {\n switch (style) {\n case \"label\":\n return \".\";\n case \"matrix\":\n return \";\";\n case \"simple\":\n return \",\";\n default:\n return \"&\";\n }\n};\n\nexport const separatorArrayNoExplode = (style: ArraySeparatorStyle) => {\n switch (style) {\n case \"form\":\n return \",\";\n case \"pipeDelimited\":\n return \"|\";\n case \"spaceDelimited\":\n return \"%20\";\n default:\n return \",\";\n }\n};\n\nexport const separatorObjectExplode = (style: ObjectSeparatorStyle) => {\n switch (style) {\n case \"label\":\n return \".\";\n case \"matrix\":\n return \";\";\n case \"simple\":\n return \",\";\n default:\n return \"&\";\n }\n};\n\nexport const serializeArrayParam = ({\n allowReserved,\n explode,\n name,\n style,\n value,\n}: SerializeOptions<ArraySeparatorStyle> & {\n value: unknown[];\n}) => {\n if (!explode) {\n const joinedValues = (\n allowReserved ? value : value.map((v) => encodeURIComponent(v as string))\n ).join(separatorArrayNoExplode(style));\n switch (style) {\n case \"label\":\n return `.${joinedValues}`;\n case \"matrix\":\n return `;${name}=${joinedValues}`;\n case \"simple\":\n return joinedValues;\n default:\n return `${name}=${joinedValues}`;\n }\n }\n\n const separator = separatorArrayExplode(style);\n const joinedValues = value\n .map((v) => {\n if (style === \"label\" || style === \"simple\") {\n return allowReserved ? v : encodeURIComponent(v as string);\n }\n\n return serializePrimitiveParam({\n allowReserved,\n name,\n value: v as string,\n });\n })\n .join(separator);\n return style === \"label\" || style === \"matrix\"\n ? separator + joinedValues\n : joinedValues;\n};\n\nexport const serializePrimitiveParam = ({\n allowReserved,\n name,\n value,\n}: SerializePrimitiveParam) => {\n if (value === undefined || value === null) {\n return \"\";\n }\n\n if (typeof value === \"object\") {\n throw new Error(\n \"Deeply-nested arrays/objects aren’t supported. Provide your own `querySerializer()` to handle these.\",\n );\n }\n\n return `${name}=${allowReserved ? value : encodeURIComponent(value)}`;\n};\n\nexport const serializeObjectParam = ({\n allowReserved,\n explode,\n name,\n style,\n value,\n valueOnly,\n}: SerializeOptions<ObjectSeparatorStyle> & {\n value: Record<string, unknown> | Date;\n valueOnly?: boolean;\n}) => {\n if (value instanceof Date) {\n return valueOnly ? value.toISOString() : `${name}=${value.toISOString()}`;\n }\n\n if (style !== \"deepObject\" && !explode) {\n let values: string[] = [];\n Object.entries(value).forEach(([key, v]) => {\n values = [\n ...values,\n key,\n allowReserved ? (v as string) : encodeURIComponent(v as string),\n ];\n });\n const joinedValues = values.join(\",\");\n switch (style) {\n case \"form\":\n return `${name}=${joinedValues}`;\n case \"label\":\n return `.${joinedValues}`;\n case \"matrix\":\n return `;${name}=${joinedValues}`;\n default:\n return joinedValues;\n }\n }\n\n const separator = separatorObjectExplode(style);\n const joinedValues = Object.entries(value)\n .map(([key, v]) =>\n serializePrimitiveParam({\n allowReserved,\n name: style === \"deepObject\" ? `${name}[${key}]` : key,\n value: v as string,\n }),\n )\n .join(separator);\n return style === \"label\" || style === \"matrix\"\n ? separator + joinedValues\n : joinedValues;\n};\n","// This file is auto-generated by @hey-api/openapi-ts\n\nimport type { BodySerializer, QuerySerializer } from \"./bodySerializer.gen\";\nimport {\n type ArraySeparatorStyle,\n serializeArrayParam,\n serializeObjectParam,\n serializePrimitiveParam,\n} from \"./pathSerializer.gen\";\n\nexport interface PathSerializer {\n path: Record<string, unknown>;\n url: string;\n}\n\nexport const PATH_PARAM_RE = /\\{[^{}]+\\}/g;\n\nexport const defaultPathSerializer = ({ path, url: _url }: PathSerializer) => {\n let url = _url;\n const matches = _url.match(PATH_PARAM_RE);\n if (matches) {\n for (const match of matches) {\n let explode = false;\n let name = match.substring(1, match.length - 1);\n let style: ArraySeparatorStyle = \"simple\";\n\n if (name.endsWith(\"*\")) {\n explode = true;\n name = name.substring(0, name.length - 1);\n }\n\n if (name.startsWith(\".\")) {\n name = name.substring(1);\n style = \"label\";\n } else if (name.startsWith(\";\")) {\n name = name.substring(1);\n style = \"matrix\";\n }\n\n const value = path[name];\n\n if (value === undefined || value === null) {\n continue;\n }\n\n if (Array.isArray(value)) {\n url = url.replace(\n match,\n serializeArrayParam({ explode, name, style, value }),\n );\n continue;\n }\n\n if (typeof value === \"object\") {\n url = url.replace(\n match,\n serializeObjectParam({\n explode,\n name,\n style,\n value: value as Record<string, unknown>,\n valueOnly: true,\n }),\n );\n continue;\n }\n\n if (style === \"matrix\") {\n url = url.replace(\n match,\n `;${serializePrimitiveParam({\n name,\n value: value as string,\n })}`,\n );\n continue;\n }\n\n const replaceValue = encodeURIComponent(\n style === \"label\" ? `.${value as string}` : (value as string),\n );\n url = url.replace(match, replaceValue);\n }\n }\n return url;\n};\n\nexport const getUrl = ({\n baseUrl,\n path,\n query,\n querySerializer,\n url: _url,\n}: {\n baseUrl?: string;\n path?: Record<string, unknown>;\n query?: Record<string, unknown>;\n querySerializer: QuerySerializer;\n url: string;\n}) => {\n const pathUrl = _url.startsWith(\"/\") ? _url : `/${_url}`;\n let url = (baseUrl ?? \"\") + pathUrl;\n if (path) {\n url = defaultPathSerializer({ path, url });\n }\n let search = query ? querySerializer(query) : \"\";\n if (search.startsWith(\"?\")) {\n search = search.substring(1);\n }\n if (search) {\n url += `?${search}`;\n }\n return url;\n};\n\nexport function getValidRequestBody(options: {\n body?: unknown;\n bodySerializer?: BodySerializer | null;\n serializedBody?: unknown;\n}) {\n const hasBody = options.body !== undefined;\n const isSerializedBody = hasBody && options.bodySerializer;\n\n if (isSerializedBody) {\n if (\"serializedBody\" in options) {\n const hasSerializedBody =\n options.serializedBody !== undefined && options.serializedBody !== \"\";\n\n return hasSerializedBody ? options.serializedBody : null;\n }\n\n // not all clients implement a serializedBody property (i.e., client-axios)\n return options.body !== \"\" ? options.body : null;\n }\n\n // plain/text body\n if (hasBody) {\n return options.body;\n }\n\n // no body was provided\n return undefined;\n}\n","// This file is auto-generated by @hey-api/openapi-ts\n\nexport type AuthToken = string | undefined;\n\nexport interface Auth {\n /**\n * Which part of the request do we use to send the auth?\n *\n * @default 'header'\n */\n in?: \"header\" | \"query\" | \"cookie\";\n /**\n * Header or query parameter name.\n *\n * @default 'Authorization'\n */\n name?: string;\n scheme?: \"basic\" | \"bearer\";\n type: \"apiKey\" | \"http\";\n}\n\nexport const getAuthToken = async (\n auth: Auth,\n callback: ((auth: Auth) => Promise<AuthToken> | AuthToken) | AuthToken,\n): Promise<string | undefined> => {\n const token =\n typeof callback === \"function\" ? await callback(auth) : callback;\n\n if (!token) {\n return;\n }\n\n if (auth.scheme === \"bearer\") {\n return `Bearer ${token}`;\n }\n\n if (auth.scheme === \"basic\") {\n return `Basic ${btoa(token)}`;\n }\n\n return token;\n};\n","// This file is auto-generated by @hey-api/openapi-ts\n\nimport { getAuthToken } from \"../core/auth.gen\";\nimport type { QuerySerializerOptions } from \"../core/bodySerializer.gen\";\nimport { jsonBodySerializer } from \"../core/bodySerializer.gen\";\nimport {\n serializeArrayParam,\n serializeObjectParam,\n serializePrimitiveParam,\n} from \"../core/pathSerializer.gen\";\nimport { getUrl } from \"../core/utils.gen\";\nimport type {\n Client,\n ClientOptions,\n Config,\n RequestOptions,\n} from \"./types.gen\";\n\nexport const createQuerySerializer = <T = unknown>({\n parameters = {},\n ...args\n}: QuerySerializerOptions = {}) => {\n const querySerializer = (queryParams: T) => {\n const search: string[] = [];\n if (queryParams && typeof queryParams === \"object\") {\n for (const name in queryParams) {\n const value = queryParams[name];\n\n if (value === undefined || value === null) {\n continue;\n }\n\n const options = parameters[name] || args;\n\n if (Array.isArray(value)) {\n const serializedArray = serializeArrayParam({\n allowReserved: options.allowReserved,\n explode: true,\n name,\n style: \"form\",\n value,\n ...options.array,\n });\n if (serializedArray) search.push(serializedArray);\n } else if (typeof value === \"object\") {\n const serializedObject = serializeObjectParam({\n allowReserved: options.allowReserved,\n explode: true,\n name,\n style: \"deepObject\",\n value: value as Record<string, unknown>,\n ...options.object,\n });\n if (serializedObject) search.push(serializedObject);\n } else {\n const serializedPrimitive = serializePrimitiveParam({\n allowReserved: options.allowReserved,\n name,\n value: value as string,\n });\n if (serializedPrimitive) search.push(serializedPrimitive);\n }\n }\n }\n return search.join(\"&\");\n };\n return querySerializer;\n};\n\n/**\n * Infers parseAs value from provided Content-Type header.\n */\nexport const getParseAs = (\n contentType: string | null,\n): Exclude<Config[\"parseAs\"], \"auto\"> => {\n if (!contentType) {\n // If no Content-Type header is provided, the best we can do is return the raw response body,\n // which is effectively the same as the 'stream' option.\n return \"stream\";\n }\n\n const cleanContent = contentType.split(\";\")[0]?.trim();\n\n if (!cleanContent) {\n return;\n }\n\n if (\n cleanContent.startsWith(\"application/json\") ||\n cleanContent.endsWith(\"+json\")\n ) {\n return \"json\";\n }\n\n if (cleanContent === \"multipart/form-data\") {\n return \"formData\";\n }\n\n if (\n [\"application/\", \"audio/\", \"image/\", \"video/\"].some((type) =>\n cleanContent.startsWith(type),\n )\n ) {\n return \"blob\";\n }\n\n if (cleanContent.startsWith(\"text/\")) {\n return \"text\";\n }\n\n return;\n};\n\nconst checkForExistence = (\n options: Pick<RequestOptions, \"auth\" | \"query\"> & {\n headers: Headers;\n },\n name?: string,\n): boolean => {\n if (!name) {\n return false;\n }\n if (\n options.headers.has(name) ||\n options.query?.[name] ||\n options.headers.get(\"Cookie\")?.includes(`${name}=`)\n ) {\n return true;\n }\n return false;\n};\n\nexport async function setAuthParams(\n options: Pick<RequestOptions, \"auth\" | \"query\" | \"security\"> & {\n headers: Headers;\n },\n): Promise<void> {\n for (const auth of options.security ?? []) {\n if (checkForExistence(options, auth.name)) {\n continue;\n }\n\n const token = await getAuthToken(auth, options.auth);\n\n if (!token) {\n continue;\n }\n\n const name = auth.name ?? \"Authorization\";\n\n switch (auth.in) {\n case \"query\":\n if (!options.query) {\n options.query = {};\n }\n options.query[name] = token;\n break;\n case \"cookie\":\n options.headers.append(\"Cookie\", `${name}=${token}`);\n break;\n case \"header\":\n default:\n options.headers.set(name, token);\n break;\n }\n }\n}\n\nexport const buildUrl: Client[\"buildUrl\"] = (options) =>\n getUrl({\n baseUrl: options.baseUrl as string,\n path: options.path,\n query: options.query,\n querySerializer:\n typeof options.querySerializer === \"function\"\n ? options.querySerializer\n : createQuerySerializer(options.querySerializer),\n url: options.url,\n });\n\nexport const mergeConfigs = (a: Config, b: Config): Config => {\n const config = { ...a, ...b };\n if (config.baseUrl?.endsWith(\"/\")) {\n config.baseUrl = config.baseUrl.substring(0, config.baseUrl.length - 1);\n }\n config.headers = mergeHeaders(a.headers, b.headers);\n return config;\n};\n\nconst headersEntries = (headers: Headers): Array<[string, string]> => {\n const entries: Array<[string, string]> = [];\n headers.forEach((value, key) => {\n entries.push([key, value]);\n });\n return entries;\n};\n\nexport const mergeHeaders = (\n ...headers: Array<Required<Config>[\"headers\"] | undefined>\n): Headers => {\n const mergedHeaders = new Headers();\n for (const header of headers) {\n if (!header) {\n continue;\n }\n\n const iterator =\n header instanceof Headers\n ? headersEntries(header)\n : Object.entries(header);\n\n for (const [key, value] of iterator) {\n if (value === null) {\n mergedHeaders.delete(key);\n } else if (Array.isArray(value)) {\n for (const v of value) {\n mergedHeaders.append(key, v as string);\n }\n } else if (value !== undefined) {\n // assume object headers are meant to be JSON stringified, i.e., their\n // content value in OpenAPI specification is 'application/json'\n mergedHeaders.set(\n key,\n typeof value === \"object\" ? JSON.stringify(value) : (value as string),\n );\n }\n }\n }\n return mergedHeaders;\n};\n\ntype ErrInterceptor<Err, Res, Req, Options> = (\n error: Err,\n /** response may be undefined due to a network error where no response object is produced */\n response: Res | undefined,\n /** request may be undefined, because error may be from building the request object itself */\n request: Req | undefined,\n options: Options,\n) => Err | Promise<Err>;\n\ntype ReqInterceptor<Req, Options> = (\n request: Req,\n options: Options,\n) => Req | Promise<Req>;\n\ntype ResInterceptor<Res, Req, Options> = (\n response: Res,\n request: Req,\n options: Options,\n) => Res | Promise<Res>;\n\nclass Interceptors<Interceptor> {\n fns: Array<Interceptor | null> = [];\n\n clear(): void {\n this.fns = [];\n }\n\n eject(id: number | Interceptor): void {\n const index = this.getInterceptorIndex(id);\n if (this.fns[index]) {\n this.fns[index] = null;\n }\n }\n\n exists(id: number | Interceptor): boolean {\n const index = this.getInterceptorIndex(id);\n return Boolean(this.fns[index]);\n }\n\n getInterceptorIndex(id: number | Interceptor): number {\n if (typeof id === \"number\") {\n return this.fns[id] ? id : -1;\n }\n return this.fns.indexOf(id);\n }\n\n update(\n id: number | Interceptor,\n fn: Interceptor,\n ): number | Interceptor | false {\n const index = this.getInterceptorIndex(id);\n if (this.fns[index]) {\n this.fns[index] = fn;\n return id;\n }\n return false;\n }\n\n use(fn: Interceptor): number {\n this.fns.push(fn);\n return this.fns.length - 1;\n }\n}\n\nexport interface Middleware<Req, Res, Err, Options> {\n error: Interceptors<ErrInterceptor<Err, Res, Req, Options>>;\n request: Interceptors<ReqInterceptor<Req, Options>>;\n response: Interceptors<ResInterceptor<Res, Req, Options>>;\n}\n\nexport const createInterceptors = <Req, Res, Err, Options>(): Middleware<\n Req,\n Res,\n Err,\n Options\n> => ({\n error: new Interceptors<ErrInterceptor<Err, Res, Req, Options>>(),\n request: new Interceptors<ReqInterceptor<Req, Options>>(),\n response: new Interceptors<ResInterceptor<Res, Req, Options>>(),\n});\n\nconst defaultQuerySerializer = createQuerySerializer({\n allowReserved: false,\n array: {\n explode: true,\n style: \"form\",\n },\n object: {\n explode: true,\n style: \"deepObject\",\n },\n});\n\nconst defaultHeaders = {\n \"Content-Type\": \"application/json\",\n};\n\nexport const createConfig = <T extends ClientOptions = ClientOptions>(\n override: Config<Omit<ClientOptions, keyof T> & T> = {},\n): Config<Omit<ClientOptions, keyof T> & T> => ({\n ...jsonBodySerializer,\n headers: defaultHeaders,\n parseAs: \"auto\",\n querySerializer: defaultQuerySerializer,\n ...override,\n});\n","// This file is auto-generated by @hey-api/openapi-ts\n\nimport { createSseClient } from \"../core/serverSentEvents.gen\";\nimport type { HttpMethod } from \"../core/types.gen\";\nimport { getValidRequestBody } from \"../core/utils.gen\";\nimport type {\n Client,\n Config,\n RequestOptions,\n ResolvedRequestOptions,\n} from \"./types.gen\";\nimport {\n buildUrl,\n createConfig,\n createInterceptors,\n getParseAs,\n mergeConfigs,\n mergeHeaders,\n setAuthParams,\n} from \"./utils.gen\";\n\ntype ReqInit = Omit<RequestInit, \"body\" | \"headers\"> & {\n body?: any;\n headers: ReturnType<typeof mergeHeaders>;\n};\n\nexport const createClient = (config: Config = {}): Client => {\n let _config = mergeConfigs(createConfig(), config);\n\n const getConfig = (): Config => ({ ..._config });\n\n const setConfig = (config: Config): Config => {\n _config = mergeConfigs(_config, config);\n return getConfig();\n };\n\n const interceptors = createInterceptors<\n Request,\n Response,\n unknown,\n ResolvedRequestOptions\n >();\n\n const beforeRequest = async <\n TData = unknown,\n TResponseStyle extends \"data\" | \"fields\" = \"fields\",\n ThrowOnError extends boolean = boolean,\n Url extends string = string,\n >(\n options: RequestOptions<TData, TResponseStyle, ThrowOnError, Url>,\n ) => {\n const opts = {\n ..._config,\n ...options,\n fetch: options.fetch ?? _config.fetch ?? globalThis.fetch,\n headers: mergeHeaders(_config.headers, options.headers),\n serializedBody: undefined as string | undefined,\n };\n\n if (opts.security) {\n await setAuthParams(opts);\n }\n\n if (opts.requestValidator) {\n await opts.requestValidator(opts);\n }\n\n if (opts.body !== undefined && opts.bodySerializer) {\n opts.serializedBody = opts.bodySerializer(opts.body) as\n string | undefined;\n }\n\n // remove Content-Type header if body is empty to avoid sending invalid requests\n if (opts.body === undefined || opts.serializedBody === \"\") {\n opts.headers.delete(\"Content-Type\");\n }\n\n const resolvedOpts = opts as typeof opts &\n ResolvedRequestOptions<TResponseStyle, ThrowOnError, Url>;\n const url = buildUrl(resolvedOpts);\n\n return { opts: resolvedOpts, url };\n };\n\n const request: Client[\"request\"] = async (options) => {\n const throwOnError = options.throwOnError ?? _config.throwOnError;\n const responseStyle = options.responseStyle ?? _config.responseStyle;\n\n let request: Request | undefined;\n let response: Response | undefined;\n\n try {\n const { opts, url } = await beforeRequest(options);\n const requestInit: ReqInit = {\n redirect: \"follow\",\n ...opts,\n body: getValidRequestBody(opts),\n };\n\n request = new Request(url, requestInit);\n\n for (const fn of interceptors.request.fns) {\n if (fn) {\n request = await fn(request, opts);\n }\n }\n\n // fetch must be assigned here, otherwise it would throw the error:\n // TypeError: Failed to execute 'fetch' on 'Window': Illegal invocation\n const _fetch = opts.fetch!;\n\n response = await _fetch(request);\n\n for (const fn of interceptors.response.fns) {\n if (fn) {\n response = await fn(response, request, opts);\n }\n }\n\n const result = {\n request,\n response,\n };\n\n if (response.ok) {\n const parseAs =\n (opts.parseAs === \"auto\"\n ? getParseAs(response.headers.get(\"Content-Type\"))\n : opts.parseAs) ?? \"json\";\n\n if (\n response.status === 204 ||\n response.headers.get(\"Content-Length\") === \"0\"\n ) {\n let emptyData: any;\n switch (parseAs) {\n case \"arrayBuffer\":\n case \"blob\":\n case \"text\":\n emptyData = await response[parseAs]();\n break;\n case \"formData\":\n emptyData = new FormData();\n break;\n case \"stream\":\n emptyData = response.body;\n break;\n case \"json\":\n default:\n emptyData = {};\n break;\n }\n return opts.responseStyle === \"data\"\n ? emptyData\n : {\n data: emptyData,\n ...result,\n };\n }\n\n let data: any;\n switch (parseAs) {\n case \"arrayBuffer\":\n case \"blob\":\n case \"formData\":\n case \"text\":\n data = await response[parseAs]();\n break;\n case \"json\": {\n // Some servers return 200 with no Content-Length and empty body.\n // response.json() would throw; read as text and parse if non-empty.\n const text = await response.text();\n data = text ? JSON.parse(text) : {};\n break;\n }\n case \"stream\":\n return opts.responseStyle === \"data\"\n ? response.body\n : {\n data: response.body,\n ...result,\n };\n }\n\n if (parseAs === \"json\") {\n if (opts.responseValidator) {\n await opts.responseValidator(data);\n }\n\n if (opts.responseTransformer) {\n data = await opts.responseTransformer(data);\n }\n }\n\n return opts.responseStyle === \"data\"\n ? data\n : {\n data,\n ...result,\n };\n }\n\n const textError = await response.text();\n let jsonError: unknown;\n\n try {\n jsonError = JSON.parse(textError);\n } catch {\n // noop\n }\n\n throw jsonError ?? textError;\n } catch (error) {\n let finalError = error;\n\n for (const fn of interceptors.error.fns) {\n if (fn) {\n finalError = await fn(\n finalError,\n response,\n request,\n options as ResolvedRequestOptions,\n );\n }\n }\n\n finalError = finalError || {};\n\n if (throwOnError) {\n throw finalError;\n }\n\n // TODO: we probably want to return error and improve types\n return responseStyle === \"data\"\n ? undefined\n : {\n error: finalError,\n request,\n response,\n };\n }\n };\n\n const makeMethodFn =\n (method: Uppercase<HttpMethod>) => (options: RequestOptions) =>\n request({ ...options, method });\n\n const makeSseFn =\n (method: Uppercase<HttpMethod>) => async (options: RequestOptions) => {\n const { opts, url } = await beforeRequest(options);\n return createSseClient({\n ...opts,\n body: opts.body as BodyInit | null | undefined,\n method,\n onRequest: async (url, init) => {\n let request = new Request(url, init);\n for (const fn of interceptors.request.fns) {\n if (fn) {\n request = await fn(request, opts);\n }\n }\n return request;\n },\n serializedBody: getValidRequestBody(opts) as\n BodyInit | null | undefined,\n url,\n });\n };\n\n const _buildUrl: Client[\"buildUrl\"] = (options) =>\n buildUrl({ ..._config, ...options });\n\n return {\n buildUrl: _buildUrl,\n connect: makeMethodFn(\"CONNECT\"),\n delete: makeMethodFn(\"DELETE\"),\n get: makeMethodFn(\"GET\"),\n getConfig,\n head: makeMethodFn(\"HEAD\"),\n interceptors,\n options: makeMethodFn(\"OPTIONS\"),\n patch: makeMethodFn(\"PATCH\"),\n post: makeMethodFn(\"POST\"),\n put: makeMethodFn(\"PUT\"),\n request,\n setConfig,\n sse: {\n connect: makeSseFn(\"CONNECT\"),\n delete: makeSseFn(\"DELETE\"),\n get: makeSseFn(\"GET\"),\n head: makeSseFn(\"HEAD\"),\n options: makeSseFn(\"OPTIONS\"),\n patch: makeSseFn(\"PATCH\"),\n post: makeSseFn(\"POST\"),\n put: makeSseFn(\"PUT\"),\n trace: makeSseFn(\"TRACE\"),\n },\n trace: makeMethodFn(\"TRACE\"),\n } as Client;\n};\n","// API keys encode their region as bk_{region}_{token}, so the client can route\n// to {region}.platform.bird.com automatically.\n\nconst REGION_PATTERN = /^[a-z]{2}[0-9]+$/;\n\n/** Extracts the region code from a `bk_{region}_{token}` key, or undefined. */\nexport function regionFromApiKey(apiKey: string): string | undefined {\n const [prefix, region, token] = apiKey.split(\"_\");\n if (prefix !== \"bk\" || !region || !token) return undefined;\n return REGION_PATTERN.test(region) ? region : undefined;\n}\n\nexport function baseUrlForRegion(region: string): string {\n return `https://${region}.platform.bird.com`;\n}\n","// Code generated by beak gen:caller-detection from clients/caller-detection.yaml. DO NOT EDIT.\n\nexport interface CallerRule {\n env: string;\n equals?: string;\n name?: string;\n passthrough?: boolean;\n}\n\nexport const callerRules: CallerRule[] = [\n { env: \"CLAUDECODE\", name: \"claude-code\" },\n { env: \"CODEX_CI\", name: \"codex\" },\n { env: \"GEMINI_CLI\", name: \"gemini\" },\n { env: \"QWEN_CODE\", name: \"qwen\" },\n { env: \"PI_CODING_AGENT\", name: \"pi\" },\n { env: \"OPENCODE\", name: \"opencode\" },\n { env: \"CLINE_ACTIVE\", name: \"cline\" },\n { env: \"ROO_ACTIVE\", name: \"roo\" },\n { env: \"CURSOR_TRACE_ID\", name: \"cursor\" },\n { env: \"CURSOR_AGENT\", name: \"cursor\" },\n { env: \"ANTIGRAVITY_AGENT\", name: \"antigravity\" },\n { env: \"AUGMENT_AGENT\", name: \"augment\" },\n { env: \"AGENT\", passthrough: true },\n { env: \"AI_AGENT\", passthrough: true },\n { env: \"REPL_ID\", name: \"replit\" },\n { env: \"CI\", name: \"ci\" },\n { env: \"GITHUB_ACTIONS\", name: \"ci\" },\n { env: \"TERM_PROGRAM\", equals: \"zed\", name: \"zed\" },\n { env: \"ZED_TERM\", name: \"zed\" },\n { env: \"TERM_PROGRAM\", equals: \"kiro\", name: \"kiro\" },\n { env: \"TERM_PROGRAM\", equals: \"WarpTerminal\", name: \"warp\" },\n { env: \"TERMINAL_EMULATOR\", equals: \"JetBrains-JediTerm\", name: \"jetbrains\" },\n { env: \"__CFBundleIdentifier\", equals: \"com.exafunction.windsurf\", name: \"windsurf\" },\n { env: \"TERM_PROGRAM\", equals: \"vscode\", name: \"vscode\" },\n];\n\nexport const callerBooleanishSkip: ReadonlySet<string> = new Set([\"1\", \"0\", \"true\", \"false\", \"yes\", \"no\", \"on\", \"off\"]);\n\nexport const callerDefault = \"shell\";\n","import { callerRules, callerBooleanishSkip, callerDefault } from \"./caller-rules.gen.js\";\n\n/**\n * Infers the environment driving the SDK for the `Bird-Caller` usage-telemetry\n * label by walking the generated rules in order (single source of truth:\n * `clients/caller-detection.yaml`, shared with the CLI and the other SDKs).\n * Best-effort and non-authoritative — it only labels traffic, never gates\n * behavior.\n *\n * Edge-safe: `process` is read only through a `typeof`-style `globalThis` guard,\n * so on a browser (no `process.env`) it returns `\"\"` and the client sends no\n * `Bird-Caller` header. `env` is injected in tests.\n */\nexport function detectCaller(env?: Record<string, string | undefined>): string {\n // Tests / explicit callers pass `env`. Otherwise derive it from a *real* Node\n // process only: a browser — including one whose bundler polyfills an empty\n // `process.env` — has no agent, so we return \"\" (no header) rather than falling\n // through to the shell default. A genuine Node process always sets\n // `process.versions.node`; polyfills do not.\n let source = env;\n if (source === undefined) {\n const proc = (\n globalThis as {\n process?: { env?: Record<string, string | undefined>; versions?: { node?: string } };\n }\n ).process;\n if (proc?.versions?.node === undefined) return \"\";\n source = proc.env ?? {};\n }\n for (const rule of callerRules) {\n const value = source[rule.env];\n if (value === undefined || value === \"\" || (rule.equals !== undefined && value !== rule.equals)) {\n continue;\n }\n if (!rule.passthrough) return rule.name as string;\n const sanitized = sanitizeCaller(value);\n if (sanitized) return sanitized;\n }\n return callerDefault;\n}\n\n// Lowercases and bounds a passthrough (AGENT=<name>) value the same charset+length\n// way as the other Bird-* labels, dropping boolean-ish values that carry no\n// harness identity (e.g. OpenCode sets AGENT=1).\nfunction sanitizeCaller(value: string): string {\n const s = value.trim().toLowerCase();\n if (s === \"\" || s.length > 32 || callerBooleanishSkip.has(s)) return \"\";\n return /^[a-z0-9._-]+$/.test(s) ? s : \"\";\n}\n","// Error hierarchy for the Bird SDK.\n//\n// One class per error `type` (clients branch on the coarse `type`,\n// never on individual codes). Two transport classes cover failures with no HTTP\n// response. Scalar fields on the error objects are camelCase — these are\n// SDK-constructed objects, not wire data (the Stripe/OpenAI-node convention:\n// snake data, camel code). Nested wire payloads (validation `details`) pass\n// through as-is.\n//\n// `mapResponseToError` is the single place a non-2xx response becomes a thrown\n// error; the request core calls it once a response is terminal.\n\n/** Root of the hierarchy. Catch this to catch anything the SDK throws. */\nexport class BirdError extends Error {\n constructor(message: string) {\n super(message);\n this.name = \"BirdError\";\n Object.setPrototypeOf(this, new.target.prototype);\n }\n}\n\n/** Network-level failure with no HTTP response (DNS, refused, socket hangup). */\nexport class BirdConnectionError extends BirdError {\n constructor(message: string) {\n super(message);\n this.name = \"BirdConnectionError\";\n Object.setPrototypeOf(this, new.target.prototype);\n }\n}\n\n/** A single attempt exceeded its timeout. Retryable. */\nexport class BirdTimeoutError extends BirdError {\n readonly timeoutMs: number;\n constructor(message: string, timeoutMs: number) {\n super(message);\n this.name = \"BirdTimeoutError\";\n this.timeoutMs = timeoutMs;\n Object.setPrototypeOf(this, new.target.prototype);\n }\n}\n\n/** A webhook payload failed signature verification (bad signature, stale timestamp, malformed headers). */\nexport class BirdWebhookVerificationError extends BirdError {\n constructor(message: string) {\n super(message);\n this.name = \"BirdWebhookVerificationError\";\n Object.setPrototypeOf(this, new.target.prototype);\n }\n}\n\n/** One per-field validation failure (the `details` array on a 422). */\nexport interface ErrorDetail {\n /** Dotted field path, e.g. `to[0].email`, `subject`, `.`. */\n param: string;\n /** What is wrong with this field. */\n message: string;\n}\n\n/** One recovery step: an operation to call to resolve the error. */\nexport interface ErrorNextAction {\n /** operationId of the follow-up operation that resolves this error. */\n operation: string;\n /** Short human-readable label for the recovery step. */\n description?: string;\n /** Permission scope the recovery operation requires, when it is scoped. */\n scope?: string;\n}\n\n/** One verification requirement blocking the action, with the flow that resolves it. */\nexport interface UnmetGate {\n /** Stable identifier for the verification requirement. */\n slug: string;\n /** Human-readable name of the verification requirement. */\n name: string;\n /** The requirement's current state. */\n status: string;\n /** How to resolve this requirement. */\n remediation_kind: string;\n}\n\n/** Constructor fields shared by every API error, mapped from the wire body. */\nexport interface BirdAPIErrorFields {\n statusCode: number;\n /** Opaque, stable error code (`E#####`). */\n code: string;\n /** Coarse category — the value callers branch on. */\n type: string;\n /** Human-readable slug for logs. Paired with `code`, never replaces it. */\n errorName: string;\n message: string;\n /** Stable link to the docs page for this code. */\n docUrl: string;\n /** Correlation ID — also the `X-Request-Id` response header. */\n requestId: string;\n /** Offending field, when applicable. */\n param?: string;\n /** Verbatim code from a downstream system (SMTP reply, payment decline). */\n vendorCode?: string;\n /** Human recovery line for this error, when a recovery is known. */\n remediation?: string;\n /** Operations that resolve this error, in the order to try them. */\n next?: ErrorNextAction[];\n /** Verification requirements blocking this action, when it is blocked pending verification. */\n unmetGates?: UnmetGate[];\n}\n\n/** The server returned an error body. Base for every `type`-specific class. */\nexport class BirdAPIError extends BirdError {\n readonly statusCode: number;\n readonly code: string;\n readonly type: string;\n readonly errorName: string;\n readonly docUrl: string;\n readonly requestId: string;\n readonly param?: string;\n readonly vendorCode?: string;\n readonly remediation?: string;\n readonly next?: ErrorNextAction[];\n readonly unmetGates?: UnmetGate[];\n\n constructor(fields: BirdAPIErrorFields) {\n super(fields.message);\n this.name = \"BirdAPIError\";\n this.statusCode = fields.statusCode;\n this.code = fields.code;\n this.type = fields.type;\n this.errorName = fields.errorName;\n this.docUrl = fields.docUrl;\n this.requestId = fields.requestId;\n this.param = fields.param;\n this.vendorCode = fields.vendorCode;\n this.remediation = fields.remediation;\n this.next = fields.next;\n this.unmetGates = fields.unmetGates;\n Object.setPrototypeOf(this, new.target.prototype);\n }\n}\n\n// One class per `type` enum value. The plain ones add nothing beyond the base;\n// they exist so callers can `instanceof BirdNotFoundError` rather than compare\n// strings, and so the special-field classes have peers.\n\n/** 401 — authentication failed or missing. */\nexport class BirdAuthError extends BirdAPIError {\n constructor(fields: BirdAPIErrorFields) {\n super(fields);\n this.name = \"BirdAuthError\";\n Object.setPrototypeOf(this, new.target.prototype);\n }\n}\n\n/** 403 — authenticated but not allowed. */\nexport class BirdPermissionError extends BirdAPIError {\n constructor(fields: BirdAPIErrorFields) {\n super(fields);\n this.name = \"BirdPermissionError\";\n Object.setPrototypeOf(this, new.target.prototype);\n }\n}\n\n/** 404 — resource does not exist. */\nexport class BirdNotFoundError extends BirdAPIError {\n constructor(fields: BirdAPIErrorFields) {\n super(fields);\n this.name = \"BirdNotFoundError\";\n Object.setPrototypeOf(this, new.target.prototype);\n }\n}\n\n/** 409 — semantic conflict (e.g. a unique value already taken). */\nexport class BirdConflictError extends BirdAPIError {\n constructor(fields: BirdAPIErrorFields) {\n super(fields);\n this.name = \"BirdConflictError\";\n Object.setPrototypeOf(this, new.target.prototype);\n }\n}\n\n/** 400 — malformed request. */\nexport class BirdBadRequestError extends BirdAPIError {\n constructor(fields: BirdAPIErrorFields) {\n super(fields);\n this.name = \"BirdBadRequestError\";\n Object.setPrototypeOf(this, new.target.prototype);\n }\n}\n\n/** 402 — billing/balance problem. */\nexport class BirdBillingError extends BirdAPIError {\n constructor(fields: BirdAPIErrorFields) {\n super(fields);\n this.name = \"BirdBillingError\";\n Object.setPrototypeOf(this, new.target.prototype);\n }\n}\n\n/** 412/428 — a precondition was not met. */\nexport class BirdPreconditionError extends BirdAPIError {\n constructor(fields: BirdAPIErrorFields) {\n super(fields);\n this.name = \"BirdPreconditionError\";\n Object.setPrototypeOf(this, new.target.prototype);\n }\n}\n\n/** 413 — request body too large. */\nexport class BirdPayloadTooLargeError extends BirdAPIError {\n constructor(fields: BirdAPIErrorFields) {\n super(fields);\n this.name = \"BirdPayloadTooLargeError\";\n Object.setPrototypeOf(this, new.target.prototype);\n }\n}\n\n/** 500 — unexpected server error. */\nexport class BirdInternalError extends BirdAPIError {\n constructor(fields: BirdAPIErrorFields) {\n super(fields);\n this.name = \"BirdInternalError\";\n Object.setPrototypeOf(this, new.target.prototype);\n }\n}\n\n/** 501 — endpoint not implemented. */\nexport class BirdNotImplementedError extends BirdAPIError {\n constructor(fields: BirdAPIErrorFields) {\n super(fields);\n this.name = \"BirdNotImplementedError\";\n Object.setPrototypeOf(this, new.target.prototype);\n }\n}\n\n/** 421 — request reached the wrong region. */\nexport class BirdMisdirectedError extends BirdAPIError {\n constructor(fields: BirdAPIErrorFields) {\n super(fields);\n this.name = \"BirdMisdirectedError\";\n Object.setPrototypeOf(this, new.target.prototype);\n }\n}\n\n/** 503 — service temporarily unavailable. */\nexport class BirdServiceUnavailableError extends BirdAPIError {\n constructor(fields: BirdAPIErrorFields) {\n super(fields);\n this.name = \"BirdServiceUnavailableError\";\n Object.setPrototypeOf(this, new.target.prototype);\n }\n}\n\n/** 422 — field validation failed; `details` carries the per-field errors. */\nexport class BirdValidationError extends BirdAPIError {\n readonly details: ErrorDetail[];\n constructor(fields: BirdAPIErrorFields & { details: ErrorDetail[] }) {\n super(fields);\n this.name = \"BirdValidationError\";\n this.details = fields.details;\n Object.setPrototypeOf(this, new.target.prototype);\n }\n}\n\n/** 429 — rate limited; `retryAfter` is the server-advised wait in seconds. */\nexport class BirdRateLimitError extends BirdAPIError {\n readonly retryAfter?: number;\n constructor(fields: BirdAPIErrorFields & { retryAfter?: number }) {\n super(fields);\n this.name = \"BirdRateLimitError\";\n this.retryAfter = fields.retryAfter;\n Object.setPrototypeOf(this, new.target.prototype);\n }\n}\n\n/** Shape of the wire error body (`ErrorBody`), snake_case as sent. */\ninterface WireErrorBody {\n type?: string;\n code?: string;\n name?: string;\n message?: string;\n doc_url?: string;\n request_id?: string;\n param?: string;\n vendor_code?: string;\n details?: ErrorDetail[];\n remediation?: string;\n next?: ErrorNextAction[];\n unmet_gates?: UnmetGate[];\n}\n\n/**\n * Parse `Retry-After` (delta-seconds or HTTP-date) into whole seconds. A\n * negative or unparseable value yields `undefined` — a negative wait is\n * meaningless, so both the user-facing `retryAfter` and the retry loop treat it\n * as \"no server advice\". The single Retry-After parser; `retryDelay` builds on it.\n */\nexport function parseRetryAfter(headers?: Headers): number | undefined {\n const header = headers?.get(\"Retry-After\");\n if (!header) return undefined;\n const seconds = Number(header);\n const value = Number.isFinite(seconds)\n ? seconds\n : (Date.parse(header) - Date.now()) / 1000;\n return Number.isFinite(value) && value >= 0 ? Math.round(value) : undefined;\n}\n\n// Status → type fallback for non-JSON error bodies (proxy 502s, etc.) where the\n// body carries no `type`.\nfunction inferType(status: number): string {\n switch (status) {\n case 400:\n return \"bad_request_error\";\n case 401:\n return \"auth_error\";\n case 402:\n return \"billing_error\";\n case 403:\n return \"permission_error\";\n case 404:\n return \"not_found_error\";\n case 409:\n return \"conflict_error\";\n case 412:\n case 428:\n return \"precondition_error\";\n case 413:\n return \"payload_too_large_error\";\n case 421:\n return \"misdirected_error\";\n case 422:\n return \"validation_error\";\n case 429:\n return \"rate_limit_error\";\n case 501:\n return \"not_implemented_error\";\n case 503:\n return \"service_unavailable_error\";\n default:\n return status >= 500 ? \"internal_error\" : \"bad_request_error\";\n }\n}\n\n/**\n * Map a non-2xx response to the right `BirdAPIError` subclass. The single place\n * the SDK turns a wire error into a thrown error.\n */\nexport function mapResponseToError(\n status: number,\n body: unknown,\n headers?: Headers,\n): BirdAPIError {\n // The API wraps errors as `{ \"error\": { … } }`; unwrap it (tolerating a bare\n // top-level body and a non-object body) so the wire type/code/message/request_id\n // are read, not defaulted. Without this the type was only ever inferred from the\n // HTTP status and code/request_id were dropped.\n const raw = (body ?? {}) as Record<string, unknown>;\n const b =\n (raw.error as WireErrorBody | undefined) ?? (raw as WireErrorBody) ?? {};\n const fields: BirdAPIErrorFields = {\n statusCode: status,\n code: b.code ?? \"unknown\",\n type: b.type ?? inferType(status),\n errorName: b.name ?? \"\",\n message: b.message ?? `Request failed with status ${status}`,\n docUrl: b.doc_url ?? \"\",\n requestId: b.request_id ?? headers?.get(\"X-Request-Id\") ?? \"\",\n param: b.param,\n vendorCode: b.vendor_code,\n remediation: b.remediation,\n next: b.next ?? [], // normalize a null/absent wire `next` to [] so callers can always iterate\n unmetGates: b.unmet_gates ?? [], // normalize a null/absent wire `unmet_gates` to [] so callers can always iterate\n };\n\n switch (fields.type) {\n case \"auth_error\":\n return new BirdAuthError(fields);\n case \"permission_error\":\n return new BirdPermissionError(fields);\n case \"not_found_error\":\n return new BirdNotFoundError(fields);\n case \"conflict_error\":\n return new BirdConflictError(fields);\n case \"bad_request_error\":\n return new BirdBadRequestError(fields);\n case \"billing_error\":\n return new BirdBillingError(fields);\n case \"precondition_error\":\n return new BirdPreconditionError(fields);\n case \"payload_too_large_error\":\n return new BirdPayloadTooLargeError(fields);\n case \"internal_error\":\n return new BirdInternalError(fields);\n case \"not_implemented_error\":\n return new BirdNotImplementedError(fields);\n case \"misdirected_error\":\n return new BirdMisdirectedError(fields);\n case \"service_unavailable_error\":\n return new BirdServiceUnavailableError(fields);\n case \"rate_limit_error\":\n return new BirdRateLimitError({\n ...fields,\n retryAfter: parseRetryAfter(headers),\n });\n case \"validation_error\":\n return new BirdValidationError({ ...fields, details: b.details ?? [] });\n default:\n return new BirdAPIError(fields);\n }\n}\n","// The request lifecycle: retries, timeouts, and idempotency.\n//\n// BirdHTTPClient owns the attempt loop and wraps a generated hey-api SDK call\n// (passed as a thunk) so resources keep the generated call-site typing while\n// the loop owns: idempotency-key generate-once-and-reuse, per-attempt timeout,\n// AbortSignal, backoff with full jitter + Retry-After, and turning a terminal\n// response into a thrown BirdError via mapResponseToError.\n//\n// The hey-api client is configured WITHOUT throwOnError: a non-2xx returns\n// `{ error, response }` so this loop can inspect status and decide\n// retry-vs-throw. Network failures reject and are caught here.\n\nimport {\n BirdConnectionError,\n BirdError,\n BirdTimeoutError,\n mapResponseToError,\n parseRetryAfter,\n} from \"../errors.js\";\n\n/** Transport metadata exposed to callers via `.withResponse()`. */\nexport interface BirdResponse {\n status: number;\n headers: Headers;\n /** Correlation ID — the `X-Request-Id` header. */\n requestId: string;\n}\n\n/** Per-request lifecycle inputs, supplied by the resource method. */\nexport interface RequestLifecycleOptions {\n /** HTTP method — decides idempotency-key generation and retry safety. */\n method: string;\n /** Caller-supplied idempotency key; auto-generated for mutations if absent. */\n idempotencyKey?: string;\n /** Caller cancellation. */\n signal?: AbortSignal;\n /** Per-attempt timeout (ms). Overrides the client default. */\n timeout?: number;\n /** Max retry attempts. Overrides the client default. */\n maxRetries?: number;\n}\n\n/** The shape a generated hey-api SDK call resolves to. */\nexport interface FetchOutcome<T> {\n data?: T;\n error?: unknown;\n /** Present whenever the HTTP round-trip completed; absent only on a rejected call. */\n response?: Response;\n}\n\n/** Context handed to the call thunk on each attempt. */\nexport interface AttemptContext {\n signal: AbortSignal;\n idempotencyKey?: string;\n}\n\nexport interface CoreDefaults {\n /** Per-attempt timeout (ms). */\n timeout: number;\n /** Max retry attempts. */\n maxRetries: number;\n /**\n * Extra credentials some operations require on top of the API key, keyed by the\n * security scheme that names them. A generated method names the schemes its\n * operation declares; the core resolves them, so a credential reaches only\n * those operations and never an unrelated request.\n */\n credentials?: Record<string, { header: string; value?: string; how: string }>;\n}\n\nconst BACKOFF_BASE_MS = 500;\nconst BACKOFF_CAP_MS = 8_000;\nconst RETRY_AFTER_CAP_MS = 60_000;\n\nexport class BirdHTTPClient {\n constructor(private readonly defaults: CoreDefaults) {}\n\n /**\n * Resolve the credential headers an operation's security schemes require.\n * Throws before the request when one is unconfigured, so a caller gets a named\n * error instead of a 401.\n */\n credentialHeaders(\n schemes: string[] | undefined,\n override?: Record<string, string>,\n ): Record<string, string> {\n if (!schemes?.length) return {};\n const out: Record<string, string> = {};\n for (const scheme of schemes) {\n const cred = this.defaults.credentials?.[scheme];\n if (!cred) throw new Error(`Unknown credential scheme \"${scheme}\"`);\n const value = override?.[scheme] ?? cred.value;\n if (!value) throw new Error(`${cred.header} is required for this operation. ${cred.how}`);\n out[cred.header] = value;\n }\n return out;\n }\n\n /**\n * Run a generated hey-api SDK call through the request lifecycle.\n *\n * @param call Invokes the SDK function; receives the per-attempt signal and\n * the idempotency key to set as a header.\n * @returns the parsed body plus transport metadata.\n * @throws a `BirdError` subclass on terminal failure; the native\n * `AbortError` if the caller's signal aborts.\n */\n async request<T>(\n call: (ctx: AttemptContext) => Promise<FetchOutcome<T>>,\n options: RequestLifecycleOptions,\n ): Promise<{ data: T; response: BirdResponse }> {\n const maxRetries = options.maxRetries ?? this.defaults.maxRetries;\n const timeout = options.timeout ?? this.defaults.timeout;\n // Generated once, reused on every attempt — regenerating would double-execute.\n const idempotencyKey =\n options.idempotencyKey ??\n (isMutation(options.method) ? crypto.randomUUID() : undefined);\n\n for (let attempt = 0; ; attempt++) {\n throwIfAborted(options.signal);\n\n // Retry a transient failure with backoff if attempts remain; otherwise\n // throw the terminal error. Caller `continue`s the loop after this returns.\n const retryOrThrow = async (terminal: () => BirdError): Promise<void> => {\n if (attempt >= maxRetries) throw terminal();\n await sleep(backoffDelay(attempt), options.signal);\n };\n\n const timeoutSignal = AbortSignal.timeout(timeout);\n const signal = options.signal\n ? AbortSignal.any([options.signal, timeoutSignal])\n : timeoutSignal;\n\n let outcome: FetchOutcome<T> | undefined;\n try {\n outcome = await call({ signal, idempotencyKey });\n } catch (err) {\n // The fetch rejected: caller abort, per-attempt timeout, or network.\n throwIfAborted(options.signal); // caller abort wins, terminal\n await retryOrThrow(() =>\n timeoutSignal.aborted\n ? new BirdTimeoutError(`Request timed out after ${timeout}ms`, timeout)\n : new BirdConnectionError(errorMessage(err)),\n );\n continue;\n }\n\n const res = outcome.response;\n if (!res) {\n // A resolved call with no response is a transport failure (the client\n // normally rejects instead) — treat it like a network error.\n await retryOrThrow(() => new BirdConnectionError(\"No response received from the server\"));\n continue;\n }\n if (res.ok) {\n return { data: outcome.data as T, response: toBirdResponse(res) };\n }\n if (!isRetryableStatus(res.status) || attempt >= maxRetries) {\n throw mapResponseToError(res.status, outcome.error, res.headers);\n }\n await sleep(retryDelay(attempt, res.headers), options.signal);\n }\n }\n}\n\nfunction isMutation(method: string): boolean {\n return [\"POST\", \"PATCH\", \"DELETE\"].includes(method.toUpperCase());\n}\n\n// Retry network failures, per-attempt timeouts, and transient statuses. 409 is a\n// semantic conflict a retry can't resolve; 501 is permanent; other 4xx are\n// deterministic.\nfunction isRetryableStatus(status: number): boolean {\n return [408, 429, 500, 502, 503, 504].includes(status);\n}\n\n/** Full-jitter exponential backoff: random in [0, min(cap, base·2^attempt)). */\nfunction backoffDelay(attempt: number): number {\n const ceiling = Math.min(BACKOFF_CAP_MS, BACKOFF_BASE_MS * 2 ** attempt);\n return Math.random() * ceiling;\n}\n\n/** Honor Retry-After on a retryable response, else fall back to backoff. */\nfunction retryDelay(attempt: number, headers: Headers): number {\n const seconds = parseRetryAfter(headers);\n return seconds === undefined ? backoffDelay(attempt) : Math.min(seconds * 1000, RETRY_AFTER_CAP_MS);\n}\n\nfunction toBirdResponse(res: Response): BirdResponse {\n return {\n status: res.status,\n headers: res.headers,\n requestId: res.headers.get(\"X-Request-Id\") ?? \"\",\n };\n}\n\n// The abort contract: surface the caller's `signal.reason` so a caller-initiated\n// abort stays the native AbortError, falling back to a synthetic one.\nfunction abortReason(signal: AbortSignal | undefined): unknown {\n return signal?.reason ?? new DOMException(\"Aborted\", \"AbortError\");\n}\n\nfunction throwIfAborted(signal: AbortSignal | undefined): void {\n if (signal?.aborted) throw abortReason(signal);\n}\n\n/** Sleep, rejecting immediately if the caller's signal aborts. */\nfunction sleep(ms: number, signal: AbortSignal | undefined): Promise<void> {\n return new Promise((resolve, reject) => {\n if (signal?.aborted) {\n reject(abortReason(signal));\n return;\n }\n const timer = setTimeout(() => {\n signal?.removeEventListener(\"abort\", onAbort);\n resolve();\n }, ms);\n const onAbort = () => {\n clearTimeout(timer);\n reject(abortReason(signal));\n };\n signal?.addEventListener(\"abort\", onAbort, { once: true });\n });\n}\n\nfunction errorMessage(err: unknown): string {\n if (err instanceof Error) return err.message;\n return String(err);\n}\n","// What resource methods return: a Promise you can await for the value, plus\n// `.withResponse()` for transport metadata and `.safe()` for a non-throwing\n// `{ data, error, response }` result (errors throw by default,\n// `.safe()` is the opt-in result form). Pagination follows R1: awaiting a list yields the\n// first page; `for await` walks every item across pages, fetching lazily.\n\nimport type { BirdResponse } from \"./http.js\";\nimport { BirdError } from \"../errors.js\";\n\n/** Per-request overrides accepted by every resource method. */\nexport interface RequestOptions {\n /**\n * Per-call override for the extra credentials an operation requires, keyed by\n * security scheme (`{ RealtimeKey: \"…\", RealtimeSecret: \"…\" }`). Overrides the\n * client config for this call, so one client can address several apps.\n */\n credentials?: Record<string, string>;\n\n /** Idempotency key; auto-generated for mutations if omitted, reused on retry. */\n idempotencyKey?: string;\n /** Caller cancellation. Rejects with the native `AbortError`. */\n signal?: AbortSignal;\n /** Per-attempt timeout (ms). Overrides the client default. */\n timeout?: number;\n /** Max retry attempts. Overrides the client default. */\n maxRetries?: number;\n /** Extra headers for this request. SDK-internal headers win on conflict. */\n headers?: Record<string, string>;\n}\n\n/**\n * The result of `.safe()` — the value or the error, never thrown. On success\n * `data` and the `response` envelope are present and `error` is `null`. On\n * failure `error` is a `BirdError` you can `instanceof`-narrow, and `data`/\n * `response` are `null` — the metadata you need (status, request id) is on the\n * error itself. A caller-initiated abort is not a Bird failure and still throws\n * (the native `AbortError`).\n */\nexport type SafeResult<T> =\n | { data: T; error: null; response: BirdResponse }\n | { data: null; error: BirdError; response: null };\n\n/** Single-result return: `await` for the value, `.withResponse()` for metadata. */\nexport interface APIPromise<T> extends Promise<T> {\n withResponse(): Promise<{ data: T; response: BirdResponse }>;\n /** Resolve to `{ data, error }` instead of throwing. */\n safe(): Promise<SafeResult<T>>;\n}\n\n// Build the base `await`→data promise shared by both wrappers and wire its\n// `.withResponse()`/`.safe()` views onto `inner`.\n//\n// `.withResponse()` and `.safe()` consume `inner` directly, so when a caller\n// uses one of those (or fires-and-forgets) this base promise is never awaited.\n// Mark its rejection handled — the chosen view still surfaces the error — so a\n// failed call isn't flagged as an unhandled rejection.\nfunction basePromise<T, P extends APIPromise<T>>(\n inner: Promise<{ data: T; response: BirdResponse }>,\n): P {\n const promise = inner.then((r) => r.data) as P;\n void promise.catch(() => {});\n promise.withResponse = () => inner;\n promise.safe = () => toSafe(inner);\n return promise;\n}\n\nexport function apiPromise<T>(\n inner: Promise<{ data: T; response: BirdResponse }>,\n): APIPromise<T> {\n return basePromise(inner);\n}\n\n/** One cursor-paginated page — the wire envelope shape (snake), verbatim. */\nexport interface CursorPage<T> {\n data: T[];\n /** Pass back as `starting_after` to advance. Null at the end. */\n next_cursor: string | null;\n /** Pass back as `ending_before` to step back. Null at the start. */\n prev_cursor: string | null;\n /** Refresh anchor; pass as `ending_before` later for items since this page. */\n refresh_cursor: string | null;\n /** Total across all pages — only when `include_total=true` was passed. */\n total?: number | null;\n}\n\n/**\n * List return (R1): `await` resolves the first page; `for await` walks every\n * item across all pages, fetching subsequent pages lazily.\n */\nexport interface PaginatedPromise<T> extends Promise<CursorPage<T>>, AsyncIterable<T> {\n withResponse(): Promise<{ data: CursorPage<T>; response: BirdResponse }>;\n /** Resolve the first page as `{ data, error }` instead of throwing. */\n safe(): Promise<SafeResult<CursorPage<T>>>;\n}\n\nexport function paginate<T>(\n fetchPage: (cursor?: string) => Promise<{ data: CursorPage<T>; response: BirdResponse }>,\n): PaginatedPromise<T> {\n const first = fetchPage();\n const promise = basePromise<CursorPage<T>, PaginatedPromise<T>>(first);\n promise[Symbol.asyncIterator] = async function* () {\n let result = await first;\n for (;;) {\n for (const item of result.data.data) yield item;\n if (result.data.next_cursor == null) return;\n result = await fetchPage(result.data.next_cursor);\n }\n };\n return promise;\n}\n\n// `.safe()` turns Bird failures (the BirdError hierarchy) into values. Anything\n// else — a caller-initiated AbortError, or an unexpected non-Bird throw — keeps\n// propagating, so `error` stays soundly typed as `BirdError`.\nfunction toSafe<V>(\n inner: Promise<{ data: V; response: BirdResponse }>,\n): Promise<SafeResult<V>> {\n return inner.then(\n ({ data, response }): SafeResult<V> => ({ data, error: null, response }),\n (error): SafeResult<V> => {\n if (error instanceof BirdError) return { data: null, error, response: null };\n throw error;\n },\n );\n}\n","// This file is auto-generated by @hey-api/openapi-ts\n\nimport {\n type ClientOptions,\n type Config,\n createClient,\n createConfig,\n} from \"./client\";\nimport type { ClientOptions as ClientOptions2 } from \"./types.gen\";\n\n/**\n * The `createClientConfig()` function will be called on client initialization\n * and the returned object will become the client's initial configuration.\n *\n * You may want to initialize your client this way instead of calling\n * `setConfig()`. This is useful for example if you're using Next.js\n * to ensure your client always has the correct values.\n */\nexport type CreateClientConfig<T extends ClientOptions = ClientOptions2> = (\n override?: Config<ClientOptions & T>,\n) => Config<Required<ClientOptions> & T>;\n\nexport const client = createClient(createConfig<ClientOptions2>());\n","// This file is auto-generated by @hey-api/openapi-ts\n\nimport type { Client, Options as Options2, TDataShape } from \"./client\";\nimport { client } from \"./client.gen\";\nimport type {\n ArchiveContactPropertyData,\n ArchiveContactPropertyErrors,\n ArchiveContactPropertyResponses,\n AssignAudienceContactsData,\n AssignAudienceContactsErrors,\n AssignAudienceContactsResponses,\n CancelEmailMessageData,\n CancelEmailMessageErrors,\n CancelEmailMessageResponses,\n CreateAudienceData,\n CreateAudienceErrors,\n CreateAudienceResponses,\n CreateContactBatchData,\n CreateContactBatchErrors,\n CreateContactBatchResponses,\n CreateContactData,\n CreateContactErrors,\n CreateContactPropertyData,\n CreateContactPropertyErrors,\n CreateContactPropertyResponses,\n CreateContactResponses,\n CreateDomainData,\n CreateDomainErrors,\n CreateDomainResponses,\n CreateEmailLookupData,\n CreateEmailLookupErrors,\n CreateEmailLookupResponses,\n CreateEmailMessageBatchData,\n CreateEmailMessageBatchErrors,\n CreateEmailMessageBatchResponses,\n CreateEmailMessageData,\n CreateEmailMessageErrors,\n CreateEmailMessageResponses,\n CreateMailboxData,\n CreateMailboxErrors,\n CreateMailboxMessageData,\n CreateMailboxMessageErrors,\n CreateMailboxMessageResponses,\n CreateMailboxReceiveRuleData,\n CreateMailboxReceiveRuleErrors,\n CreateMailboxReceiveRuleResponses,\n CreateMailboxResponses,\n CreatePhoneNumberLookupData,\n CreatePhoneNumberLookupErrors,\n CreatePhoneNumberLookupResponses,\n CreateSmsMessageBatchData,\n CreateSmsMessageBatchErrors,\n CreateSmsMessageBatchResponses,\n CreateSmsMessageData,\n CreateSmsMessageErrors,\n CreateSmsMessageResponses,\n CreateVerificationCheckData,\n CreateVerificationCheckErrors,\n CreateVerificationCheckResponses,\n CreateVerificationData,\n CreateVerificationErrors,\n CreateVerificationNextChannelData,\n CreateVerificationNextChannelErrors,\n CreateVerificationNextChannelResponses,\n CreateVerificationResponses,\n CreateWhatsAppMessageData,\n CreateWhatsAppMessageErrors,\n CreateWhatsAppMessageResponses,\n DeleteAudienceData,\n DeleteAudienceErrors,\n DeleteAudienceResponses,\n DeleteContactData,\n DeleteContactErrors,\n DeleteContactResponses,\n DeleteDomainData,\n DeleteDomainErrors,\n DeleteDomainResponses,\n DeleteEmailThreadData,\n DeleteEmailThreadErrors,\n DeleteEmailThreadResponses,\n DeleteMailboxData,\n DeleteMailboxErrors,\n DeleteMailboxReceiveRuleData,\n DeleteMailboxReceiveRuleErrors,\n DeleteMailboxReceiveRuleResponses,\n DeleteMailboxResponses,\n DisconnectRealtimeAppMemberData,\n DisconnectRealtimeAppMemberErrors,\n DisconnectRealtimeAppMemberResponses,\n GetAudienceData,\n GetAudienceErrors,\n GetAudienceResponses,\n GetContactData,\n GetContactErrors,\n GetContactPropertyData,\n GetContactPropertyErrors,\n GetContactPropertyResponses,\n GetContactResponses,\n GetDomainData,\n GetDomainErrors,\n GetDomainResponses,\n GetEmailMessageData,\n GetEmailMessageErrors,\n GetEmailMessageResponses,\n GetEmailStatsByBounceCodeData,\n GetEmailStatsByBounceCodeErrors,\n GetEmailStatsByBounceCodeResponses,\n GetEmailStatsByBroadcastData,\n GetEmailStatsByBroadcastErrors,\n GetEmailStatsByBroadcastResponses,\n GetEmailStatsByCategoryData,\n GetEmailStatsByCategoryErrors,\n GetEmailStatsByCategoryResponses,\n GetEmailStatsByClientData,\n GetEmailStatsByClientErrors,\n GetEmailStatsByClientResponses,\n GetEmailStatsByComplaintTypeData,\n GetEmailStatsByComplaintTypeErrors,\n GetEmailStatsByComplaintTypeResponses,\n GetEmailStatsByLocationData,\n GetEmailStatsByLocationErrors,\n GetEmailStatsByLocationResponses,\n GetEmailStatsByMailboxProviderData,\n GetEmailStatsByMailboxProviderErrors,\n GetEmailStatsByMailboxProviderRegionData,\n GetEmailStatsByMailboxProviderRegionErrors,\n GetEmailStatsByMailboxProviderRegionResponses,\n GetEmailStatsByMailboxProviderResponses,\n GetEmailStatsByRecipientDomainData,\n GetEmailStatsByRecipientDomainErrors,\n GetEmailStatsByRecipientDomainResponses,\n GetEmailStatsBySendingDomainData,\n GetEmailStatsBySendingDomainErrors,\n GetEmailStatsBySendingDomainResponses,\n GetEmailStatsBySendingIpData,\n GetEmailStatsBySendingIpErrors,\n GetEmailStatsBySendingIpResponses,\n GetEmailStatsByTagData,\n GetEmailStatsByTagErrors,\n GetEmailStatsByTagResponses,\n GetEmailStatsByTemplateData,\n GetEmailStatsByTemplateErrors,\n GetEmailStatsByTemplateResponses,\n GetEmailStatsDailyData,\n GetEmailStatsDailyErrors,\n GetEmailStatsDailyResponses,\n GetEmailStatsHourlyData,\n GetEmailStatsHourlyErrors,\n GetEmailStatsHourlyResponses,\n GetEmailStatsSummaryData,\n GetEmailStatsSummaryErrors,\n GetEmailStatsSummaryResponses,\n GetEmailThreadData,\n GetEmailThreadErrors,\n GetEmailThreadMessageBodyData,\n GetEmailThreadMessageBodyErrors,\n GetEmailThreadMessageBodyResponses,\n GetEmailThreadMessageData,\n GetEmailThreadMessageErrors,\n GetEmailThreadMessageResponses,\n GetEmailThreadResponses,\n GetMailboxData,\n GetMailboxErrors,\n GetMailboxResponses,\n GetMailboxStatsData,\n GetMailboxStatsErrors,\n GetMailboxStatsResponses,\n GetRealtimeAppChannelData,\n GetRealtimeAppChannelErrors,\n GetRealtimeAppChannelResponses,\n GetSmsMessageData,\n GetSmsMessageErrors,\n GetSmsMessageResponses,\n GetSmsTemplateData,\n GetSmsTemplateErrors,\n GetSmsTemplateResponses,\n GetVoiceCallData,\n GetVoiceCallErrors,\n GetVoiceCallResponses,\n GetWhatsAppMessageData,\n GetWhatsAppMessageErrors,\n GetWhatsAppMessageResponses,\n ListAudienceContactsData,\n ListAudienceContactsErrors,\n ListAudienceContactsResponses,\n ListAudiencesData,\n ListAudiencesErrors,\n ListAudiencesResponses,\n ListContactPropertiesData,\n ListContactPropertiesErrors,\n ListContactPropertiesResponses,\n ListContactsData,\n ListContactsErrors,\n ListContactsResponses,\n ListDomainsData,\n ListDomainsErrors,\n ListDomainsResponses,\n ListEmailMessagesData,\n ListEmailMessagesErrors,\n ListEmailMessagesResponses,\n ListEmailThreadMessageAttachmentsData,\n ListEmailThreadMessageAttachmentsErrors,\n ListEmailThreadMessageAttachmentsResponses,\n ListEmailThreadMessagesData,\n ListEmailThreadMessagesErrors,\n ListEmailThreadMessagesResponses,\n ListEmailThreadsData,\n ListEmailThreadsErrors,\n ListEmailThreadsResponses,\n ListMailboxesData,\n ListMailboxesErrors,\n ListMailboxesResponses,\n ListMailboxLabelsData,\n ListMailboxLabelsErrors,\n ListMailboxLabelsResponses,\n ListMailboxReceiveRulesData,\n ListMailboxReceiveRulesErrors,\n ListMailboxReceiveRulesResponses,\n ListRealtimeAppChannelMembersData,\n ListRealtimeAppChannelMembersErrors,\n ListRealtimeAppChannelMembersResponses,\n ListRealtimeAppChannelsData,\n ListRealtimeAppChannelsErrors,\n ListRealtimeAppChannelsResponses,\n ListSmsMessagesData,\n ListSmsMessagesErrors,\n ListSmsMessagesResponses,\n ListSmsTemplatesData,\n ListSmsTemplatesErrors,\n ListSmsTemplatesResponses,\n ListVoiceCallsData,\n ListVoiceCallsErrors,\n ListVoiceCallsResponses,\n ListWhatsAppMessageEventsData,\n ListWhatsAppMessageEventsErrors,\n ListWhatsAppMessageEventsResponses,\n ListWhatsAppMessagesData,\n ListWhatsAppMessagesErrors,\n ListWhatsAppMessagesResponses,\n PublishRealtimeAppBatchData,\n PublishRealtimeAppBatchErrors,\n PublishRealtimeAppBatchResponses,\n PublishRealtimeAppEventData,\n PublishRealtimeAppEventErrors,\n PublishRealtimeAppEventResponses,\n ReplyEmailThreadMessageData,\n ReplyEmailThreadMessageErrors,\n ReplyEmailThreadMessageResponses,\n RestoreMailboxData,\n RestoreMailboxErrors,\n RestoreMailboxResponses,\n ResumeMailboxData,\n ResumeMailboxErrors,\n ResumeMailboxResponses,\n SendRealtimeAppMemberEventData,\n SendRealtimeAppMemberEventErrors,\n SendRealtimeAppMemberEventResponses,\n UnarchiveContactPropertyData,\n UnarchiveContactPropertyErrors,\n UnarchiveContactPropertyResponses,\n UnassignAudienceContactData,\n UnassignAudienceContactErrors,\n UnassignAudienceContactResponses,\n UnassignAudienceContactsData,\n UnassignAudienceContactsErrors,\n UnassignAudienceContactsResponses,\n UpdateAudienceData,\n UpdateAudienceErrors,\n UpdateAudienceResponses,\n UpdateContactData,\n UpdateContactErrors,\n UpdateContactPropertyData,\n UpdateContactPropertyErrors,\n UpdateContactPropertyResponses,\n UpdateContactResponses,\n UpdateDomainData,\n UpdateDomainErrors,\n UpdateDomainResponses,\n UpdateEmailThreadData,\n UpdateEmailThreadErrors,\n UpdateEmailThreadResponses,\n UpdateMailboxData,\n UpdateMailboxErrors,\n UpdateMailboxResponses,\n VerifyDomainData,\n VerifyDomainErrors,\n VerifyDomainResponses,\n} from \"./types.gen\";\n\nexport type Options<\n TData extends TDataShape = TDataShape,\n ThrowOnError extends boolean = boolean,\n TResponse = unknown,\n> = Options2<TData, ThrowOnError, TResponse> & {\n /**\n * You can provide a client instance returned by `createClient()` instead of\n * individual options. This might be also useful if you want to implement a\n * custom client.\n */\n client?: Client;\n /**\n * You can pass arbitrary values through the `meta` object. This can be\n * used to access values that aren't defined as part of the SDK function.\n */\n meta?: Record<string, unknown>;\n};\n\n/**\n * Publish a Realtime event\n *\n * Publishes an event to one or more channels of a Realtime app. Listing several channels broadcasts the event to all of them in one call. Connected clients subscribed to those channels receive it in real time.\n */\nexport const publishRealtimeAppEvent = <ThrowOnError extends boolean = false>(\n options: Options<PublishRealtimeAppEventData, ThrowOnError>,\n) =>\n (options.client ?? client).post<\n PublishRealtimeAppEventResponses,\n PublishRealtimeAppEventErrors,\n ThrowOnError\n >({\n security: [\n { scheme: \"bearer\", type: \"http\" },\n { name: \"X-Realtime-Key\", type: \"apiKey\" },\n { name: \"X-Realtime-Secret\", type: \"apiKey\" },\n {\n in: \"cookie\",\n name: \"bird_session\",\n type: \"apiKey\",\n },\n ],\n url: \"/v1/realtime/apps/{realtime_app_id}/events\",\n ...options,\n headers: {\n \"Content-Type\": \"application/json\",\n ...options.headers,\n },\n });\n\n/**\n * Publish a batch of Realtime events\n *\n * Publishes up to 10 events (each to one channel) in a single request.\n */\nexport const publishRealtimeAppBatch = <ThrowOnError extends boolean = false>(\n options: Options<PublishRealtimeAppBatchData, ThrowOnError>,\n) =>\n (options.client ?? client).post<\n PublishRealtimeAppBatchResponses,\n PublishRealtimeAppBatchErrors,\n ThrowOnError\n >({\n security: [\n { scheme: \"bearer\", type: \"http\" },\n { name: \"X-Realtime-Key\", type: \"apiKey\" },\n { name: \"X-Realtime-Secret\", type: \"apiKey\" },\n {\n in: \"cookie\",\n name: \"bird_session\",\n type: \"apiKey\",\n },\n ],\n url: \"/v1/realtime/apps/{realtime_app_id}/batch-events\",\n ...options,\n headers: {\n \"Content-Type\": \"application/json\",\n ...options.headers,\n },\n });\n\n/**\n * List Realtime channels\n *\n * Lists the app's currently occupied channels, optionally filtered by name prefix.\n */\nexport const listRealtimeAppChannels = <ThrowOnError extends boolean = false>(\n options: Options<ListRealtimeAppChannelsData, ThrowOnError>,\n) =>\n (options.client ?? client).get<\n ListRealtimeAppChannelsResponses,\n ListRealtimeAppChannelsErrors,\n ThrowOnError\n >({\n security: [\n { scheme: \"bearer\", type: \"http\" },\n { name: \"X-Realtime-Key\", type: \"apiKey\" },\n { name: \"X-Realtime-Secret\", type: \"apiKey\" },\n {\n in: \"cookie\",\n name: \"bird_session\",\n type: \"apiKey\",\n },\n ],\n url: \"/v1/realtime/apps/{realtime_app_id}/channels\",\n ...options,\n });\n\n/**\n * Get a Realtime channel\n *\n * Returns a single channel's occupancy and (on request) counts. Channels exist implicitly — a channel appears when the first connection subscribes and vanishes when the last one leaves — so this endpoint reports state, not existence: an unknown or never-used name returns 200 with `occupied: false`, never 404.\n */\nexport const getRealtimeAppChannel = <ThrowOnError extends boolean = false>(\n options: Options<GetRealtimeAppChannelData, ThrowOnError>,\n) =>\n (options.client ?? client).get<\n GetRealtimeAppChannelResponses,\n GetRealtimeAppChannelErrors,\n ThrowOnError\n >({\n security: [\n { scheme: \"bearer\", type: \"http\" },\n { name: \"X-Realtime-Key\", type: \"apiKey\" },\n { name: \"X-Realtime-Secret\", type: \"apiKey\" },\n {\n in: \"cookie\",\n name: \"bird_session\",\n type: \"apiKey\",\n },\n ],\n url: \"/v1/realtime/apps/{realtime_app_id}/channels/{channel_name}\",\n ...options,\n });\n\n/**\n * List members on a presence channel\n *\n * Lists the member ids currently subscribed to a presence channel. Ids only: `member_info` (the profile data attached by your authorization endpoint) is delivered to subscribed clients over the realtime connection and is not available over REST.\n */\nexport const listRealtimeAppChannelMembers = <\n ThrowOnError extends boolean = false,\n>(\n options: Options<ListRealtimeAppChannelMembersData, ThrowOnError>,\n) =>\n (options.client ?? client).get<\n ListRealtimeAppChannelMembersResponses,\n ListRealtimeAppChannelMembersErrors,\n ThrowOnError\n >({\n security: [\n { scheme: \"bearer\", type: \"http\" },\n { name: \"X-Realtime-Key\", type: \"apiKey\" },\n { name: \"X-Realtime-Secret\", type: \"apiKey\" },\n {\n in: \"cookie\",\n name: \"bird_session\",\n type: \"apiKey\",\n },\n ],\n url: \"/v1/realtime/apps/{realtime_app_id}/channels/{channel_name}/members\",\n ...options,\n });\n\n/**\n * Disconnect a member\n *\n * Disconnects all of a member's active connections (e.g. on sign-out or ban).\n */\nexport const disconnectRealtimeAppMember = <\n ThrowOnError extends boolean = false,\n>(\n options: Options<DisconnectRealtimeAppMemberData, ThrowOnError>,\n) =>\n (options.client ?? client).post<\n DisconnectRealtimeAppMemberResponses,\n DisconnectRealtimeAppMemberErrors,\n ThrowOnError\n >({\n security: [\n { scheme: \"bearer\", type: \"http\" },\n { name: \"X-Realtime-Key\", type: \"apiKey\" },\n { name: \"X-Realtime-Secret\", type: \"apiKey\" },\n {\n in: \"cookie\",\n name: \"bird_session\",\n type: \"apiKey\",\n },\n ],\n url: \"/v1/realtime/apps/{realtime_app_id}/members/{member_id}/disconnect\",\n ...options,\n });\n\n/**\n * Send an event to a member\n *\n * Delivers an event to one member of a Realtime app, addressing the person rather than a channel. Every connection that member currently holds receives it, across tabs and devices, so there is no need to track their connections or give them a channel of their own.\n * The member must have signed in on the connection for it to be addressable. Delivery is best-effort and not queued: a member holding no connections at the moment of the call simply does not receive the event.\n */\nexport const sendRealtimeAppMemberEvent = <\n ThrowOnError extends boolean = false,\n>(\n options: Options<SendRealtimeAppMemberEventData, ThrowOnError>,\n) =>\n (options.client ?? client).post<\n SendRealtimeAppMemberEventResponses,\n SendRealtimeAppMemberEventErrors,\n ThrowOnError\n >({\n security: [\n { scheme: \"bearer\", type: \"http\" },\n { name: \"X-Realtime-Key\", type: \"apiKey\" },\n { name: \"X-Realtime-Secret\", type: \"apiKey\" },\n {\n in: \"cookie\",\n name: \"bird_session\",\n type: \"apiKey\",\n },\n ],\n url: \"/v1/realtime/apps/{realtime_app_id}/members/{member_id}/events\",\n ...options,\n headers: {\n \"Content-Type\": \"application/json\",\n ...options.headers,\n },\n });\n\n/**\n * List messages\n *\n * Returns the workspace's sent and scheduled messages, newest first, as a cursor page. Each item has the aggregate delivery `status` and per-state recipient counts, not the message body.\n *\n * Combine filters to narrow the page:\n *\n * - Delivery status.\n * - Category.\n * - Tag.\n * - An exact `to` or `from` address.\n * - A `created_after` or `created_before` time window.\n *\n */\nexport const listEmailMessages = <ThrowOnError extends boolean = false>(\n options?: Options<ListEmailMessagesData, ThrowOnError>,\n) =>\n (options?.client ?? client).get<\n ListEmailMessagesResponses,\n ListEmailMessagesErrors,\n ThrowOnError\n >({\n security: [\n { scheme: \"bearer\", type: \"http\" },\n {\n in: \"cookie\",\n name: \"bird_session\",\n type: \"apiKey\",\n },\n ],\n url: \"/v1/email/messages\",\n ...options,\n });\n\n/**\n * Send an email message\n *\n * Sends an email to the recipients you list explicitly in `to`/`cc`/`bcc`. Use it for\n * transactional sends (receipts, password resets, alerts) and for marketing sends where\n * you have the recipient addresses on hand. To submit many independent messages in one\n * request, use [Send a batch of messages](/docs/api/reference/create-email-message-batch)\n * instead. The `category` field controls suppression policy independently of content:\n * set it to `marketing` when sending marketing content from this endpoint.\n *\n * The `202` response means the message is safely accepted for delivery, not yet\n * delivered. Fetch it by `id` or subscribe to webhook events to follow delivery. The\n * request never half-succeeds: an unverified sender domain or any field-level\n * validation failure rejects it immediately with a `422` naming the reason.\n * Suppression is evaluated per recipient after acceptance, so a suppressed recipient\n * appears as `rejected` on the message's recipient list rather than as a synchronous\n * error. New workspaces can send from the shared onboarding domain before verifying\n * their own. The [quickstart](/docs/get-started/send-your-first-email) covers its\n * recipient and volume limits.\n *\n */\nexport const createEmailMessage = <ThrowOnError extends boolean = false>(\n options: Options<CreateEmailMessageData, ThrowOnError>,\n) =>\n (options.client ?? client).post<\n CreateEmailMessageResponses,\n CreateEmailMessageErrors,\n ThrowOnError\n >({\n security: [\n { scheme: \"bearer\", type: \"http\" },\n {\n in: \"cookie\",\n name: \"bird_session\",\n type: \"apiKey\",\n },\n ],\n url: \"/v1/email/messages\",\n ...options,\n headers: {\n \"Content-Type\": \"application/json\",\n ...options.headers,\n },\n });\n\n/**\n * Send a batch of messages\n *\n * Accepts up to 100 independent email messages and queues them for delivery. All items are validated before any are queued: if one fails validation, the entire batch is rejected. Field-level validation failures and business-rule failures (such as `domain_not_verified`) both return `422`. Suppression is evaluated per recipient after acceptance, never as a synchronous error. The `202` response returns one entry per message in submission order, each with its own `id` you can use to fetch that message or match it against webhook events. Attachments are allowed per message. Each message must stay within the 20 MB estimated generated message-size cap, and the serialized JSON request body for the whole batch has a hard 20 MB cap.\n *\n */\nexport const createEmailMessageBatch = <ThrowOnError extends boolean = false>(\n options: Options<CreateEmailMessageBatchData, ThrowOnError>,\n) =>\n (options.client ?? client).post<\n CreateEmailMessageBatchResponses,\n CreateEmailMessageBatchErrors,\n ThrowOnError\n >({\n security: [\n { scheme: \"bearer\", type: \"http\" },\n {\n in: \"cookie\",\n name: \"bird_session\",\n type: \"apiKey\",\n },\n ],\n url: \"/v1/email/batches\",\n ...options,\n headers: {\n \"Content-Type\": \"application/json\",\n ...options.headers,\n },\n });\n\n/**\n * Get a message\n *\n * Returns a single message with its aggregate delivery `status` and per-state recipient counts. The response never includes the `html`/`text` bodies. When content storage is enabled for the send, fetch the stored bodies with [Get stored message content](/docs/api/reference/get-email-message-content). Per-recipient statuses and the event timeline are separate sub-resources.\n *\n */\nexport const getEmailMessage = <ThrowOnError extends boolean = false>(\n options: Options<GetEmailMessageData, ThrowOnError>,\n) =>\n (options.client ?? client).get<\n GetEmailMessageResponses,\n GetEmailMessageErrors,\n ThrowOnError\n >({\n security: [\n { scheme: \"bearer\", type: \"http\" },\n {\n in: \"cookie\",\n name: \"bird_session\",\n type: \"apiKey\",\n },\n ],\n url: \"/v1/email/messages/{message_id}\",\n ...options,\n });\n\n/**\n * Cancel a scheduled message\n *\n * Cancels a message that was scheduled with `scheduled_at` before it sends. Only a message that is still scheduled can be canceled. A message that already started sending, was delivered, or was previously canceled returns a conflict error. The message's status becomes `canceled` and an `email.canceled` webhook event fires. Canceling does not return consumed scheduled-send quota.\n *\n */\nexport const cancelEmailMessage = <ThrowOnError extends boolean = false>(\n options: Options<CancelEmailMessageData, ThrowOnError>,\n) =>\n (options.client ?? client).post<\n CancelEmailMessageResponses,\n CancelEmailMessageErrors,\n ThrowOnError\n >({\n security: [\n { scheme: \"bearer\", type: \"http\" },\n {\n in: \"cookie\",\n name: \"bird_session\",\n type: \"apiKey\",\n },\n ],\n url: \"/v1/email/messages/{message_id}/cancel\",\n ...options,\n });\n\n/**\n * List contacts\n *\n * Returns a paginated list of contacts in the workspace, newest first. Look up a single contact by its exact `email`, `phone_number`, or `external_id`, or search by email, first name, last name, or phone substring with `q`. Pass `include_total=true` to add the total number of matching contacts to the response.\n *\n */\nexport const listContacts = <ThrowOnError extends boolean = false>(\n options?: Options<ListContactsData, ThrowOnError>,\n) =>\n (options?.client ?? client).get<\n ListContactsResponses,\n ListContactsErrors,\n ThrowOnError\n >({\n security: [\n { scheme: \"bearer\", type: \"http\" },\n {\n in: \"cookie\",\n name: \"bird_session\",\n type: \"apiKey\",\n },\n ],\n url: \"/v1/contacts\",\n ...options,\n });\n\n/**\n * Create a contact\n *\n * Creates a contact in the workspace, identified by an email address, a phone number, or both; at least one is required. Email is stored trimmed and lowercased, and phone in its canonical international form. Creating a second contact with the same email or phone number, or reusing another contact's `external_id`, returns a conflict error.\n *\n * To create or update many contacts in one request, or to write a contact without knowing whether the address already exists, use [Create or update contacts in bulk](/docs/api/reference/create-contact-batch) instead.\n *\n */\nexport const createContact = <ThrowOnError extends boolean = false>(\n options: Options<CreateContactData, ThrowOnError>,\n) =>\n (options.client ?? client).post<\n CreateContactResponses,\n CreateContactErrors,\n ThrowOnError\n >({\n security: [\n { scheme: \"bearer\", type: \"http\" },\n {\n in: \"cookie\",\n name: \"bird_session\",\n type: \"apiKey\",\n },\n ],\n url: \"/v1/contacts\",\n ...options,\n headers: {\n \"Content-Type\": \"application/json\",\n ...options.headers,\n },\n });\n\n/**\n * Create or update contacts in bulk\n *\n * Creates or updates up to 1,000 contacts in one request. Each entry is matched automatically against every identifier it supplies: its email address (trimmed and lowercased before matching), its phone number (normalized to international form), and your own `external_id`. An entry that matches no existing contact creates one; an entry whose identifiers all point at one contact updates it with the fields it supplies, and omitted fields keep their stored values, so a contact's email address can change under a stable `external_id` without creating a second record. An entry whose identifiers belong to more than one contact fails with an error naming each matched contact, since Bird never merges contacts or picks between them. Supplying `match_on` overrides the automatic matching: every entry is matched by that one field only, and must carry it. Optionally adds every contact in the request to up to 10 audiences.\n *\n * Each entry succeeds or fails on its own: the response lists one result per contact in submission order (`created`, `updated`, or `failed` with the reason), and a failed entry does not abort the rest. If the request itself is invalid, for example when an entry in `audience_ids` does not exist, the whole request fails with a validation error and no contacts are written.\n *\n */\nexport const createContactBatch = <ThrowOnError extends boolean = false>(\n options: Options<CreateContactBatchData, ThrowOnError>,\n) =>\n (options.client ?? client).post<\n CreateContactBatchResponses,\n CreateContactBatchErrors,\n ThrowOnError\n >({\n security: [\n { scheme: \"bearer\", type: \"http\" },\n {\n in: \"cookie\",\n name: \"bird_session\",\n type: \"apiKey\",\n },\n ],\n url: \"/v1/contacts/batch\",\n ...options,\n headers: {\n \"Content-Type\": \"application/json\",\n ...options.headers,\n },\n });\n\n/**\n * Delete a contact\n *\n * Deletes a contact permanently and removes it from every audience it belongs to. Suppression records for the address are not affected: an unsubscribed or bounced address stays suppressed even after the contact is deleted.\n *\n */\nexport const deleteContact = <ThrowOnError extends boolean = false>(\n options: Options<DeleteContactData, ThrowOnError>,\n) =>\n (options.client ?? client).delete<\n DeleteContactResponses,\n DeleteContactErrors,\n ThrowOnError\n >({\n security: [\n { scheme: \"bearer\", type: \"http\" },\n {\n in: \"cookie\",\n name: \"bird_session\",\n type: \"apiKey\",\n },\n ],\n url: \"/v1/contacts/{contact_id}\",\n ...options,\n });\n\n/**\n * Get a contact\n *\n * Returns a single contact, including its custom `data` values and the channels it can be reached on. To find a contact's ID by email address or `external_id`, use [List contacts](/docs/api/reference/list-contacts).\n *\n */\nexport const getContact = <ThrowOnError extends boolean = false>(\n options: Options<GetContactData, ThrowOnError>,\n) =>\n (options.client ?? client).get<\n GetContactResponses,\n GetContactErrors,\n ThrowOnError\n >({\n security: [\n { scheme: \"bearer\", type: \"http\" },\n {\n in: \"cookie\",\n name: \"bird_session\",\n type: \"apiKey\",\n },\n ],\n url: \"/v1/contacts/{contact_id}\",\n ...options,\n });\n\n/**\n * Update a contact\n *\n * Updates a contact. Supplied fields are changed and omitted fields are left unchanged; set `first_name`, `last_name`, or `external_id` to null to clear them. Custom values in `data` are merged: keys you supply are set, keys set to null are removed, and keys you omit are unchanged.\n *\n * Changing the email address, phone number, or `external_id` to a value already used by another contact returns a conflict error, and a contact always keeps at least one identifier: clearing both email and phone in the same contact is rejected.\n *\n */\nexport const updateContact = <ThrowOnError extends boolean = false>(\n options: Options<UpdateContactData, ThrowOnError>,\n) =>\n (options.client ?? client).patch<\n UpdateContactResponses,\n UpdateContactErrors,\n ThrowOnError\n >({\n security: [\n { scheme: \"bearer\", type: \"http\" },\n {\n in: \"cookie\",\n name: \"bird_session\",\n type: \"apiKey\",\n },\n ],\n url: \"/v1/contacts/{contact_id}\",\n ...options,\n headers: {\n \"Content-Type\": \"application/json\",\n ...options.headers,\n },\n });\n\n/**\n * List contact properties\n *\n * Returns a paginated list of the workspace's contact properties, newest first. Archived properties are included; check each entry's `archived` flag.\n *\n */\nexport const listContactProperties = <ThrowOnError extends boolean = false>(\n options?: Options<ListContactPropertiesData, ThrowOnError>,\n) =>\n (options?.client ?? client).get<\n ListContactPropertiesResponses,\n ListContactPropertiesErrors,\n ThrowOnError\n >({\n security: [\n { scheme: \"bearer\", type: \"http\" },\n {\n in: \"cookie\",\n name: \"bird_session\",\n type: \"apiKey\",\n },\n ],\n url: \"/v1/contact-properties\",\n ...options,\n });\n\n/**\n * Create a contact property\n *\n * Defines a custom property that contacts in the workspace can carry. The key becomes available in contact `data` and as a template variable in broadcasts. The key and type cannot be changed after creation.\n *\n * A key already in use returns a conflict error. A workspace can hold at most 200 properties; archived properties keep their key and count toward that limit.\n *\n */\nexport const createContactProperty = <ThrowOnError extends boolean = false>(\n options: Options<CreateContactPropertyData, ThrowOnError>,\n) =>\n (options.client ?? client).post<\n CreateContactPropertyResponses,\n CreateContactPropertyErrors,\n ThrowOnError\n >({\n security: [\n { scheme: \"bearer\", type: \"http\" },\n {\n in: \"cookie\",\n name: \"bird_session\",\n type: \"apiKey\",\n },\n ],\n url: \"/v1/contact-properties\",\n ...options,\n headers: {\n \"Content-Type\": \"application/json\",\n ...options.headers,\n },\n });\n\n/**\n * Get a contact property\n *\n * Returns a single contact property: its immutable key and type, the fallback value, and whether it is archived.\n *\n */\nexport const getContactProperty = <ThrowOnError extends boolean = false>(\n options: Options<GetContactPropertyData, ThrowOnError>,\n) =>\n (options.client ?? client).get<\n GetContactPropertyResponses,\n GetContactPropertyErrors,\n ThrowOnError\n >({\n security: [\n { scheme: \"bearer\", type: \"http\" },\n {\n in: \"cookie\",\n name: \"bird_session\",\n type: \"apiKey\",\n },\n ],\n url: \"/v1/contact-properties/{property_id}\",\n ...options,\n });\n\n/**\n * Update a contact property\n *\n * Updates a contact property's fallback value, the only mutable field. The key and type cannot be changed after creation; create a new property instead.\n *\n */\nexport const updateContactProperty = <ThrowOnError extends boolean = false>(\n options: Options<UpdateContactPropertyData, ThrowOnError>,\n) =>\n (options.client ?? client).patch<\n UpdateContactPropertyResponses,\n UpdateContactPropertyErrors,\n ThrowOnError\n >({\n security: [\n { scheme: \"bearer\", type: \"http\" },\n {\n in: \"cookie\",\n name: \"bird_session\",\n type: \"apiKey\",\n },\n ],\n url: \"/v1/contact-properties/{property_id}\",\n ...options,\n headers: {\n \"Content-Type\": \"application/json\",\n ...options.headers,\n },\n });\n\n/**\n * Archive a contact property\n *\n * Archives a contact property. The key stops being accepted in contact writes and stops rendering in templates, but every value already stored on your contacts is preserved and still returned when you read a contact.\n *\n * The key stays reserved and still counts toward the workspace's 200-property limit, so it cannot be re-created with a different type. Archiving an already-archived property returns a conflict error; reverse it with [Unarchive a contact property](/docs/api/reference/unarchive-contact-property).\n *\n */\nexport const archiveContactProperty = <ThrowOnError extends boolean = false>(\n options: Options<ArchiveContactPropertyData, ThrowOnError>,\n) =>\n (options.client ?? client).post<\n ArchiveContactPropertyResponses,\n ArchiveContactPropertyErrors,\n ThrowOnError\n >({\n security: [\n { scheme: \"bearer\", type: \"http\" },\n {\n in: \"cookie\",\n name: \"bird_session\",\n type: \"apiKey\",\n },\n ],\n url: \"/v1/contact-properties/{property_id}/archive\",\n ...options,\n });\n\n/**\n * Unarchive a contact property\n *\n * Reactivates an archived contact property. The key is accepted in contact writes and renders in templates again; stored values were never removed, so they are unchanged. Unarchiving a property that is not archived returns a conflict error.\n *\n */\nexport const unarchiveContactProperty = <ThrowOnError extends boolean = false>(\n options: Options<UnarchiveContactPropertyData, ThrowOnError>,\n) =>\n (options.client ?? client).post<\n UnarchiveContactPropertyResponses,\n UnarchiveContactPropertyErrors,\n ThrowOnError\n >({\n security: [\n { scheme: \"bearer\", type: \"http\" },\n {\n in: \"cookie\",\n name: \"bird_session\",\n type: \"apiKey\",\n },\n ],\n url: \"/v1/contact-properties/{property_id}/unarchive\",\n ...options,\n });\n\n/**\n * List audiences\n *\n * Returns a paginated list of audiences in the workspace, newest first. Filter to audiences whose name contains a substring with `q`.\n *\n */\nexport const listAudiences = <ThrowOnError extends boolean = false>(\n options?: Options<ListAudiencesData, ThrowOnError>,\n) =>\n (options?.client ?? client).get<\n ListAudiencesResponses,\n ListAudiencesErrors,\n ThrowOnError\n >({\n security: [\n { scheme: \"bearer\", type: \"http\" },\n {\n in: \"cookie\",\n name: \"bird_session\",\n type: \"apiKey\",\n },\n ],\n url: \"/v1/audiences\",\n ...options,\n });\n\n/**\n * Create an audience\n *\n * Creates an audience in the workspace. New audiences start empty: add members with [Add contacts to an audience](/docs/api/reference/assign-audience-contacts) or through [Create or update contacts in bulk](/docs/api/reference/create-contact-batch). Only `static` audiences can be created today; requesting `dynamic` or `external` returns a validation error.\n *\n */\nexport const createAudience = <ThrowOnError extends boolean = false>(\n options: Options<CreateAudienceData, ThrowOnError>,\n) =>\n (options.client ?? client).post<\n CreateAudienceResponses,\n CreateAudienceErrors,\n ThrowOnError\n >({\n security: [\n { scheme: \"bearer\", type: \"http\" },\n {\n in: \"cookie\",\n name: \"bird_session\",\n type: \"apiKey\",\n },\n ],\n url: \"/v1/audiences\",\n ...options,\n headers: {\n \"Content-Type\": \"application/json\",\n ...options.headers,\n },\n });\n\n/**\n * Delete an audience\n *\n * Deletes an audience and its memberships. Contacts themselves are not deleted. An audience cannot be deleted while a broadcast targeting it is scheduled, accepted, sending, or canceling; cancel that broadcast first, then retry.\n *\n */\nexport const deleteAudience = <ThrowOnError extends boolean = false>(\n options: Options<DeleteAudienceData, ThrowOnError>,\n) =>\n (options.client ?? client).delete<\n DeleteAudienceResponses,\n DeleteAudienceErrors,\n ThrowOnError\n >({\n security: [\n { scheme: \"bearer\", type: \"http\" },\n {\n in: \"cookie\",\n name: \"bird_session\",\n type: \"apiKey\",\n },\n ],\n url: \"/v1/audiences/{audience_id}\",\n ...options,\n });\n\n/**\n * Get an audience\n *\n * Returns a single audience: its name, description, and type. The member list is separate; fetch it with [List an audience's contacts](/docs/api/reference/list-audience-contacts).\n *\n */\nexport const getAudience = <ThrowOnError extends boolean = false>(\n options: Options<GetAudienceData, ThrowOnError>,\n) =>\n (options.client ?? client).get<\n GetAudienceResponses,\n GetAudienceErrors,\n ThrowOnError\n >({\n security: [\n { scheme: \"bearer\", type: \"http\" },\n {\n in: \"cookie\",\n name: \"bird_session\",\n type: \"apiKey\",\n },\n ],\n url: \"/v1/audiences/{audience_id}\",\n ...options,\n });\n\n/**\n * Update an audience\n *\n * Updates an audience's name or description. Omitted fields are left unchanged; set `description` to null to clear it.\n *\n */\nexport const updateAudience = <ThrowOnError extends boolean = false>(\n options: Options<UpdateAudienceData, ThrowOnError>,\n) =>\n (options.client ?? client).patch<\n UpdateAudienceResponses,\n UpdateAudienceErrors,\n ThrowOnError\n >({\n security: [\n { scheme: \"bearer\", type: \"http\" },\n {\n in: \"cookie\",\n name: \"bird_session\",\n type: \"apiKey\",\n },\n ],\n url: \"/v1/audiences/{audience_id}\",\n ...options,\n headers: {\n \"Content-Type\": \"application/json\",\n ...options.headers,\n },\n });\n\n/**\n * List an audience's contacts\n *\n * Lists the contacts in a static audience as a cursor page, ordered by the time each contact joined the audience, most recent first. Each entry is the contact together with the time it joined.\n *\n */\nexport const listAudienceContacts = <ThrowOnError extends boolean = false>(\n options: Options<ListAudienceContactsData, ThrowOnError>,\n) =>\n (options.client ?? client).get<\n ListAudienceContactsResponses,\n ListAudienceContactsErrors,\n ThrowOnError\n >({\n security: [\n { scheme: \"bearer\", type: \"http\" },\n {\n in: \"cookie\",\n name: \"bird_session\",\n type: \"apiKey\",\n },\n ],\n url: \"/v1/audiences/{audience_id}/contacts\",\n ...options,\n });\n\n/**\n * Add contacts to an audience\n *\n * Adds up to 1,000 contacts to an audience. Adding is idempotent: contacts that are already members are left in place and keep their original join time. If any contact ID does not exist in the workspace, the whole request fails with a validation error and no contacts are added.\n *\n */\nexport const assignAudienceContacts = <ThrowOnError extends boolean = false>(\n options: Options<AssignAudienceContactsData, ThrowOnError>,\n) =>\n (options.client ?? client).post<\n AssignAudienceContactsResponses,\n AssignAudienceContactsErrors,\n ThrowOnError\n >({\n security: [\n { scheme: \"bearer\", type: \"http\" },\n {\n in: \"cookie\",\n name: \"bird_session\",\n type: \"apiKey\",\n },\n ],\n url: \"/v1/audiences/{audience_id}/contacts\",\n ...options,\n headers: {\n \"Content-Type\": \"application/json\",\n ...options.headers,\n },\n });\n\n/**\n * Remove contacts from an audience\n *\n * Removes up to 1,000 contacts from an audience. Contacts that are not members are skipped. If any contact ID does not exist in the workspace, the whole request fails with a validation error and no memberships are removed. The contacts themselves are not deleted and remain members of any other audiences.\n *\n */\nexport const unassignAudienceContacts = <ThrowOnError extends boolean = false>(\n options: Options<UnassignAudienceContactsData, ThrowOnError>,\n) =>\n (options.client ?? client).post<\n UnassignAudienceContactsResponses,\n UnassignAudienceContactsErrors,\n ThrowOnError\n >({\n security: [\n { scheme: \"bearer\", type: \"http\" },\n {\n in: \"cookie\",\n name: \"bird_session\",\n type: \"apiKey\",\n },\n ],\n url: \"/v1/audiences/{audience_id}/contacts/remove\",\n ...options,\n headers: {\n \"Content-Type\": \"application/json\",\n ...options.headers,\n },\n });\n\n/**\n * Remove a contact from an audience\n *\n * Removes a contact's membership in an audience. The contact itself is not deleted and remains a member of any other audiences. Removing a contact that is not a member of the audience succeeds with no effect (204); an unknown audience or contact returns a not-found error.\n *\n */\nexport const unassignAudienceContact = <ThrowOnError extends boolean = false>(\n options: Options<UnassignAudienceContactData, ThrowOnError>,\n) =>\n (options.client ?? client).delete<\n UnassignAudienceContactResponses,\n UnassignAudienceContactErrors,\n ThrowOnError\n >({\n security: [\n { scheme: \"bearer\", type: \"http\" },\n {\n in: \"cookie\",\n name: \"bird_session\",\n type: \"apiKey\",\n },\n ],\n url: \"/v1/audiences/{audience_id}/contacts/{contact_id}\",\n ...options,\n });\n\n/**\n * List SMS messages\n *\n * Returns the workspace's SMS messages as a cursor-paginated list, newest first. Filter by direction, status, category, recipient, sender, failure reason, tag, or creation time; pass the response's `next_cursor` back as `starting_after` to fetch the next page. To follow a single message's delivery, use [Get an SMS message](/docs/api/reference/get-sms-message) instead.\n *\n * Messages are retained for **30 days**. A `created_after` earlier than that is accepted and raised to the retention bound rather than rejected, so a wider window returns what is still retained instead of failing. There is no way to read messages older than the window.\n *\n */\nexport const listSmsMessages = <ThrowOnError extends boolean = false>(\n options?: Options<ListSmsMessagesData, ThrowOnError>,\n) =>\n (options?.client ?? client).get<\n ListSmsMessagesResponses,\n ListSmsMessagesErrors,\n ThrowOnError\n >({\n security: [\n { scheme: \"bearer\", type: \"http\" },\n {\n in: \"cookie\",\n name: \"bird_session\",\n type: \"apiKey\",\n },\n ],\n url: \"/v1/sms/messages\",\n ...options,\n });\n\n/**\n * Send an SMS message\n *\n * Sends one SMS message to a single recipient. A send carries exactly one\n * content form: `text` (free text, which also requires `category`) or\n * `template` (a stored template that supplies the body and category). To\n * submit up to 100 independent messages in one request, use\n * [Send a batch of SMS messages](/docs/api/reference/create-sms-message-batch)\n * instead.\n *\n * The `202` response means Bird durably accepted the message for asynchronous\n * delivery, not that it was delivered. Follow delivery with\n * [Get an SMS message](/docs/api/reference/get-sms-message) or by subscribing\n * to `sms.*` webhook events.\n *\n * Sends fail with a `422` when a field is invalid, the body exceeds the\n * 12-segment cap, the destination country is not enabled for the workspace,\n * or the sender is not permitted for the destination; a send from a\n * workspace with no wallet balance fails with a `402`.\n *\n */\nexport const createSmsMessage = <ThrowOnError extends boolean = false>(\n options: Options<CreateSmsMessageData, ThrowOnError>,\n) =>\n (options.client ?? client).post<\n CreateSmsMessageResponses,\n CreateSmsMessageErrors,\n ThrowOnError\n >({\n security: [\n { scheme: \"bearer\", type: \"http\" },\n {\n in: \"cookie\",\n name: \"bird_session\",\n type: \"apiKey\",\n },\n ],\n url: \"/v1/sms/messages\",\n ...options,\n headers: {\n \"Content-Type\": \"application/json\",\n ...options.headers,\n },\n });\n\n/**\n * Send a batch of SMS messages\n *\n * Sends up to 100 independent SMS messages in one request. Each item is a\n * complete send request with its own recipient, content, id, status, and\n * cost. For a single message, use\n * [Send an SMS message](/docs/api/reference/create-sms-message) instead.\n *\n * Acceptance is all-or-nothing: every item is validated before any is queued,\n * and one invalid item rejects the whole batch with a `422` (nothing is\n * sent). A batch from a workspace with no wallet balance fails with a `402`.\n * The `202` response lists the accepted messages in submission order; each\n * delivers asynchronously and is tracked individually, like a single send.\n *\n */\nexport const createSmsMessageBatch = <ThrowOnError extends boolean = false>(\n options: Options<CreateSmsMessageBatchData, ThrowOnError>,\n) =>\n (options.client ?? client).post<\n CreateSmsMessageBatchResponses,\n CreateSmsMessageBatchErrors,\n ThrowOnError\n >({\n security: [\n { scheme: \"bearer\", type: \"http\" },\n {\n in: \"cookie\",\n name: \"bird_session\",\n type: \"apiKey\",\n },\n ],\n url: \"/v1/sms/batches\",\n ...options,\n headers: {\n \"Content-Type\": \"application/json\",\n ...options.headers,\n },\n });\n\n/**\n * Get an SMS message\n *\n * Returns a single SMS message: its current delivery status, segment breakdown, cost, and failure detail when it failed. The `status` advances asynchronously as delivery progresses, and `cost` is null until the message has been priced, so poll this endpoint (or subscribe to `sms.*` webhook events) after a send to confirm delivery. To scan messages in bulk, use [List SMS messages](/docs/api/reference/list-sms-messages) instead.\n *\n */\nexport const getSmsMessage = <ThrowOnError extends boolean = false>(\n options: Options<GetSmsMessageData, ThrowOnError>,\n) =>\n (options.client ?? client).get<\n GetSmsMessageResponses,\n GetSmsMessageErrors,\n ThrowOnError\n >({\n security: [\n { scheme: \"bearer\", type: \"http\" },\n {\n in: \"cookie\",\n name: \"bird_session\",\n type: \"apiKey\",\n },\n ],\n url: \"/v1/sms/messages/{message_id}\",\n ...options,\n });\n\n/**\n * List SMS templates\n *\n * Returns the SMS templates you can send from, including Bird's built-in templates. Filter by scope, category, or language; the catalogue is small and returned in full, so this list is not paginated. To read one template's variables before sending with it, use [Get an SMS template](/docs/api/reference/get-sms-template).\n *\n */\nexport const listSmsTemplates = <ThrowOnError extends boolean = false>(\n options?: Options<ListSmsTemplatesData, ThrowOnError>,\n) =>\n (options?.client ?? client).get<\n ListSmsTemplatesResponses,\n ListSmsTemplatesErrors,\n ThrowOnError\n >({\n security: [\n { scheme: \"bearer\", type: \"http\" },\n {\n in: \"cookie\",\n name: \"bird_session\",\n type: \"apiKey\",\n },\n ],\n url: \"/v1/sms/templates\",\n ...options,\n });\n\n/**\n * Get an SMS template\n *\n * Returns a single SMS template: its body preview, category, the `variables` it expects (each with its accepted format), and the languages it is available in. Fetch a template before sending with it to see which `parameters` keys are required; an unknown reference returns a `404`. To browse the whole catalogue, use [List SMS templates](/docs/api/reference/list-sms-templates) instead.\n *\n */\nexport const getSmsTemplate = <ThrowOnError extends boolean = false>(\n options: Options<GetSmsTemplateData, ThrowOnError>,\n) =>\n (options.client ?? client).get<\n GetSmsTemplateResponses,\n GetSmsTemplateErrors,\n ThrowOnError\n >({\n security: [\n { scheme: \"bearer\", type: \"http\" },\n {\n in: \"cookie\",\n name: \"bird_session\",\n type: \"apiKey\",\n },\n ],\n url: \"/v1/sms/templates/{template_ref}\",\n ...options,\n });\n\n/**\n * Look up a phone number\n *\n * Returns what we know about a phone number: which network serves it, which network issued it, whether it has been ported, its country, and what kind of line it is. That baseline is included with every lookup.\n *\n * Use `type` to buy more. Each value adds a block to the answer: how the number is classified, whether it is live on the network right now, whether it is roaming, when its SIM last changed, its porting record, or a credibility score. Omit `type` and the response is the baseline alone, and no intelligence provider is contacted.\n *\n * Every block you request comes back carrying a `status`, so a partial answer is visible rather than silent, and **you are billed for exactly the blocks whose status is `ok`**.\n *\n * Send the number in the body rather than the URL when you would rather it did not appear in request logs or browser history. [Look up a phone number by URL](/docs/api/reference/get-phone-number-lookup) is the same lookup with the number in the path.\n *\n * Send an `Idempotency-Key` and a retried request returns the stored answer instead of looking the number up and charging again. Without one, every attempt is a new lookup and is billed.\n *\n */\nexport const createPhoneNumberLookup = <ThrowOnError extends boolean = false>(\n options: Options<CreatePhoneNumberLookupData, ThrowOnError>,\n) =>\n (options.client ?? client).post<\n CreatePhoneNumberLookupResponses,\n CreatePhoneNumberLookupErrors,\n ThrowOnError\n >({\n security: [\n { scheme: \"bearer\", type: \"http\" },\n {\n in: \"cookie\",\n name: \"bird_session\",\n type: \"apiKey\",\n },\n ],\n url: \"/v1/lookup/phone-number\",\n ...options,\n headers: {\n \"Content-Type\": \"application/json\",\n ...options.headers,\n },\n });\n\n/**\n * Look up an email address\n *\n * Returns whether an email address is worth sending to:\n *\n * - Whether it will accept mail.\n * - How confident that is.\n * - Why not, when it will not.\n * - Whether it is a role, disposable, or free-provider address.\n * - What it looks like it was meant to be, when it looks misspelled.\n *\n * One address per call, and one answer: `result` is the field to decide on. Every answer costs the same, including `undeliverable`, which is usually the most valuable one you can get.\n *\n * `result` and `reason` are open vocabularies: the values below are the ones in use today, and further ones may be added. Branch on the values you know and treat anything else as a future value rather than an error. `delivery_confidence` is always present and always comparable, so it is the safe fallback.\n *\n * Send the address in the body rather than the URL when you would rather it did not appear in request logs or browser history. [Look up an email address by URL](/docs/api/reference/get-email-lookup) is the same lookup with the address in the path.\n *\n * Send an `Idempotency-Key` and a retried request returns the stored answer instead of validating the address and charging again. Without one, every attempt is a new lookup and is billed.\n *\n */\nexport const createEmailLookup = <ThrowOnError extends boolean = false>(\n options: Options<CreateEmailLookupData, ThrowOnError>,\n) =>\n (options.client ?? client).post<\n CreateEmailLookupResponses,\n CreateEmailLookupErrors,\n ThrowOnError\n >({\n security: [\n { scheme: \"bearer\", type: \"http\" },\n {\n in: \"cookie\",\n name: \"bird_session\",\n type: \"apiKey\",\n },\n ],\n url: \"/v1/lookup/email\",\n ...options,\n headers: {\n \"Content-Type\": \"application/json\",\n ...options.headers,\n },\n });\n\n/**\n * Create a verification\n *\n * Creates a verification for a recipient and sends them a one-time passcode. Provide the recipient in `to`: an email address (verified over email), a phone number (verified over the phone channels enabled for its destination country), or both. The passcode is sent over one channel at a time and delivery falls over to the next channel in the plan if one fails; it is never sent over two channels at once.\n *\n * Calling this again for the same recipient resumes the verification in progress rather than starting a second one: within the resend cooldown the request returns the current state without sending, and after it a fresh passcode is sent. Use the same call to send and to resend.\n *\n * The `200` response is the verification's current state; the passcode itself is never returned. Submit the passcode the recipient enters with POST /v1/verify/verifications/check before the verification's `expires_at`. An invalid recipient returns `422`, and requesting passcodes for the same recipient too often returns `429`.\n *\n */\nexport const createVerification = <ThrowOnError extends boolean = false>(\n options: Options<CreateVerificationData, ThrowOnError>,\n) =>\n (options.client ?? client).post<\n CreateVerificationResponses,\n CreateVerificationErrors,\n ThrowOnError\n >({\n security: [\n { scheme: \"bearer\", type: \"http\" },\n {\n in: \"cookie\",\n name: \"bird_session\",\n type: \"apiKey\",\n },\n ],\n url: \"/v1/verify/verifications\",\n ...options,\n headers: {\n \"Content-Type\": \"application/json\",\n ...options.headers,\n },\n });\n\n/**\n * Check a verification passcode\n *\n * Checks a passcode for a recipient and returns the outcome together with the verification's current state. Identify the verification by the same `to` used to create it; you do not need to store a verification ID.\n *\n * A wrong or expired passcode is a normal outcome, not an HTTP error: the response is `200` with `success` set to `false` and a `reason` such as `incorrect_code` or `expired`. `success: true` means the verification is complete. Each verification reports its final outcome exactly once and is no longer checkable afterwards.\n *\n * An error status is returned only when the check cannot be evaluated: `404` when no verification matches the recipient or the matching one already reached its final state, `422` for an invalid recipient, and `429` when passcodes for a recipient are checked too quickly.\n *\n */\nexport const createVerificationCheck = <ThrowOnError extends boolean = false>(\n options: Options<CreateVerificationCheckData, ThrowOnError>,\n) =>\n (options.client ?? client).post<\n CreateVerificationCheckResponses,\n CreateVerificationCheckErrors,\n ThrowOnError\n >({\n security: [\n { scheme: \"bearer\", type: \"http\" },\n {\n in: \"cookie\",\n name: \"bird_session\",\n type: \"apiKey\",\n },\n ],\n url: \"/v1/verify/verifications/check\",\n ...options,\n headers: {\n \"Content-Type\": \"application/json\",\n ...options.headers,\n },\n });\n\n/**\n * Advance a verification to its next channel\n *\n * Advances an in-progress verification to the next channel in its plan and sends a fresh passcode there, for a recipient who reports not receiving the code. Identify the verification by the same `to` used to create it; you do not need to store a verification ID.\n *\n * The send bypasses the resend cooldown (a deliberate channel switch is a different act from a same-channel resend), and every passcode already sent stays valid, so a code that arrives late can still be checked. The response is the verification with `last_channel` set to the channel the new passcode went to. Concurrent requests for the same recipient are safe: each advances the plan at most one step. When two race, the request that completes the newer send is the authoritative one; the other returns the verification's committed state, whose `last_channel` still names the most recent send that completed. A later read of the verification always reflects the settled outcome.\n *\n * An error status is returned when the verification cannot be advanced: `404` when no verification is in progress for the recipient, `422` with `NoNextChannel` when the plan has no further channel (fall back to a plain resend), `422` with `NoAvailableChannel` when every remaining channel failed to send, and `429` when sends for the account are requested too quickly.\n *\n */\nexport const createVerificationNextChannel = <\n ThrowOnError extends boolean = false,\n>(\n options: Options<CreateVerificationNextChannelData, ThrowOnError>,\n) =>\n (options.client ?? client).post<\n CreateVerificationNextChannelResponses,\n CreateVerificationNextChannelErrors,\n ThrowOnError\n >({\n security: [\n { scheme: \"bearer\", type: \"http\" },\n {\n in: \"cookie\",\n name: \"bird_session\",\n type: \"apiKey\",\n },\n ],\n url: \"/v1/verify/verifications/next-channel\",\n ...options,\n headers: {\n \"Content-Type\": \"application/json\",\n ...options.headers,\n },\n });\n\n/**\n * List WhatsApp messages\n *\n * Returns the workspace's WhatsApp messages as a cursor-paginated list,\n * newest first. Filter by direction, status, contact phone number,\n * business-scoped user ID, template category, tag, or creation time; pass the response's `next_cursor` back as\n * `starting_after` to fetch the next page. To follow a single message's\n * delivery, use\n * [Get a WhatsApp message](/docs/api/reference/get-whats-app-message)\n * instead.\n *\n * Messages are retained for **30 days**. A `created_after` earlier than that\n * is accepted and raised to the retention bound rather than rejected, so a\n * wider window returns what is still retained instead of failing. There is no\n * way to read messages older than the window.\n *\n */\nexport const listWhatsAppMessages = <ThrowOnError extends boolean = false>(\n options?: Options<ListWhatsAppMessagesData, ThrowOnError>,\n) =>\n (options?.client ?? client).get<\n ListWhatsAppMessagesResponses,\n ListWhatsAppMessagesErrors,\n ThrowOnError\n >({\n security: [\n { scheme: \"bearer\", type: \"http\" },\n {\n in: \"cookie\",\n name: \"bird_session\",\n type: \"apiKey\",\n },\n ],\n url: \"/v1/whatsapp/messages\",\n ...options,\n });\n\n/**\n * Send a WhatsApp message\n *\n * Sends a WhatsApp message built from a message template to one recipient.\n * Name the template, optionally pick its language variant, and fill its\n * placeholders in `components`; a Bird-managed template selects its sender\n * number from its category, so the request carries no sender field. A request\n * that carries no content is rejected with a `422`. Browse your workspace's\n * templates in the Bird dashboard.\n *\n * The `202` response is the accepted message, echoing the resolved template\n * and language; it is not a delivery confirmation. Follow delivery with\n * [Get a WhatsApp message](/docs/api/reference/get-whats-app-message), the\n * per-message timeline from\n * [List events for a WhatsApp message](/docs/api/reference/list-whats-app-message-events),\n * or `whatsapp.*` webhook events.\n *\n * A template slug or language the catalogue does not stock, parameter values\n * that do not match the template's declared placeholders, and a recipient\n * that is not a valid phone number each return a `422`, as does a request\n * that carries no content at all.\n *\n */\nexport const createWhatsAppMessage = <ThrowOnError extends boolean = false>(\n options: Options<CreateWhatsAppMessageData, ThrowOnError>,\n) =>\n (options.client ?? client).post<\n CreateWhatsAppMessageResponses,\n CreateWhatsAppMessageErrors,\n ThrowOnError\n >({\n security: [\n { scheme: \"bearer\", type: \"http\" },\n {\n in: \"cookie\",\n name: \"bird_session\",\n type: \"apiKey\",\n },\n ],\n url: \"/v1/whatsapp/messages\",\n ...options,\n headers: {\n \"Content-Type\": \"application/json\",\n ...options.headers,\n },\n });\n\n/**\n * Get a WhatsApp message\n *\n * Returns a single WhatsApp message: its current delivery status, per-stage timestamps (`sent_at`, `delivered_at`, `read_at`), the template it was sent from, and failure detail when it failed. The `status` advances asynchronously as delivery progresses, so poll this endpoint (or subscribe to `whatsapp.*` webhook events) after a send to confirm delivery. For the per-event timeline, use [List events for a WhatsApp message](/docs/api/reference/list-whats-app-message-events) instead.\n *\n */\nexport const getWhatsAppMessage = <ThrowOnError extends boolean = false>(\n options: Options<GetWhatsAppMessageData, ThrowOnError>,\n) =>\n (options.client ?? client).get<\n GetWhatsAppMessageResponses,\n GetWhatsAppMessageErrors,\n ThrowOnError\n >({\n security: [\n { scheme: \"bearer\", type: \"http\" },\n {\n in: \"cookie\",\n name: \"bird_session\",\n type: \"apiKey\",\n },\n ],\n url: \"/v1/whatsapp/messages/{message_id}\",\n ...options,\n });\n\n/**\n * List events for a WhatsApp message\n *\n * Returns a WhatsApp message's lifecycle events in chronological order, one entry per delivery transition (`whatsapp.accepted`, `whatsapp.sent`, `whatsapp.delivered`, `whatsapp.read`, `whatsapp.failed`). The timeline is bounded and returned in full, so this list is not paginated; an unknown message id returns a `404`. For the message's current state in a single field, use [Get a WhatsApp message](/docs/api/reference/get-whats-app-message) instead.\n *\n */\nexport const listWhatsAppMessageEvents = <ThrowOnError extends boolean = false>(\n options: Options<ListWhatsAppMessageEventsData, ThrowOnError>,\n) =>\n (options.client ?? client).get<\n ListWhatsAppMessageEventsResponses,\n ListWhatsAppMessageEventsErrors,\n ThrowOnError\n >({\n security: [\n { scheme: \"bearer\", type: \"http\" },\n {\n in: \"cookie\",\n name: \"bird_session\",\n type: \"apiKey\",\n },\n ],\n url: \"/v1/whatsapp/messages/{message_id}/events\",\n ...options,\n });\n\n/**\n * Daily sending statistics\n *\n * Returns one row of aggregate sending statistics per calendar day for the workspace: UTC days by default, or your local days when `timezone` is set. Days with no activity are included with zero counts, so the series charts without client-side gap handling. Suited to charts and trend lines; for per-message exact accounting use the message detail endpoints.\n *\n * Rows are bucketed by event time, not send time: a complaint received on Wednesday for a message sent the prior Monday is counted in Wednesday's row.\n *\n * The maximum window is 365 days; requesting a longer range returns 422.\n *\n */\nexport const getEmailStatsDaily = <ThrowOnError extends boolean = false>(\n options?: Options<GetEmailStatsDailyData, ThrowOnError>,\n) =>\n (options?.client ?? client).get<\n GetEmailStatsDailyResponses,\n GetEmailStatsDailyErrors,\n ThrowOnError\n >({\n security: [\n { scheme: \"bearer\", type: \"http\" },\n {\n in: \"cookie\",\n name: \"bird_session\",\n type: \"apiKey\",\n },\n ],\n url: \"/v1/email/stats/daily\",\n ...options,\n });\n\n/**\n * Hourly sending statistics\n *\n * Returns one row of aggregate sending statistics per hour for the workspace: UTC hours by default, or your local hours when `timezone` is set (a timezone with a sub-hour offset gets correctly aligned hours). Useful for inspecting send rate, deliverability, and engagement inside a single day or a recent window; hours with no activity are included with zero counts.\n *\n * Rows are bucketed by event time, not send time: a click recorded at 14:07 for a message sent at 09:00 lands in the 14:00 row.\n *\n * A single request may span at most 30 days (720 hourly rows); for longer ranges use the daily endpoint, which has a 365-day window. An hourly window longer than 30 days, or a `from` after `to`, returns 422.\n *\n */\nexport const getEmailStatsHourly = <ThrowOnError extends boolean = false>(\n options?: Options<GetEmailStatsHourlyData, ThrowOnError>,\n) =>\n (options?.client ?? client).get<\n GetEmailStatsHourlyResponses,\n GetEmailStatsHourlyErrors,\n ThrowOnError\n >({\n security: [\n { scheme: \"bearer\", type: \"http\" },\n {\n in: \"cookie\",\n name: \"bird_session\",\n type: \"apiKey\",\n },\n ],\n url: \"/v1/email/stats/hourly\",\n ...options,\n });\n\n/**\n * Stats by tag\n *\n * Returns delivery and engagement counts for the requested period, grouped by tag. Use it to compare performance across the tags you set at send time. Rows are ranked by the `sort` metric, `processed` by default, and capped at the requested `limit` (50 by default, 200 at most).\n *\n * Rows are computed against event time rather than send time, so engagement received during the period counts even for messages that were sent earlier.\n *\n * The window can span at most 365 days. Ask for more and you get a 422.\n *\n */\nexport const getEmailStatsByTag = <ThrowOnError extends boolean = false>(\n options?: Options<GetEmailStatsByTagData, ThrowOnError>,\n) =>\n (options?.client ?? client).get<\n GetEmailStatsByTagResponses,\n GetEmailStatsByTagErrors,\n ThrowOnError\n >({\n security: [\n { scheme: \"bearer\", type: \"http\" },\n {\n in: \"cookie\",\n name: \"bird_session\",\n type: \"apiKey\",\n },\n ],\n url: \"/v1/email/stats/tags\",\n ...options,\n });\n\n/**\n * Aggregate stats summary\n *\n * Returns a single-row aggregate across the requested period covering delivery, bounce, complaint, open, and click counts plus the derived rates, along with processing, delivery, and total latency percentiles (p50/p95/p99). Suitable for KPI tiles, campaign reports, and email digests; the daily and hourly endpoints have the same metrics per time bucket.\n *\n * The aggregate is computed against event time (not send time), so engagement received during the period for messages sent earlier is included. Rate fields are null when their denominator is zero.\n *\n * The window grain follows the form of `from` and `to`: calendar days (`YYYY-MM-DD`, up to 365 days) or RFC 3339 instants (hour grain, up to 720 hours, 30 days), so a rolling window such as the last 24 hours is a single request. Mixing the two forms returns 422. Set `timezone` to compute day and hour boundaries in a local zone instead of UTC, and `compare=previous_period` to include the preceding equal-length window in the same response.\n *\n */\nexport const getEmailStatsSummary = <ThrowOnError extends boolean = false>(\n options?: Options<GetEmailStatsSummaryData, ThrowOnError>,\n) =>\n (options?.client ?? client).get<\n GetEmailStatsSummaryResponses,\n GetEmailStatsSummaryErrors,\n ThrowOnError\n >({\n security: [\n { scheme: \"bearer\", type: \"http\" },\n {\n in: \"cookie\",\n name: \"bird_session\",\n type: \"apiKey\",\n },\n ],\n url: \"/v1/email/stats/summary\",\n ...options,\n });\n\n/**\n * Stats by sending IP\n *\n * Returns delivery and deliverability counts for the requested period, grouped by the specific IP address used to send each message. Use it to spot a reputation problem on one IP. Block bounces concentrated on a single IP usually mean that IP's reputation has taken a hit, and sorting by `bounces.block` puts those IPs first.\n *\n * A sending IP is only known once the receiving mail server reports an outcome: a delivery, a bounce, a deferral, or a late bounce. So this breakdown starts from the delivery stage onward. Accepted, processed, and rejected counts aren't included at all, and neither are engagement counts or processing latency. Complaints and out-of-band bounces aren't attributed to a sending IP either, so `complained` and `oob_bounces` are included but always read 0 here. Bounced, deferred, delivery latency, and total latency are the ones that have real numbers. For workspace-wide figures, use `GET /v1/email/stats/daily`. Rows are computed against event time rather than send time.\n *\n * Rows are ranked by the `sort` field, `delivered` by default, and capped at the requested `limit` (50 by default, 200 at most). The window can span at most 365 days. Ask for more and you get a 422.\n *\n */\nexport const getEmailStatsBySendingIp = <ThrowOnError extends boolean = false>(\n options?: Options<GetEmailStatsBySendingIpData, ThrowOnError>,\n) =>\n (options?.client ?? client).get<\n GetEmailStatsBySendingIpResponses,\n GetEmailStatsBySendingIpErrors,\n ThrowOnError\n >({\n security: [\n { scheme: \"bearer\", type: \"http\" },\n {\n in: \"cookie\",\n name: \"bird_session\",\n type: \"apiKey\",\n },\n ],\n url: \"/v1/email/stats/sending-ips\",\n ...options,\n });\n\n/**\n * Stats by sending domain\n *\n * Returns delivery, engagement, and deliverability counts for the requested period, grouped by sending domain: the portion of the `From` address after the `@`. Use it to compare deliverability across multiple verified domains in your workspace, for example transactional versus marketing domains, or sub-domain segregation during IP warming.\n *\n * Rows are computed against event time rather than send time, so engagement and bounces received during the period count even for messages that were sent earlier.\n *\n * Rows are ranked by the `sort` metric, `processed` by default, and capped at the requested `limit` (50 by default, 200 at most). The window can span at most 365 days. Ask for more and you get a 422.\n *\n */\nexport const getEmailStatsBySendingDomain = <\n ThrowOnError extends boolean = false,\n>(\n options?: Options<GetEmailStatsBySendingDomainData, ThrowOnError>,\n) =>\n (options?.client ?? client).get<\n GetEmailStatsBySendingDomainResponses,\n GetEmailStatsBySendingDomainErrors,\n ThrowOnError\n >({\n security: [\n { scheme: \"bearer\", type: \"http\" },\n {\n in: \"cookie\",\n name: \"bird_session\",\n type: \"apiKey\",\n },\n ],\n url: \"/v1/email/stats/sending-domains\",\n ...options,\n });\n\n/**\n * Stats by category\n *\n * Returns delivery and engagement counts for the requested period, grouped by category, so you can compare deliverability and engagement between your transactional and marketing traffic. Rows are ranked by the `sort` metric, `processed` by default, and capped at the requested `limit` (50 by default, 200 at most).\n *\n * Rows are computed against event time rather than send time, so engagement received during the period counts even for messages that were sent earlier.\n *\n * The window can span at most 365 days. Ask for more and you get a 422.\n *\n */\nexport const getEmailStatsByCategory = <ThrowOnError extends boolean = false>(\n options?: Options<GetEmailStatsByCategoryData, ThrowOnError>,\n) =>\n (options?.client ?? client).get<\n GetEmailStatsByCategoryResponses,\n GetEmailStatsByCategoryErrors,\n ThrowOnError\n >({\n security: [\n { scheme: \"bearer\", type: \"http\" },\n {\n in: \"cookie\",\n name: \"bird_session\",\n type: \"apiKey\",\n },\n ],\n url: \"/v1/email/stats/categories\",\n ...options,\n });\n\n/**\n * Stats by mailbox provider\n *\n * Returns delivery, engagement, and deliverability counts for the requested period, grouped by recipient mailbox provider, for example `gmail`, `yahoo`, `microsoft`, or `apple`. Use it to compare how each major inbox provider treats your mail, for example to spot a delivered-rate dip or a complaint spike at one provider before it spreads. For a per-region split within a provider, use the mailbox-provider-region breakdown.\n *\n * A recipient's mailbox provider is only known once the receiving mail system reports an outcome, so this breakdown covers the delivery stage onward. Accepted, processed, and rejected counts and processing latency are not included. Rows are computed against event time rather than send time.\n *\n * Rows are ranked by the `sort` metric, `delivered` by default, and capped at the requested `limit` (50 by default, 200 at most). The window can span at most 365 days. Ask for more and you get a 422.\n *\n */\nexport const getEmailStatsByMailboxProvider = <\n ThrowOnError extends boolean = false,\n>(\n options?: Options<GetEmailStatsByMailboxProviderData, ThrowOnError>,\n) =>\n (options?.client ?? client).get<\n GetEmailStatsByMailboxProviderResponses,\n GetEmailStatsByMailboxProviderErrors,\n ThrowOnError\n >({\n security: [\n { scheme: \"bearer\", type: \"http\" },\n {\n in: \"cookie\",\n name: \"bird_session\",\n type: \"apiKey\",\n },\n ],\n url: \"/v1/email/stats/mailbox-providers\",\n ...options,\n });\n\n/**\n * Stats by mailbox provider region\n *\n * Returns delivery, engagement, and deliverability counts for the requested period, grouped by mailbox provider and provider region pair, for example `gmail` in `NA` or `microsoft` in `EU`. The provider region is the regional grouping the receiving mail system reports for the recipient's provider. Pairing it with the provider tells apart a region label that several providers share. Use it to spot a deliverability problem isolated to one provider in one region. For a per-provider view without the region split, use the mailbox-provider breakdown.\n *\n * A provider region is only known once the receiving mail system reports an outcome, so this breakdown covers the delivery stage onward. Accepted, processed, and rejected counts and processing latency are not included. Rows are computed against event time rather than send time.\n *\n * Rows are ranked by the `sort` metric, `delivered` by default, and capped at the requested `limit` (50 by default, 200 at most). The window can span at most 365 days. Ask for more and you get a 422.\n *\n */\nexport const getEmailStatsByMailboxProviderRegion = <\n ThrowOnError extends boolean = false,\n>(\n options?: Options<GetEmailStatsByMailboxProviderRegionData, ThrowOnError>,\n) =>\n (options?.client ?? client).get<\n GetEmailStatsByMailboxProviderRegionResponses,\n GetEmailStatsByMailboxProviderRegionErrors,\n ThrowOnError\n >({\n security: [\n { scheme: \"bearer\", type: \"http\" },\n {\n in: \"cookie\",\n name: \"bird_session\",\n type: \"apiKey\",\n },\n ],\n url: \"/v1/email/stats/mailbox-provider-regions\",\n ...options,\n });\n\n/**\n * Stats by recipient domain\n *\n * Returns delivery and engagement counts for the requested period, grouped by recipient mailbox domain: the part of each recipient address after the `@`, for example `gmail.com`, `yahoo.com`, or `outlook.com`. This is the finest-grained deliverability view. Where the mailbox-provider breakdown groups recipients into provider buckets such as `gmail` or `microsoft`, this keys on the exact destination domain. Use it to spot a delivery-rate dip or a complaint spike at a specific domain.\n *\n * Rows are ranked by the `sort` metric, `processed` by default, and capped at the requested `limit` (50 by default, 200 at most). Rows are computed against event time rather than send time, so engagement received during the period counts even for messages that were sent earlier.\n *\n * The window can span at most 365 days. Ask for more and you get a 422.\n *\n */\nexport const getEmailStatsByRecipientDomain = <\n ThrowOnError extends boolean = false,\n>(\n options?: Options<GetEmailStatsByRecipientDomainData, ThrowOnError>,\n) =>\n (options?.client ?? client).get<\n GetEmailStatsByRecipientDomainResponses,\n GetEmailStatsByRecipientDomainErrors,\n ThrowOnError\n >({\n security: [\n { scheme: \"bearer\", type: \"http\" },\n {\n in: \"cookie\",\n name: \"bird_session\",\n type: \"apiKey\",\n },\n ],\n url: \"/v1/email/stats/recipient-domains\",\n ...options,\n });\n\n/**\n * Stats by template\n *\n * Returns aggregate delivery and engagement counts grouped by the template each message was sent with, so a template's deliverability and engagement can be compared side by side. Attribution is by the template used at send time; only messages sent with a template appear here, so a workspace that has sent none returns an empty list rather than an error. Each row is keyed by the template ID (`emt_…`); a template deleted after sending still appears by its ID.\n *\n * Rows are ranked by the `sort` metric (default `processed`) descending and capped at the requested `limit` (default 50, hard maximum 200). Rows are computed against event time (not send time), so engagement received during the period for messages sent earlier is included.\n *\n * The maximum window is 365 days; requesting a longer range returns 422.\n *\n */\nexport const getEmailStatsByTemplate = <ThrowOnError extends boolean = false>(\n options?: Options<GetEmailStatsByTemplateData, ThrowOnError>,\n) =>\n (options?.client ?? client).get<\n GetEmailStatsByTemplateResponses,\n GetEmailStatsByTemplateErrors,\n ThrowOnError\n >({\n security: [\n { scheme: \"bearer\", type: \"http\" },\n {\n in: \"cookie\",\n name: \"bird_session\",\n type: \"apiKey\",\n },\n ],\n url: \"/v1/email/stats/templates\",\n ...options,\n });\n\n/**\n * Engagement by location\n *\n * Returns engagement counts (opens and clicks) for the requested period, grouped by the location they were recorded from. Use it to see where your audience engages, for example the top countries by unique opens. The reading location is only known from open and click events, so rows have engagement counts but no delivery counts or rates.\n *\n * Use `group_by` to choose the granularity: `country` (the default), `region`, or `city`. Each row has the location hierarchy down to the requested level, so a `city` grouping also reports that row's region and country. Rows are ranked by the `sort` metric, `unique_opens` by default, and capped at the requested `limit` (50 by default, 200 at most).\n *\n * Rows are computed against event time rather than send time. The window can span at most 365 days. Ask for more and you get a 422.\n *\n */\nexport const getEmailStatsByLocation = <ThrowOnError extends boolean = false>(\n options?: Options<GetEmailStatsByLocationData, ThrowOnError>,\n) =>\n (options?.client ?? client).get<\n GetEmailStatsByLocationResponses,\n GetEmailStatsByLocationErrors,\n ThrowOnError\n >({\n security: [\n { scheme: \"bearer\", type: \"http\" },\n {\n in: \"cookie\",\n name: \"bird_session\",\n type: \"apiKey\",\n },\n ],\n url: \"/v1/email/stats/locations\",\n ...options,\n });\n\n/**\n * Engagement by email client\n *\n * Returns engagement counts (opens and clicks) for the requested period, grouped by the email client, operating system, or device type they were recorded from. Use it for the classic view of opens by mail client, for example the share of opens from Apple Mail compared with Gmail and Outlook. The reading environment is only known from open and click events, so rows have engagement counts but no delivery counts or rates.\n *\n * Use `group_by` to choose the facet: `email_client` (the default), `os`, or `device_type`. Each row fills in the facet you chose and leaves the other two null. Rows are ranked by the `sort` metric, `unique_opens` by default, and capped at the requested `limit` (50 by default, 200 at most).\n *\n * Rows are computed against event time rather than send time. The window can span at most 365 days. Ask for more and you get a 422.\n *\n */\nexport const getEmailStatsByClient = <ThrowOnError extends boolean = false>(\n options?: Options<GetEmailStatsByClientData, ThrowOnError>,\n) =>\n (options?.client ?? client).get<\n GetEmailStatsByClientResponses,\n GetEmailStatsByClientErrors,\n ThrowOnError\n >({\n security: [\n { scheme: \"bearer\", type: \"http\" },\n {\n in: \"cookie\",\n name: \"bird_session\",\n type: \"apiKey\",\n },\n ],\n url: \"/v1/email/stats/clients\",\n ...options,\n });\n\n/**\n * Bounces by SMTP error code\n *\n * Returns bounce counts for the requested period, grouped by the SMTP error code the receiving mail server returned. It answers the question of which SMTP responses are driving your bounces. Each row reports how many recipients bounced with that code, plus the hard, soft, admin, block, and undetermined split for that code.\n *\n * This breakdown only covers the failure side. There are no delivered, open, click, or rate fields, because a bounce code is only ever recorded on a bounce event.\n *\n * Rows are ranked by the `sort` metric, `bounced` by default, and capped at the requested `limit` (50 by default, 200 at most). They are computed against event time rather than send time. The window can span at most 365 days. Ask for more and you get a 422.\n *\n */\nexport const getEmailStatsByBounceCode = <ThrowOnError extends boolean = false>(\n options?: Options<GetEmailStatsByBounceCodeData, ThrowOnError>,\n) =>\n (options?.client ?? client).get<\n GetEmailStatsByBounceCodeResponses,\n GetEmailStatsByBounceCodeErrors,\n ThrowOnError\n >({\n security: [\n { scheme: \"bearer\", type: \"http\" },\n {\n in: \"cookie\",\n name: \"bird_session\",\n type: \"apiKey\",\n },\n ],\n url: \"/v1/email/stats/bounce-codes\",\n ...options,\n });\n\n/**\n * Complaints by type\n *\n * Returns spam-complaint counts for the requested period, grouped by the feedback-loop complaint type the mailbox provider reported, for example `abuse`, `fraud`, or `virus`. Use it to see what kind of complaints your mail attracts.\n *\n * This breakdown only covers the complaint side. Each row has the complained count for one type and nothing else, because a complaint type is only ever recorded on a spam-complaint event.\n *\n * Rows are ranked by `complained` descending, and capped at the requested `limit` (default 50, hard maximum 200). They are computed against event time rather than send time. The window can span at most 365 days. Ask for more and you get a 422.\n *\n */\nexport const getEmailStatsByComplaintType = <\n ThrowOnError extends boolean = false,\n>(\n options?: Options<GetEmailStatsByComplaintTypeData, ThrowOnError>,\n) =>\n (options?.client ?? client).get<\n GetEmailStatsByComplaintTypeResponses,\n GetEmailStatsByComplaintTypeErrors,\n ThrowOnError\n >({\n security: [\n { scheme: \"bearer\", type: \"http\" },\n {\n in: \"cookie\",\n name: \"bird_session\",\n type: \"apiKey\",\n },\n ],\n url: \"/v1/email/stats/complaint-types\",\n ...options,\n });\n\n/**\n * Stats by broadcast\n *\n * Returns aggregate delivery and engagement counts grouped by broadcast for the requested period, so each broadcast's deliverability and engagement can be compared side by side. Only messages sent as part of a broadcast appear here. One-off and transactional sends are not included, so a workspace that has not sent broadcasts returns an empty list rather than an error.\n *\n * Rows are ranked by the `sort` metric (default `processed`) descending and capped at the requested `limit` (default 50, hard maximum 200). Rows are computed against event time (not send time), so engagement received during the period for messages sent earlier is included.\n *\n * The maximum window is 365 days. Requesting a longer range returns a 422. This breakdown is computed from per-message activity retained for 30 days, so it reflects roughly the last 30 days of activity even when the requested window reaches further back.\n *\n */\nexport const getEmailStatsByBroadcast = <ThrowOnError extends boolean = false>(\n options?: Options<GetEmailStatsByBroadcastData, ThrowOnError>,\n) =>\n (options?.client ?? client).get<\n GetEmailStatsByBroadcastResponses,\n GetEmailStatsByBroadcastErrors,\n ThrowOnError\n >({\n security: [\n { scheme: \"bearer\", type: \"http\" },\n {\n in: \"cookie\",\n name: \"bird_session\",\n type: \"apiKey\",\n },\n ],\n url: \"/v1/email/stats/broadcasts\",\n ...options,\n });\n\n/**\n * List sending domains\n *\n * Returns all sending domains for the current workspace, newest first by default. Each item is the full domain object, including capability statuses and `dns_records`, so no per-domain follow-up read is needed. Filter with `name` to find a specific domain.\n *\n */\nexport const listDomains = <ThrowOnError extends boolean = false>(\n options?: Options<ListDomainsData, ThrowOnError>,\n) =>\n (options?.client ?? client).get<\n ListDomainsResponses,\n ListDomainsErrors,\n ThrowOnError\n >({\n security: [\n { scheme: \"bearer\", type: \"http\" },\n {\n in: \"cookie\",\n name: \"bird_session\",\n type: \"apiKey\",\n },\n ],\n url: \"/v1/email/domains\",\n ...options,\n });\n\n/**\n * Add a sending domain\n *\n * Registers a new sending domain and returns the DNS records to publish\n * for it. The DKIM TXT record proves ownership, and together with the\n * return-path CNAME (which also covers SPF, so no separate SPF record is\n * needed) and a DMARC policy it gates sending. The tracking CNAME is\n * optional and gates branded link tracking only. Publish the records at\n * your DNS provider, then check progress with\n * [Trigger domain verification](/docs/api/reference/verify-domain). Published\n * records are also re-checked for you automatically. Setup walkthrough:\n * [Sending domains](/docs/guides/email/sending-domains).\n *\n * The domain starts in `pending` status. A domain already registered in\n * this workspace returns `409`, and creation beyond your organization's\n * domain quota returns `422` `E10000`. A domain that never verifies\n * ownership is removed after about 14 days, with a reminder email first.\n *\n */\nexport const createDomain = <ThrowOnError extends boolean = false>(\n options: Options<CreateDomainData, ThrowOnError>,\n) =>\n (options.client ?? client).post<\n CreateDomainResponses,\n CreateDomainErrors,\n ThrowOnError\n >({\n security: [\n { scheme: \"bearer\", type: \"http\" },\n {\n in: \"cookie\",\n name: \"bird_session\",\n type: \"apiKey\",\n },\n ],\n url: \"/v1/email/domains\",\n ...options,\n headers: {\n \"Content-Type\": \"application/json\",\n ...options.headers,\n },\n });\n\n/**\n * Delete a sending domain\n *\n * Removes the domain and revokes its sender authorization. New sends from a deleted domain are rejected. Historical statistics and events for past sends from this domain are preserved.\n *\n */\nexport const deleteDomain = <ThrowOnError extends boolean = false>(\n options: Options<DeleteDomainData, ThrowOnError>,\n) =>\n (options.client ?? client).delete<\n DeleteDomainResponses,\n DeleteDomainErrors,\n ThrowOnError\n >({\n security: [\n { scheme: \"bearer\", type: \"http\" },\n {\n in: \"cookie\",\n name: \"bird_session\",\n type: \"apiKey\",\n },\n ],\n url: \"/v1/email/domains/{domain_id}\",\n ...options,\n });\n\n/**\n * Get a sending domain\n *\n * Returns the domain with its capability statuses and every DNS record's current verification state. This read reports the stored result of the last check. To run a fresh DNS check, use [Trigger domain verification](/docs/api/reference/verify-domain).\n *\n */\nexport const getDomain = <ThrowOnError extends boolean = false>(\n options: Options<GetDomainData, ThrowOnError>,\n) =>\n (options.client ?? client).get<\n GetDomainResponses,\n GetDomainErrors,\n ThrowOnError\n >({\n security: [\n { scheme: \"bearer\", type: \"http\" },\n {\n in: \"cookie\",\n name: \"bird_session\",\n type: \"apiKey\",\n },\n ],\n url: \"/v1/email/domains/{domain_id}\",\n ...options,\n });\n\n/**\n * Update a sending domain\n *\n * Updates settings and configuration on a sending domain. `settings`\n * changes apply immediately. Changes to `return_path`, `tracking`, or\n * `dkim` on a verified capability are staged: the current configuration\n * keeps serving until the new one's DNS records verify, then the change\n * is promoted automatically. Staged values are visible under\n * `capabilities.*.pending`. The records to publish appear in\n * `dns_records` with `state: pending`.\n *\n * Invalid combinations are rejected. Enabling tracking toggles without a\n * tracking domain, or removing the tracking domain while a toggle is on,\n * returns `409`. Enabling inbound receiving has verification\n * prerequisites that return `422`. Each rule is detailed on its field.\n *\n */\nexport const updateDomain = <ThrowOnError extends boolean = false>(\n options: Options<UpdateDomainData, ThrowOnError>,\n) =>\n (options.client ?? client).patch<\n UpdateDomainResponses,\n UpdateDomainErrors,\n ThrowOnError\n >({\n security: [\n { scheme: \"bearer\", type: \"http\" },\n {\n in: \"cookie\",\n name: \"bird_session\",\n type: \"apiKey\",\n },\n ],\n url: \"/v1/email/domains/{domain_id}\",\n ...options,\n headers: {\n \"Content-Type\": \"application/json\",\n ...options.headers,\n },\n });\n\n/**\n * Trigger domain verification\n *\n * Runs a fresh DNS check across the domain's records (DKIM, return path,\n * DMARC, tracking, inbound MX, and any staged changes) and returns the\n * updated domain. Use it for an immediate result after publishing or\n * correcting records. [Get a sending domain](/docs/api/reference/get-domain)\n * only reports the last stored result. Published records are also re-checked\n * for you automatically in the background.\n *\n * A `200` with records still `pending` is not a failure: the records were\n * not found yet, which is normal while DNS propagates (minutes to hours).\n * Recently verified records are not re-queried, so the call is safe to\n * repeat while you wait.\n *\n */\nexport const verifyDomain = <ThrowOnError extends boolean = false>(\n options: Options<VerifyDomainData, ThrowOnError>,\n) =>\n (options.client ?? client).post<\n VerifyDomainResponses,\n VerifyDomainErrors,\n ThrowOnError\n >({\n security: [\n { scheme: \"bearer\", type: \"http\" },\n {\n in: \"cookie\",\n name: \"bird_session\",\n type: \"apiKey\",\n },\n ],\n url: \"/v1/email/domains/{domain_id}/verify\",\n ...options,\n });\n\n/**\n * List mailboxes\n *\n * Returns a paginated list of the workspace's mailboxes, newest first. Search across addresses and display names with `q`, look a mailbox up by its exact address, or filter by lifecycle state or domain.\n *\n */\nexport const listMailboxes = <ThrowOnError extends boolean = false>(\n options?: Options<ListMailboxesData, ThrowOnError>,\n) =>\n (options?.client ?? client).get<\n ListMailboxesResponses,\n ListMailboxesErrors,\n ThrowOnError\n >({\n security: [\n { scheme: \"bearer\", type: \"http\" },\n {\n in: \"cookie\",\n name: \"bird_session\",\n type: \"apiKey\",\n },\n ],\n url: \"/v1/email/mailboxes\",\n ...options,\n });\n\n/**\n * Create a mailbox\n *\n * Creates a mailbox. The address is `local_part@domain`. The domain defaults to `inbox.ai`, our shared mailbox domain, where creating the mailbox claims the address for your organization. It is first come, first served, and reserved to your organization even after the mailbox is deleted. You may instead name one of your own domains that is enabled for receiving email. An omitted local part is generated. On a custom domain, addresses of deleted mailboxes are quarantined. The same workspace can rebind one 30 days after deletion, but other workspaces never can.\n *\n */\nexport const createMailbox = <ThrowOnError extends boolean = false>(\n options: Options<CreateMailboxData, ThrowOnError>,\n) =>\n (options.client ?? client).post<\n CreateMailboxResponses,\n CreateMailboxErrors,\n ThrowOnError\n >({\n security: [\n { scheme: \"bearer\", type: \"http\" },\n {\n in: \"cookie\",\n name: \"bird_session\",\n type: \"apiKey\",\n },\n ],\n url: \"/v1/email/mailboxes\",\n ...options,\n headers: {\n \"Content-Type\": \"application/json\",\n ...options.headers,\n },\n });\n\n/**\n * Delete a mailbox\n *\n * Deletes a mailbox. The address stops receiving mail immediately and enters quarantine. The same workspace can bind it to a new mailbox after 30 days, but other workspaces never can. The mailbox and its remembered messages are kept for 30 days, so you can bring it back with `POST /email/mailboxes/{mailbox_id}/restore`. Once those 30 days are up they are deleted for good.\n *\n */\nexport const deleteMailbox = <ThrowOnError extends boolean = false>(\n options: Options<DeleteMailboxData, ThrowOnError>,\n) =>\n (options.client ?? client).delete<\n DeleteMailboxResponses,\n DeleteMailboxErrors,\n ThrowOnError\n >({\n security: [\n { scheme: \"bearer\", type: \"http\" },\n {\n in: \"cookie\",\n name: \"bird_session\",\n type: \"apiKey\",\n },\n ],\n url: \"/v1/email/mailboxes/{mailbox_id}\",\n ...options,\n });\n\n/**\n * Get a mailbox\n *\n * Returns a single mailbox by ID. A mailbox deleted within its 30-day restore window is still returned, with a non-null `deleted_at`. Once the window closes it is permanently removed and returns 404.\n *\n */\nexport const getMailbox = <ThrowOnError extends boolean = false>(\n options: Options<GetMailboxData, ThrowOnError>,\n) =>\n (options.client ?? client).get<\n GetMailboxResponses,\n GetMailboxErrors,\n ThrowOnError\n >({\n security: [\n { scheme: \"bearer\", type: \"http\" },\n {\n in: \"cookie\",\n name: \"bird_session\",\n type: \"apiKey\",\n },\n ],\n url: \"/v1/email/mailboxes/{mailbox_id}\",\n ...options,\n });\n\n/**\n * Update a mailbox\n *\n * Updates a mailbox. The address and domain are immutable. Lowering the retention tier deletes any remembered message older than the new cutoff, so that request needs `confirm=true` before it will run.\n *\n */\nexport const updateMailbox = <ThrowOnError extends boolean = false>(\n options: Options<UpdateMailboxData, ThrowOnError>,\n) =>\n (options.client ?? client).patch<\n UpdateMailboxResponses,\n UpdateMailboxErrors,\n ThrowOnError\n >({\n security: [\n { scheme: \"bearer\", type: \"http\" },\n {\n in: \"cookie\",\n name: \"bird_session\",\n type: \"apiKey\",\n },\n ],\n url: \"/v1/email/mailboxes/{mailbox_id}\",\n ...options,\n headers: {\n \"Content-Type\": \"application/json\",\n ...options.headers,\n },\n });\n\n/**\n * Restore a deleted mailbox\n *\n * Restores a mailbox deleted less than 30 days ago. The address is bound back to the mailbox and starts receiving again, and the remembered messages and conversations are available as before the delete. Once the 30-day window has passed the mailbox and its messages are permanently deleted and can no longer be restored (404). Restoring a mailbox that is not deleted returns a conflict, as does an address that is no longer available.\n *\n */\nexport const restoreMailbox = <ThrowOnError extends boolean = false>(\n options: Options<RestoreMailboxData, ThrowOnError>,\n) =>\n (options.client ?? client).post<\n RestoreMailboxResponses,\n RestoreMailboxErrors,\n ThrowOnError\n >({\n security: [\n { scheme: \"bearer\", type: \"http\" },\n {\n in: \"cookie\",\n name: \"bird_session\",\n type: \"apiKey\",\n },\n ],\n url: \"/v1/email/mailboxes/{mailbox_id}/restore\",\n ...options,\n });\n\n/**\n * Mailbox email statistics\n *\n * Returns the mailbox's sent and received email statistics over a time window: a period-wide summary plus a bucketed series. Sent-mail metrics have the same delivery, engagement, and latency breakdowns as the email stats endpoints. `received` counts mail that arrived at the mailbox.\n *\n * Rows are bucketed by the time the event happened rather than the time the message was sent, so engagement that arrived during the period for a message sent earlier is counted here. Statistics start when the mailbox starts sending and receiving; the mailbox's all-time `message_count` and `thread_count` live on the mailbox resource itself.\n *\n * `from` and `to` accept either calendar days (YYYY-MM-DD, `day` granularity only) or RFC 3339 instants (`hour` granularity only). Both bounds must use the same form. Window caps depend on `granularity`: 365 days at `day`, 30 days at `hour`. Set `timezone` to report in a local zone instead of UTC.\n *\n */\nexport const getMailboxStats = <ThrowOnError extends boolean = false>(\n options: Options<GetMailboxStatsData, ThrowOnError>,\n) =>\n (options.client ?? client).get<\n GetMailboxStatsResponses,\n GetMailboxStatsErrors,\n ThrowOnError\n >({\n security: [\n { scheme: \"bearer\", type: \"http\" },\n {\n in: \"cookie\",\n name: \"bird_session\",\n type: \"apiKey\",\n },\n ],\n url: \"/v1/email/mailboxes/{mailbox_id}/stats\",\n ...options,\n });\n\n/**\n * Resume a suspended mailbox\n *\n * Resumes a mailbox that was suspended because the organization dropped below the plan needed to keep it active. The mailbox can send and receive again and its conversations and messages become visible. Resuming is refused when the organization has no room for another active mailbox, or for another custom inbox.ai handle, on its current plan. Free up a slot by deleting an active mailbox, or move to a bigger plan. Resuming a mailbox that is not suspended returns a conflict.\n *\n */\nexport const resumeMailbox = <ThrowOnError extends boolean = false>(\n options: Options<ResumeMailboxData, ThrowOnError>,\n) =>\n (options.client ?? client).post<\n ResumeMailboxResponses,\n ResumeMailboxErrors,\n ThrowOnError\n >({\n security: [\n { scheme: \"bearer\", type: \"http\" },\n {\n in: \"cookie\",\n name: \"bird_session\",\n type: \"apiKey\",\n },\n ],\n url: \"/v1/email/mailboxes/{mailbox_id}/resume\",\n ...options,\n });\n\n/**\n * List receive rules\n *\n * Returns a paginated list of the mailbox's receive rules, oldest first. Filter by action to see only allow or only block entries.\n *\n */\nexport const listMailboxReceiveRules = <ThrowOnError extends boolean = false>(\n options: Options<ListMailboxReceiveRulesData, ThrowOnError>,\n) =>\n (options.client ?? client).get<\n ListMailboxReceiveRulesResponses,\n ListMailboxReceiveRulesErrors,\n ThrowOnError\n >({\n security: [\n { scheme: \"bearer\", type: \"http\" },\n {\n in: \"cookie\",\n name: \"bird_session\",\n type: \"apiKey\",\n },\n ],\n url: \"/v1/email/mailboxes/{mailbox_id}/receive-rules\",\n ...options,\n });\n\n/**\n * Add a receive rule\n *\n * Adds an allow or block rule to the mailbox. Rules match the message's envelope sender. Domain entries also match subdomains. Block rules always win, both over allow rules and over the reply admission on allowlist mailboxes. An entry is either allow or block. Rules have no update operation, so a rule that needs the other action is a new rule and the old one is removed. A mailbox holds up to 200 rules.\n *\n */\nexport const createMailboxReceiveRule = <ThrowOnError extends boolean = false>(\n options: Options<CreateMailboxReceiveRuleData, ThrowOnError>,\n) =>\n (options.client ?? client).post<\n CreateMailboxReceiveRuleResponses,\n CreateMailboxReceiveRuleErrors,\n ThrowOnError\n >({\n security: [\n { scheme: \"bearer\", type: \"http\" },\n {\n in: \"cookie\",\n name: \"bird_session\",\n type: \"apiKey\",\n },\n ],\n url: \"/v1/email/mailboxes/{mailbox_id}/receive-rules\",\n ...options,\n headers: {\n \"Content-Type\": \"application/json\",\n ...options.headers,\n },\n });\n\n/**\n * Delete a receive rule\n *\n * Removes a receive rule from the mailbox. There is no update operation for rules, so a rule's allow or block action cannot be changed after it is created.\n *\n */\nexport const deleteMailboxReceiveRule = <ThrowOnError extends boolean = false>(\n options: Options<DeleteMailboxReceiveRuleData, ThrowOnError>,\n) =>\n (options.client ?? client).delete<\n DeleteMailboxReceiveRuleResponses,\n DeleteMailboxReceiveRuleErrors,\n ThrowOnError\n >({\n security: [\n { scheme: \"bearer\", type: \"http\" },\n {\n in: \"cookie\",\n name: \"bird_session\",\n type: \"apiKey\",\n },\n ],\n url: \"/v1/email/mailboxes/{mailbox_id}/receive-rules/{rule_id}\",\n ...options,\n });\n\n/**\n * List threads\n *\n * Returns a paginated list of conversations across the workspace's mailboxes, most recently active first. `label` selects the view: the inbox (the default when omitted), `archive`, `spam`, `blocked`, or any custom label. You can also filter by mailbox, by linked contact, by participant address, or by a subject substring.\n *\n * To search conversations by their messages' subject and text instead of listing them, use `GET /v1/email/threads/search`.\n *\n * Conversations whose every message has been trashed are left out of the list, and restoring a message brings the conversation back.\n *\n * `before` and `after` filter by time. To page through the results, pass the response cursors back as `starting_after` or `ending_before`.\n *\n */\nexport const listEmailThreads = <ThrowOnError extends boolean = false>(\n options?: Options<ListEmailThreadsData, ThrowOnError>,\n) =>\n (options?.client ?? client).get<\n ListEmailThreadsResponses,\n ListEmailThreadsErrors,\n ThrowOnError\n >({\n security: [\n { scheme: \"bearer\", type: \"http\" },\n {\n in: \"cookie\",\n name: \"bird_session\",\n type: \"apiKey\",\n },\n ],\n url: \"/v1/email/threads\",\n ...options,\n });\n\n/**\n * Delete a thread\n *\n * Moves the conversation and all of its messages to the trash. Trashed messages are permanently deleted after 30 days. Pass `permanent=true` to permanently delete the conversation and its messages immediately.\n *\n */\nexport const deleteEmailThread = <ThrowOnError extends boolean = false>(\n options: Options<DeleteEmailThreadData, ThrowOnError>,\n) =>\n (options.client ?? client).delete<\n DeleteEmailThreadResponses,\n DeleteEmailThreadErrors,\n ThrowOnError\n >({\n security: [\n { scheme: \"bearer\", type: \"http\" },\n {\n in: \"cookie\",\n name: \"bird_session\",\n type: \"apiKey\",\n },\n ],\n url: \"/v1/email/threads/{thread_id}\",\n ...options,\n });\n\n/**\n * Get a thread\n *\n * Returns a single conversation. Fetch the messages in the conversation with `GET /v1/email/threads/{thread_id}/messages`. A thread whose retention tier has ended returns `410 Gone`.\n *\n */\nexport const getEmailThread = <ThrowOnError extends boolean = false>(\n options: Options<GetEmailThreadData, ThrowOnError>,\n) =>\n (options.client ?? client).get<\n GetEmailThreadResponses,\n GetEmailThreadErrors,\n ThrowOnError\n >({\n security: [\n { scheme: \"bearer\", type: \"http\" },\n {\n in: \"cookie\",\n name: \"bird_session\",\n type: \"apiKey\",\n },\n ],\n url: \"/v1/email/threads/{thread_id}\",\n ...options,\n });\n\n/**\n * Update a thread\n *\n * Applies label changes to a conversation, and links or unlinks a contact. Adding `spam` files the conversation, and its received messages, as spam. Adding `archive` files it away without deleting it. Adding `inbox`, or removing `spam`, `blocked`, or `archive`, returns it to the inbox, and its unread count recomputes to match. An archived conversation returns to the inbox by itself when a new message arrives. To block a sender going forward, add a receive rule instead. Any field you leave out stays unchanged.\n *\n */\nexport const updateEmailThread = <ThrowOnError extends boolean = false>(\n options: Options<UpdateEmailThreadData, ThrowOnError>,\n) =>\n (options.client ?? client).patch<\n UpdateEmailThreadResponses,\n UpdateEmailThreadErrors,\n ThrowOnError\n >({\n security: [\n { scheme: \"bearer\", type: \"http\" },\n {\n in: \"cookie\",\n name: \"bird_session\",\n type: \"apiKey\",\n },\n ],\n url: \"/v1/email/threads/{thread_id}\",\n ...options,\n headers: {\n \"Content-Type\": \"application/json\",\n ...options.headers,\n },\n });\n\n/**\n * List messages in a thread\n *\n * Returns the messages in a conversation, newest first, both received and sent. To page through older messages, use `starting_after`. The sort order is fixed, so to render the messages in conversation order, reverse the page yourself.\n *\n * By default, every message that is not in the trash is returned, whichever folder the conversation is in. Pass `label` to narrow the view instead: use `trash` for trashed messages, or any custom label.\n *\n * Pass `include=extracted_text` to inline each message's extracted plain text. A thread whose retention tier has ended returns `410 Gone`.\n *\n */\nexport const listEmailThreadMessages = <ThrowOnError extends boolean = false>(\n options: Options<ListEmailThreadMessagesData, ThrowOnError>,\n) =>\n (options.client ?? client).get<\n ListEmailThreadMessagesResponses,\n ListEmailThreadMessagesErrors,\n ThrowOnError\n >({\n security: [\n { scheme: \"bearer\", type: \"http\" },\n {\n in: \"cookie\",\n name: \"bird_session\",\n type: \"apiKey\",\n },\n ],\n url: \"/v1/email/threads/{thread_id}/messages\",\n ...options,\n });\n\n/**\n * Get a message in a thread\n *\n * Returns a single message in a conversation, including its extracted plain text. Metadata and extracted text stay readable for the mailbox's retention tier. A message that has aged past its retention tier returns `410 Gone`. A message that exists but does not belong to this thread returns `404`.\n *\n */\nexport const getEmailThreadMessage = <ThrowOnError extends boolean = false>(\n options: Options<GetEmailThreadMessageData, ThrowOnError>,\n) =>\n (options.client ?? client).get<\n GetEmailThreadMessageResponses,\n GetEmailThreadMessageErrors,\n ThrowOnError\n >({\n security: [\n { scheme: \"bearer\", type: \"http\" },\n {\n in: \"cookie\",\n name: \"bird_session\",\n type: \"apiKey\",\n },\n ],\n url: \"/v1/email/threads/{thread_id}/messages/{message_id}\",\n ...options,\n });\n\n/**\n * Get a thread message's original body\n *\n * Returns the original rendered HTML and plain-text body of a message in a conversation. The original body is available for 30 days after the message occurred. After that, this endpoint returns `410 Gone`, but the message's extracted text stays readable on the message itself.\n *\n */\nexport const getEmailThreadMessageBody = <ThrowOnError extends boolean = false>(\n options: Options<GetEmailThreadMessageBodyData, ThrowOnError>,\n) =>\n (options.client ?? client).get<\n GetEmailThreadMessageBodyResponses,\n GetEmailThreadMessageBodyErrors,\n ThrowOnError\n >({\n security: [\n { scheme: \"bearer\", type: \"http\" },\n {\n in: \"cookie\",\n name: \"bird_session\",\n type: \"apiKey\",\n },\n ],\n url: \"/v1/email/threads/{thread_id}/messages/{message_id}/body\",\n ...options,\n });\n\n/**\n * List a thread message's attachments\n *\n * Returns the attachments on a message in a conversation. Attachment bytes are downloadable for 30 days after the message occurred. After that, this endpoint returns `410 Gone`, but the attachment metadata stays readable on the message's `attachment_manifest`.\n *\n */\nexport const listEmailThreadMessageAttachments = <\n ThrowOnError extends boolean = false,\n>(\n options: Options<ListEmailThreadMessageAttachmentsData, ThrowOnError>,\n) =>\n (options.client ?? client).get<\n ListEmailThreadMessageAttachmentsResponses,\n ListEmailThreadMessageAttachmentsErrors,\n ThrowOnError\n >({\n security: [\n { scheme: \"bearer\", type: \"http\" },\n {\n in: \"cookie\",\n name: \"bird_session\",\n type: \"apiKey\",\n },\n ],\n url: \"/v1/email/threads/{thread_id}/messages/{message_id}/attachments\",\n ...options,\n });\n\n/**\n * Reply to a thread message\n *\n * Sends a reply to a specific message in a conversation, from the mailbox's own address. Recipients are derived from the message being replied to: its Reply-To address when present, otherwise its From address. Set `reply_all` to also include the original To and Cc recipients. The subject and the threading headers that keep the reply in this conversation are set automatically, and the reply is recorded in the conversation. To reply to a conversation as a whole, target its newest received message.\n *\n */\nexport const replyEmailThreadMessage = <ThrowOnError extends boolean = false>(\n options: Options<ReplyEmailThreadMessageData, ThrowOnError>,\n) =>\n (options.client ?? client).post<\n ReplyEmailThreadMessageResponses,\n ReplyEmailThreadMessageErrors,\n ThrowOnError\n >({\n security: [\n { scheme: \"bearer\", type: \"http\" },\n {\n in: \"cookie\",\n name: \"bird_session\",\n type: \"apiKey\",\n },\n ],\n url: \"/v1/email/threads/{thread_id}/messages/{message_id}/reply\",\n ...options,\n headers: {\n \"Content-Type\": \"application/json\",\n ...options.headers,\n },\n });\n\n/**\n * Send a message from a mailbox\n *\n * Sends a new message from the mailbox's own address and starts a new conversation with it. The request mirrors the plain send request minus `from`, because the mailbox is who the message comes from. We set the RFC 5322 Message-ID, so later replies from the recipients thread back into the conversation automatically. The send is added to the mailbox's remembered messages and returned as the conversation's first message. A mailbox always sends immediately, so this endpoint does not accept a scheduled send. A suspended mailbox cannot send and returns `403`.\n *\n */\nexport const createMailboxMessage = <ThrowOnError extends boolean = false>(\n options: Options<CreateMailboxMessageData, ThrowOnError>,\n) =>\n (options.client ?? client).post<\n CreateMailboxMessageResponses,\n CreateMailboxMessageErrors,\n ThrowOnError\n >({\n security: [\n { scheme: \"bearer\", type: \"http\" },\n {\n in: \"cookie\",\n name: \"bird_session\",\n type: \"apiKey\",\n },\n ],\n url: \"/v1/email/mailboxes/{mailbox_id}/messages\",\n ...options,\n headers: {\n \"Content-Type\": \"application/json\",\n ...options.headers,\n },\n });\n\n/**\n * List a mailbox's labels\n *\n * Returns the labels available in a mailbox. First, the built-in system\n * labels:\n *\n * - The placements `inbox`, `archive`, `spam`, `blocked`, and `sent`.\n * - `trash`.\n * - `unread`.\n *\n * Then, every custom label currently in use on its conversations and\n * messages. You apply and remove labels through the conversation and\n * message update endpoints, and that is also what creates or removes a\n * custom label: it exists for as long as at least one message or\n * conversation has it applied.\n *\n */\nexport const listMailboxLabels = <ThrowOnError extends boolean = false>(\n options: Options<ListMailboxLabelsData, ThrowOnError>,\n) =>\n (options.client ?? client).get<\n ListMailboxLabelsResponses,\n ListMailboxLabelsErrors,\n ThrowOnError\n >({\n security: [\n { scheme: \"bearer\", type: \"http\" },\n {\n in: \"cookie\",\n name: \"bird_session\",\n type: \"apiKey\",\n },\n ],\n url: \"/v1/email/mailboxes/{mailbox_id}/labels\",\n ...options,\n });\n\n/**\n * List calls\n *\n * Returns a paginated list of the workspace's calls, ordered by start time descending.\n *\n * The `status` filter selects where in the lifecycle you look, and any combination is a single page: in-flight statuses (`ringing`, `in_progress`), final ones, or both together. Omit it and you get completed calls, which is what this list has always returned.\n *\n * A call in flight carries no economics yet: `duration_ms`, `billable_ms`, `ended_at`, and `cost` are null until it ends. It keeps the same `id` throughout, so the same call answers under one identity from the first ring to settlement.\n *\n */\nexport const listVoiceCalls = <ThrowOnError extends boolean = false>(\n options?: Options<ListVoiceCallsData, ThrowOnError>,\n) =>\n (options?.client ?? client).get<\n ListVoiceCallsResponses,\n ListVoiceCallsErrors,\n ThrowOnError\n >({\n querySerializer: { parameters: { status: { array: { explode: false } } } },\n security: [\n { scheme: \"bearer\", type: \"http\" },\n {\n in: \"cookie\",\n name: \"bird_session\",\n type: \"apiKey\",\n },\n ],\n url: \"/v1/voice/calls\",\n ...options,\n });\n\n/**\n * Get a call\n *\n * Returns a single call at any point in its lifecycle. A call that is still ringing or connected answers with its in-flight `status` and no economics: `duration_ms`, `billable_ms`, `ended_at`, and `cost` fill in once it ends, at this same URL. Returns a 404 `not_found_error` if the call does not exist in the workspace.\n *\n */\nexport const getVoiceCall = <ThrowOnError extends boolean = false>(\n options: Options<GetVoiceCallData, ThrowOnError>,\n) =>\n (options.client ?? client).get<\n GetVoiceCallResponses,\n GetVoiceCallErrors,\n ThrowOnError\n >({\n security: [\n { scheme: \"bearer\", type: \"http\" },\n {\n in: \"cookie\",\n name: \"bird_session\",\n type: \"apiKey\",\n },\n ],\n url: \"/v1/voice/calls/{call_id}\",\n ...options,\n });\n","// Base for resource wrappers. Each public method builds a typed hey-api SDK\n// call and runs it through the lifecycle core, returning an APIPromise (single)\n// or PaginatedPromise (list). Resources stay thin over `call`/`paginated` so the\n// per-operation logic could later be extracted to standalone tree-shakeable\n// functions without a rewrite.\n\nimport type { Client } from \"../generated/client/index.js\";\nimport type { AttemptContext, BirdHTTPClient, FetchOutcome, RequestLifecycleOptions } from \"../core/http.js\";\nimport {\n apiPromise,\n paginate,\n type APIPromise,\n type CursorPage,\n type PaginatedPromise,\n type RequestOptions,\n} from \"../core/result.js\";\n\n/** Resolved per-attempt inputs handed to the hey-api SDK call. */\nexport interface CallContext {\n signal: AbortSignal;\n /** Merged headers: caller `headers` plus the resolved `Idempotency-Key`. */\n headers: Record<string, string>;\n}\n\nexport abstract class Resource {\n constructor(\n protected readonly core: BirdHTTPClient,\n protected readonly client: Client,\n ) {}\n\n /** Run a single typed call through the lifecycle. */\n protected call<T>(\n method: string,\n options: RequestOptions | undefined,\n invoke: (ctx: CallContext) => Promise<FetchOutcome<T>>,\n schemes?: string[],\n ): APIPromise<T> {\n // Resolved eagerly so a missing credential throws before the lifecycle starts,\n // never as a rejected promise with a request already in flight.\n const credentials = this.core.credentialHeaders(schemes, options?.credentials);\n return apiPromise(\n this.core.request<T>(\n (ctx) => invoke(callContext(ctx, options, credentials)),\n lifecycle(method, options),\n ),\n );\n }\n\n /** Run a cursor-paginated list through the lifecycle (each page retried independently). */\n protected paginated<T>(\n method: string,\n options: RequestOptions | undefined,\n invoke: (ctx: CallContext, cursor: string | undefined) => Promise<FetchOutcome<CursorPage<T>>>,\n schemes?: string[],\n ): PaginatedPromise<T> {\n const credentials = this.core.credentialHeaders(schemes, options?.credentials);\n return paginate<T>((cursor) =>\n this.core.request<CursorPage<T>>(\n (ctx) => invoke(callContext(ctx, options, credentials), cursor),\n lifecycle(method, options),\n ),\n );\n }\n}\n\nfunction callContext(\n ctx: AttemptContext,\n options: RequestOptions | undefined,\n credentials: Record<string, string> = {},\n): CallContext {\n return {\n signal: ctx.signal,\n headers: { ...mergeHeaders(ctx.idempotencyKey, options?.headers), ...credentials },\n };\n}\n\nfunction lifecycle(method: string, options: RequestOptions | undefined): RequestLifecycleOptions {\n return {\n method,\n idempotencyKey: options?.idempotencyKey,\n signal: options?.signal,\n timeout: options?.timeout,\n maxRetries: options?.maxRetries,\n };\n}\n\nfunction mergeHeaders(\n idempotencyKey: string | undefined,\n extra: Record<string, string> | undefined,\n): Record<string, string> {\n return {\n ...extra,\n ...(idempotencyKey ? { \"Idempotency-Key\": idempotencyKey } : {}),\n };\n}\n","// Code generated by surface-gen; DO NOT EDIT.\nimport { cancelEmailMessage, getEmailMessage, listEmailMessages } from \"../generated/sdk.gen.js\";\nimport type { CancelEmailMessageData, EmailMessage, GetEmailMessageData, ListEmailMessagesData } from \"../generated/types.gen.js\";\nimport { Resource } from \"./base.js\";\nimport type { APIPromise, PaginatedPromise, RequestOptions } from \"../core/result.js\";\n\nexport type { EmailMessage };\nexport type EmailListQuery = NonNullable<ListEmailMessagesData[\"query\"]>;\n\nexport class EmailResourceBase extends Resource {\n /**\n * Fetch one email message by `id`, with aggregate delivery status and per-state recipient counts. The message body (`html`, `text`) is not returned. Per-recipient delivery statuses and the event log are separate sub-resources: `GET /v1/email/messages/{message_id}/recipients` and `GET /v1/email/messages/{message_id}/events`.\n *\n * @example \n * const msg = await bird.email.get(\"em_abc123\");\n * msg.status; // \"accepted\" | \"processed\" | \"delivered\" | \"bounced\" | …\n * msg.delivered_count;\n * msg.bounced_count;\n */\n get(messageId: string, options?: RequestOptions): APIPromise<EmailMessage> {\n return this.call<EmailMessage>(\"GET\", options, ({ signal, headers }) =>\n getEmailMessage({ client: this.client, path: { message_id: messageId }, headers, signal }));\n }\n\n /**\n * List sent email messages, newest first, as a cursor page (`{data, next_cursor, …}`). Pass `next_cursor` back as `starting_after` to fetch the next page. Filter by creation time with the half-open range `created_after` (inclusive) and `created_before` (exclusive). For a single UTC day, `created_after` is that day at 00:00:00Z and `created_before` is the next day at 00:00:00Z.\n *\n * @example \n * for await (const message of bird.email.list({ status: \"bounced\" })) {\n * console.log(message.id);\n * }\n */\n list(query?: EmailListQuery, options?: RequestOptions): PaginatedPromise<EmailMessage> {\n return this.paginated<EmailMessage>(\"GET\", options, ({ signal, headers }, cursor) =>\n listEmailMessages({ client: this.client, query: { ...query, starting_after: cursor ?? query?.starting_after }, headers, signal }));\n }\n\n /**\n * Cancel a scheduled email before it sends. Only works while the message's `status` is still `scheduled`. Once it starts sending, or was already canceled, the call returns a conflict error. Canceling does not return consumed scheduled-send quota.\n *\n * @example \n * await bird.email.cancel(\"em_abc123\");\n */\n cancel(messageId: string, options?: RequestOptions): APIPromise<void> {\n return this.call<void>(\"POST\", options, ({ signal, headers }) =>\n cancelEmailMessage({ client: this.client, path: { message_id: messageId }, headers, signal }));\n }\n}\n","// Code generated by surface-gen; DO NOT EDIT.\nimport { getEmailStatsByBounceCode, getEmailStatsByBroadcast, getEmailStatsByCategory, getEmailStatsByClient, getEmailStatsByComplaintType, getEmailStatsByLocation, getEmailStatsByMailboxProvider, getEmailStatsByMailboxProviderRegion, getEmailStatsByRecipientDomain, getEmailStatsBySendingDomain, getEmailStatsBySendingIp, getEmailStatsByTag, getEmailStatsByTemplate, getEmailStatsDaily, getEmailStatsHourly, getEmailStatsSummary } from \"../generated/sdk.gen.js\";\nimport type { EmailStatsByBounceCodeResponse, EmailStatsByBroadcastResponse, EmailStatsByCategoryResponse, EmailStatsByClientResponse, EmailStatsByComplaintTypeResponse, EmailStatsByLocationResponse, EmailStatsByMailboxProviderRegionResponse, EmailStatsByMailboxProviderResponse, EmailStatsByRecipientDomainResponse, EmailStatsBySendingDomainResponse, EmailStatsBySendingIpResponse, EmailStatsByTemplateResponse, EmailStatsResponse, EmailStatsSummary, EmailStatsTagsResponse, GetEmailStatsByBounceCodeData, GetEmailStatsByBroadcastData, GetEmailStatsByCategoryData, GetEmailStatsByClientData, GetEmailStatsByComplaintTypeData, GetEmailStatsByLocationData, GetEmailStatsByMailboxProviderData, GetEmailStatsByMailboxProviderRegionData, GetEmailStatsByRecipientDomainData, GetEmailStatsBySendingDomainData, GetEmailStatsBySendingIpData, GetEmailStatsByTagData, GetEmailStatsByTemplateData, GetEmailStatsDailyData, GetEmailStatsHourlyData, GetEmailStatsSummaryData } from \"../generated/types.gen.js\";\nimport { Resource } from \"./base.js\";\nimport type { APIPromise, RequestOptions } from \"../core/result.js\";\n\nexport type { EmailStatsSummary };\nexport type { EmailStatsResponse };\nexport type { EmailStatsTagsResponse };\nexport type { EmailStatsByCategoryResponse };\nexport type { EmailStatsBySendingIpResponse };\nexport type { EmailStatsBySendingDomainResponse };\nexport type { EmailStatsByRecipientDomainResponse };\nexport type { EmailStatsByMailboxProviderResponse };\nexport type { EmailStatsByMailboxProviderRegionResponse };\nexport type { EmailStatsByTemplateResponse };\nexport type { EmailStatsByLocationResponse };\nexport type { EmailStatsByClientResponse };\nexport type { EmailStatsByBounceCodeResponse };\nexport type { EmailStatsByComplaintTypeResponse };\nexport type { EmailStatsByBroadcastResponse };\nexport type EmailStatsSummaryQuery = NonNullable<GetEmailStatsSummaryData[\"query\"]>;\nexport type EmailStatsDailyQuery = NonNullable<GetEmailStatsDailyData[\"query\"]>;\nexport type EmailStatsHourlyQuery = NonNullable<GetEmailStatsHourlyData[\"query\"]>;\nexport type EmailStatsByTagQuery = NonNullable<GetEmailStatsByTagData[\"query\"]>;\nexport type EmailStatsByCategoryQuery = NonNullable<GetEmailStatsByCategoryData[\"query\"]>;\nexport type EmailStatsBySendingIpQuery = NonNullable<GetEmailStatsBySendingIpData[\"query\"]>;\nexport type EmailStatsBySendingDomainQuery = NonNullable<GetEmailStatsBySendingDomainData[\"query\"]>;\nexport type EmailStatsByRecipientDomainQuery = NonNullable<GetEmailStatsByRecipientDomainData[\"query\"]>;\nexport type EmailStatsByMailboxProviderQuery = NonNullable<GetEmailStatsByMailboxProviderData[\"query\"]>;\nexport type EmailStatsByMailboxProviderRegionQuery = NonNullable<GetEmailStatsByMailboxProviderRegionData[\"query\"]>;\nexport type EmailStatsByTemplateQuery = NonNullable<GetEmailStatsByTemplateData[\"query\"]>;\nexport type EmailStatsByLocationQuery = NonNullable<GetEmailStatsByLocationData[\"query\"]>;\nexport type EmailStatsByClientQuery = NonNullable<GetEmailStatsByClientData[\"query\"]>;\nexport type EmailStatsByBounceCodeQuery = NonNullable<GetEmailStatsByBounceCodeData[\"query\"]>;\nexport type EmailStatsByComplaintTypeQuery = NonNullable<GetEmailStatsByComplaintTypeData[\"query\"]>;\nexport type EmailStatsByBroadcastQuery = NonNullable<GetEmailStatsByBroadcastData[\"query\"]>;\n\nexport class EmailStatsResource extends Resource {\n /**\n * Aggregate email KPIs for one period: sends, delivered, bounces, complaints, opens, clicks, their rates, and latency percentiles. `from`/`to` are both YYYY-MM-DD days or both RFC 3339 instants (hour grain); add `compare=previous_period` for deltas versus the prior window. For a per-day or per-hour series use `email.stats.daily` or `email.stats.hourly`.\n *\n * @example Summary for a month\n * const s = await bird.email.stats.summary({ from: \"2026-05-01\", to: \"2026-05-31\" });\n * console.log(s.sends_accepted, s.delivery.delivered);\n */\n summary(query?: EmailStatsSummaryQuery, options?: RequestOptions): APIPromise<EmailStatsSummary> {\n return this.call<EmailStatsSummary>(\"GET\", options, ({ signal, headers }) =>\n getEmailStatsSummary({ client: this.client, query, headers, signal }));\n }\n\n /**\n * Per-day email stats series (counts, rates, latency percentiles), gap-filled with zero rows, max 365 days. At most one filter of `category`, `sending_domain`, `tag`, `sending_ip`, `recipient_domain`, `template`. For hour resolution use `email.stats.hourly`; for one aggregate row use `email.stats.summary`.\n *\n * @example \n * const series = await bird.email.stats.daily({ from: \"2026-05-01\", to: \"2026-05-31\" });\n * for (const row of series.data) console.log(row.bucket, row.delivery.delivered);\n */\n daily(query?: EmailStatsDailyQuery, options?: RequestOptions): APIPromise<EmailStatsResponse> {\n return this.call<EmailStatsResponse>(\"GET\", options, ({ signal, headers }) =>\n getEmailStatsDaily({ client: this.client, query, headers, signal }));\n }\n\n /**\n * Per-hour email stats series, gap-filled with zero rows, max 720 hours (30 days). Takes the same single-dimension filters as `email.stats.daily`; for longer ranges use `email.stats.daily`, for one aggregate row use `email.stats.summary`.\n *\n * @example \n * const series = await bird.email.stats.hourly({ from: \"2026-05-01\", to: \"2026-05-02\" });\n * for (const row of series.data) console.log(row.bucket, row.delivery.delivered);\n */\n hourly(query?: EmailStatsHourlyQuery, options?: RequestOptions): APIPromise<EmailStatsResponse> {\n return this.call<EmailStatsResponse>(\"GET\", options, ({ signal, headers }) =>\n getEmailStatsHourly({ client: this.client, query, headers, signal }));\n }\n\n /**\n * Email delivery and engagement stats grouped by tag, one row per `name:value` pair set at send time. Rows are ranked by `sort`, `processed` by default. Set `include_trend=true` to add a per-bucket rate series to each row.\n *\n * @example Top 10 tags by delivered\n * const { data } = await bird.email.stats.byTag({\n * from: \"2026-05-01\",\n * to: \"2026-05-31\",\n * sort: \"delivered\",\n * limit: 10,\n * });\n * for (const row of data) console.log(row.tag, row.delivery.delivered);\n */\n byTag(query?: EmailStatsByTagQuery, options?: RequestOptions): APIPromise<EmailStatsTagsResponse> {\n return this.call<EmailStatsTagsResponse>(\"GET\", options, ({ signal, headers }) =>\n getEmailStatsByTag({ client: this.client, query, headers, signal }));\n }\n\n /**\n * Email delivery and engagement stats grouped by category, meaning `transactional` compared with `marketing`. Rows are ranked by `sort`, `processed` by default. Set `include_trend=true` to add a per-bucket rate series to each row.\n *\n * @example \n * const { data } = await bird.email.stats.byCategory({ from: \"2026-05-01\", to: \"2026-05-31\" });\n * for (const row of data) console.log(row.category, row.delivery.delivered);\n */\n byCategory(query?: EmailStatsByCategoryQuery, options?: RequestOptions): APIPromise<EmailStatsByCategoryResponse> {\n return this.call<EmailStatsByCategoryResponse>(\"GET\", options, ({ signal, headers }) =>\n getEmailStatsByCategory({ client: this.client, query, headers, signal }));\n }\n\n /**\n * Delivery and bounce stats grouped by sending IP, with deferral counts alongside them. `sort=bounces.block` surfaces reputation-damaged IPs first. Engagement, accepted, and processed counts aren't available per IP, and complaint and out-of-band bounce counts always read 0 here. For workspace-wide figures, use `email.stats.daily`.\n *\n * @example \n * const { data } = await bird.email.stats.bySendingIp({\n * from: \"2026-05-01\",\n * to: \"2026-05-31\",\n * sort: \"bounces.block\",\n * limit: 20,\n * });\n * for (const row of data) console.log(row.sending_ip, row.delivery.delivered);\n */\n bySendingIp(query?: EmailStatsBySendingIpQuery, options?: RequestOptions): APIPromise<EmailStatsBySendingIpResponse> {\n return this.call<EmailStatsBySendingIpResponse>(\"GET\", options, ({ signal, headers }) =>\n getEmailStatsBySendingIp({ client: this.client, query, headers, signal }));\n }\n\n /**\n * Email delivery and engagement stats grouped by sending (`From`) domain, so you can compare deliverability across your workspace's verified domains. For per-IP reputation instead, use `email.stats.by_sending_ip`.\n *\n * @example \n * const { data } = await bird.email.stats.bySendingDomain({\n * from: \"2026-05-01\",\n * to: \"2026-05-31\",\n * sort: \"delivery_rate\",\n * limit: 25,\n * });\n * for (const row of data) console.log(row.sending_domain, row.delivery.delivery_rate);\n */\n bySendingDomain(query?: EmailStatsBySendingDomainQuery, options?: RequestOptions): APIPromise<EmailStatsBySendingDomainResponse> {\n return this.call<EmailStatsBySendingDomainResponse>(\"GET\", options, ({ signal, headers }) =>\n getEmailStatsBySendingDomain({ client: this.client, query, headers, signal }));\n }\n\n /**\n * Email delivery and engagement stats grouped by exact recipient mailbox domain, for example `gmail.com`. Finer-grained than `email.stats.by_mailbox_provider`, which buckets domains into providers.\n *\n * @example \n * const { data } = await bird.email.stats.byRecipientDomain({\n * from: \"2026-05-01\",\n * to: \"2026-05-31\",\n * sort: \"bounce_rate\",\n * limit: 25,\n * });\n * for (const row of data) console.log(row.recipient_domain, row.delivery.bounce_rate);\n */\n byRecipientDomain(query?: EmailStatsByRecipientDomainQuery, options?: RequestOptions): APIPromise<EmailStatsByRecipientDomainResponse> {\n return this.call<EmailStatsByRecipientDomainResponse>(\"GET\", options, ({ signal, headers }) =>\n getEmailStatsByRecipientDomain({ client: this.client, query, headers, signal }));\n }\n\n /**\n * Email delivery and engagement stats grouped by recipient mailbox provider, for example `gmail`, `microsoft`, or `yahoo`. It covers the delivery stage onward, so there are no accepted or processed counts. For a per-region split within a provider, use `email.stats.by_mailbox_provider_region`; for exact destination domains instead, use `email.stats.by_recipient_domain`.\n *\n * @example \n * const { data } = await bird.email.stats.byMailboxProvider({\n * from: \"2026-05-01\",\n * to: \"2026-05-31\",\n * limit: 25,\n * });\n * for (const row of data) console.log(row.mailbox_provider, row.delivery.delivered);\n */\n byMailboxProvider(query?: EmailStatsByMailboxProviderQuery, options?: RequestOptions): APIPromise<EmailStatsByMailboxProviderResponse> {\n return this.call<EmailStatsByMailboxProviderResponse>(\"GET\", options, ({ signal, headers }) =>\n getEmailStatsByMailboxProvider({ client: this.client, query, headers, signal }));\n }\n\n /**\n * Email delivery and engagement stats grouped by a mailbox provider and provider region pair, for example `gmail` in `NA`. It covers the delivery stage onward, so there are no accepted or processed counts. For the provider-level view without the region split, use `email.stats.by_mailbox_provider`.\n *\n * @example \n * const { data } = await bird.email.stats.byMailboxProviderRegion({\n * from: \"2026-05-01\",\n * to: \"2026-05-31\",\n * limit: 25,\n * });\n * for (const row of data) console.log(row.mailbox_provider, row.mailbox_provider_region, row.delivery.delivered);\n */\n byMailboxProviderRegion(query?: EmailStatsByMailboxProviderRegionQuery, options?: RequestOptions): APIPromise<EmailStatsByMailboxProviderRegionResponse> {\n return this.call<EmailStatsByMailboxProviderRegionResponse>(\"GET\", options, ({ signal, headers }) =>\n getEmailStatsByMailboxProviderRegion({ client: this.client, query, headers, signal }));\n }\n\n /**\n * Email delivery and engagement stats grouped by the template used at send time, keyed by template id (`emt_…`); only templated sends appear. A single template's trend over time comes from `email.stats.daily` with its `template` filter.\n *\n * @example \n * const { data } = await bird.email.stats.byTemplate({\n * from: \"2026-05-01\",\n * to: \"2026-05-31\",\n * sort: \"open_rate\",\n * limit: 25,\n * });\n * for (const row of data) console.log(row.template_id, row.engagement.open_rate);\n */\n byTemplate(query?: EmailStatsByTemplateQuery, options?: RequestOptions): APIPromise<EmailStatsByTemplateResponse> {\n return this.call<EmailStatsByTemplateResponse>(\"GET\", options, ({ signal, headers }) =>\n getEmailStatsByTemplate({ client: this.client, query, headers, signal }));\n }\n\n /**\n * Opens and clicks grouped by country, region, or city, whichever you choose with `group_by`. It only has engagement counts, no delivery counts or rates. For engagement grouped by mail client or device instead, use `email.stats.by_client`.\n *\n * @example \n * const { data } = await bird.email.stats.byLocation({\n * from: \"2026-05-01\",\n * to: \"2026-05-31\",\n * limit: 25,\n * });\n * for (const row of data) console.log(row.country, row.engagement.unique_opens);\n */\n byLocation(query?: EmailStatsByLocationQuery, options?: RequestOptions): APIPromise<EmailStatsByLocationResponse> {\n return this.call<EmailStatsByLocationResponse>(\"GET\", options, ({ signal, headers }) =>\n getEmailStatsByLocation({ client: this.client, query, headers, signal }));\n }\n\n /**\n * Opens and clicks grouped by mail client, operating system, or device type, whichever you choose with `group_by`. It only has engagement counts, no delivery counts or rates. For engagement grouped by geography instead, use `email.stats.by_location`.\n *\n * @example \n * const { data } = await bird.email.stats.byClient({\n * from: \"2026-05-01\",\n * to: \"2026-05-31\",\n * limit: 25,\n * });\n * for (const row of data) console.log(row.email_client, row.engagement.unique_opens);\n */\n byClient(query?: EmailStatsByClientQuery, options?: RequestOptions): APIPromise<EmailStatsByClientResponse> {\n return this.call<EmailStatsByClientResponse>(\"GET\", options, ({ signal, headers }) =>\n getEmailStatsByClient({ client: this.client, query, headers, signal }));\n }\n\n /**\n * Bounce counts grouped by the SMTP error code the receiving mail server returned. Each row also breaks the bounce down into its hard, soft, admin, block, and undetermined split. There are no delivered, open, or click counts here, because a bounce code only appears on a bounce event. For bounces broken down by destination instead, use `email.stats.by_recipient_domain` or `email.stats.by_mailbox_provider`.\n *\n * @example \n * const { data } = await bird.email.stats.byBounceCode({\n * from: \"2026-05-01\",\n * to: \"2026-05-31\",\n * sort: \"bounced\",\n * limit: 25,\n * });\n * for (const row of data) console.log(row.smtp_error_code, row.bounced);\n */\n byBounceCode(query?: EmailStatsByBounceCodeQuery, options?: RequestOptions): APIPromise<EmailStatsByBounceCodeResponse> {\n return this.call<EmailStatsByBounceCodeResponse>(\"GET\", options, ({ signal, headers }) =>\n getEmailStatsByBounceCode({ client: this.client, query, headers, signal }));\n }\n\n /**\n * Spam-complaint counts grouped by the feedback-loop complaint type, for example `abuse`, `fraud`, or `virus`. Complaint side only, so there are no delivery or engagement counts. For complaints broken down by destination instead, use `email.stats.by_mailbox_provider` or `email.stats.by_recipient_domain`.\n *\n * @example \n * const { data } = await bird.email.stats.byComplaintType({ from: \"2026-05-01\", to: \"2026-05-31\" });\n * for (const row of data) console.log(row.feedback_type, row.complained);\n */\n byComplaintType(query?: EmailStatsByComplaintTypeQuery, options?: RequestOptions): APIPromise<EmailStatsByComplaintTypeResponse> {\n return this.call<EmailStatsByComplaintTypeResponse>(\"GET\", options, ({ signal, headers }) =>\n getEmailStatsByComplaintType({ client: this.client, query, headers, signal }));\n }\n\n /**\n * Email delivery and engagement stats grouped by broadcast. Only broadcast sends appear. Reflects roughly the last 30 days of activity.\n *\n * @example \n * const { data } = await bird.email.stats.byBroadcast({\n * from: \"2026-05-01\",\n * to: \"2026-05-31\",\n * sort: \"click_rate\",\n * limit: 25,\n * });\n * for (const row of data) console.log(row.broadcast_id, row.engagement.click_rate);\n */\n byBroadcast(query?: EmailStatsByBroadcastQuery, options?: RequestOptions): APIPromise<EmailStatsByBroadcastResponse> {\n return this.call<EmailStatsByBroadcastResponse>(\"GET\", options, ({ signal, headers }) =>\n getEmailStatsByBroadcast({ client: this.client, query, headers, signal }));\n }\n}\n","// Code generated by surface-gen; DO NOT EDIT.\nimport { createMailbox, deleteMailbox, getMailbox, getMailboxStats, listMailboxLabels, listMailboxes, restoreMailbox, resumeMailbox, updateMailbox } from \"../generated/sdk.gen.js\";\nimport type { CreateMailboxData, DeleteMailboxData, EmailMailboxLabelList, GetMailboxData, GetMailboxStatsData, ListMailboxLabelsData, ListMailboxesData, Mailbox, MailboxStatsResponse, RestoreMailboxData, ResumeMailboxData, UpdateMailboxData } from \"../generated/types.gen.js\";\nimport { Resource } from \"./base.js\";\nimport type { APIPromise, PaginatedPromise, RequestOptions } from \"../core/result.js\";\n\nexport type { Mailbox };\nexport type { MailboxStatsResponse };\nexport type { EmailMailboxLabelList };\nexport type EmailMailboxesListQuery = NonNullable<ListMailboxesData[\"query\"]>;\nexport type EmailMailboxesCreateParams = NonNullable<CreateMailboxData[\"body\"]>;\nexport type EmailMailboxesUpdateParams = NonNullable<UpdateMailboxData[\"body\"]>;\nexport type EmailMailboxesUpdateQuery = NonNullable<UpdateMailboxData[\"query\"]>;\nexport type EmailMailboxesStatsQuery = NonNullable<GetMailboxStatsData[\"query\"]>;\n\nexport class EmailMailboxesResourceBase extends Resource {\n /**\n * List the workspace's mailboxes as a cursor page, newest first. Search addresses and display names with q, or filter by exact address, state, or domain.\n *\n * @example List mailboxes\n * for await (const mailbox of bird.email.mailboxes.list()) {\n * console.log(mailbox.address);\n * }\n */\n list(query?: EmailMailboxesListQuery, options?: RequestOptions): PaginatedPromise<Mailbox> {\n return this.paginated<Mailbox>(\"GET\", options, ({ signal, headers }, cursor) =>\n listMailboxes({ client: this.client, query: { ...query, starting_after: cursor ?? query?.starting_after }, headers, signal }));\n }\n\n /**\n * Create a mailbox: a durable agent identity that owns an email address, groups mail into conversations, and remembers conversations for its retention tier.\n *\n * @example Create a mailbox\n * const mailbox = await bird.email.mailboxes.create({ display_name: \"Support\" });\n * console.log(mailbox.address); // \"abc123@inbox.ai\"\n */\n create(params: EmailMailboxesCreateParams = {}, options?: RequestOptions): APIPromise<Mailbox> {\n return this.call<Mailbox>(\"POST\", options, ({ signal, headers }) =>\n createMailbox({ client: this.client, body: params, headers, signal }));\n }\n\n /**\n * Read one mailbox by ID. A mailbox deleted within its 30-day restore window is still returned, with a non-null `deleted_at`. Once that window closes it is gone and this returns 404.\n *\n * @example Get a mailbox\n * const mailbox = await bird.email.mailboxes.get(\"mbx_01abc\");\n * console.log(mailbox.state); // \"active\"\n */\n get(mailboxId: string, options?: RequestOptions): APIPromise<Mailbox> {\n return this.call<Mailbox>(\"GET\", options, ({ signal, headers }) =>\n getMailbox({ client: this.client, path: { mailbox_id: mailboxId }, headers, signal }));\n }\n\n /**\n * Update a mailbox's display name, reply-to, receive policy, retention tier, IP pool, or metadata. Lowering the retention tier requires `confirm=true` when it would delete remembered messages older than the new cutoff.\n *\n * @example Change a mailbox's receive policy\n * const mailbox = await bird.email.mailboxes.update(\"mbx_01abc\", {\n * receive_policy: \"open\",\n * });\n * console.log(mailbox.id, mailbox.receive_policy);\n */\n update(mailboxId: string, params: EmailMailboxesUpdateParams = {}, query?: EmailMailboxesUpdateQuery, options?: RequestOptions): APIPromise<Mailbox> {\n return this.call<Mailbox>(\"PATCH\", options, ({ signal, headers }) =>\n updateMailbox({ client: this.client, path: { mailbox_id: mailboxId }, body: params, query, headers, signal }));\n }\n\n /**\n * Delete a mailbox. The address stops receiving immediately and is quarantined. The mailbox and its remembered messages stay restorable for 30 days through the restore endpoint, then are permanently deleted.\n *\n * @example Delete a mailbox\n * await bird.email.mailboxes.delete(\"mbx_01abc\");\n */\n delete(mailboxId: string, options?: RequestOptions): APIPromise<void> {\n return this.call<void>(\"DELETE\", options, ({ signal, headers }) =>\n deleteMailbox({ client: this.client, path: { mailbox_id: mailboxId }, headers, signal }));\n }\n\n /**\n * Restore a mailbox deleted less than 30 days ago: the address starts receiving again and the remembered messages are back. Past the window the mailbox is permanently deleted and returns 404. A mailbox that is not deleted returns 409.\n *\n * @example Restore a deleted mailbox\n * const mailbox = await bird.email.mailboxes.restore(\"mbx_01abc\");\n * console.log(mailbox.deleted_at); // null\n */\n restore(mailboxId: string, options?: RequestOptions): APIPromise<Mailbox> {\n return this.call<Mailbox>(\"POST\", options, ({ signal, headers }) =>\n restoreMailbox({ client: this.client, path: { mailbox_id: mailboxId }, headers, signal }));\n }\n\n /**\n * Resume a suspended mailbox so it can send and receive again and its conversations become visible. Fails if your plan does not have room for another active mailbox (or another custom inbox.ai handle). Delete an active mailbox or upgrade first. A mailbox that is not suspended returns 409.\n *\n * @example Resume a suspended mailbox\n * const mailbox = await bird.email.mailboxes.resume(\"mbx_01abc\");\n * console.log(mailbox.state); // \"active\"\n */\n resume(mailboxId: string, options?: RequestOptions): APIPromise<Mailbox> {\n return this.call<Mailbox>(\"POST\", options, ({ signal, headers }) =>\n resumeMailbox({ client: this.client, path: { mailbox_id: mailboxId }, headers, signal }));\n }\n\n /**\n * Read a mailbox's sent and received email statistics over a window: a period summary plus a bucketed series. Rows are bucketed by event time rather than send time, so engagement that arrived during the period for messages sent earlier is counted here. Both window bounds must use the same form, calendar days or RFC 3339 instants, matching the granularity.\n *\n * @example Get mailbox stats\n * const stats = await bird.email.mailboxes.stats(\"mbx_01abc\");\n * console.log(stats.summary?.sends_accepted);\n */\n stats(mailboxId: string, query?: EmailMailboxesStatsQuery, options?: RequestOptions): APIPromise<MailboxStatsResponse> {\n return this.call<MailboxStatsResponse>(\"GET\", options, ({ signal, headers }) =>\n getMailboxStats({ client: this.client, path: { mailbox_id: mailboxId }, query, headers, signal }));\n }\n\n /**\n * List the labels available in a mailbox: the built-in system labels (inbox, archive, spam, blocked, sent, trash, unread) plus every custom label in use.\n *\n * @example List a mailbox's labels\n * const labels = await bird.email.mailboxes.labels(\"mbx_01abc\");\n * console.log(labels.data.map((label) => label.name));\n */\n labels(mailboxId: string, options?: RequestOptions): APIPromise<EmailMailboxLabelList> {\n return this.call<EmailMailboxLabelList>(\"GET\", options, ({ signal, headers }) =>\n listMailboxLabels({ client: this.client, path: { mailbox_id: mailboxId }, headers, signal }));\n }\n}\n","// `bird.email.mailboxes.messages` — the override residue over the generated\n// mailbox facade: create (address-list body).\n\nimport { createMailboxMessage } from \"../generated/sdk.gen.js\";\nimport type {\n EmailMailboxComposeRequest,\n EmailThreadMessage,\n} from \"../generated/types.gen.js\";\nimport { Resource } from \"./base.js\";\nimport type { APIPromise, RequestOptions } from \"../core/result.js\";\n\n/** Parameters for sending a new message from a mailbox. */\nexport type EmailMailboxesMessagesCreateParams = EmailMailboxComposeRequest;\n/** A message returned from create or reply. */\nexport type { EmailThreadMessage };\n\nexport class EmailMailboxesMessagesResource extends Resource {\n /**\n * Send a new email from this mailbox, starting a new conversation.\n *\n * @example Send from a mailbox\n * const msg = await bird.email.mailboxes.messages.create(\"mbx_01abc\", {\n * to: [\"customer@example.com\"],\n * subject: \"Hello\",\n * text: \"Hi there!\",\n * });\n */\n create(\n mailboxId: string,\n params: EmailMailboxesMessagesCreateParams,\n options?: RequestOptions,\n ): APIPromise<EmailThreadMessage> {\n return this.call<EmailThreadMessage>(\"POST\", options, ({ signal, headers }) =>\n createMailboxMessage({\n client: this.client,\n path: { mailbox_id: mailboxId },\n body: params,\n headers,\n signal,\n }),\n );\n }\n}\n","// Code generated by surface-gen; DO NOT EDIT.\nimport { createMailboxReceiveRule, deleteMailboxReceiveRule, listMailboxReceiveRules } from \"../generated/sdk.gen.js\";\nimport type { CreateMailboxReceiveRuleData, DeleteMailboxReceiveRuleData, ListMailboxReceiveRulesData, ReceiveRule } from \"../generated/types.gen.js\";\nimport { Resource } from \"./base.js\";\nimport type { APIPromise, PaginatedPromise, RequestOptions } from \"../core/result.js\";\n\nexport type { ReceiveRule };\nexport type EmailMailboxesReceiveRulesListQuery = NonNullable<ListMailboxReceiveRulesData[\"query\"]>;\nexport type EmailMailboxesReceiveRulesCreateParams = NonNullable<CreateMailboxReceiveRuleData[\"body\"]>;\n\nexport class EmailMailboxesReceiveRulesResource extends Resource {\n /**\n * List a mailbox's allow/block receive rules as a cursor page, oldest first. Filter by action.\n *\n * @example List a mailbox's receive rules\n * for await (const rule of bird.email.mailboxes.receiveRules.list(\"mbx_01abc\")) {\n * console.log(rule.action, rule.entry);\n * }\n */\n list(mailboxId: string, query?: EmailMailboxesReceiveRulesListQuery, options?: RequestOptions): PaginatedPromise<ReceiveRule> {\n return this.paginated<ReceiveRule>(\"GET\", options, ({ signal, headers }, cursor) =>\n listMailboxReceiveRules({ client: this.client, path: { mailbox_id: mailboxId }, query: { ...query, starting_after: cursor ?? query?.starting_after }, headers, signal }));\n }\n\n /**\n * Add an allow or block rule for a sender address or domain to a mailbox. Block always wins. Up to 200 rules per mailbox.\n *\n * @example Block a domain\n * const rule = await bird.email.mailboxes.receiveRules.create(\"mbx_01abc\", {\n * action: \"block\",\n * entry: \"spam.example.com\",\n * });\n * console.log(rule.id);\n */\n create(mailboxId: string, params: EmailMailboxesReceiveRulesCreateParams, options?: RequestOptions): APIPromise<ReceiveRule> {\n return this.call<ReceiveRule>(\"POST\", options, ({ signal, headers }) =>\n createMailboxReceiveRule({ client: this.client, path: { mailbox_id: mailboxId }, body: params, headers, signal }));\n }\n\n /**\n * Remove a receive rule from a mailbox. Rules have no update operation, so a rule's allow or block action cannot be changed after it is created.\n *\n * @example Delete a rule\n * await bird.email.mailboxes.receiveRules.delete(\"mbx_01abc\", \"erl_01xyz\");\n */\n delete(mailboxId: string, ruleId: string, options?: RequestOptions): APIPromise<void> {\n return this.call<void>(\"DELETE\", options, ({ signal, headers }) =>\n deleteMailboxReceiveRule({ client: this.client, path: { mailbox_id: mailboxId, rule_id: ruleId }, headers, signal }));\n }\n}\n","// `bird.email.mailboxes` — the generated mailbox facade plus its nested\n// collections (messages, receiveRules), which a generated class can't declare.\n\nimport { Resource } from \"./base.js\";\nimport { EmailMailboxesResourceBase } from \"./emailMailboxes.gen.js\";\nimport { EmailMailboxesMessagesResource } from \"./emailMailboxesMessages.js\";\nimport { EmailMailboxesReceiveRulesResource } from \"./emailMailboxesReceiveRules.gen.js\";\n\nexport class EmailMailboxesResource extends EmailMailboxesResourceBase {\n /** Messages sent from the mailbox's own address — `bird.email.mailboxes.messages.create(...)`. */\n readonly messages: EmailMailboxesMessagesResource;\n\n /** Per-sender allow/block rules — `bird.email.mailboxes.receiveRules.create(...)`, `.list(...)`, `.delete(...)`. */\n readonly receiveRules: EmailMailboxesReceiveRulesResource;\n\n constructor(...args: ConstructorParameters<typeof Resource>) {\n super(...args);\n this.messages = new EmailMailboxesMessagesResource(...args);\n this.receiveRules = new EmailMailboxesReceiveRulesResource(...args);\n }\n}\n","// Code generated by surface-gen; DO NOT EDIT.\nimport { deleteEmailThread, getEmailThread, listEmailThreads, updateEmailThread } from \"../generated/sdk.gen.js\";\nimport type { DeleteEmailThreadData, EmailThread, GetEmailThreadData, ListEmailThreadsData, UpdateEmailThreadData } from \"../generated/types.gen.js\";\nimport { Resource } from \"./base.js\";\nimport type { APIPromise, PaginatedPromise, RequestOptions } from \"../core/result.js\";\n\nexport type { EmailThread };\nexport type EmailThreadsListQuery = NonNullable<ListEmailThreadsData[\"query\"]>;\nexport type EmailThreadsUpdateParams = NonNullable<UpdateEmailThreadData[\"body\"]>;\nexport type EmailThreadsDeleteQuery = NonNullable<DeleteEmailThreadData[\"query\"]>;\n\nexport class EmailThreadsResourceBase extends Resource {\n /**\n * List mailbox conversations as a cursor page, most recently active first. `label` selects the view: inbox (default), archive, spam, blocked, or a custom label. Filter by mailbox, contact, participant address, or subject substring.\n *\n * @example List conversation threads\n * for await (const thread of bird.email.threads.list({ mailbox_id: \"mbx_01abc\" })) {\n * console.log(thread.id, thread.subject);\n * }\n */\n list(query?: EmailThreadsListQuery, options?: RequestOptions): PaginatedPromise<EmailThread> {\n return this.paginated<EmailThread>(\"GET\", options, ({ signal, headers }, cursor) =>\n listEmailThreads({ client: this.client, query: { ...query, starting_after: cursor ?? query?.starting_after }, headers, signal }));\n }\n\n /**\n * Get one conversation: participants, counts, labels, read state. Fetch its messages with the thread messages endpoint.\n *\n * @example Get a thread\n * const thread = await bird.email.threads.get(\"thr_01abc\");\n * console.log(thread.subject);\n */\n get(threadId: string, options?: RequestOptions): APIPromise<EmailThread> {\n return this.call<EmailThread>(\"GET\", options, ({ signal, headers }) =>\n getEmailThread({ client: this.client, path: { thread_id: threadId }, headers, signal }));\n }\n\n /**\n * Add or remove labels on a conversation, or link and unlink a contact. Adding `spam` files it as spam, `archive` clears it out of the inbox, and `inbox` brings it back.\n *\n * @example Apply label changes to a thread\n * const thread = await bird.email.threads.update(\"thr_01abc\", {\n * labels: { add: [\"archive\"] },\n * });\n * console.log(thread.id);\n */\n update(threadId: string, params: EmailThreadsUpdateParams = {}, options?: RequestOptions): APIPromise<EmailThread> {\n return this.call<EmailThread>(\"PATCH\", options, ({ signal, headers }) =>\n updateEmailThread({ client: this.client, path: { thread_id: threadId }, body: params, headers, signal }));\n }\n\n /**\n * Move a conversation and all its messages to trash (purged after 30 days), or delete permanently with ?permanent=true.\n *\n * @example Delete a thread\n * await bird.email.threads.delete(\"thr_01abc\", { permanent: true });\n */\n delete(threadId: string, query?: EmailThreadsDeleteQuery, options?: RequestOptions): APIPromise<void> {\n return this.call<void>(\"DELETE\", options, ({ signal, headers }) =>\n deleteEmailThread({ client: this.client, path: { thread_id: threadId }, query, headers, signal }));\n }\n}\n","// Code generated by surface-gen; DO NOT EDIT.\nimport { getEmailThreadMessage, getEmailThreadMessageBody, listEmailThreadMessageAttachments, listEmailThreadMessages, replyEmailThreadMessage } from \"../generated/sdk.gen.js\";\nimport type { EmailThreadMessage, EmailThreadMessageAttachmentList, EmailThreadMessageBody, GetEmailThreadMessageBodyData, GetEmailThreadMessageData, ListEmailThreadMessageAttachmentsData, ListEmailThreadMessagesData, ReplyEmailThreadMessageData } from \"../generated/types.gen.js\";\nimport { Resource } from \"./base.js\";\nimport type { APIPromise, PaginatedPromise, RequestOptions } from \"../core/result.js\";\n\nexport type { EmailThreadMessage };\nexport type { EmailThreadMessageBody };\nexport type { EmailThreadMessageAttachmentList };\nexport type EmailThreadsMessagesListQuery = NonNullable<ListEmailThreadMessagesData[\"query\"]>;\nexport type EmailThreadsMessagesReplyParams = NonNullable<ReplyEmailThreadMessageData[\"body\"]>;\n\nexport class EmailThreadsMessagesResource extends Resource {\n /**\n * List the messages in a conversation newest first, both directions. Page older messages with starting_after, and pass include=extracted_text to inline each message's extracted plain text.\n *\n * @example List a thread's messages\n * for await (const msg of bird.email.threads.messages.list(\"thr_01abc\")) {\n * console.log(msg.id, msg.direction);\n * }\n */\n list(threadId: string, query?: EmailThreadsMessagesListQuery, options?: RequestOptions): PaginatedPromise<EmailThreadMessage> {\n return this.paginated<EmailThreadMessage>(\"GET\", options, ({ signal, headers }, cursor) =>\n listEmailThreadMessages({ client: this.client, path: { thread_id: threadId }, query: { ...query, starting_after: cursor ?? query?.starting_after }, headers, signal }));\n }\n\n /**\n * Get one conversation message with its extracted plain text, readable for the mailbox's full retention tier without MIME parsing.\n *\n * @example Get a message\n * const msg = await bird.email.threads.messages.get(\"thr_01abc\", \"rem_01xyz\");\n * console.log(msg.direction); // \"inbound\"\n */\n get(threadId: string, messageId: string, options?: RequestOptions): APIPromise<EmailThreadMessage> {\n return this.call<EmailThreadMessage>(\"GET\", options, ({ signal, headers }) =>\n getEmailThreadMessage({ client: this.client, path: { thread_id: threadId, message_id: messageId }, headers, signal }));\n }\n\n /**\n * Get the original rendered HTML and plain-text body of a conversation message. Available for 30 days. After that, use the message's extracted_text.\n *\n * @example Get a message body\n * const body = await bird.email.threads.messages.body(\"thr_01abc\", \"rem_01xyz\");\n * console.log(body.text);\n */\n body(threadId: string, messageId: string, options?: RequestOptions): APIPromise<EmailThreadMessageBody> {\n return this.call<EmailThreadMessageBody>(\"GET\", options, ({ signal, headers }) =>\n getEmailThreadMessageBody({ client: this.client, path: { thread_id: threadId, message_id: messageId }, headers, signal }));\n }\n\n /**\n * Reply to a specific conversation message from the mailbox's own address. To reply to a conversation, target its newest received message. Recipients, subject, and threading headers are derived automatically.\n *\n * @example Reply to a message\n * const reply = await bird.email.threads.messages.reply(\"thr_01abc\", \"rem_01xyz\", {\n * text: \"Thanks for reaching out!\",\n * });\n * console.log(reply.id);\n */\n reply(threadId: string, messageId: string, params: EmailThreadsMessagesReplyParams = {}, options?: RequestOptions): APIPromise<EmailThreadMessage> {\n return this.call<EmailThreadMessage>(\"POST\", options, ({ signal, headers }) =>\n replyEmailThreadMessage({ client: this.client, path: { thread_id: threadId, message_id: messageId }, body: params, headers, signal }));\n }\n\n /**\n * List the attachments on a conversation message. Bytes are downloadable for 30 days, and the metadata stays readable afterward on the message's attachment_manifest.\n *\n * @example List a message's attachments\n * const atts = await bird.email.threads.messages.attachments(\"thr_01abc\", \"rem_01xyz\");\n * console.log(atts.data.map((a) => a.filename));\n */\n attachments(threadId: string, messageId: string, options?: RequestOptions): APIPromise<EmailThreadMessageAttachmentList> {\n return this.call<EmailThreadMessageAttachmentList>(\"GET\", options, ({ signal, headers }) =>\n listEmailThreadMessageAttachments({ client: this.client, path: { thread_id: threadId, message_id: messageId }, headers, signal }));\n }\n}\n","// `bird.email.threads` — the generated thread facade plus its nested messages\n// collection, which a generated class can't declare.\n\nimport { Resource } from \"./base.js\";\nimport { EmailThreadsResourceBase } from \"./emailThreads.gen.js\";\nimport { EmailThreadsMessagesResource } from \"./emailThreadsMessages.gen.js\";\n\nexport class EmailThreadsResource extends EmailThreadsResourceBase {\n /** Messages in a conversation — `bird.email.threads.messages.list(...)`, `.reply(...)`, … */\n readonly messages: EmailThreadsMessagesResource;\n\n constructor(...args: ConstructorParameters<typeof Resource>) {\n super(...args);\n this.messages = new EmailThreadsMessagesResource(...args);\n }\n}\n","// `bird.email` — the email channel: send email messages and read their delivery status.\n\nimport {\n cancelEmailMessage,\n createEmailMessage,\n createEmailMessageBatch,\n getEmailMessage,\n listEmailMessages,\n} from \"../generated/sdk.gen.js\";\nimport type {\n EmailMessage,\n EmailMessageBatchRequest,\n EmailMessageBatchResponse,\n EmailMessageSendRequest,\n ListEmailMessagesData,\n} from \"../generated/types.gen.js\";\nimport { Resource } from \"./base.js\";\nimport { EmailResourceBase } from \"./email.gen.js\";\nimport { EmailStatsResource } from \"./emailStats.gen.js\";\nimport { EmailMailboxesResource } from \"./emailMailboxes.js\";\nimport { EmailThreadsResource } from \"./emailThreads.js\";\nimport type {\n APIPromise,\n PaginatedPromise,\n RequestOptions,\n} from \"../core/result.js\";\n\n/** An email message with aggregate delivery status. */\nexport type { EmailMessage };\n/** Body for `bird.email.send`. */\nexport type EmailSendParams = EmailMessageSendRequest;\n/** Body for `bird.email.sendBatch` — an array of send params, validated as a unit. */\nexport type EmailSendBatchParams = EmailMessageBatchRequest;\n/** Result of `bird.email.sendBatch` — one accepted item per submitted message. */\nexport type EmailSendBatchResult = EmailMessageBatchResponse;\n/** Filters and cursor params for `bird.email.list`. */\nexport type EmailListQuery = NonNullable<ListEmailMessagesData[\"query\"]>;\n\n/**\n * Channel-level defaults set at client construction. Field names mirror the\n * send params (so they read as pre-filled fields). Any field set here becomes\n * optional in `send` and is filled when omitted (per-send value wins).\n */\nexport type EmailChannelDefaults = Partial<\n Pick<\n EmailSendParams,\n | \"from\"\n | \"reply_to\"\n | \"category\"\n | \"track_opens\"\n | \"track_clicks\"\n | \"headers\"\n | \"tags\"\n | \"metadata\"\n >\n>;\n\ntype PartialBy<T, K extends keyof T> = Omit<T, K> & Partial<Pick<T, K>>;\n/** Keys that carry a configured default — made optional in `send`. */\ntype DefaultedKeys<D> = D extends object\n ? Extract<keyof D, keyof EmailSendParams>\n : never;\n/** `send` params with defaulted fields made optional. */\nexport type EmailSend<D> = PartialBy<EmailSendParams, DefaultedKeys<D>>;\n\nexport class EmailResource<\n D extends EmailChannelDefaults | undefined = undefined,\n> extends EmailResourceBase {\n #defaults?: D;\n\n /** Email statistics — `bird.email.stats.summary(...)`, `.daily(...)`, `.byTag(...)`, … */\n readonly stats: EmailStatsResource;\n\n /** Durable agent mailboxes — `bird.email.mailboxes.list(...)`, `.create(...)`, … */\n readonly mailboxes: EmailMailboxesResource;\n\n /** Conversations across every mailbox — `bird.email.threads.list(...)`, `.get(...)`, … */\n readonly threads: EmailThreadsResource;\n\n constructor(\n core: ConstructorParameters<typeof Resource>[0],\n client: ConstructorParameters<typeof Resource>[1],\n defaults?: D,\n ) {\n super(core, client);\n this.#defaults = defaults;\n this.stats = new EmailStatsResource(core, client);\n this.mailboxes = new EmailMailboxesResource(core, client);\n this.threads = new EmailThreadsResource(core, client);\n }\n\n /**\n * Send an email message. Resolves once the message is accepted for delivery\n * (the API's 202). Throws on failure — a 422 (unverified sender, all\n * recipients suppressed, validation) is a `BirdValidationError`. Fields set as\n * channel defaults may be omitted (per-send value wins).\n *\n * @example Send a message\n * const msg = await bird.email.send({\n * from: { email: \"onboarding@messagebird.dev\", name: \"Bird\" },\n * to: [\"delivered@messagebird.dev\"],\n * subject: \"Hello from Bird\",\n * html: \"<p>My first Bird email.</p>\",\n * });\n * console.log(msg.id, msg.status); // \"em_…\", \"accepted\"\n *\n * @example A richer send — cc/bcc, reply-to, tags, metadata, click-tracking off, and an idempotency key (safe to retry; the server dedupes)\n * await bird.email.send(\n * {\n * from: \"hello@acme.com\",\n * to: [\"a@example.com\", \"b@example.com\"],\n * cc: [\"manager@example.com\"],\n * reply_to: [\"support@acme.com\"],\n * subject: \"Your March invoice\",\n * html: \"<p>Attached.</p>\",\n * tags: [{ name: \"category\", value: \"billing\" }],\n * metadata: { invoice_id: \"inv_123\" },\n * track_clicks: false,\n * },\n * { idempotencyKey: \"invoice-march/cust_1\" },\n * );\n *\n * @example Branch on the typed error hierarchy\n * import { BirdRateLimitError, BirdValidationError, BirdAPIError } from \"@messagebird/sdk\";\n *\n * try {\n * await bird.email.send({\n * from: { email: \"onboarding@messagebird.dev\", name: \"Bird\" },\n * to: [\"delivered@messagebird.dev\"],\n * subject: \"Hello from Bird\",\n * html: \"<p>My first Bird email.</p>\",\n * });\n * } catch (err) {\n * if (err instanceof BirdRateLimitError) console.log(`rate limited — retry in ${err.retryAfter}s`);\n * else if (err instanceof BirdValidationError) console.error(err.details);\n * else if (err instanceof BirdAPIError) console.error(err.code, err.requestId);\n * else throw err;\n * }\n *\n * @example Errors as values with `.safe()`\n * const { data, error } = await bird.email\n * .send({\n * from: { email: \"onboarding@messagebird.dev\", name: \"Bird\" },\n * to: [\"delivered@messagebird.dev\"],\n * subject: \"Hello from Bird\",\n * html: \"<p>My first Bird email.</p>\",\n * })\n * .safe();\n * if (error) console.error(error.message);\n * else console.log(data.id);\n */\n send(\n params: EmailSend<D>,\n options?: RequestOptions,\n ): APIPromise<EmailMessage> {\n // EmailSend<D> guarantees the caller supplied every field not covered by a\n // default, so the merge is a complete EmailSendParams. TS can't reprove that\n // across a spread, so the assertion is necessary here (and only here).\n const body = { ...this.#defaults, ...params } as EmailSendParams;\n return this.call<EmailMessage>(\"POST\", options, ({ signal, headers }) =>\n createEmailMessage({ client: this.client, body, headers, signal }),\n );\n }\n\n /**\n * Send a batch of up to 100 independent email messages in one request. The\n * batch is validated as a unit — if any item fails validation (unverified\n * sender, all recipients suppressed, field-level errors) the whole batch is\n * rejected with a `BirdValidationError` and nothing is queued. Resolves with\n * one accepted item per submitted message, in submission order, once the batch\n * is accepted (the API's 202). Channel defaults are applied per item.\n *\n * @example Send a batch of messages\n * const batch = await bird.email.sendBatch([\n * {\n * from: { email: \"onboarding@messagebird.dev\", name: \"Bird\" },\n * to: [\"alice@example.com\"],\n * subject: \"Your receipt\",\n * html: \"<p>Thanks, Alice.</p>\",\n * },\n * {\n * from: { email: \"onboarding@messagebird.dev\", name: \"Bird\" },\n * to: [\"bob@example.com\"],\n * subject: \"Your receipt\",\n * html: \"<p>Thanks, Bob.</p>\",\n * },\n * ]);\n * for (const item of batch.data) console.log(item.id, item.status);\n */\n sendBatch(\n params: EmailSendBatchParams,\n options?: RequestOptions,\n ): APIPromise<EmailSendBatchResult> {\n const body = params.map((item) => ({\n ...this.#defaults,\n ...item,\n })) as EmailSendBatchParams;\n return this.call<EmailSendBatchResult>(\n \"POST\",\n options,\n ({ signal, headers }) =>\n createEmailMessageBatch({ client: this.client, body, headers, signal }),\n );\n }\n\n}\n","// Code generated by surface-gen; DO NOT EDIT.\nimport { assignAudienceContacts, createAudience, deleteAudience, getAudience, listAudienceContacts, listAudiences, unassignAudienceContact, unassignAudienceContacts, updateAudience } from \"../generated/sdk.gen.js\";\nimport type { AssignAudienceContactsData, Audience, AudienceMember, CreateAudienceData, DeleteAudienceData, GetAudienceData, ListAudienceContactsData, ListAudiencesData, UnassignAudienceContactData, UnassignAudienceContactsData, UpdateAudienceData } from \"../generated/types.gen.js\";\nimport { Resource } from \"./base.js\";\nimport type { APIPromise, PaginatedPromise, RequestOptions } from \"../core/result.js\";\n\nexport type { Audience };\nexport type { AudienceMember };\nexport type AudienceListQuery = NonNullable<ListAudiencesData[\"query\"]>;\nexport type AudienceCreateParams = NonNullable<CreateAudienceData[\"body\"]>;\nexport type AudienceUpdateParams = NonNullable<UpdateAudienceData[\"body\"]>;\nexport type AudienceListContactsQuery = NonNullable<ListAudienceContactsData[\"query\"]>;\nexport type AudienceAddContactsParams = NonNullable<AssignAudienceContactsData[\"body\"]>;\nexport type AudienceRemoveContactsParams = NonNullable<UnassignAudienceContactsData[\"body\"]>;\n\nexport class AudiencesResource extends Resource {\n /**\n * List the workspace's audiences as a cursor page, newest first. Filter by name substring with `q`.\n *\n * @example Iterate every audience, or take one page\n * for await (const audience of bird.audiences.list()) {\n * console.log(audience.id, audience.name);\n * }\n */\n list(query?: AudienceListQuery, options?: RequestOptions): PaginatedPromise<Audience> {\n return this.paginated<Audience>(\"GET\", options, ({ signal, headers }, cursor) =>\n listAudiences({ client: this.client, query: { ...query, starting_after: cursor ?? query?.starting_after }, headers, signal }));\n }\n\n /**\n * Get a single audience by ID: name, description, and type. Members are listed separately with `audiences.list_contacts`.\n *\n * @example Fetch an audience by id\n * const audience = await bird.audiences.get(\"adn_01krdgeqcxet5s7t44vh8rt9mg\");\n * console.log(audience.name);\n */\n get(audienceId: string, options?: RequestOptions): APIPromise<Audience> {\n return this.call<Audience>(\"GET\", options, ({ signal, headers }) =>\n getAudience({ client: this.client, path: { audience_id: audienceId }, headers, signal }));\n }\n\n /**\n * Create an audience in the workspace. New audiences start empty; add contacts with `audiences.add_contacts` or `contacts.batch`. Only static audiences can be created today.\n *\n * @example Create an audience\n * const audience = await bird.audiences.create({ name: \"Newsletter subscribers\" });\n * console.log(audience.id); // \"adn_…\"\n */\n create(params: AudienceCreateParams, options?: RequestOptions): APIPromise<Audience> {\n return this.call<Audience>(\"POST\", options, ({ signal, headers }) =>\n createAudience({ client: this.client, body: params, headers, signal }));\n }\n\n /**\n * Update an audience's name or description. Omitted fields are unchanged; a null description clears it.\n *\n * @example Rename an audience\n * await bird.audiences.update(\"adn_01krdgeqcxet5s7t44vh8rt9mg\", { name: \"Renamed\" });\n */\n update(audienceId: string, params: AudienceUpdateParams = {}, options?: RequestOptions): APIPromise<Audience> {\n return this.call<Audience>(\"PATCH\", options, ({ signal, headers }) =>\n updateAudience({ client: this.client, path: { audience_id: audienceId }, body: params, headers, signal }));\n }\n\n /**\n * Delete an audience and its memberships; contacts themselves are not deleted. Fails while a broadcast targeting the audience is scheduled, accepted, sending, or canceling.\n *\n * @example Delete an audience by id\n * await bird.audiences.delete(\"adn_01krdgeqcxet5s7t44vh8rt9mg\");\n */\n delete(audienceId: string, options?: RequestOptions): APIPromise<void> {\n return this.call<void>(\"DELETE\", options, ({ signal, headers }) =>\n deleteAudience({ client: this.client, path: { audience_id: audienceId }, headers, signal }));\n }\n\n /**\n * List the contacts in a static audience by ID, as a cursor page ordered by when each contact joined (most recent first). Each entry pairs the contact with its join time.\n *\n * @example Iterate an audience's members\n * for await (const member of bird.audiences.listContacts(\"adn_01krdgeqcxet5s7t44vh8rt9mg\")) {\n * console.log(member.contact.id, member.joined_at);\n * }\n */\n listContacts(audienceId: string, query?: AudienceListContactsQuery, options?: RequestOptions): PaginatedPromise<AudienceMember> {\n return this.paginated<AudienceMember>(\"GET\", options, ({ signal, headers }, cursor) =>\n listAudienceContacts({ client: this.client, path: { audience_id: audienceId }, query: { ...query, starting_after: cursor ?? query?.starting_after }, headers, signal }));\n }\n\n /**\n * Add up to 1,000 existing contacts to a static audience by ID. Fails entirely if any contact ID does not exist. To add contacts you have not created yet, use `contacts.batch` with `audience_ids` instead: it matches or creates each contact by email address and assigns it to the audience in one call.\n *\n * @example Add contacts to an audience\n * await bird.audiences.addContacts(\"adn_01krdgeqcxet5s7t44vh8rt9mg\", {\n * contact_ids: [\"con_01krdgeqcxet5s7t44vh8rt9mg\"],\n * });\n */\n addContacts(audienceId: string, params: AudienceAddContactsParams, options?: RequestOptions): APIPromise<void> {\n return this.call<void>(\"POST\", options, ({ signal, headers }) =>\n assignAudienceContacts({ client: this.client, path: { audience_id: audienceId }, body: params, headers, signal }));\n }\n\n /**\n * Remove up to 1,000 contacts from a static audience by ID. Fails entirely if any contact ID does not exist; contacts are not deleted.\n *\n * @example Remove contacts from an audience\n * await bird.audiences.removeContacts(\"adn_01krdgeqcxet5s7t44vh8rt9mg\", {\n * contact_ids: [\"con_01krdgeqcxet5s7t44vh8rt9mg\"],\n * });\n */\n removeContacts(audienceId: string, params: AudienceRemoveContactsParams, options?: RequestOptions): APIPromise<void> {\n return this.call<void>(\"POST\", options, ({ signal, headers }) =>\n unassignAudienceContacts({ client: this.client, path: { audience_id: audienceId }, body: params, headers, signal }));\n }\n\n /**\n * Remove one contact's membership from an audience. The contact itself is not deleted and stays a member of any other audiences.\n *\n * @example Remove one contact's membership\n * await bird.audiences.removeContact(\n * \"adn_01krdgeqcxet5s7t44vh8rt9mg\",\n * \"con_01krdgeqcxet5s7t44vh8rt9mg\",\n * );\n */\n removeContact(audienceId: string, contactId: string, options?: RequestOptions): APIPromise<void> {\n return this.call<void>(\"DELETE\", options, ({ signal, headers }) =>\n unassignAudienceContact({ client: this.client, path: { audience_id: audienceId, contact_id: contactId }, headers, signal }));\n }\n}\n","// Code generated by surface-gen; DO NOT EDIT.\nimport { createDomain, deleteDomain, getDomain, listDomains, updateDomain, verifyDomain } from \"../generated/sdk.gen.js\";\nimport type { CreateDomainData, DeleteDomainData, Domain, GetDomainData, ListDomainsData, UpdateDomainData, VerifyDomainData } from \"../generated/types.gen.js\";\nimport { Resource } from \"./base.js\";\nimport type { APIPromise, PaginatedPromise, RequestOptions } from \"../core/result.js\";\n\nexport type { Domain };\nexport type DomainListQuery = NonNullable<ListDomainsData[\"query\"]>;\nexport type DomainCreateParams = NonNullable<CreateDomainData[\"body\"]>;\nexport type DomainUpdateParams = NonNullable<UpdateDomainData[\"body\"]>;\n\nexport class DomainsResource extends Resource {\n /**\n * List the workspace's sending domains with their verification status, as a cursor page.\n *\n * @example Iterate every sending domain\n * for await (const domain of bird.domains.list()) {\n * console.log(domain.id, domain.status);\n * }\n */\n list(query?: DomainListQuery, options?: RequestOptions): PaginatedPromise<Domain> {\n return this.paginated<Domain>(\"GET\", options, ({ signal, headers }, cursor) =>\n listDomains({ client: this.client, query: { ...query, starting_after: cursor ?? query?.starting_after }, headers, signal }));\n }\n\n /**\n * Fetch one sending domain: verification status and the DNS records with their individual verification states.\n *\n * @example Fetch a sending domain by id\n * const domain = await bird.domains.get(\"dom_01krdgeqcxet5s7t44vh8rt9mg\");\n * console.log(domain.domain);\n */\n get(domainId: string, options?: RequestOptions): APIPromise<Domain> {\n return this.call<Domain>(\"GET\", options, ({ signal, headers }) =>\n getDomain({ client: this.client, path: { domain_id: domainId }, headers, signal }));\n }\n\n /**\n * Register a new sending domain and get the DNS records to publish. Verification is a second step: the records go live at the DNS provider, then email_domains_verify confirms them. Propagation takes minutes to hours, so the first verify often still reports unverified and a later one succeeds.\n *\n * @example Register a sending domain\n * const domain = await bird.domains.create({ domain: \"mail.acme.com\" });\n * console.log(domain.id, domain.status); // \"dom_…\", \"pending\"\n */\n create(params: DomainCreateParams, options?: RequestOptions): APIPromise<Domain> {\n return this.call<Domain>(\"POST\", options, ({ signal, headers }) =>\n createDomain({ client: this.client, body: params, headers, signal }));\n }\n\n /**\n * Trigger a DNS verification check for a sending domain and return the refreshed domain with per-record results. Safe to repeat while waiting for DNS propagation.\n *\n * @example Re-run the DNS verification check\n * const domain = await bird.domains.verify(\"dom_01krdgeqcxet5s7t44vh8rt9mg\");\n * console.log(domain.status); // \"verified\" once DNS is in place\n */\n verify(domainId: string, options?: RequestOptions): APIPromise<Domain> {\n return this.call<Domain>(\"POST\", options, ({ signal, headers }) =>\n verifyDomain({ client: this.client, path: { domain_id: domainId }, headers, signal }));\n }\n\n /**\n * Update a sending domain's tracking and inbound configuration. Tracking: click_tracking and open_tracking apply immediately to new sends, and the tracking domain can be set, changed, or removed (the name part only, and the sending domain is appended for you). Enabling either toggle with no tracking domain configured returns 409, and removing the tracking domain while either toggle is still on also returns 409. Tracking-domain changes on a verified domain are staged behind DNS verification, so the current config keeps serving until the new records verify. Inbound receiving: inbound.enabled starts or stops receiving mail for the domain. Enabling requires the domain's DKIM to be verified first (a fresh enable on an unverified domain returns 422), and a domain already receiving inbound for another organization returns 422. The MX records to publish are always listed in dns_records regardless, so receiving starts only once inbound.enabled is set, even when those records are already published.\n *\n * @example Enable tracking on a domain\n * await bird.domains.update(\"dom_01krdgeqcxet5s7t44vh8rt9mg\", {\n * settings: { click_tracking: true, open_tracking: true },\n * tracking: { name: \"links\" },\n * });\n */\n update(domainId: string, params: DomainUpdateParams = {}, options?: RequestOptions): APIPromise<Domain> {\n return this.call<Domain>(\"PATCH\", options, ({ signal, headers }) =>\n updateDomain({ client: this.client, path: { domain_id: domainId }, body: params, headers, signal }));\n }\n\n /**\n * Delete a sending domain by id. Revokes its sender authorization: new sends from the domain are rejected afterward, while historical statistics and events for past sends are preserved. Destructive.\n *\n * @example Delete a sending domain by id\n * await bird.domains.delete(\"dom_01krdgeqcxet5s7t44vh8rt9mg\");\n */\n delete(domainId: string, options?: RequestOptions): APIPromise<void> {\n return this.call<void>(\"DELETE\", options, ({ signal, headers }) =>\n deleteDomain({ client: this.client, path: { domain_id: domainId }, headers, signal }));\n }\n}\n","// Code generated by surface-gen; DO NOT EDIT.\nimport { archiveContactProperty, createContactProperty, getContactProperty, listContactProperties, unarchiveContactProperty, updateContactProperty } from \"../generated/sdk.gen.js\";\nimport type { ArchiveContactPropertyData, ContactProperty, CreateContactPropertyData, GetContactPropertyData, ListContactPropertiesData, UnarchiveContactPropertyData, UpdateContactPropertyData } from \"../generated/types.gen.js\";\nimport { Resource } from \"./base.js\";\nimport type { APIPromise, PaginatedPromise, RequestOptions } from \"../core/result.js\";\n\nexport type { ContactProperty };\nexport type ContactPropertyListQuery = NonNullable<ListContactPropertiesData[\"query\"]>;\nexport type ContactPropertyCreateParams = NonNullable<CreateContactPropertyData[\"body\"]>;\nexport type ContactPropertyUpdateParams = NonNullable<UpdateContactPropertyData[\"body\"]>;\n\nexport class ContactPropertiesResource extends Resource {\n /**\n * List the workspace's contact properties as a cursor page, newest first. Archived properties are included, marked by their archived flag.\n *\n * @example Iterate every contact property, or take one page\n * for await (const prop of bird.contactProperties.list()) {\n * console.log(prop.key, prop.type);\n * }\n * const page = await bird.contactProperties.list({ limit: 50 }); // page.data, page.next_cursor\n */\n list(query?: ContactPropertyListQuery, options?: RequestOptions): PaginatedPromise<ContactProperty> {\n return this.paginated<ContactProperty>(\"GET\", options, ({ signal, headers }, cursor) =>\n listContactProperties({ client: this.client, query: { ...query, starting_after: cursor ?? query?.starting_after }, headers, signal }));\n }\n\n /**\n * Get a single contact property by ID: key, type, fallback value, and archived state.\n *\n * @example Fetch a contact property by id\n * const prop = await bird.contactProperties.get(\"cp_01krdgeqcxet5s7t44vh8rt9mg\");\n * console.log(prop.key, prop.type);\n */\n get(propertyId: string, options?: RequestOptions): APIPromise<ContactProperty> {\n return this.call<ContactProperty>(\"GET\", options, ({ signal, headers }) =>\n getContactProperty({ client: this.client, path: { property_id: propertyId }, headers, signal }));\n }\n\n /**\n * Define a custom contact property (key + value type) that becomes available in contact data and as a broadcast template variable. The key and type cannot change after creation; a workspace holds at most 200 properties, archived included.\n *\n * @example Define a custom property\n * const prop = await bird.contactProperties.create({ key: \"plan\", type: \"string\" });\n * console.log(prop.id); // \"cp_…\"\n */\n create(params: ContactPropertyCreateParams, options?: RequestOptions): APIPromise<ContactProperty> {\n return this.call<ContactProperty>(\"POST\", options, ({ signal, headers }) =>\n createContactProperty({ client: this.client, body: params, headers, signal }));\n }\n\n /**\n * Update a contact property's fallback value. Only the fallback value can change; the key and type are fixed at creation, so a different key or type needs a new property.\n *\n * @example Change a property's fallback value\n * await bird.contactProperties.update(\"cp_01krdgeqcxet5s7t44vh8rt9mg\", { fallback_value: \"free\" });\n */\n update(propertyId: string, params: ContactPropertyUpdateParams = {}, options?: RequestOptions): APIPromise<ContactProperty> {\n return this.call<ContactProperty>(\"PATCH\", options, ({ signal, headers }) =>\n updateContactProperty({ client: this.client, path: { property_id: propertyId }, body: params, headers, signal }));\n }\n\n /**\n * Archive a contact property: the key is rejected in new contact writes and stops rendering in templates, while stored values remain readable. The key stays reserved and counts toward the 200-property limit; reverse with `contact_properties.unarchive`.\n *\n * @example Archive a property, retiring the field without deleting its data\n * const prop = await bird.contactProperties.archive(\"cp_01krdgeqcxet5s7t44vh8rt9mg\");\n * console.log(prop.key, prop.archived);\n */\n archive(propertyId: string, options?: RequestOptions): APIPromise<ContactProperty> {\n return this.call<ContactProperty>(\"POST\", options, ({ signal, headers }) =>\n archiveContactProperty({ client: this.client, path: { property_id: propertyId }, headers, signal }));\n }\n\n /**\n * Reactivate an archived contact property so its key is accepted in contact writes and renders in templates again. Fails with a conflict if the property is not archived.\n *\n * @example Restore an archived property\n * await bird.contactProperties.unarchive(\"cp_01krdgeqcxet5s7t44vh8rt9mg\");\n */\n unarchive(propertyId: string, options?: RequestOptions): APIPromise<ContactProperty> {\n return this.call<ContactProperty>(\"POST\", options, ({ signal, headers }) =>\n unarchiveContactProperty({ client: this.client, path: { property_id: propertyId }, headers, signal }));\n }\n}\n","// Code generated by surface-gen; DO NOT EDIT.\nimport { createContact, createContactBatch, deleteContact, getContact, listContacts, updateContact } from \"../generated/sdk.gen.js\";\nimport type { Contact, ContactUpsertResult, CreateContactBatchData, CreateContactData, DeleteContactData, GetContactData, ListContactsData, UpdateContactData } from \"../generated/types.gen.js\";\nimport { Resource } from \"./base.js\";\nimport type { APIPromise, PaginatedPromise, RequestOptions } from \"../core/result.js\";\n\nexport type { Contact };\nexport type { ContactUpsertResult };\nexport type ContactListQuery = NonNullable<ListContactsData[\"query\"]>;\nexport type ContactCreateParams = NonNullable<CreateContactData[\"body\"]>;\nexport type ContactUpdateParams = NonNullable<UpdateContactData[\"body\"]>;\nexport type ContactBatchParams = NonNullable<CreateContactBatchData[\"body\"]>;\n\nexport class ContactsResource extends Resource {\n /**\n * List the workspace's contacts as a cursor page, newest first. Look one up by exact email, phone_number, or external_id, or search by email, name, or phone substring. Pass include_total for a total count.\n *\n * @example Iterate every contact, or take one page\n * for await (const contact of bird.contacts.list({ q: \"acme.com\" })) {\n * console.log(contact.id, contact.email);\n * }\n * const page = await bird.contacts.list({ limit: 50 }); // page.data, page.next_cursor\n */\n list(query?: ContactListQuery, options?: RequestOptions): PaginatedPromise<Contact> {\n return this.paginated<Contact>(\"GET\", options, ({ signal, headers }, cursor) =>\n listContacts({ client: this.client, query: { ...query, starting_after: cursor ?? query?.starting_after }, headers, signal }));\n }\n\n /**\n * Get a single contact by ID (`con_`-prefixed). Look up an ID by exact email, phone_number, or external_id with `contacts.list`.\n *\n * @example Fetch a contact by id\n * const contact = await bird.contacts.get(\"con_01krdgeqcxet5s7t44vh8rt9mg\");\n * console.log(contact.email, contact.first_name);\n */\n get(contactId: string, options?: RequestOptions): APIPromise<Contact> {\n return this.call<Contact>(\"GET\", options, ({ signal, headers }) =>\n getContact({ client: this.client, path: { contact_id: contactId }, headers, signal }));\n }\n\n /**\n * Create a contact identified by an email address, an E.164 phone number, or both. Fails with a conflict if the email, phone_number, or external_id is already used by another contact. For bulk import or create-or-update semantics use `contacts.batch`.\n *\n * @example Create a contact\n * const contact = await bird.contacts.create({\n * email: \"jane@acme.com\",\n * first_name: \"Jane\",\n * });\n * console.log(contact.id); // \"con_…\"\n */\n create(params: ContactCreateParams = {}, options?: RequestOptions): APIPromise<Contact> {\n return this.call<Contact>(\"POST\", options, ({ signal, headers }) =>\n createContact({ client: this.client, body: params, headers, signal }));\n }\n\n /**\n * Update a contact's name, external_id, email, phone_number, or custom data. Only supplied fields change; custom data keys are merged, with null removing a key. A contact keeps at least one identifier: clearing both email and phone_number is rejected.\n *\n * @example Change a contact's fields\n * const contact = await bird.contacts.update(\"con_01krdgeqcxet5s7t44vh8rt9mg\", {\n * first_name: \"Jane\",\n * });\n * console.log(contact.first_name);\n */\n update(contactId: string, params: ContactUpdateParams = {}, options?: RequestOptions): APIPromise<Contact> {\n return this.call<Contact>(\"PATCH\", options, ({ signal, headers }) =>\n updateContact({ client: this.client, path: { contact_id: contactId }, body: params, headers, signal }));\n }\n\n /**\n * Delete a contact and remove it from every audience it belongs to. Suppression records for the address are unaffected.\n *\n * @example Delete a contact by id\n * await bird.contacts.delete(\"con_01krdgeqcxet5s7t44vh8rt9mg\");\n */\n delete(contactId: string, options?: RequestOptions): APIPromise<void> {\n return this.call<void>(\"DELETE\", options, ({ signal, headers }) =>\n deleteContact({ client: this.client, path: { contact_id: contactId }, headers, signal }));\n }\n\n /**\n * Create or update up to 1,000 contacts in one request, each entry matched automatically against every identifier it supplies (email, phone_number, external_id) or, with match_on, by that one field only, and optionally add them all to one or more audiences. Per-contact results are returned in submission order.\n *\n * @example Create or update many contacts at once, matched by the identifiers each entry carries\n * const result = await bird.contacts.batch({\n * contacts: [{ email: \"jane@acme.com\", first_name: \"Jane\" }],\n * });\n * for (const item of result.data) {\n * console.log(item.entry.email, item.status);\n * }\n */\n batch(params: ContactBatchParams, options?: RequestOptions): APIPromise<ContactUpsertResult> {\n return this.call<ContactUpsertResult>(\"POST\", options, ({ signal, headers }) =>\n createContactBatch({ client: this.client, body: params, headers, signal }));\n }\n}\n","// Code generated by surface-gen; DO NOT EDIT.\nimport { getSmsMessage, listSmsMessages } from \"../generated/sdk.gen.js\";\nimport type { GetSmsMessageData, ListSmsMessagesData, SmsMessage } from \"../generated/types.gen.js\";\nimport { Resource } from \"./base.js\";\nimport type { APIPromise, PaginatedPromise, RequestOptions } from \"../core/result.js\";\n\nexport type { SmsMessage };\nexport type SmsListQuery = NonNullable<ListSmsMessagesData[\"query\"]>;\n\nexport class SmsResourceBase extends Resource {\n /**\n * Get one SMS message by id: its current delivery status, segment breakdown, cost, and failure detail if it failed.\n *\n * @example Read a message back\n * const msg = await bird.sms.get(\"sms_abc123\");\n * msg.status; // \"accepted\" | \"delivered\" | …\n */\n get(messageId: string, options?: RequestOptions): APIPromise<SmsMessage> {\n return this.call<SmsMessage>(\"GET\", options, ({ signal, headers }) =>\n getSmsMessage({ client: this.client, path: { message_id: messageId }, headers, signal }));\n }\n\n /**\n * List SMS messages, newest first, as a cursor page ({data, next_cursor, …}). Pass next_cursor back as starting_after to fetch the next page. Filter by direction, status, category, recipient, sender, or tag.\n *\n * @example Iterate outbound messages\n * for await (const msg of bird.sms.list({ direction: \"outbound\" })) {\n * console.log(msg.id, msg.status);\n * }\n */\n list(query?: SmsListQuery, options?: RequestOptions): PaginatedPromise<SmsMessage> {\n return this.paginated<SmsMessage>(\"GET\", options, ({ signal, headers }, cursor) =>\n listSmsMessages({ client: this.client, query: { ...query, starting_after: cursor ?? query?.starting_after }, headers, signal }));\n }\n}\n","// `bird.sms` — the SMS channel: send SMS messages and read their status.\n\nimport {\n createSmsMessage,\n createSmsMessageBatch,\n} from \"../generated/sdk.gen.js\";\nimport type {\n SmsMessage,\n SmsMessageBatchRequest,\n SmsMessageBatchResponse,\n SmsMessageSendRequest,\n} from \"../generated/types.gen.js\";\nimport { SmsResourceBase } from \"./sms.gen.js\";\nimport type { APIPromise, RequestOptions } from \"../core/result.js\";\n\n/** Body for `bird.sms.send` — supply either `text` (with `category`) or `template`. */\nexport type SmsSendParams = SmsMessageSendRequest;\n/** Body for `bird.sms.sendBatch` — an array of up to 100 sends. */\nexport type SmsSendBatchParams = SmsMessageBatchRequest;\n/** Result of `bird.sms.sendBatch`. */\nexport type SmsSendBatchResult = SmsMessageBatchResponse;\n/** Filters and cursor params for `bird.sms.list`. */\n\nexport class SmsResource extends SmsResourceBase {\n /**\n * Send one SMS to a single recipient. Supply either `text` (with a `category`)\n * or a stored `template` (by `id` or `name`, with its `parameters`). The\n * result is `accepted`, not yet delivered — read it back with `get` to confirm.\n *\n * @example Send free text\n * const msg = await bird.sms.send({\n * from: \"MyBrand\",\n * to: \"+14155550100\",\n * text: \"Your verification code is 123456.\",\n * category: \"authentication\",\n * });\n * console.log(msg.id, msg.status);\n *\n * @example Send by template\n * await bird.sms.send({\n * to: \"+14155550100\",\n * template: { name: \"bird_otp_verification\", parameters: { code: \"123456\" } },\n * });\n */\n send(\n params: SmsSendParams,\n options?: RequestOptions,\n ): APIPromise<SmsMessage> {\n return this.call<SmsMessage>(\"POST\", options, ({ signal, headers }) =>\n createSmsMessage({ client: this.client, body: params, headers, signal }),\n );\n }\n\n /**\n * Send up to 100 independent SMS messages in one call. Each item is a full send\n * (free text or template); all items are validated before any are queued.\n *\n * @example\n * const result = await bird.sms.sendBatch([\n * { to: \"+15551111111\", text: \"Hi Alice!\", category: \"marketing\" },\n * { to: \"+15552222222\", text: \"Hi Bob!\", category: \"marketing\" },\n * ]);\n */\n sendBatch(\n params: SmsSendBatchParams,\n options?: RequestOptions,\n ): APIPromise<SmsSendBatchResult> {\n return this.call<SmsSendBatchResult>(\n \"POST\",\n options,\n ({ signal, headers }) =>\n createSmsMessageBatch({\n client: this.client,\n body: params,\n headers,\n signal,\n }),\n );\n }\n}\n","// Code generated by surface-gen; DO NOT EDIT.\nimport { getSmsTemplate, listSmsTemplates } from \"../generated/sdk.gen.js\";\nimport type { GetSmsTemplateData, ListSmsTemplatesData, SmsTemplate, SmsTemplateList } from \"../generated/types.gen.js\";\nimport { Resource } from \"./base.js\";\nimport type { APIPromise, RequestOptions } from \"../core/result.js\";\n\nexport type { SmsTemplateList };\nexport type { SmsTemplate };\nexport type SmsTemplateListQuery = NonNullable<ListSmsTemplatesData[\"query\"]>;\n\nexport class SmsTemplatesResource extends Resource {\n /**\n * List the SMS templates available to your workspace, including Bird's built-in templates. Filter by scope, category, or language. The catalogue is small and returned in full; this list is not paginated. Use sms_templates_get to read one template's variables before sending with it.\n *\n * @example List the built-in templates\n * const { data } = await bird.smsTemplates.list({ scope: \"system\" });\n * for (const tpl of data) console.log(tpl.id, tpl.name);\n */\n list(query?: SmsTemplateListQuery, options?: RequestOptions): APIPromise<SmsTemplateList> {\n return this.call<SmsTemplateList>(\"GET\", options, ({ signal, headers }) =>\n listSmsTemplates({ client: this.client, query, headers, signal }));\n }\n\n /**\n * Get one SMS template by its name or id, including its body and the variables it expects. Fetch it before sms_send to see which parameter keys a template send requires.\n *\n * @example Read one template by name or id\n * const tpl = await bird.smsTemplates.get(\"bird_otp_verification\");\n * console.log(tpl.body, tpl.variables);\n */\n get(templateRef: string, options?: RequestOptions): APIPromise<SmsTemplate> {\n return this.call<SmsTemplate>(\"GET\", options, ({ signal, headers }) =>\n getSmsTemplate({ client: this.client, path: { template_ref: templateRef }, headers, signal }));\n }\n}\n","// Code generated by surface-gen; DO NOT EDIT.\nimport { getWhatsAppMessage, listWhatsAppMessageEvents, listWhatsAppMessages } from \"../generated/sdk.gen.js\";\nimport type { GetWhatsAppMessageData, ListWhatsAppMessageEventsData, ListWhatsAppMessagesData, WhatsAppEventList, WhatsAppMessage } from \"../generated/types.gen.js\";\nimport { Resource } from \"./base.js\";\nimport type { APIPromise, PaginatedPromise, RequestOptions } from \"../core/result.js\";\n\nexport type { WhatsAppMessage };\nexport type { WhatsAppEventList };\nexport type WhatsappListQuery = NonNullable<ListWhatsAppMessagesData[\"query\"]>;\nexport type WhatsappListEventsQuery = NonNullable<ListWhatsAppMessageEventsData[\"query\"]>;\n\nexport class WhatsappResourceBase extends Resource {\n /**\n * Get one WhatsApp message by id: current delivery status, sent/delivered/read timestamps, the template it was sent from, and failure detail if it failed. For the per-event timeline use whatsapp_list_events.\n *\n * @example Read a message back\n * const msg = await bird.whatsapp.get(\"wa_abc123\");\n * msg.status; // \"accepted\" | \"delivered\" | …\n */\n get(messageId: string, options?: RequestOptions): APIPromise<WhatsAppMessage> {\n return this.call<WhatsAppMessage>(\"GET\", options, ({ signal, headers }) =>\n getWhatsAppMessage({ client: this.client, path: { message_id: messageId }, headers, signal }));\n }\n\n /**\n * List WhatsApp messages, newest first, as a cursor page ({data, next_cursor, …}). Pass next_cursor back as starting_after to fetch the next page. Filter by direction, status, contact phone number, bsuid, template category, or tag. Use whatsapp_get for one message's current state.\n *\n * @example Iterate delivered messages\n * for await (const msg of bird.whatsapp.list({ status: [\"delivered\"] })) {\n * console.log(msg.id, msg.status);\n * }\n */\n list(query?: WhatsappListQuery, options?: RequestOptions): PaginatedPromise<WhatsAppMessage> {\n return this.paginated<WhatsAppMessage>(\"GET\", options, ({ signal, headers }, cursor) =>\n listWhatsAppMessages({ client: this.client, query: { ...query, starting_after: cursor ?? query?.starting_after }, headers, signal }));\n }\n\n /**\n * Get one WhatsApp message's delivery timeline, oldest first: whatsapp.accepted, whatsapp.sent, whatsapp.delivered, whatsapp.read, and whatsapp.failed events, with failure detail on failed events. Not paginated; an unknown message id is a 404. Use whatsapp_get for the condensed current status.\n *\n * @example Read one message's delivery timeline\n * const { data } = await bird.whatsapp.listEvents(\"wa_abc123\");\n * for (const event of data) console.log(event.type, event.occurred_at);\n */\n listEvents(messageId: string, query?: WhatsappListEventsQuery, options?: RequestOptions): APIPromise<WhatsAppEventList> {\n return this.call<WhatsAppEventList>(\"GET\", options, ({ signal, headers }) =>\n listWhatsAppMessageEvents({ client: this.client, path: { message_id: messageId }, query, headers, signal }));\n }\n}\n","// `bird.whatsapp` — the WhatsApp channel: send WhatsApp messages and read their\n// status and events.\n\nimport { createWhatsAppMessage } from \"../generated/sdk.gen.js\";\nimport type {\n WhatsAppMessageSendRequest,\n WhatsAppMessage,\n} from \"../generated/types.gen.js\";\nimport { WhatsappResourceBase } from \"./whatsapp.gen.js\";\nimport type { APIPromise, RequestOptions } from \"../core/result.js\";\n\n/** Body for `bird.whatsapp.send` — a template send; Bird picks the sender from the template's category. */\nexport type WhatsappSendParams = WhatsAppMessageSendRequest;\n\nexport class WhatsappResource extends WhatsappResourceBase {\n /**\n * Send a template message. Bird selects the sender number from the\n * template's category, so there is no sender field on the request. The\n * result is `accepted`, not yet delivered — read it back with `get` to\n * confirm.\n *\n * @example\n * const msg = await bird.whatsapp.send({\n * to: \"+15551234567\",\n * template: {\n * slug: \"bird_otp\",\n * components: [\n * { type: \"body\", parameters: [{ type: \"text\", text: \"123456\" }] },\n * ],\n * },\n * });\n * console.log(msg.id, msg.status);\n */\n send(\n params: WhatsappSendParams,\n options?: RequestOptions,\n ): APIPromise<WhatsAppMessage> {\n return this.call<WhatsAppMessage>(\"POST\", options, ({ signal, headers }) =>\n createWhatsAppMessage({\n client: this.client,\n body: params,\n headers,\n signal,\n }),\n );\n }\n}\n","// Code generated by surface-gen; DO NOT EDIT.\nimport { getVoiceCall, listVoiceCalls } from \"../generated/sdk.gen.js\";\nimport type { GetVoiceCallData, ListVoiceCallsData, VoiceCall } from \"../generated/types.gen.js\";\nimport { Resource } from \"./base.js\";\nimport type { APIPromise, PaginatedPromise, RequestOptions } from \"../core/result.js\";\n\nexport type { VoiceCall };\nexport type VoiceListQuery = NonNullable<ListVoiceCallsData[\"query\"]>;\n\nexport class VoiceResource extends Resource {\n /**\n * List the workspace's calls, newest first. Filter to `ringing`/`in_progress` for the calls in progress right now, to final statuses for completed records, or to any mix of the two. Use `from`/`to` for one known party number in international form, and `number` to search either side by fragment. These are per-call records: for rates and totals over a period use voice_stats_summary rather than summing them here, and voice_get to follow one call to settlement.\n *\n * @example Iterate the calls happening right now\n * for await (const call of bird.voice.list({ status: [\"ringing\", \"in_progress\"] })) {\n * console.log(call.id, call.status);\n * }\n */\n list(query?: VoiceListQuery, options?: RequestOptions): PaginatedPromise<VoiceCall> {\n return this.paginated<VoiceCall>(\"GET\", options, ({ signal, headers }, cursor) =>\n listVoiceCalls({ client: this.client, query: { ...query, starting_after: cursor ?? query?.starting_after }, headers, signal }));\n }\n\n /**\n * Fetch one call by id, at any point in its lifecycle. A call still ringing or connected carries no economics yet: `duration_ms`, `billable_ms`, `ended_at`, and `cost` are null until it ends, and this same id then answers with the settled record. Poll here to watch one known call; use voice_list to find calls in the first place. When a call was refused, `rejection_reason` names the gate that turned it away.\n *\n * @example Read one call back\n * const call = await bird.voice.get(\"vcl_01k0p3v9wera3v6q6xw3e9y2mh\");\n * // A call still ringing or connected carries no economics yet.\n * call.status; // \"answered\" | \"no_answer\" | \"ringing\" | …\n */\n get(callId: string, options?: RequestOptions): APIPromise<VoiceCall> {\n return this.call<VoiceCall>(\"GET\", options, ({ signal, headers }) =>\n getVoiceCall({ client: this.client, path: { call_id: callId }, headers, signal }));\n }\n}\n","// Code generated by surface-gen; DO NOT EDIT.\nimport { createVerification, createVerificationCheck, createVerificationNextChannel } from \"../generated/sdk.gen.js\";\nimport type { CreateVerificationCheckData, CreateVerificationData, CreateVerificationNextChannelData, Verification, VerificationCheckResult } from \"../generated/types.gen.js\";\nimport { Resource } from \"./base.js\";\nimport type { APIPromise, RequestOptions } from \"../core/result.js\";\n\nexport type { Verification };\nexport type { VerificationCheckResult };\nexport type VerifyVerificationsCreateParams = NonNullable<CreateVerificationData[\"body\"]>;\nexport type VerifyVerificationsCheckParams = NonNullable<CreateVerificationCheckData[\"body\"]>;\nexport type VerifyVerificationsNextChannelParams = NonNullable<CreateVerificationNextChannelData[\"body\"]>;\n\nexport class VerifyVerificationsResource extends Resource {\n /**\n * Start a verification: generate a one-time passcode and send it to the recipient in `to` (a phone number over the phone channels enabled for its destination country; an email address over email; or both). It is sent over one channel at a time and fails over to the next in the plan, never over two at once. Calling again for the same recipient reuses the in-progress verification and sends a fresh code after the resend cooldown; it does not start a second one, so use this both to send and to resend. The passcode is never returned; submit what the recipient enters with verify_verifications_check. SMS delivery draws on the workspace's SMS balance.\n *\n * @example Start a verification over SMS\n * const verification = await bird.verify.verifications.create({\n * to: { phone_number: \"+15551234567\" },\n * });\n * console.log(verification.id, verification.status);\n */\n create(params: VerifyVerificationsCreateParams, options?: RequestOptions): APIPromise<Verification> {\n return this.call<Verification>(\"POST\", options, ({ signal, headers }) =>\n createVerification({ client: this.client, body: params, headers, signal }));\n }\n\n /**\n * Check a passcode a recipient submitted. Identify the verification by the same `to` recipient used to start it; no verification id needed. A wrong or expired code returns HTTP 200 with `success: false` and a `reason` (for example `incorrect_code` or `expired`), not an error. A verification that has already reached a final state is no longer checkable and returns 404, as does a missing verification; malformed input or rate limiting is also an error status.\n *\n * @example Check a submitted passcode\n * const result = await bird.verify.verifications.check({\n * to: { phone_number: \"+15551234567\" },\n * code: \"123456\",\n * });\n * console.log(result.success);\n */\n check(params: VerifyVerificationsCheckParams, options?: RequestOptions): APIPromise<VerificationCheckResult> {\n return this.call<VerificationCheckResult>(\"POST\", options, ({ signal, headers }) =>\n createVerificationCheck({ client: this.client, body: params, headers, signal }));\n }\n\n /**\n * Advance an in-progress verification to the next channel in its plan and send a fresh passcode there: the \"I didn't receive my code\" action. The verification is identified by the same `to` recipient used to start it, with no verification id needed. The send bypasses the resend cooldown, and earlier passcodes stay valid. Returns the verification with `last_channel` set to the channel the new code went to; when concurrent advances race for the same recipient, the response reflects committed state: `last_channel` names the most recent completed send, and the racing call that completed the newer send is authoritative. A plan with no further channel returns a 422 named NoNextChannel, after which only re-creating the verification will resend.\n *\n * @example Send the code again on the next channel\n * const verification = await bird.verify.verifications.nextChannel({\n * to: { phone_number: \"+15551234567\" },\n * });\n * console.log(verification.last_channel);\n */\n nextChannel(params: VerifyVerificationsNextChannelParams, options?: RequestOptions): APIPromise<Verification> {\n return this.call<Verification>(\"POST\", options, ({ signal, headers }) =>\n createVerificationNextChannel({ client: this.client, body: params, headers, signal }));\n }\n}\n","// `bird.verify` — the Verify product. `bird.verify.verifications.create(...)` starts\n// a verification (sends a one-time passcode); `.check(...)` checks the passcode a\n// recipient submits.\n\nimport { Resource } from \"./base.js\";\nimport { VerifyVerificationsResource } from \"./verifyVerifications.gen.js\";\n\n/** The Verify product namespace — holds the `verifications` collection. */\nexport class VerifyResource {\n readonly verifications: VerifyVerificationsResource;\n constructor(...args: ConstructorParameters<typeof Resource>) {\n this.verifications = new VerifyVerificationsResource(...args);\n }\n}\n","// `bird.webhooks` — verifies a delivered payload's Standard Webhooks signature\n// and returns it as a typed, discriminated event union. Pure crypto: it never\n// touches the transport layer, so it carries no client/core dependency.\n\nimport { Webhook } from \"standardwebhooks\";\nimport type { WebhookEvent } from \"../generated/types.gen.js\";\nimport { BirdWebhookVerificationError } from \"../errors.js\";\n\n/** A verified webhook event, discriminated on `type`. */\nexport type BirdWebhookEvent = WebhookEvent;\n\n/** Inbound request headers, as a `Headers` object or a plain record. */\nexport type WebhookHeaders = Headers | Record<string, string>;\n\n/** Client-level webhooks config (`new BirdClient({ webhooks: { secret } })`). */\nexport interface WebhookOptions {\n /** Signing secret used by `unwrap`; a per-call `secret` overrides it. */\n secret?: string;\n}\n\nexport class WebhooksResource {\n readonly #secret?: string;\n\n constructor(config?: WebhookOptions) {\n this.#secret = config?.secret;\n }\n\n /**\n * Verify a webhook delivery and return the typed event.\n *\n * **Pass the raw request body**, exactly as received — do NOT parse it first.\n * The Standard Webhooks signature is computed over the raw bytes, so parsing\n * and re-serializing before verifying is the classic webhook bug.\n *\n * The secret comes from `webhooks.secret` on the client; pass `{ secret }` to\n * override per call. Throws {@link BirdWebhookVerificationError} on a bad\n * signature, a stale timestamp, or missing/malformed headers. Unknown event\n * types are returned as-is (handle them in a `default` case) so a newer server\n * event can't break an older SDK.\n *\n * @example One call verifies the signature and returns the typed event\n * // Pass the RAW request body; set the secret via new BirdClient({ webhooks: { secret } }).\n * const event = bird.webhooks.unwrap(rawBody, headers);\n * console.log(event.type); // discriminated union: narrow on event.type\n *\n * @example Verify and dispatch: pass the raw request body, never the parsed JSON\n * // new BirdClient({ apiKey, webhooks: { secret } })\n * try {\n * const event = bird.webhooks.unwrap(rawBody, req.headers);\n * switch (event.type) {\n * case \"email.delivered\":\n * markDelivered(event.data.email_id, event.data.recipient); // narrowed by event.type\n * break;\n * case \"email.bounced\":\n * case \"email.complained\":\n * suppress(event.data.recipient);\n * break;\n * default: // unknown future event types — an older SDK won't break on a new one\n * }\n * } catch (err) {\n * if (err instanceof BirdWebhookVerificationError) {\n * // reject with 400 — bad signature, stale timestamp, or missing/malformed headers\n * } else throw err;\n * }\n */\n unwrap(\n payload: string,\n headers: WebhookHeaders,\n options?: WebhookOptions,\n ): BirdWebhookEvent {\n const secret = options?.secret ?? this.#secret;\n if (!secret) {\n throw new Error(\n \"No webhook secret. Set `webhooks: { secret }` on the client, or pass `{ secret }` to unwrap.\",\n );\n }\n const wh = new Webhook(secret);\n let verified: unknown;\n try {\n verified = wh.verify(payload, toHeaderRecord(headers));\n } catch (err) {\n throw new BirdWebhookVerificationError(\n err instanceof Error\n ? err.message\n : \"Webhook signature verification failed\",\n );\n }\n // `verify` returns `unknown`; the payload is authenticated and the wire\n // schema is `additionalProperties: false`, so the assertion is sound here.\n return verified as BirdWebhookEvent;\n }\n}\n\nfunction toHeaderRecord(headers: WebhookHeaders): Record<string, string> {\n return headers instanceof Headers ? Object.fromEntries(headers) : headers;\n}\n","// Code generated by surface-gen; DO NOT EDIT.\nimport { publishRealtimeAppBatch, publishRealtimeAppEvent } from \"../generated/sdk.gen.js\";\nimport type { PublishRealtimeAppBatchData, PublishRealtimeAppEventData, RealtimeBatchPublishResult, RealtimePublishResult } from \"../generated/types.gen.js\";\nimport { Resource } from \"./base.js\";\nimport type { APIPromise, RequestOptions } from \"../core/result.js\";\n\nexport type { RealtimePublishResult };\nexport type { RealtimeBatchPublishResult };\nexport type RealtimePublishParams = NonNullable<PublishRealtimeAppEventData[\"body\"]>;\nexport type RealtimePublishBatchParams = NonNullable<PublishRealtimeAppBatchData[\"body\"]>;\n\nexport class RealtimeResourceBase extends Resource {\n /**\n * @example Broadcast an event to a channel\n * const result = await bird.realtime.publish(\"rap_01krdgeqcxet5s7t44vh8rt9mg\", {\n * event: \"order.updated\",\n * channels: [\"orders\", \"presence-lobby\"],\n * data: { order_id: \"ord_123\", status: \"shipped\" },\n * });\n * console.log(result.data?.length); // one entry per channel\n */\n publish(realtimeAppId: string, params: RealtimePublishParams, options?: RequestOptions): APIPromise<RealtimePublishResult> {\n return this.call<RealtimePublishResult>(\"POST\", options, ({ signal, headers }) =>\n publishRealtimeAppEvent({ client: this.client, path: { realtime_app_id: realtimeAppId }, body: params, headers, signal }), [\"RealtimeKey\", \"RealtimeSecret\"]);\n }\n\n /**\n * @example Publish two events in one call\n * await bird.realtime.publishBatch(\"rap_01krdgeqcxet5s7t44vh8rt9mg\", {\n * events: [\n * { event: \"order.created\", channel: \"orders\", data: { id: 1 } },\n * { event: \"order.updated\", channel: \"orders\", data: { id: 2 } },\n * ],\n * });\n */\n publishBatch(realtimeAppId: string, params: RealtimePublishBatchParams, options?: RequestOptions): APIPromise<RealtimeBatchPublishResult> {\n return this.call<RealtimeBatchPublishResult>(\"POST\", options, ({ signal, headers }) =>\n publishRealtimeAppBatch({ client: this.client, path: { realtime_app_id: realtimeAppId }, body: params, headers, signal }), [\"RealtimeKey\", \"RealtimeSecret\"]);\n }\n}\n","// Code generated by surface-gen; DO NOT EDIT.\nimport { getRealtimeAppChannel, listRealtimeAppChannelMembers, listRealtimeAppChannels } from \"../generated/sdk.gen.js\";\nimport type { GetRealtimeAppChannelData, ListRealtimeAppChannelMembersData, ListRealtimeAppChannelsData, RealtimeChannelInfo, RealtimeChannelMembers, RealtimeChannelsList } from \"../generated/types.gen.js\";\nimport { Resource } from \"./base.js\";\nimport type { APIPromise, RequestOptions } from \"../core/result.js\";\n\nexport type { RealtimeChannelsList };\nexport type { RealtimeChannelInfo };\nexport type { RealtimeChannelMembers };\nexport type RealtimeChannelListQuery = NonNullable<ListRealtimeAppChannelsData[\"query\"]>;\nexport type RealtimeChannelGetQuery = NonNullable<GetRealtimeAppChannelData[\"query\"]>;\n\nexport class RealtimeChannelsResource extends Resource {\n /**\n * @example List the occupied presence channels with their member counts\n * const { data } = await bird.realtime.channels.list(\"rap_01krdgeqcxet5s7t44vh8rt9mg\", {\n * prefix: \"presence-\",\n * include: [\"member_count\"],\n * });\n * for (const channel of data) console.log(channel.name, channel.member_count);\n */\n list(realtimeAppId: string, query?: RealtimeChannelListQuery, options?: RequestOptions): APIPromise<RealtimeChannelsList> {\n return this.call<RealtimeChannelsList>(\"GET\", options, ({ signal, headers }) =>\n listRealtimeAppChannels({ client: this.client, path: { realtime_app_id: realtimeAppId }, query, headers, signal }), [\"RealtimeKey\", \"RealtimeSecret\"]);\n }\n\n /**\n * @example Check whether anyone is in a channel\n * const channel = await bird.realtime.channels.get(\"rap_01krdgeqcxet5s7t44vh8rt9mg\", \"presence-lobby\", {\n * include: [\"member_count\"],\n * });\n * console.log(channel.occupied, channel.member_count);\n */\n get(realtimeAppId: string, channelName: string, query?: RealtimeChannelGetQuery, options?: RequestOptions): APIPromise<RealtimeChannelInfo> {\n return this.call<RealtimeChannelInfo>(\"GET\", options, ({ signal, headers }) =>\n getRealtimeAppChannel({ client: this.client, path: { realtime_app_id: realtimeAppId, channel_name: channelName }, query, headers, signal }), [\"RealtimeKey\", \"RealtimeSecret\"]);\n }\n\n /**\n * @example Who is in the lobby\n * const { members } = await bird.realtime.channels.members(\"rap_01krdgeqcxet5s7t44vh8rt9mg\", \"presence-lobby\");\n * for (const member of members) console.log(member.member_id);\n */\n members(realtimeAppId: string, channelName: string, options?: RequestOptions): APIPromise<RealtimeChannelMembers> {\n return this.call<RealtimeChannelMembers>(\"GET\", options, ({ signal, headers }) =>\n listRealtimeAppChannelMembers({ client: this.client, path: { realtime_app_id: realtimeAppId, channel_name: channelName }, headers, signal }), [\"RealtimeKey\", \"RealtimeSecret\"]);\n }\n}\n","// Code generated by surface-gen; DO NOT EDIT.\nimport { disconnectRealtimeAppMember, sendRealtimeAppMemberEvent } from \"../generated/sdk.gen.js\";\nimport type { DisconnectRealtimeAppMemberData, SendRealtimeAppMemberEventData } from \"../generated/types.gen.js\";\nimport { Resource } from \"./base.js\";\nimport type { APIPromise, RequestOptions } from \"../core/result.js\";\n\nexport type RealtimeMemberSendParams = NonNullable<SendRealtimeAppMemberEventData[\"body\"]>;\n\nexport class RealtimeMembersResource extends Resource {\n /**\n * @example Notify one person wherever they are signed in\n * await bird.realtime.members.send(\"rap_01krdgeqcxet5s7t44vh8rt9mg\", \"user_42\", {\n * event: \"order-shipped\",\n * data: { order_id: \"ord_123\" },\n * });\n */\n send(realtimeAppId: string, memberId: string, params: RealtimeMemberSendParams, options?: RequestOptions): APIPromise<void> {\n return this.call<void>(\"POST\", options, ({ signal, headers }) =>\n sendRealtimeAppMemberEvent({ client: this.client, path: { realtime_app_id: realtimeAppId, member_id: memberId }, body: params, headers, signal }), [\"RealtimeKey\", \"RealtimeSecret\"]);\n }\n\n /**\n * @example Kick a member off every connection\n * await bird.realtime.members.disconnect(\"rap_01krdgeqcxet5s7t44vh8rt9mg\", \"user_42\");\n */\n disconnect(realtimeAppId: string, memberId: string, options?: RequestOptions): APIPromise<void> {\n return this.call<void>(\"POST\", options, ({ signal, headers }) =>\n disconnectRealtimeAppMember({ client: this.client, path: { realtime_app_id: realtimeAppId, member_id: memberId }, headers, signal }), [\"RealtimeKey\", \"RealtimeSecret\"]);\n }\n}\n","// `bird.realtime` — publish to Realtime channels, plus the `channels` and\n// `members` collections nested under it.\n//\n// Every Realtime operation authenticates to the Realtime edge with the app's own\n// key/secret pair on top of the workspace API key. Those are credentials, so pass\n// them as client config (`realtime: { key, secret }`); the request core stamps\n// them on the operations that declare them.\n\nimport type {\n RealtimeChannelInclude,\n RealtimeChannelListItem,\n RealtimeChannelMember,\n} from \"../generated/types.gen.js\";\nimport { RealtimeResourceBase } from \"./realtime.gen.js\";\nimport { RealtimeChannelsResource } from \"./realtimeChannels.gen.js\";\nimport { RealtimeMembersResource } from \"./realtimeMembers.gen.js\";\nimport { Resource } from \"./base.js\";\n\nexport type {\n RealtimePublishBatchParams,\n RealtimeBatchPublishResult,\n} from \"./realtime.gen.js\";\n\n// The rest of the Realtime surface, re-exported here so `bird.realtime`'s public\n// types have one import site regardless of which file generates them.\nexport type { RealtimeChannelInclude, RealtimeChannelListItem, RealtimeChannelMember };\nexport type {\n RealtimePublishParams,\n RealtimePublishResult,\n} from \"./realtime.gen.js\";\nexport type {\n RealtimeChannelsList,\n RealtimeChannelInfo,\n RealtimeChannelMembers,\n RealtimeChannelListQuery,\n RealtimeChannelGetQuery,\n} from \"./realtimeChannels.gen.js\";\nexport type { RealtimeMemberSendParams } from \"./realtimeMembers.gen.js\";\n\n/**\n * Realtime app credentials — `new BirdClient({ realtime: { key, secret } })`.\n * They come from the app's credentials (shown once at creation) and must belong\n * to the calling workspace.\n */\nexport interface RealtimeOptions {\n /** The Realtime app key, sent as `X-Realtime-Key`. */\n key?: string;\n /** The Realtime app secret, sent as `X-Realtime-Secret`. */\n secret?: string;\n}\n\n/**\n * `bird.realtime` — publish events to a Realtime app's channels and inspect its\n * live state. Reached as `bird.realtime.*`.\n */\nexport class RealtimeResource extends RealtimeResourceBase {\n /** Channel state — `bird.realtime.channels.list(...)`, `.get(...)`, `.members(...)`. */\n readonly channels: RealtimeChannelsResource;\n\n /** Members — `bird.realtime.members.send(...)`, `.disconnect(...)`. */\n readonly members: RealtimeMembersResource;\n\n constructor(\n core: ConstructorParameters<typeof Resource>[0],\n client: ConstructorParameters<typeof Resource>[1],\n ) {\n super(core, client);\n this.channels = new RealtimeChannelsResource(core, client);\n this.members = new RealtimeMembersResource(core, client);\n }\n\n}\n","// Code generated by surface-gen; DO NOT EDIT.\nimport { createEmailLookup, createPhoneNumberLookup } from \"../generated/sdk.gen.js\";\nimport type { CreateEmailLookupData, CreatePhoneNumberLookupData, EmailLookup, PhoneNumberLookup } from \"../generated/types.gen.js\";\nimport { Resource } from \"./base.js\";\nimport type { APIPromise, RequestOptions } from \"../core/result.js\";\n\nexport type { PhoneNumberLookup };\nexport type { EmailLookup };\nexport type LookupPhoneNumberParams = NonNullable<CreatePhoneNumberLookupData[\"body\"]>;\nexport type LookupEmailParams = NonNullable<CreateEmailLookupData[\"body\"]>;\n\nexport class LookupResource extends Resource {\n /**\n * Look up what a phone number is. Returns the serving network, the issuing network, whether the number was ported, its country, and its line type, free with every call. Pass `type` to buy extra blocks: `classification` (the allocated service of the range, from an intelligence source, reported beside the free `line_type` rather than replacing it), `porting` (whether the number ever moved network, when, and its full history), `presence` (reachable on the network right now), `roaming`, `sim_swap` (when the SIM last changed), and `score` (0-100 credibility). Every requested block reports its own status, and only the ones reading `ok` are billed on top of the lookup. Nothing is sent to the number.\n *\n * @example Look up a number, buying two extra blocks\n * const answer = await bird.lookup.phoneNumber({\n * phone_number: \"+31612345678\",\n * type: [\"classification\", \"score\"],\n * });\n * console.log(answer.country_code, answer.line_type);\n * // Only a block whose status is ok carries a value, and only that one is billed.\n * if (answer.score?.status === \"ok\") console.log(answer.score.value);\n */\n phoneNumber(params: LookupPhoneNumberParams, options?: RequestOptions): APIPromise<PhoneNumberLookup> {\n return this.call<PhoneNumberLookup>(\"POST\", options, ({ signal, headers }) =>\n createPhoneNumberLookup({ client: this.client, body: params, headers, signal }));\n }\n\n /**\n * Look up whether an email address is worth sending to. Returns `result` (the verdict: `valid`; `neutral`, meaning it could not be confirmed either way; `risky`, meaning it will probably accept mail but is likelier than most to bounce or complain; `undeliverable`; or `typo`), `delivery_confidence` (0-100), `flags` (`role`, `disposable`, `free_provider`), `reason` on an undeliverable address (`invalid_syntax`, `invalid_domain`, `invalid_recipient`), and `did_you_mean` when the address looks like a misspelling of a real one. `result` and `reason` are OPEN vocabularies: the values listed here are today's and more may be added, so treat an unrecognized value as a future one rather than an error, falling back on `delivery_confidence`. One address per call. Every answered lookup is billed the same flat amount whatever the verdict, so treat it as a paid call rather than a free check, and use an `Idempotency-Key` so a retry does not buy a second answer. Nothing is sent to the address.\n *\n * @example Check whether an address is worth sending to\n * const answer = await bird.lookup.email({ email: \"aisha.khan@example.com\" });\n * // result is an open vocabulary; delivery_confidence is always comparable.\n * console.log(answer.result, answer.delivery_confidence);\n */\n email(params: LookupEmailParams, options?: RequestOptions): APIPromise<EmailLookup> {\n return this.call<EmailLookup>(\"POST\", options, ({ signal, headers }) =>\n createEmailLookup({ client: this.client, body: params, headers, signal }));\n }\n}\n","import {\n createClient,\n createConfig,\n type Client,\n} from \"./generated/client/index.js\";\nimport { baseUrlForRegion, regionFromApiKey } from \"./region.js\";\nimport { detectCaller } from \"./detect-caller.js\";\nimport {\n BirdHTTPClient,\n type AttemptContext,\n type FetchOutcome,\n} from \"./core/http.js\";\nimport {\n apiPromise,\n type APIPromise,\n type RequestOptions,\n} from \"./core/result.js\";\nimport { EmailResource, type EmailChannelDefaults } from \"./resources/email.js\";\nimport { AudiencesResource } from \"./resources/audiences.gen.js\";\nimport { DomainsResource } from \"./resources/domains.gen.js\";\nimport { ContactPropertiesResource } from \"./resources/contactProperties.gen.js\";\nimport { ContactsResource } from \"./resources/contacts.gen.js\";\nimport { SmsResource } from \"./resources/sms.js\";\nimport { SmsTemplatesResource } from \"./resources/smsTemplates.gen.js\";\nimport { WhatsappResource } from \"./resources/whatsapp.js\";\nimport { VoiceResource } from \"./resources/voice.gen.js\";\nimport { VerifyResource } from \"./resources/verify.js\";\nimport { WebhooksResource, type WebhookOptions } from \"./resources/webhooks.js\";\nimport { RealtimeResource, type RealtimeOptions } from \"./resources/realtime.js\";\nimport { LookupResource } from \"./resources/lookup.gen.js\";\n\n// The SDK's own version, sent as User-Agent. Injected at build time from\n// package.json (tsdown/vitest `define`) so it never drifts from the published\n// version. Distinct from the Bird API version (X-Bird-API-Version)\n// which is deferred — see sdk-build-ledger #3.\ndeclare const __SDK_VERSION__: string;\nconst DEFAULT_TIMEOUT_MS = 60_000;\nconst DEFAULT_MAX_RETRIES = 2;\n\nexport interface BirdClientOptions {\n apiKey: string;\n /** Explicit base URL; overrides region resolution. For local/self-hosted use. */\n baseUrl?: string;\n /** Region override (e.g. `\"eu1\"`); the API key prefix is used by default. */\n region?: string;\n /** Per-attempt timeout in ms. Default 60_000. */\n timeout?: number;\n /** Max retry attempts on retryable failures (429, 5xx, network). Default 2. */\n maxRetries?: number;\n /** Custom fetch — testing, proxying, edge-runtime adapters. Default global fetch. */\n fetch?: typeof fetch;\n /** Headers added to every request. SDK-internal headers win on conflict. */\n defaultHeaders?: Record<string, string>;\n /**\n * Email channel defaults. Any field set here may be omitted in\n * `bird.email.send` (the type enforces this); the per-send value wins.\n */\n email?: EmailChannelDefaults;\n /** Webhooks config — `secret` is the default used by `bird.webhooks.unwrap`. */\n webhooks?: WebhookOptions;\n /**\n * Realtime app credentials. Every `bird.realtime.*` call authenticates to the\n * Realtime edge with this key/secret pair; a call's options can override it.\n */\n realtime?: RealtimeOptions;\n}\n\n/** A raw request for the `bird.request` escape hatch. */\nexport interface BirdRequest {\n method: \"GET\" | \"POST\" | \"PUT\" | \"PATCH\" | \"DELETE\";\n /**\n * Absolute path on the API host, e.g. `/v1/email/domains`; must start\n * with a single `/`.\n */\n path: string;\n query?: Record<string, string | number | boolean | undefined>;\n /** JSON request body. */\n body?: unknown;\n headers?: Record<string, string>;\n}\n\n// Extract the email-channel defaults from the (literal) options type, or\n// `undefined` when none were set — drives whether `send` requires `from` etc.\ntype EmailDefaultsOf<O> = O extends {\n email: infer E extends EmailChannelDefaults;\n}\n ? E\n : undefined;\n\n// Precedence: explicit baseUrl, then explicit region, then the key's region\n// prefix. There is no region-less data-plane host, so an unresolvable region throws.\nfunction resolveBaseUrl(options: BirdClientOptions): string {\n if (options.baseUrl) return options.baseUrl;\n const region = options.region ?? regionFromApiKey(options.apiKey);\n if (!region) {\n throw new Error(\n \"Unable to determine region: API key is not in the expected \" +\n \"bk_{region}_{token} format. Pass an explicit `region` or `baseUrl`.\",\n );\n }\n return baseUrlForRegion(region);\n}\n\n// The raw escape hatch accepts caller-supplied paths. Require an absolute path\n// segment (not an authority-relative URL) and assert the final origin before\n// attaching SDK auth headers.\nfunction resolveRawRequestUrl(baseUrl: string, path: string): URL {\n if (!path.startsWith(\"/\") || path.startsWith(\"//\")) {\n throw new TypeError(\n \"bird.request path must be an absolute path starting with a single `/`\",\n );\n }\n const base = new URL(baseUrl);\n const url = new URL(baseUrl + path);\n if (url.origin !== base.origin) {\n throw new TypeError(\n \"bird.request path must stay on the configured Bird API origin\",\n );\n }\n return url;\n}\n\n/**\n * The Bird API client. Construct it with an API key; the region is taken from\n * the key's prefix (`bk_{region}_…`) — pass `baseUrl` or `region` to override.\n *\n * @example Construct and send\n * const bird = new BirdClient({ apiKey: process.env.BIRD_API_KEY! });\n * const msg = await bird.email.send({\n * from: \"hello@acme.com\",\n * to: [\"customer@example.com\"],\n * subject: \"Welcome aboard\",\n * html: \"<h1>Hi there 👋</h1>\",\n * });\n * console.log(msg.id);\n *\n * @example Channel defaults — set common send fields once; a per-send value always wins\n * const bird = new BirdClient({\n * apiKey: process.env.BIRD_API_KEY!,\n * email: { from: \"hello@acme.com\", category: \"transactional\" },\n * });\n * // `from` and `category` are filled from the defaults; both stay optional in `send`.\n * await bird.email.send({ to: [\"customer@example.com\"], subject: \"Hi\", html: \"<p>hi</p>\" });\n *\n * @example All client options\n * const bird = new BirdClient({\n * apiKey: process.env.BIRD_API_KEY!,\n * region: \"eu1\", // optional — override the region from the key prefix\n * baseUrl: \"http://localhost:8080\", // optional — overrides region entirely (local/self-hosted)\n * timeout: 60_000, // per-attempt timeout in ms (default 60_000)\n * maxRetries: 2, // retry budget for transient failures (default 2)\n * });\n */\nexport class BirdClient<const O extends BirdClientOptions = BirdClientOptions> {\n protected readonly core: BirdHTTPClient;\n\n // The generated hey-api client, configured with this instance's base URL,\n // auth, and fetch. Resources call the generated SDK functions through it.\n readonly #client: Client;\n readonly #baseUrl: string;\n readonly #fetch: typeof fetch;\n readonly #headers: Record<string, string>;\n\n /** The email channel — `bird.email.send(...)`, `.get(...)`, `.list(...)`. */\n readonly email: EmailResource<EmailDefaultsOf<O>>;\n\n\n /** The SMS channel — `bird.sms.send(...)`, `.get(...)`, `.list(...)`. */\n readonly sms: SmsResource;\n\n /** SMS templates — `bird.smsTemplates.list(...)`, `.get(...)`. */\n readonly smsTemplates: SmsTemplatesResource;\n\n /** The WhatsApp channel — `bird.whatsapp.send(...)`, `.get(...)`, `.list(...)`, `.listEvents(...)`. */\n readonly whatsapp: WhatsappResource;\n\n /** The Voice call log — `bird.voice.list(...)`, `.get(...)`. Calls are placed by your own SIP equipment, so this is a read surface. */\n readonly voice: VoiceResource;\n\n /** The Verify product — `bird.verify.verifications.create(...)`, `.check(...)`. */\n readonly verify: VerifyResource;\n\n /** Contacts — `bird.contacts.create(...)`, `.list(...)`, `.get(...)`, `.batch(...)`, … */\n readonly contacts: ContactsResource;\n\n /** Audiences — `bird.audiences.create(...)`, `.list(...)`, `.addContacts(...)`, … */\n readonly audiences: AudiencesResource;\n\n /** Contact properties — `bird.contactProperties.create(...)`, `.list(...)`, `.archive(...)`, … */\n readonly contactProperties: ContactPropertiesResource;\n\n /** Sending domains — `bird.domains.create(...)`, `.list(...)`, `.verify(...)`, … */\n readonly domains: DomainsResource;\n\n /** Recipient intelligence — `bird.lookup.email(...)`, `.phoneNumber(...)`. Every answer is billed. */\n readonly lookup: LookupResource;\n\n /** Webhooks — `bird.webhooks.unwrap(payload, headers)` verifies an inbound delivery. */\n readonly webhooks: WebhooksResource;\n\n\n\n\n /** Realtime — `bird.realtime.publish(...)`, `.channels.list(...)`, `.members.disconnect(...)`, … */\n readonly realtime: RealtimeResource;\n\n constructor(options: O) {\n const opts: BirdClientOptions = options; // widen for safe optional access\n this.#baseUrl = resolveBaseUrl(opts);\n this.#fetch = opts.fetch ?? fetch;\n this.#headers = {\n ...opts.defaultHeaders,\n Authorization: `Bearer ${opts.apiKey}`,\n \"User-Agent\": `bird-sdk-js/${__SDK_VERSION__}`,\n // Bird-* client-identity headers: the API attributes the SDK\n // surface from these, not the User-Agent. Edge-safe, so no os/arch/runtime\n // (those need Node globals this SDK must not touch); surface + version only.\n \"Bird-Surface\": \"sdk-js\",\n \"Bird-Version\": __SDK_VERSION__,\n };\n // Bird-Caller (the driving agent harness) — empty on a browser / when no\n // agent env is present, in which case the header is omitted.\n const caller = detectCaller();\n if (caller) this.#headers[\"Bird-Caller\"] = caller;\n this.#client = createClient(\n createConfig({\n baseUrl: this.#baseUrl,\n fetch: this.#fetch,\n headers: this.#headers,\n }),\n );\n this.core = new BirdHTTPClient({\n timeout: opts.timeout ?? DEFAULT_TIMEOUT_MS,\n maxRetries: opts.maxRetries ?? DEFAULT_MAX_RETRIES,\n credentials: {\n RealtimeKey: {\n header: \"X-Realtime-Key\",\n value: opts.realtime?.key,\n how: \"Set `realtime: { key, secret }` on the client.\",\n },\n RealtimeSecret: {\n header: \"X-Realtime-Secret\",\n value: opts.realtime?.secret,\n how: \"Set `realtime: { key, secret }` on the client.\",\n },\n },\n });\n // The runtime value is the configured defaults (or undefined); the precise\n // conditional type can't be reproved from the widened access, so assert it.\n this.email = new EmailResource<EmailDefaultsOf<O>>(\n this.core,\n this.#client,\n opts.email as EmailDefaultsOf<O>,\n );\n this.sms = new SmsResource(this.core, this.#client);\n this.smsTemplates = new SmsTemplatesResource(this.core, this.#client);\n this.whatsapp = new WhatsappResource(this.core, this.#client);\n this.voice = new VoiceResource(this.core, this.#client);\n this.verify = new VerifyResource(this.core, this.#client);\n this.contacts = new ContactsResource(this.core, this.#client);\n this.audiences = new AudiencesResource(this.core, this.#client);\n this.contactProperties = new ContactPropertiesResource(\n this.core,\n this.#client,\n );\n this.domains = new DomainsResource(this.core, this.#client);\n this.lookup = new LookupResource(this.core, this.#client);\n this.webhooks = new WebhooksResource(opts.webhooks);\n this.realtime = new RealtimeResource(this.core, this.#client);\n }\n\n /**\n * Escape hatch for endpoints the typed resources don't cover. Runs the full\n * lifecycle (auth, retries, idempotency, error mapping); you supply the\n * response type. Prefer a typed resource method where one exists.\n *\n * @throws {TypeError} if `req.path` does not start with exactly one `/` or\n * resolves to a different origin than the configured Bird API base URL.\n *\n * @example Reach an endpoint outside the curated surface — you supply the response type\n * type Suppressions = { data: Array<{ recipient: string }> };\n * const suppressions = await bird.request<Suppressions>({ method: \"GET\", path: \"/v1/email/suppressions\" });\n * console.log(suppressions.data.length);\n */\n request<T = unknown>(\n req: BirdRequest,\n options?: RequestOptions,\n ): APIPromise<T> {\n const url = resolveRawRequestUrl(this.#baseUrl, req.path);\n return apiPromise(\n this.core.request<T>(\n (ctx) => this.#raw<T>(url, req, ctx, options?.headers),\n {\n method: req.method,\n idempotencyKey: options?.idempotencyKey,\n signal: options?.signal,\n timeout: options?.timeout,\n maxRetries: options?.maxRetries,\n },\n ),\n );\n }\n\n async #raw<T>(\n url: URL,\n req: BirdRequest,\n ctx: AttemptContext,\n extraHeaders?: Record<string, string>,\n ): Promise<FetchOutcome<T>> {\n url = new URL(url);\n if (req.query) {\n for (const [key, value] of Object.entries(req.query)) {\n if (value !== undefined) url.searchParams.set(key, String(value));\n }\n }\n // SDK-internal headers (auth, idempotency) win over caller-supplied ones.\n const headers: Record<string, string> = {\n ...extraHeaders,\n ...this.#headers,\n };\n if (ctx.idempotencyKey) headers[\"Idempotency-Key\"] = ctx.idempotencyKey;\n if (req.body !== undefined) headers[\"Content-Type\"] = \"application/json\";\n\n const response = await this.#fetch(url, {\n method: req.method,\n headers,\n body: req.body !== undefined ? JSON.stringify(req.body) : undefined,\n signal: ctx.signal,\n });\n\n if (response.ok) {\n const data =\n response.status === 204\n ? undefined\n : await response.json().catch(() => undefined);\n // Caller supplies T; the raw JSON is asserted to it (escape hatch — untyped path).\n return { data: data as T, response };\n }\n const error = await response\n .clone()\n .json()\n .catch(() => undefined);\n return { error, response };\n }\n}\n","// Code generated by beak gen:event-consts. DO NOT EDIT.\n\n/**\n * Webhook event types known at this SDK version. The wire value is an open\n * string: a value added by a newer server is returned by `unwrap` unchanged,\n * so switch on these with a `default` branch.\n */\nexport const WebhookEventType = {\n DomainFailed: \"domain.failed\",\n DomainVerified: \"domain.verified\",\n EmailAccepted: \"email.accepted\",\n EmailBounced: \"email.bounced\",\n EmailCanceled: \"email.canceled\",\n EmailClicked: \"email.clicked\",\n EmailComplained: \"email.complained\",\n EmailDeferred: \"email.deferred\",\n EmailDelivered: \"email.delivered\",\n EmailListUnsubscribed: \"email.list_unsubscribed\",\n EmailMailboxMessageDelivered: \"email_mailbox.message_delivered\",\n EmailMailboxMessageFailed: \"email_mailbox.message_failed\",\n EmailMailboxMessageReceived: \"email_mailbox.message_received\",\n EmailMailboxMessageSent: \"email_mailbox.message_sent\",\n EmailMailboxSuspended: \"email_mailbox.suspended\",\n EmailMailboxThreadCreated: \"email_mailbox.thread_created\",\n EmailOpened: \"email.opened\",\n EmailOutOfBandBounce: \"email.out_of_band_bounce\",\n EmailProcessed: \"email.processed\",\n EmailReceived: \"email.received\",\n EmailRejected: \"email.rejected\",\n EmailScheduled: \"email.scheduled\",\n EmailSuppressionCreated: \"email_suppression.created\",\n EmailUnsubscribed: \"email.unsubscribed\",\n SmsAccepted: \"sms.accepted\",\n SmsDelivered: \"sms.delivered\",\n SmsExpired: \"sms.expired\",\n SmsFailed: \"sms.failed\",\n SmsReceived: \"sms.received\",\n SmsRejected: \"sms.rejected\",\n SmsSent: \"sms.sent\",\n SmsUndelivered: \"sms.undelivered\",\n VerifyAttemptDelivered: \"verify.attempt.delivered\",\n VerifyAttemptSent: \"verify.attempt.sent\",\n VerifyAttemptUndelivered: \"verify.attempt.undelivered\",\n VerifyVerificationCreated: \"verify.verification.created\",\n VerifyVerificationVerified: \"verify.verification.verified\",\n VoiceCallAnswered: \"voice_call.answered\",\n VoiceCallEnded: \"voice_call.ended\",\n VoiceCallInitiated: \"voice_call.initiated\",\n WhatsappAccepted: \"whatsapp.accepted\",\n WhatsappDelivered: \"whatsapp.delivered\",\n WhatsappFailed: \"whatsapp.failed\",\n WhatsappRead: \"whatsapp.read\",\n WhatsappRejected: \"whatsapp.rejected\",\n WhatsappSent: \"whatsapp.sent\",\n} as const;\n\n/** A known webhook event type value. */\nexport type WebhookEventTypeValue =\n (typeof WebhookEventType)[keyof typeof WebhookEventType];\n","// Code generated by beak gen:event-consts. DO NOT EDIT.\n\n/**\n * Values of EmailEventType known at this SDK version. The wire value is an open\n * string: a value added by a newer server deserializes unchanged, so switch on\n * these with a `default` branch rather than treating the set as closed.\n */\nexport const EmailEventType = {\n EmailAccepted: \"email.accepted\",\n EmailBounced: \"email.bounced\",\n EmailCanceled: \"email.canceled\",\n EmailClicked: \"email.clicked\",\n EmailComplained: \"email.complained\",\n EmailDeferred: \"email.deferred\",\n EmailDelivered: \"email.delivered\",\n EmailListUnsubscribed: \"email.list_unsubscribed\",\n EmailOpened: \"email.opened\",\n EmailOutOfBandBounce: \"email.out_of_band_bounce\",\n EmailProcessed: \"email.processed\",\n EmailRejected: \"email.rejected\",\n EmailScheduled: \"email.scheduled\",\n EmailUnsubscribed: \"email.unsubscribed\",\n} as const;\n\n/** A known EmailEventType value. */\nexport type EmailEventTypeValue = (typeof EmailEventType)[keyof typeof EmailEventType];\n\n/**\n * Values of EmailLookupFlag known at this SDK version. The wire value is an open\n * string: a value added by a newer server deserializes unchanged, so switch on\n * these with a `default` branch rather than treating the set as closed.\n */\nexport const EmailLookupFlag = {\n Disposable: \"disposable\",\n FreeProvider: \"free_provider\",\n Role: \"role\",\n} as const;\n\n/** A known EmailLookupFlag value. */\nexport type EmailLookupFlagValue = (typeof EmailLookupFlag)[keyof typeof EmailLookupFlag];\n\n/**\n * Values of EmailLookupReason known at this SDK version. The wire value is an open\n * string: a value added by a newer server deserializes unchanged, so switch on\n * these with a `default` branch rather than treating the set as closed.\n */\nexport const EmailLookupReason = {\n InvalidDomain: \"invalid_domain\",\n InvalidRecipient: \"invalid_recipient\",\n InvalidSyntax: \"invalid_syntax\",\n} as const;\n\n/** A known EmailLookupReason value. */\nexport type EmailLookupReasonValue = (typeof EmailLookupReason)[keyof typeof EmailLookupReason];\n\n/**\n * Values of EmailLookupResult known at this SDK version. The wire value is an open\n * string: a value added by a newer server deserializes unchanged, so switch on\n * these with a `default` branch rather than treating the set as closed.\n */\nexport const EmailLookupResult = {\n Neutral: \"neutral\",\n Risky: \"risky\",\n Typo: \"typo\",\n Undeliverable: \"undeliverable\",\n Valid: \"valid\",\n} as const;\n\n/** A known EmailLookupResult value. */\nexport type EmailLookupResultValue = (typeof EmailLookupResult)[keyof typeof EmailLookupResult];\n\n/**\n * Values of LookupFlag known at this SDK version. The wire value is an open\n * string: a value added by a newer server deserializes unchanged, so switch on\n * these with a `default` branch rather than treating the set as closed.\n */\nexport const LookupFlag = {\n Ported: \"ported\",\n} as const;\n\n/** A known LookupFlag value. */\nexport type LookupFlagValue = (typeof LookupFlag)[keyof typeof LookupFlag];\n\n/**\n * Values of LookupPropertyStatus known at this SDK version. The wire value is an open\n * string: a value added by a newer server deserializes unchanged, so switch on\n * these with a `default` branch rather than treating the set as closed.\n */\nexport const LookupPropertyStatus = {\n Inconclusive: \"inconclusive\",\n Ok: \"ok\",\n Unavailable: \"unavailable\",\n} as const;\n\n/** A known LookupPropertyStatus value. */\nexport type LookupPropertyStatusValue = (typeof LookupPropertyStatus)[keyof typeof LookupPropertyStatus];\n\n/**\n * Values of SMSErrorCode known at this SDK version. The wire value is an open\n * string: a value added by a newer server deserializes unchanged, so switch on\n * these with a `default` branch rather than treating the set as closed.\n */\nexport const SMSErrorCode = {\n BlockedByCarrier: \"blocked_by_carrier\",\n BlockedByRecipient: \"blocked_by_recipient\",\n ContentRejected: \"content_rejected\",\n InsufficientBalance: \"insufficient_balance\",\n InvalidDestination: \"invalid_destination\",\n LandlineUnreachable: \"landline_unreachable\",\n ProviderUnavailable: \"provider_unavailable\",\n RecipientOptedOut: \"recipient_opted_out\",\n SenderUnregistered: \"sender_unregistered\",\n Unknown: \"unknown\",\n Unreachable: \"unreachable\",\n} as const;\n\n/** A known SMSErrorCode value. */\nexport type SMSErrorCodeValue = (typeof SMSErrorCode)[keyof typeof SMSErrorCode];\n\n/**\n * Values of VerificationAttemptFailureReason known at this SDK version. The wire value is an open\n * string: a value added by a newer server deserializes unchanged, so switch on\n * these with a `default` branch rather than treating the set as closed.\n */\nexport const VerificationAttemptFailureReason = {\n CarrierRejected: \"carrier_rejected\",\n ChannelDisabled: \"channel_disabled\",\n ChannelUnavailable: \"channel_unavailable\",\n DeliveryTimeout: \"delivery_timeout\",\n HardBounce: \"hard_bounce\",\n SoftBounce: \"soft_bounce\",\n Undelivered: \"undelivered\",\n} as const;\n\n/** A known VerificationAttemptFailureReason value. */\nexport type VerificationAttemptFailureReasonValue = (typeof VerificationAttemptFailureReason)[keyof typeof VerificationAttemptFailureReason];\n\n/**\n * Values of VerificationChannel known at this SDK version. The wire value is an open\n * string: a value added by a newer server deserializes unchanged, so switch on\n * these with a `default` branch rather than treating the set as closed.\n */\nexport const VerificationChannel = {\n Email: \"email\",\n Sms: \"sms\",\n Whatsapp: \"whatsapp\",\n} as const;\n\n/** A known VerificationChannel value. */\nexport type VerificationChannelValue = (typeof VerificationChannel)[keyof typeof VerificationChannel];\n\n/**\n * Values of VerificationTerminalReason known at this SDK version. The wire value is an open\n * string: a value added by a newer server deserializes unchanged, so switch on\n * these with a `default` branch rather than treating the set as closed.\n */\nexport const VerificationTerminalReason = {\n AttemptsExhausted: \"attempts_exhausted\",\n TtlElapsed: \"ttl_elapsed\",\n} as const;\n\n/** A known VerificationTerminalReason value. */\nexport type VerificationTerminalReasonValue = (typeof VerificationTerminalReason)[keyof typeof VerificationTerminalReason];\n\n/**\n * Values of WhatsAppErrorCode known at this SDK version. The wire value is an open\n * string: a value added by a newer server deserializes unchanged, so switch on\n * these with a `default` branch rather than treating the set as closed.\n */\nexport const WhatsAppErrorCode = {\n InsufficientBalance: \"insufficient_balance\",\n InternalError: \"internal_error\",\n PriceNotFound: \"price_not_found\",\n RateLimited: \"rate_limited\",\n RecipientSuppressed: \"recipient_suppressed\",\n ServiceWindowExpired: \"service_window_expired\",\n Undeliverable: \"undeliverable\",\n} as const;\n\n/** A known WhatsAppErrorCode value. */\nexport type WhatsAppErrorCodeValue = (typeof WhatsAppErrorCode)[keyof typeof WhatsAppErrorCode];\n\n/**\n * Values of WhatsAppTemplateCategory known at this SDK version. The wire value is an open\n * string: a value added by a newer server deserializes unchanged, so switch on\n * these with a `default` branch rather than treating the set as closed.\n */\nexport const WhatsAppTemplateCategory = {\n Authentication: \"authentication\",\n Marketing: \"marketing\",\n Utility: \"utility\",\n} as const;\n\n/** A known WhatsAppTemplateCategory value. */\nexport type WhatsAppTemplateCategoryValue = (typeof WhatsAppTemplateCategory)[keyof typeof WhatsAppTemplateCategory];\n\n/**\n * Values of WhatsAppTemplateParameterType known at this SDK version. The wire value is an open\n * string: a value added by a newer server deserializes unchanged, so switch on\n * these with a `default` branch rather than treating the set as closed.\n */\nexport const WhatsAppTemplateParameterType = {\n Document: \"document\",\n Gif: \"gif\",\n Image: \"image\",\n Location: \"location\",\n Text: \"text\",\n Video: \"video\",\n} as const;\n\n/** A known WhatsAppTemplateParameterType value. */\nexport type WhatsAppTemplateParameterTypeValue = (typeof WhatsAppTemplateParameterType)[keyof typeof WhatsAppTemplateParameterType];\n"],"mappings":";;AAuEA,MAAa,qBAAqB,EAChC,iBAAiB,SACf,KAAK,UAAU,OAAO,MAAM,UAC1B,OAAO,UAAU,WAAW,MAAM,SAAS,IAAI,KACjD,EACJ;;;ACYA,SAAgB,gBAAiC,EAC/C,WACA,YACA,YACA,qBACA,mBACA,sBACA,qBACA,k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