export type DeleteApiNoteNoteIdArgs = {noteId: number}; export type DeleteApiNoteNoteIdOptions = {baseUrl?: string | undefined, sessionAuth?: string | undefined, fetch?: typeof fetch | undefined}; /** * Deletes a single note based on the ID supplied * * DELETE /note/{noteId} */ export const deleteApiNoteNoteId = async (args: DeleteApiNoteNoteIdArgs, options?: DeleteApiNoteNoteIdOptions) => { const {baseUrl = "https://small-eod.siecobywatelska.pl/v1", fetch: fetchFn = fetch, sessionAuth} = options ?? {} const query = new URLSearchParams() const headers = new Headers() if (sessionAuth !== undefined) cookies.push("session=" + encodeURIComponent(sessionAuth)) const url = `${baseUrl.replace(/\/+$/, '')}/note/${encodeURIComponent(String(args.noteId))}${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "DELETE", headers}) if (!res.ok) throw new Error(`Request failed with status ${res.status}`, {cause: {status: res.status, body: await res.text()}}) return undefined };