export type GetApiModUnreportRoomIdArgs = {room_id: string}; export type GetApiModUnreportRoomIdOptions = {baseUrl: string, ModerationAuth?: {username: string, password: string} | undefined, fetch?: typeof fetch | undefined}; /** * Clear a room's reports * * GET /mod/unreport/{room_id} */ export const getApiModUnreportRoomId = async (args: GetApiModUnreportRoomIdArgs, options: GetApiModUnreportRoomIdOptions) => { const {baseUrl, fetch: fetchFn = fetch, ModerationAuth} = options ?? {} const query = new URLSearchParams() const headers = new Headers() if (ModerationAuth !== undefined) headers.set('authorization', `Basic ${btoa(`${ModerationAuth.username}:${ModerationAuth.password}`)}`) const url = `${baseUrl.replace(/\/+$/, '')}/mod/unreport/${encodeURIComponent(String(args.room_id))}${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "GET", headers}) if (!res.ok) throw new Error(`Request failed with status ${res.status}`, {cause: {status: res.status, body: await res.text()}}) return undefined };