export type MultiDomainLoginSchema = {app_name?: string | undefined, email: string, marketplace_signup_nonce?: string | undefined, otp?: (string | null) | undefined, otp_type?: (string | null) | undefined, system_domain_id: string}; export type CreateApiV1AuthOtpGenerateArgs = {'Temp-Auth-Token': string, body: MultiDomainLoginSchema}; export type CreateApiV1AuthOtpGenerateOptions = {baseUrl: string, fetch?: typeof fetch | undefined}; /** * Request OTP code * * POST /v1/auth/otp/generate/ */ export const createApiV1AuthOtpGenerate = async (args: CreateApiV1AuthOtpGenerateArgs, options: CreateApiV1AuthOtpGenerateOptions) => { const {baseUrl, fetch: fetchFn = fetch} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/json") if (args['Temp-Auth-Token'] != null) headers.set("Temp-Auth-Token", String(args['Temp-Auth-Token'])) const url = `${baseUrl.replace(/\/+$/, '')}/v1/auth/otp/generate/${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "POST", 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 };