export type CreateApiApiV10AccountsRecaptchaArgs = {token: string}; export type CreateApiApiV10AccountsRecaptchaOptions = {baseUrl?: string | undefined, oauth2?: string | undefined, fetch?: typeof fetch | undefined}; /** * POST /api/v1.0/accounts/recaptcha */ export const createApiApiV10AccountsRecaptcha = async (args: CreateApiApiV10AccountsRecaptchaArgs, options?: CreateApiApiV10AccountsRecaptchaOptions) => { const {baseUrl = "https://api.flipdish.co", fetch: fetchFn = fetch, oauth2} = options ?? {} const query = new URLSearchParams() const headers = new Headers() if (args.token != null) query.append("token", String(args.token)) if (oauth2 !== undefined) headers.set('authorization', `Bearer ${oauth2}`) const url = `${baseUrl.replace(/\/+$/, '')}/api/v1.0/accounts/recaptcha${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 };