export type CreateApiApiV1SubAccountsSubAuthIdKycSessionsArgs = {sub_auth_id: string, body: {account_auth_id: string, flow_type: 'email' | 'redirect', customer_email?: string | undefined, redirect_url?: string | undefined, webhook_url?: string | undefined, expires_in_days?: number | undefined}}; export type CreateApiApiV1SubAccountsSubAuthIdKycSessionsOptions = {baseUrl?: string | undefined, AuthID?: string | undefined, AuthToken?: string | undefined, fetch?: typeof fetch | undefined}; /** * Create a hosted KYC session * * POST /api/v1/sub-accounts/{sub_auth_id}/kyc-sessions */ export const createApiApiV1SubAccountsSubAuthIdKycSessions = async (args: CreateApiApiV1SubAccountsSubAuthIdKycSessionsArgs, options?: CreateApiApiV1SubAccountsSubAuthIdKycSessionsOptions) => { const {baseUrl = "https://api.vobiz.ai", fetch: fetchFn = fetch, AuthID, AuthToken} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/json") headers.set('accept', "application/json") if (AuthID !== undefined) headers.set("X-Auth-ID", AuthID) if (AuthToken !== undefined) headers.set("X-Auth-Token", AuthToken) const url = `${baseUrl.replace(/\/+$/, '')}/api/v1/sub-accounts/${encodeURIComponent(String(args.sub_auth_id))}/kyc-sessions${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 (await res.json()) as unknown };