export type PatchApiExpensesSyncStatusArgs = {body: Array<{transaction_ref: string}>}; export type PatchApiExpensesSyncStatusOptions = {baseUrl?: string | undefined, ApiKeyAuth?: string | undefined, fetch?: typeof fetch | undefined}; /** * Update expense sync status * * PATCH /expenses/sync_status */ export const patchApiExpensesSyncStatus = async (args: PatchApiExpensesSyncStatusArgs, options?: PatchApiExpensesSyncStatusOptions) => { const {baseUrl = "https://api.boyahq.com/v1", fetch: fetchFn = fetch, ApiKeyAuth} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/json") if (ApiKeyAuth !== undefined) headers.set("X-API-KEY", ApiKeyAuth) const url = `${baseUrl.replace(/\/+$/, '')}/expenses/sync_status${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 undefined };