export type CreateApiUser2faActivateArgs = {body: {user: {otp_attempt: number}}}; export type CreateApiUser2faActivateOptions = {baseUrl?: string | undefined, KisiLogin?: string | undefined, fetch?: typeof fetch | undefined}; /** * Activate 2FA for user * * POST /user/2fa/activate * * Also accepts auth: OAuth2 */ export const createApiUser2faActivate = async (args: CreateApiUser2faActivateArgs, options?: CreateApiUser2faActivateOptions) => { const {baseUrl = "https://api.kisi.io", fetch: fetchFn = fetch, KisiLogin} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/json") if (KisiLogin !== undefined) headers.set("Authorization", KisiLogin) const url = `${baseUrl.replace(/\/+$/, '')}/user/2fa/activate${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 };