export type CreateApiV2CustomersCustomerIdDomainsDomainRegenerateAuthCodeArgs = {'X-Request-Id'?: string | undefined, customerId: string, domain: string}; export type CreateApiV2CustomersCustomerIdDomainsDomainRegenerateAuthCodeOptions = {baseUrl: string, fetch?: typeof fetch | undefined}; /** * Regenerate the auth code for the given domain * * POST /v2/customers/{customerId}/domains/{domain}/regenerateAuthCode */ export const createApiV2CustomersCustomerIdDomainsDomainRegenerateAuthCode = async (args: CreateApiV2CustomersCustomerIdDomainsDomainRegenerateAuthCodeArgs, options: CreateApiV2CustomersCustomerIdDomainsDomainRegenerateAuthCodeOptions) => { 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'])) const url = `${baseUrl.replace(/\/+$/, '')}/v2/customers/${encodeURIComponent(String(args.customerId))}/domains/${encodeURIComponent(String(args.domain))}/regenerateAuthCode${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 };