export type DeleteApiSendersDomainsDomainNameArgs = {domainName: string}; export type DeleteApiSendersDomainsDomainNameOptions = {baseUrl?: string | undefined, apiKey?: string | undefined, fetch?: typeof fetch | undefined}; /** * Delete a domain * * DELETE /senders/domains/{domainName} * * Also accepts auth: partner-key */ export const deleteApiSendersDomainsDomainName = async (args: DeleteApiSendersDomainsDomainNameArgs, options?: DeleteApiSendersDomainsDomainNameOptions) => { const {baseUrl = "https://api.brevo.com/v3", fetch: fetchFn = fetch, apiKey} = options ?? {} const query = new URLSearchParams() const headers = new Headers() if (apiKey !== undefined) headers.set("api-key", apiKey) const url = `${baseUrl.replace(/\/+$/, '')}/senders/domains/${encodeURIComponent(String(args.domainName))}${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "DELETE", headers}) if (!res.ok) throw new Error(`Request failed with status ${res.status}`, {cause: {status: res.status, body: await res.text()}}) return undefined };