export type CreateApiIdentitiesIdentityIdVerificationsArgs = {identity_id: string, 'Finix-Version'?: string | undefined, 'Content-Type'?: string | undefined, body: unknown}; export type CreateApiIdentitiesIdentityIdVerificationsOptions = {baseUrl?: string | undefined, BasicAuth?: {username: string, password: string} | undefined, fetch?: typeof fetch | undefined}; /** * Verify an Identity * * POST /identities/{identity_id}/verifications */ export const createApiIdentitiesIdentityIdVerifications = async (args: CreateApiIdentitiesIdentityIdVerificationsArgs, options?: CreateApiIdentitiesIdentityIdVerificationsOptions) => { const {baseUrl = "https://finix.sandbox-payments-api.com", fetch: fetchFn = fetch, BasicAuth} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/json") if (args['Finix-Version'] != null) headers.set("Finix-Version", String(args['Finix-Version'])) if (args['Content-Type'] != null) headers.set("Content-Type", String(args['Content-Type'])) if (BasicAuth !== undefined) headers.set('authorization', `Basic ${btoa(`${BasicAuth.username}:${BasicAuth.password}`)}`) const url = `${baseUrl.replace(/\/+$/, '')}/identities/${encodeURIComponent(String(args.identity_id))}/verifications${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 };