export type UpdateTenantPayload = {name?: string | undefined}; export type PatchApiTenantsTenantIDArgs = {tenantID: number, body: UpdateTenantPayload}; export type PatchApiTenantsTenantIDOptions = {baseUrl?: string | undefined, fetch?: typeof fetch | undefined}; /** * PATCH /tenants/{tenantID} */ export const patchApiTenantsTenantID = async (args: PatchApiTenantsTenantIDArgs, options?: PatchApiTenantsTenantIDOptions) => { const {baseUrl = "https://congo.gopheracademy.com/api", fetch: fetchFn = fetch} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/json") const url = `${baseUrl.replace(/\/+$/, '')}/tenants/${encodeURIComponent(String(args.tenantID))}${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "PATCH", 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 };