export type IdentityMfaLoginEnforcementRequest = {auth_method_accessors?: Array | undefined, auth_method_types?: Array | undefined, identity_entity_ids?: Array | undefined, identity_group_ids?: Array | undefined, mfa_method_ids: Array}; export type CreateApiIdentityMfaLoginEnforcementNameArgs = {body: IdentityMfaLoginEnforcementRequest}; export type CreateApiIdentityMfaLoginEnforcementNameOptions = {baseUrl: string, fetch?: typeof fetch | undefined}; /** * Create or update a login enforcement * * POST /identity/mfa/login-enforcement/{name} */ export const createApiIdentityMfaLoginEnforcementName = async (args: CreateApiIdentityMfaLoginEnforcementNameArgs, options: CreateApiIdentityMfaLoginEnforcementNameOptions) => { 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/login-enforcement/${encodeURIComponent(String(args.name))}${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 };