export type OrganizationSummary = {name: string, display_name?: string | undefined, description?: string | undefined, home_url?: string | undefined, logo_image_id?: string | undefined}; export type UpdateApiOrgsOrgNameArgs = {orgName: string, body: OrganizationSummary}; export type UpdateApiOrgsOrgNameOptions = {baseUrl: string, ApiKeyId?: string | undefined, ApiKeySecret?: string | undefined, fetch?: typeof fetch | undefined}; /** * Updates organization profile * * PUT /orgs/{orgName} */ export const updateApiOrgsOrgName = async (args: UpdateApiOrgsOrgNameArgs, options: UpdateApiOrgsOrgNameOptions) => { const {baseUrl, fetch: fetchFn = fetch, ApiKeyId, ApiKeySecret} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/json") if (ApiKeyId !== undefined) headers.set("X-API-KEY-ID", ApiKeyId) if (ApiKeySecret !== undefined) headers.set("X-API-KEY-SECRET", ApiKeySecret) const url = `${baseUrl.replace(/\/+$/, '')}/orgs/${encodeURIComponent(String(args.orgName))}${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 };