export type CreateUpdateAnnouncementRequest = {content?: string | undefined, description?: string | undefined, group_ids?: Array | undefined, published?: boolean | undefined, published_at?: string | undefined, title?: string | undefined, user_ids?: Array | undefined}; export type PatchApiAdminAnnouncementsAnnouncementIdArgs = {body: CreateUpdateAnnouncementRequest}; export type PatchApiAdminAnnouncementsAnnouncementIdOptions = {baseUrl: string, Bearer?: string | undefined, fetch?: typeof fetch | undefined}; /** * Updates an announcement (admin only) * * PATCH /admin/announcements/{announcement_id} * * Also accepts auth: API-Key */ export const patchApiAdminAnnouncementsAnnouncementId = async (args: PatchApiAdminAnnouncementsAnnouncementIdArgs, options: PatchApiAdminAnnouncementsAnnouncementIdOptions) => { const {baseUrl, fetch: fetchFn = fetch, Bearer} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/json") if (Bearer !== undefined) headers.set("Authorization", Bearer) const url = `${baseUrl.replace(/\/+$/, '')}/admin/announcements/${encodeURIComponent(String(args.announcement_id))}${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 };