export type DeleteApiLetterLetterIdArgs = {letterId: number}; export type DeleteApiLetterLetterIdOptions = {baseUrl?: string | undefined, sessionAuth?: string | undefined, fetch?: typeof fetch | undefined}; /** * Deletes a single letter based on the ID supplied * * DELETE /letter/{letterId} */ export const deleteApiLetterLetterId = async (args: DeleteApiLetterLetterIdArgs, options?: DeleteApiLetterLetterIdOptions) => { 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(/\/+$/, '')}/letter/${encodeURIComponent(String(args.letterId))}${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 };