diff --git a/packages/loot-core/src/types/api-handlers.d.ts b/packages/loot-core/src/types/api-handlers.d.ts index 30ecac4cf36..7ad399073d8 100644 --- a/packages/loot-core/src/types/api-handlers.d.ts +++ b/packages/loot-core/src/types/api-handlers.d.ts @@ -1,3 +1,5 @@ +import { type batchUpdateTransactions } from '../server/accounts/transactions'; + import { type ServerHandlers } from './server-handlers'; export interface ApiHandlers { @@ -9,20 +11,23 @@ export interface ApiHandlers { ...args: Parameters ) => Promise; - 'api/download-budget': (arg: { syncId; password }) => Promise; + 'api/download-budget': (arg: { + syncId: string; + password?: string; + }) => Promise; - 'api/start-import': (arg: { budgetName }) => Promise; + 'api/start-import': (arg: { budgetName: string }) => Promise; - 'api/finish-import': () => Promise; + 'api/finish-import': () => Promise; - 'api/abort-import': () => Promise; + 'api/abort-import': () => Promise; 'api/query': (arg: { query }) => Promise; - 'api/budget-months': () => Promise; + 'api/budget-months': () => Promise; 'api/budget-month': (arg: { month }) => Promise<{ - month; + month: string; incomeAvailable: number; lastMonthOverspent: number; forNextMonth: number; @@ -37,16 +42,16 @@ export interface ApiHandlers { }>; 'api/budget-set-amount': (arg: { - month; - categoryId; - amount; - }) => Promise; + month: string; + categoryId: string; + amount: number; + }) => Promise; 'api/budget-set-carryover': (arg: { - month; - categoryId; - flag; - }) => Promise; + month: string; + categoryId: string; + flag: boolean; + }) => Promise; 'api/transactions-export': (arg: { transactions; @@ -68,22 +73,27 @@ export interface ApiHandlers { }) => Promise<'ok'>; 'api/transactions-get': (arg: { - accountId; - startDate; - endDate; - }) => Promise; + accountId?: string; + startDate?: string; + endDate?: string; + }) => Promise; - 'api/transaction-update': (arg: { id; fields }) => Promise; + 'api/transaction-update': (arg: { + id; + fields; + }) => Promise>['updated']>; - 'api/transaction-delete': (arg: { id }) => Promise; + 'api/transaction-delete': (arg: { + id; + }) => Promise>['updated']>; - 'api/sync': () => Promise; + 'api/sync': () => Promise; 'api/accounts-get': () => Promise; 'api/account-create': (arg: { account; initialBalance? }) => Promise; - 'api/account-update': (arg: { id; fields }) => Promise; + 'api/account-update': (arg: { id; fields }) => Promise; 'api/account-close': (arg: { id; @@ -112,7 +122,10 @@ export interface ApiHandlers { 'api/category-update': (arg: { id; fields }) => Promise; - 'api/category-delete': (arg: { id; transferCategoryId }) => Promise; + 'api/category-delete': (arg: { + id; + transferCategoryId?; + }) => Promise<{ error?: string }>; 'api/payees-get': () => Promise; diff --git a/upcoming-release-notes/2334.md b/upcoming-release-notes/2334.md new file mode 100644 index 00000000000..35fd366ef4b --- /dev/null +++ b/upcoming-release-notes/2334.md @@ -0,0 +1,6 @@ +--- +category: Maintenance +authors: [twk3] +--- + +Define more of the returns types in api-handlers.