export type DeleteBooksAPIJournalEntriesRequest = {journalEntryIds: Array}; export type DeleteApiBooksJournalEntriesArgs = {booksId?: string | undefined, body: DeleteBooksAPIJournalEntriesRequest}; export type DeleteApiBooksJournalEntriesOptions = {baseUrl?: string | undefined, bearerAuth?: string | undefined, fetch?: typeof fetch | undefined}; /** * Delete multiple journal entries * * DELETE /books/journal-entries */ export const deleteApiBooksJournalEntries = async (args: DeleteApiBooksJournalEntriesArgs, options?: DeleteApiBooksJournalEntriesOptions) => { const {baseUrl = "https://api.mercury.com/api/v1", fetch: fetchFn = fetch, bearerAuth} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/json") headers.set('accept', "application/json") if (args.booksId != null) query.append("booksId", String(args.booksId)) if (bearerAuth !== undefined) headers.set('authorization', `Bearer ${bearerAuth}`) const url = `${baseUrl.replace(/\/+$/, '')}/books/journal-entries${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "DELETE", 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 (await res.json()) as unknown };