export type SystemSettings = {user_channel_autocreate?: boolean | undefined, show_intro?: boolean | undefined, cve_channel_id?: (string | null) | undefined, anaconda_ident_settings?: ({enabled?: boolean | undefined, enable_from?: string | undefined, updated_by?: string | undefined, selected_tokens?: (Array<'client_token' | 'session_token' | 'environment_token' | 'username' | 'hostname' | 'environment' | 'organization'>) | undefined} | null) | undefined}; export type UpdateApiSystemSettingsArgs = {body: SystemSettings}; export type UpdateApiSystemSettingsOptions = {baseUrl?: string | undefined, jwt?: string | undefined, fetch?: typeof fetch | undefined}; /** * Update system settings * * PUT /system/settings * * Also accepts auth: user_token */ export const updateApiSystemSettings = async (args: UpdateApiSystemSettingsArgs, options?: UpdateApiSystemSettingsOptions) => { const {baseUrl = "https://api.anaconda.cloud/api", fetch: fetchFn = fetch, jwt} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/json") if (jwt !== undefined) headers.set('authorization', `Bearer ${jwt}`) const url = `${baseUrl.replace(/\/+$/, '')}/system/settings${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "PUT", 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 };