export type PhoneNumber = string; export type PhoneNumberOTP = string; export type PhoneNumberOTPVerificationRequest = {phone_number: PhoneNumber, code: PhoneNumberOTP}; export type CreateApiPassportProfileV1PhoneOtpVerifyArgs = {body: PhoneNumberOTPVerificationRequest}; export type CreateApiPassportProfileV1PhoneOtpVerifyOptions = {baseUrl?: string | undefined, BearerAuth?: string | undefined, fetch?: typeof fetch | undefined}; /** * Verify phone OTP code against user phone number * * POST /passport-profile/v1/phone-otp/verify */ export const createApiPassportProfileV1PhoneOtpVerify = async (args: CreateApiPassportProfileV1PhoneOtpVerifyArgs, options?: CreateApiPassportProfileV1PhoneOtpVerifyOptions) => { const {baseUrl = "https://api.sandbox.immutable.com", fetch: fetchFn = fetch, BearerAuth} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/json") if (BearerAuth !== undefined) headers.set('authorization', `Bearer ${BearerAuth}`) const url = `${baseUrl.replace(/\/+$/, '')}/passport-profile/v1/phone-otp/verify${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 };