export type IdentityMfaMethodOktaRequest = {api_token?: string | undefined, base_url?: string | undefined, method_id?: string | undefined, org_name?: string | undefined, primary_email?: boolean | undefined, production?: boolean | undefined, username_format?: string | undefined}; export type CreateApiIdentityMfaMethodOktaMethodIdArgs = {body: IdentityMfaMethodOktaRequest}; export type CreateApiIdentityMfaMethodOktaMethodIdOptions = {baseUrl: string, fetch?: typeof fetch | undefined}; /** * Update or create a configuration for the given MFA method * * POST /identity/mfa/method/okta/{method_id} */ export const createApiIdentityMfaMethodOktaMethodId = async (args: CreateApiIdentityMfaMethodOktaMethodIdArgs, options: CreateApiIdentityMfaMethodOktaMethodIdOptions) => { const {baseUrl, fetch: fetchFn = fetch} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/json") const url = `${baseUrl.replace(/\/+$/, '')}/identity/mfa/method/okta/${encodeURIComponent(String(args.method_id))}${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 };