export type UpdateOrgRequest = {description: string}; export type PatchApiApiOrgsNameArgs = {name: string, body: UpdateOrgRequest}; export type PatchApiApiOrgsNameOptions = {baseUrl: string, cookieAuth?: string | undefined, fetch?: typeof fetch | undefined}; /** * Update Organization * * PATCH /api/orgs/{name} */ export const patchApiApiOrgsName = async (args: PatchApiApiOrgsNameArgs, options: PatchApiApiOrgsNameOptions) => { const {baseUrl, fetch: fetchFn = fetch, cookieAuth} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/json") if (cookieAuth !== undefined) cookies.push("gitarena-session=" + encodeURIComponent(cookieAuth)) const url = `${baseUrl.replace(/\/+$/, '')}/api/orgs/${encodeURIComponent(String(args.name))}${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 };