export type CreateApiDiditV3PhoneCheckArgs = {body: {phone_number: string, code: string, duplicated_phone_number_action?: string | undefined, disposable_number_action?: string | undefined, voip_number_action?: string | undefined}}; export type CreateApiDiditV3PhoneCheckOptions = {baseUrl?: string | undefined, fetch?: typeof fetch | undefined}; /** * Verify a one-time code sent to a phone number. Maximum of three verification attempts per code. * * POST /didit/v3/phone/check */ export const createApiDiditV3PhoneCheck = async (args: CreateApiDiditV3PhoneCheckArgs, options?: CreateApiDiditV3PhoneCheckOptions) => { const {baseUrl = "https://api.orthogonal.com/mpp", fetch: fetchFn = fetch} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/json") const url = `${baseUrl.replace(/\/+$/, '')}/didit/v3/phone/check${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 };