export type CreateApiV2CustomersCustomerIdDomainsDomainTransferOutArgs = {'X-Request-Id'?: string | undefined, customerId: string, domain: string, registrar: string}; export type CreateApiV2CustomersCustomerIdDomainsDomainTransferOutOptions = {baseUrl: string, fetch?: typeof fetch | undefined}; /** * Initiate transfer out to another registrar for a .uk domain. * * POST /v2/customers/{customerId}/domains/{domain}/transferOut */ export const createApiV2CustomersCustomerIdDomainsDomainTransferOut = async (args: CreateApiV2CustomersCustomerIdDomainsDomainTransferOutArgs, options: CreateApiV2CustomersCustomerIdDomainsDomainTransferOutOptions) => { const {baseUrl, fetch: fetchFn = fetch} = options ?? {} const query = new URLSearchParams() const headers = new Headers() if (args['X-Request-Id'] != null) headers.set("X-Request-Id", String(args['X-Request-Id'])) if (args.registrar != null) query.append("registrar", String(args.registrar)) const url = `${baseUrl.replace(/\/+$/, '')}/v2/customers/${encodeURIComponent(String(args.customerId))}/domains/${encodeURIComponent(String(args.domain))}/transferOut${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "POST", headers}) if (!res.ok) throw new Error(`Request failed with status ${res.status}`, {cause: {status: res.status, body: await res.text()}}) return undefined };