export type Status = 'ACTIVE' | 'PENDING' | 'DISABLED'; export type TenantMutable = {name: string, status?: Status | undefined, confirmed?: boolean | undefined}; export type UpdateApiApiV1TenantsIdArgs = {id: string, body: TenantMutable}; export type UpdateApiApiV1TenantsIdOptions = {baseUrl?: string | undefined, fetch?: typeof fetch | undefined}; /** * Modify the tenant * * PUT /api/v1/tenants/{id} */ export const updateApiApiV1TenantsId = async (args: UpdateApiApiV1TenantsIdArgs, options?: UpdateApiApiV1TenantsIdOptions) => { const {baseUrl = "https://iam.example.com", fetch: fetchFn = fetch} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/json") const url = `${baseUrl.replace(/\/+$/, '')}/api/v1/tenants/${encodeURIComponent(String(args.id))}${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 };