export type UpdateChildDomain = {domain?: string | undefined}; export type UpdateApiResellerChildrenChildIdentifierDomainsDomainNameArgs = {childIdentifier: string, domainName: string, body: UpdateChildDomain}; export type UpdateApiResellerChildrenChildIdentifierDomainsDomainNameOptions = {baseUrl?: string | undefined, apiKey?: string | undefined, fetch?: typeof fetch | undefined}; /** * Update the sender domain of reseller's child based on the childIdentifier and domainName passed * * PUT /reseller/children/{childIdentifier}/domains/{domainName} * * Also accepts auth: partner-key */ export const updateApiResellerChildrenChildIdentifierDomainsDomainName = async (args: UpdateApiResellerChildrenChildIdentifierDomainsDomainNameArgs, options?: UpdateApiResellerChildrenChildIdentifierDomainsDomainNameOptions) => { const {baseUrl = "https://api.brevo.com/v3", fetch: fetchFn = fetch, apiKey} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/json") if (apiKey !== undefined) headers.set("api-key", apiKey) const url = `${baseUrl.replace(/\/+$/, '')}/reseller/children/${encodeURIComponent(String(args.childIdentifier))}/domains/${encodeURIComponent(String(args.domainName))}${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "PUT", headers, body: JSON.stringify(args.body)}) if (!res.ok) throw new Error(`Request failed with status ${res.status}`, {cause: {status: res.status, body: await res.text()}}) return undefined };