export type PatchApiApiV2NotificationsIdArgs = {id: number, body: {Status: 'Open' | 'Reviewed' | 'Closed' | 'FalsePositive' | 'Suppress'}}; export type PatchApiApiV2NotificationsIdOptions = {baseUrl?: string | undefined, OAuthv2?: string | undefined, fetch?: typeof fetch | undefined}; /** * Updates a notification. * * PATCH /api/v2/notifications/{id} */ export const patchApiApiV2NotificationsId = async (args: PatchApiApiV2NotificationsIdArgs, options?: PatchApiApiV2NotificationsIdOptions) => { const {baseUrl = "https://app.blackkitetech.com", fetch: fetchFn = fetch, OAuthv2} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/json") headers.set('accept', "text/plain") if (OAuthv2 !== undefined) headers.set('authorization', `Bearer ${OAuthv2}`) const url = `${baseUrl.replace(/\/+$/, '')}/api/v2/notifications/${encodeURIComponent(String(args.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 res.text() };