export type CreateApiFiberV1ValidatePhoneSingleArgs = {body: {phoneNumber: string}}; export type CreateApiFiberV1ValidatePhoneSingleOptions = {baseUrl?: string | undefined, fetch?: typeof fetch | undefined}; /** * Validates a phone number and returns whether it's valid, reachable, carrier info, and caller name. * * POST /fiber/v1/validate-phone/single */ export const createApiFiberV1ValidatePhoneSingle = async (args: CreateApiFiberV1ValidatePhoneSingleArgs, options?: CreateApiFiberV1ValidatePhoneSingleOptions) => { 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(/\/+$/, '')}/fiber/v1/validate-phone/single${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 };