@cynco/sdk 0.1.0 → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.ts CHANGED
@@ -129,48 +129,73 @@ interface ValidationDetail {
129
129
  message: string;
130
130
  }
131
131
  interface ListParams {
132
+ page?: number;
132
133
  limit?: number;
133
- offset?: number;
134
134
  cursor?: string;
135
135
  sort?: string;
136
136
  order?: 'asc' | 'desc';
137
+ fields?: string;
137
138
  }
139
+ /**
140
+ * Query params for GET /api/v1/invoices.
141
+ * Matches the Zod `listQuerySchema` in api.v1.invoices.tsx.
142
+ * Sort accepts: 'created_at' | 'due_date' | 'total'.
143
+ */
138
144
  interface InvoiceListParams extends ListParams {
139
145
  status?: InvoiceStatus;
140
- customerId?: string;
141
- dateFrom?: string;
142
- dateTo?: string;
143
- dueDateFrom?: string;
144
- dueDateTo?: string;
146
+ created_from?: string;
147
+ created_to?: string;
148
+ due_from?: string;
149
+ due_to?: string;
150
+ min_amount?: number;
151
+ max_amount?: number;
145
152
  search?: string;
146
153
  }
154
+ /**
155
+ * Query params for GET /api/v1/customers.
156
+ * Matches the Zod `listQuerySchema` in api.v1.customers.tsx.
157
+ * Sort accepts: 'name' | 'email' | 'created_at'.
158
+ */
147
159
  interface CustomerListParams extends ListParams {
160
+ status?: 'active' | 'inactive' | 'all';
148
161
  search?: string;
149
- type?: 'individual' | 'company';
150
- isActive?: boolean;
151
162
  }
163
+ /**
164
+ * Query params for GET /api/v1/vendors.
165
+ * Matches the Zod `listQuerySchema` in api.v1.vendors.tsx.
166
+ * Sort accepts: 'name' | 'created_at' | 'total_amount'.
167
+ */
152
168
  interface VendorListParams extends ListParams {
169
+ status?: 'active' | 'inactive' | 'all';
170
+ category?: string;
153
171
  search?: string;
154
- isActive?: boolean;
155
172
  }
173
+ /**
174
+ * Query params for GET /api/v1/bills.
175
+ * Matches the Zod `listQuerySchema` in api.v1.bills.tsx.
176
+ * Sort accepts: 'created_at' | 'due_date' | 'total_amount' | 'bill_number'.
177
+ */
156
178
  interface BillListParams extends ListParams {
157
- status?: BillStatus;
158
- vendorId?: string;
159
- dateFrom?: string;
160
- dateTo?: string;
161
- dueDateFrom?: string;
162
- dueDateTo?: string;
179
+ status?: BillStatus | 'all';
163
180
  search?: string;
181
+ vendorId?: string;
182
+ startDate?: string;
183
+ endDate?: string;
164
184
  }
185
+ /**
186
+ * Query params for GET /api/v1/items.
187
+ * Matches the Zod `listQuerySchema` in api.v1.items.tsx.
188
+ */
165
189
  interface ItemListParams extends ListParams {
166
190
  search?: string;
167
- type?: 'product' | 'service';
168
- isActive?: boolean;
169
191
  }
192
+ /**
193
+ * Query params for GET /api/v1/accounts.
194
+ * Matches the Zod `listQuerySchema` in api.v1.accounts.tsx.
195
+ */
170
196
  interface AccountListParams extends ListParams {
171
- search?: string;
172
- type?: AccountType;
173
- isActive?: boolean;
197
+ account_type?: AccountType;
198
+ active_only?: 'true' | 'false';
174
199
  }
175
200
  interface JournalEntryListParams extends ListParams {
176
201
  dateFrom?: string;
@@ -193,146 +218,156 @@ interface BankTransactionListParams extends ListParams {
193
218
  interface WebhookListParams extends ListParams {
194
219
  isActive?: boolean;
195
220
  }
196
- interface InvoiceCreateInput {
197
- customerId: string;
198
- issueDate: string;
199
- dueDate: string;
200
- lineItems: InvoiceLineItemInput[];
201
- currency?: string;
202
- notes?: string;
203
- reference?: string;
204
- taxInclusive?: boolean;
205
- }
221
+ /**
222
+ * Invoice update input.
223
+ * Matches the Zod `updateInvoiceSchema` in invoice.schemas.ts.
224
+ * Note: Invoice create is not yet exposed via API (Phase 2).
225
+ */
206
226
  interface InvoiceUpdateInput {
207
- customerId?: string;
208
- issueDate?: string;
209
- dueDate?: string;
210
- lineItems?: InvoiceLineItemInput[];
211
- currency?: string;
212
- notes?: string;
213
- reference?: string;
214
- taxInclusive?: boolean;
215
- }
216
- interface InvoiceLineItemInput {
217
- itemId?: string;
218
- description: string;
219
- quantity: number;
220
- unitPrice: number;
221
- taxRate?: number;
222
- accountId?: string;
227
+ memo?: string | null;
228
+ paymentTerms?: string | null;
229
+ dueDate?: string | null;
223
230
  }
231
+ /**
232
+ * Customer create input.
233
+ * Matches the Zod `createCustomerSchema` in customer.schemas.ts.
234
+ */
224
235
  interface CustomerCreateInput {
225
236
  name: string;
226
237
  email?: string;
227
238
  phone?: string;
228
- type?: 'individual' | 'company';
229
- taxNumber?: string;
230
- currency?: string;
231
- billingAddress?: Address;
232
- shippingAddress?: Address;
239
+ address?: string;
240
+ city?: string;
241
+ state?: string;
242
+ zip?: string;
243
+ country?: string;
244
+ registrationNumber?: string;
245
+ taxId?: string;
246
+ website?: string;
247
+ paymentTerms?: string;
248
+ preferredPaymentMethod?: string;
249
+ preferredCurrency?: string;
250
+ creditLimit?: string;
251
+ category?: string;
233
252
  notes?: string;
234
253
  }
254
+ /**
255
+ * Customer update input.
256
+ * Matches the Zod `updateCustomerSchema` in customer.schemas.ts.
257
+ * All create fields are optional, plus `isActive`.
258
+ */
235
259
  interface CustomerUpdateInput {
236
260
  name?: string;
237
261
  email?: string;
238
262
  phone?: string;
239
- type?: 'individual' | 'company';
240
- taxNumber?: string;
241
- currency?: string;
242
- billingAddress?: Address;
243
- shippingAddress?: Address;
263
+ address?: string;
264
+ city?: string;
265
+ state?: string;
266
+ zip?: string;
267
+ country?: string;
268
+ registrationNumber?: string;
269
+ taxId?: string;
270
+ website?: string;
271
+ paymentTerms?: string;
272
+ preferredPaymentMethod?: string;
273
+ preferredCurrency?: string;
274
+ creditLimit?: string;
275
+ category?: string;
244
276
  notes?: string;
277
+ isActive?: boolean;
245
278
  }
279
+ /**
280
+ * Vendor create input.
281
+ * Matches the Zod `createVendorSchema` in vendor.schemas.ts.
282
+ */
246
283
  interface VendorCreateInput {
247
284
  name: string;
248
285
  email?: string;
249
286
  phone?: string;
250
- taxNumber?: string;
251
- currency?: string;
252
- address?: Address;
253
- bankDetails?: BankDetails;
287
+ address?: string;
288
+ city?: string;
289
+ state?: string;
290
+ zip?: string;
291
+ country?: string;
292
+ registrationNumber?: string;
293
+ taxId?: string;
294
+ website?: string;
295
+ paymentTerms?: string;
296
+ preferredPaymentMethod?: string;
297
+ bankAccountNumber?: string;
298
+ bankName?: string;
299
+ bankBranch?: string;
300
+ category?: string;
254
301
  notes?: string;
302
+ defaultExpenseAccountId?: string;
303
+ defaultPayableAccountId?: string;
255
304
  }
305
+ /**
306
+ * Vendor update input.
307
+ * Matches the Zod `updateVendorSchema` in vendor.schemas.ts.
308
+ * All create fields are optional, plus `isActive`.
309
+ */
256
310
  interface VendorUpdateInput {
257
311
  name?: string;
258
312
  email?: string;
259
313
  phone?: string;
260
- taxNumber?: string;
261
- currency?: string;
262
- address?: Address;
263
- bankDetails?: BankDetails;
264
- notes?: string;
265
- }
266
- interface BillCreateInput {
267
- vendorId: string;
268
- issueDate: string;
269
- dueDate: string;
270
- lineItems: BillLineItemInput[];
271
- currency?: string;
314
+ address?: string;
315
+ city?: string;
316
+ state?: string;
317
+ zip?: string;
318
+ country?: string;
319
+ registrationNumber?: string;
320
+ taxId?: string;
321
+ website?: string;
322
+ paymentTerms?: string;
323
+ preferredPaymentMethod?: string;
324
+ bankAccountNumber?: string;
325
+ bankName?: string;
326
+ bankBranch?: string;
327
+ category?: string;
272
328
  notes?: string;
273
- reference?: string;
274
- taxInclusive?: boolean;
329
+ defaultExpenseAccountId?: string;
330
+ defaultPayableAccountId?: string;
331
+ isActive?: boolean;
275
332
  }
333
+ /**
334
+ * Bill update input.
335
+ * Matches the Zod `updateBillSchema` in bill.schemas.ts.
336
+ * Note: Bill create is not yet exposed via API.
337
+ */
276
338
  interface BillUpdateInput {
277
339
  vendorId?: string;
278
- issueDate?: string;
279
- dueDate?: string;
280
- lineItems?: BillLineItemInput[];
340
+ billNumber?: string;
341
+ referenceNumber?: string;
342
+ status?: BillStatus;
281
343
  currency?: string;
344
+ dueDate?: string;
345
+ issueDate?: string;
346
+ category?: string;
347
+ memo?: string;
282
348
  notes?: string;
283
- reference?: string;
284
- taxInclusive?: boolean;
285
- }
286
- interface BillLineItemInput {
287
- itemId?: string;
288
- description: string;
289
- quantity: number;
290
- unitPrice: number;
291
- taxRate?: number;
292
- accountId?: string;
293
349
  }
350
+ /**
351
+ * Item create input.
352
+ * Matches the Zod `createItemSchema` in item.schemas.ts.
353
+ */
294
354
  interface ItemCreateInput {
295
355
  name: string;
296
- type: 'product' | 'service';
297
356
  description?: string;
298
- unitPrice?: number;
299
- cost?: number;
357
+ unitPrice: number;
300
358
  taxRate?: number;
301
- sku?: string;
302
- unit?: string;
303
- incomeAccountId?: string;
304
- expenseAccountId?: string;
359
+ discountRate?: number;
305
360
  }
361
+ /**
362
+ * Item update input.
363
+ * Matches the Zod `updateItemSchema` in item.schemas.ts.
364
+ */
306
365
  interface ItemUpdateInput {
307
366
  name?: string;
308
- type?: 'product' | 'service';
309
367
  description?: string;
310
368
  unitPrice?: number;
311
- cost?: number;
312
369
  taxRate?: number;
313
- sku?: string;
314
- unit?: string;
315
- incomeAccountId?: string;
316
- expenseAccountId?: string;
317
- }
318
- interface AccountCreateInput {
319
- name: string;
320
- code: string;
321
- type: AccountType;
322
- subType?: string;
323
- description?: string;
324
- currency?: string;
325
- taxRate?: number;
326
- isActive?: boolean;
327
- }
328
- interface AccountUpdateInput {
329
- name?: string;
330
- code?: string;
331
- subType?: string;
332
- description?: string;
333
- currency?: string;
334
- taxRate?: number;
335
- isActive?: boolean;
370
+ discountRate?: number;
336
371
  }
337
372
  interface JournalEntryCreateInput {
338
373
  date: string;
@@ -382,128 +417,155 @@ interface WebhookUpdateInput {
382
417
  description?: string;
383
418
  isActive?: boolean;
384
419
  }
420
+ /**
421
+ * Invoice as returned by the API.
422
+ * Matches `serializeInvoice()` in invoice.serializer.ts.
423
+ */
385
424
  interface Invoice {
386
425
  id: string;
387
426
  invoiceNumber: string;
388
- customerId: string;
389
- customer?: Customer;
390
- status: InvoiceStatus;
391
- issueDate: string;
392
- dueDate: string;
393
- lineItems: InvoiceLineItem[];
394
- subtotal: number;
395
- taxTotal: number;
396
- total: number;
397
- amountDue: number;
427
+ status: string;
428
+ customerId: string | null;
429
+ customerName: string | null;
430
+ customerEmail: string | null;
398
431
  currency: string;
399
- notes: string | null;
400
- reference: string | null;
401
- taxInclusive: boolean;
402
- pdfUrl: string | null;
432
+ lineItems: unknown[];
433
+ taxes: number;
434
+ totalAmount: number | null;
435
+ paidAmount: number;
436
+ hasDeposit: boolean;
437
+ depositAmount: number;
438
+ dueDate: string | null;
439
+ paymentTerms: string | null;
440
+ memo: string | null;
441
+ source: string;
403
442
  createdAt: string;
404
443
  updatedAt: string;
405
444
  }
406
- interface InvoiceLineItem {
407
- id: string;
408
- itemId: string | null;
409
- description: string;
410
- quantity: number;
411
- unitPrice: number;
412
- taxRate: number;
413
- amount: number;
414
- accountId: string | null;
415
- }
416
- type InvoiceStatus = 'draft' | 'sent' | 'viewed' | 'partially_paid' | 'paid' | 'overdue' | 'voided';
445
+ type InvoiceStatus = 'draft' | 'finalized' | 'paid' | 'overdue' | 'partially_paid' | 'deposit_paid' | 'deposit_due';
446
+ /**
447
+ * Customer as returned by the API.
448
+ * Matches `serializeCustomer()` in customer.serializer.ts.
449
+ */
417
450
  interface Customer {
418
451
  id: string;
419
452
  name: string;
420
453
  email: string | null;
421
454
  phone: string | null;
422
- type: 'individual' | 'company';
423
- taxNumber: string | null;
424
- currency: string;
425
- billingAddress: Address | null;
426
- shippingAddress: Address | null;
455
+ address: string | null;
456
+ city: string | null;
457
+ state: string | null;
458
+ zip: string | null;
459
+ country: string | null;
460
+ registrationNumber: string | null;
461
+ taxId: string | null;
462
+ website: string | null;
463
+ paymentTerms: string | null;
464
+ preferredPaymentMethod: string | null;
465
+ preferredCurrency: string | null;
466
+ creditLimit: number | null;
467
+ category: string | null;
427
468
  notes: string | null;
428
469
  isActive: boolean;
429
- outstandingBalance: number;
430
470
  createdAt: string;
431
471
  updatedAt: string;
432
472
  }
473
+ /**
474
+ * Vendor as returned by the API.
475
+ * Matches `serializeVendor()` in vendor.serializer.ts.
476
+ */
433
477
  interface Vendor {
434
478
  id: string;
435
479
  name: string;
436
480
  email: string | null;
437
481
  phone: string | null;
438
- taxNumber: string | null;
439
- currency: string;
440
- address: Address | null;
441
- bankDetails: BankDetails | null;
482
+ address: string | null;
483
+ city: string | null;
484
+ state: string | null;
485
+ zip: string | null;
486
+ country: string | null;
487
+ registrationNumber: string | null;
488
+ taxId: string | null;
489
+ website: string | null;
490
+ paymentTerms: string | null;
491
+ preferredPaymentMethod: string | null;
492
+ preferredCurrency: string | null;
493
+ creditLimit: number | null;
494
+ category: string | null;
442
495
  notes: string | null;
443
496
  isActive: boolean;
444
- outstandingBalance: number;
497
+ totalAmount: number;
498
+ totalPayments: number;
445
499
  createdAt: string;
446
500
  updatedAt: string;
447
501
  }
502
+ /**
503
+ * Bill as returned by the API.
504
+ * Matches `serializeBill()` in bill.serializer.ts.
505
+ */
448
506
  interface Bill {
449
507
  id: string;
450
- billNumber: string;
451
- vendorId: string;
452
- vendor?: Vendor;
453
- status: BillStatus;
454
- issueDate: string;
455
- dueDate: string;
456
- lineItems: BillLineItem[];
457
- subtotal: number;
458
- taxTotal: number;
459
- total: number;
460
- amountDue: number;
508
+ billNumber: string | null;
509
+ referenceNumber: string | null;
510
+ vendorId: string | null;
511
+ vendorName: string | null;
512
+ status: string;
461
513
  currency: string;
514
+ subtotalAmount: number | null;
515
+ taxAmount: number | null;
516
+ totalAmount: number | null;
517
+ issueDate: string | null;
518
+ dueDate: string | null;
519
+ category: string | null;
520
+ memo: string | null;
462
521
  notes: string | null;
463
- reference: string | null;
464
- taxInclusive: boolean;
522
+ source: string | null;
523
+ lineItems: unknown[] | null;
465
524
  createdAt: string;
466
525
  updatedAt: string;
467
526
  }
468
- interface BillLineItem {
469
- id: string;
470
- itemId: string | null;
471
- description: string;
472
- quantity: number;
473
- unitPrice: number;
474
- taxRate: number;
475
- amount: number;
476
- accountId: string | null;
477
- }
478
- type BillStatus = 'draft' | 'received' | 'partially_paid' | 'paid' | 'overdue' | 'voided';
527
+ type BillStatus = 'draft' | 'in_review' | 'pending_approval' | 'approved' | 'awaiting_payment' | 'scheduled' | 'paid' | 'rejected' | 'void';
528
+ /**
529
+ * Item as returned by the API.
530
+ * Matches `serializeItem()` in item.serializer.ts.
531
+ */
479
532
  interface Item {
480
533
  id: string;
481
534
  name: string;
482
- type: 'product' | 'service';
483
535
  description: string | null;
484
- unitPrice: number | null;
485
- cost: number | null;
486
- taxRate: number | null;
487
- sku: string | null;
488
- unit: string | null;
489
- incomeAccountId: string | null;
490
- expenseAccountId: string | null;
491
- isActive: boolean;
536
+ unitPrice: number;
537
+ taxRate: number;
538
+ discountRate: number;
492
539
  createdAt: string;
493
540
  updatedAt: string;
494
541
  }
495
- type AccountType = 'asset' | 'liability' | 'equity' | 'revenue' | 'expense';
542
+ /**
543
+ * Account type values accepted by the accounts API.
544
+ * Matches the `account_type` enum in the accounts route listQuerySchema.
545
+ */
546
+ type AccountType = 'asset' | 'liability' | 'equity' | 'revenue' | 'expense' | 'contra_asset' | 'contra_liability' | 'contra_equity' | 'contra_revenue' | 'contra_expense';
547
+ /**
548
+ * Account as returned by the API.
549
+ * Matches `serializeAccount()` in api.v1.accounts.tsx.
550
+ */
496
551
  interface Account {
497
552
  id: string;
498
- name: string;
499
- code: string;
500
- type: AccountType;
501
- subType: string | null;
502
- description: string | null;
503
- currency: string;
504
- taxRate: number | null;
553
+ accountCode: string;
554
+ accountName: string;
555
+ accountType: string;
556
+ normalBalance: string | null;
557
+ parentAccountId: string | null;
558
+ path: string | null;
559
+ level: number;
505
560
  isActive: boolean;
506
- balance: number;
561
+ isSystemAccount: boolean;
562
+ isHeaderAccount: boolean;
563
+ isCashAccount: boolean;
564
+ isBankAccount: boolean;
565
+ taxRelated: boolean;
566
+ defaultTaxRate: number | null;
567
+ taxCode: string | null;
568
+ description: string | null;
507
569
  createdAt: string;
508
570
  updatedAt: string;
509
571
  }
@@ -632,20 +694,6 @@ interface ReportRow {
632
694
  amount: number;
633
695
  previousAmount?: number;
634
696
  }
635
- interface Address {
636
- line1: string;
637
- line2?: string;
638
- city: string;
639
- state?: string;
640
- postalCode: string;
641
- country: string;
642
- }
643
- interface BankDetails {
644
- bankName: string;
645
- accountNumber: string;
646
- routingNumber?: string;
647
- swiftCode?: string;
648
- }
649
697
 
650
698
  /**
651
699
  * Low-level HTTP client that handles authentication, retries, rate limiting,
@@ -696,6 +744,7 @@ declare class CyncoClient {
696
744
  * ```
697
745
  */
698
746
  declare class Page<T> implements AsyncIterable<T> {
747
+ readonly success: true;
699
748
  readonly data: T[];
700
749
  readonly pagination: PaginatedResponse<T>['pagination'];
701
750
  readonly links?: PaginatedResponse<T>['links'];
@@ -714,6 +763,7 @@ declare class Page<T> implements AsyncIterable<T> {
714
763
  * A cursor-based paginated list with async iteration support.
715
764
  */
716
765
  declare class CursorPage<T> implements AsyncIterable<T> {
766
+ readonly success: true;
717
767
  readonly data: T[];
718
768
  readonly pagination: CursorPaginatedResponse<T>['pagination'];
719
769
  readonly links?: CursorPaginatedResponse<T>['links'];
@@ -725,6 +775,42 @@ declare class CursorPage<T> implements AsyncIterable<T> {
725
775
  nextPage(): Promise<CursorPage<T> | null>;
726
776
  [Symbol.asyncIterator](): AsyncIterator<T>;
727
777
  }
778
+ /**
779
+ * A promise that resolves to a `Page<T>` but also implements `AsyncIterable<T>`,
780
+ * so it can be used directly in `for await...of` without an intermediate `await`:
781
+ *
782
+ * ```ts
783
+ * // Both work:
784
+ * const page = await cynco.invoices.list(); // Page<Invoice>
785
+ * for await (const inv of cynco.invoices.list()) { ... }
786
+ * ```
787
+ */
788
+ declare class PagePromise<T> implements PromiseLike<Page<T>>, AsyncIterable<T> {
789
+ private readonly _promise;
790
+ constructor(promise: Promise<Page<T>>);
791
+ /** Satisfy PromiseLike so `await` works. */
792
+ then<TResult1 = Page<T>, TResult2 = never>(onfulfilled?: ((value: Page<T>) => TResult1 | PromiseLike<TResult1>) | null | undefined, onrejected?: ((reason: unknown) => TResult2 | PromiseLike<TResult2>) | null | undefined): Promise<TResult1 | TResult2>;
793
+ /** Satisfy Promise-like `catch`. */
794
+ catch<TResult = never>(onrejected?: ((reason: unknown) => TResult | PromiseLike<TResult>) | null | undefined): Promise<Page<T> | TResult>;
795
+ /** Satisfy Promise-like `finally`. */
796
+ finally(onfinally?: (() => void) | null | undefined): Promise<Page<T>>;
797
+ /**
798
+ * Iterate over all items across all pages.
799
+ * Fetches the first page lazily, then auto-paginates.
800
+ */
801
+ [Symbol.asyncIterator](): AsyncIterator<T>;
802
+ }
803
+ /**
804
+ * A promise that resolves to a `CursorPage<T>` but also implements `AsyncIterable<T>`.
805
+ */
806
+ declare class CursorPagePromise<T> implements PromiseLike<CursorPage<T>>, AsyncIterable<T> {
807
+ private readonly _promise;
808
+ constructor(promise: Promise<CursorPage<T>>);
809
+ then<TResult1 = CursorPage<T>, TResult2 = never>(onfulfilled?: ((value: CursorPage<T>) => TResult1 | PromiseLike<TResult1>) | null | undefined, onrejected?: ((reason: unknown) => TResult2 | PromiseLike<TResult2>) | null | undefined): Promise<TResult1 | TResult2>;
810
+ catch<TResult = never>(onrejected?: ((reason: unknown) => TResult | PromiseLike<TResult>) | null | undefined): Promise<CursorPage<T> | TResult>;
811
+ finally(onfinally?: (() => void) | null | undefined): Promise<CursorPage<T>>;
812
+ [Symbol.asyncIterator](): AsyncIterator<T>;
813
+ }
728
814
 
729
815
  declare class Invoices {
730
816
  private readonly _client;
@@ -732,19 +818,23 @@ declare class Invoices {
732
818
  /**
733
819
  * List invoices with pagination.
734
820
  *
735
- * Returns a `Page` that can be used as an async iterator for auto-pagination:
821
+ * Returns a `PagePromise` that can be awaited for a single page or used
822
+ * directly as an async iterator for auto-pagination:
736
823
  * ```ts
824
+ * // Single page
825
+ * const page = await cynco.invoices.list({ limit: 20 });
826
+ * console.log(page.data);
827
+ *
828
+ * // Auto-pagination
737
829
  * for await (const invoice of cynco.invoices.list({ limit: 50 })) {
738
830
  * console.log(invoice.id);
739
831
  * }
740
832
  * ```
741
833
  */
742
- list(params?: InvoiceListParams): Promise<Page<Invoice>>;
834
+ list(params?: InvoiceListParams): PagePromise<Invoice>;
743
835
  /** Retrieve a single invoice by ID. */
744
836
  retrieve(id: string): Promise<Invoice>;
745
- /** Create a new invoice. */
746
- create(data: InvoiceCreateInput, options?: RequestOptions): Promise<Invoice>;
747
- /** Update an existing invoice. */
837
+ /** Update an existing invoice (memo, paymentTerms, dueDate only). */
748
838
  update(id: string, data: InvoiceUpdateInput, options?: RequestOptions): Promise<Invoice>;
749
839
  /** Delete an invoice. Only draft invoices can be deleted. */
750
840
  delete(id: string, options?: RequestOptions): Promise<void>;
@@ -775,7 +865,7 @@ declare class Customers {
775
865
  * }
776
866
  * ```
777
867
  */
778
- list(params?: CustomerListParams): Promise<Page<Customer>>;
868
+ list(params?: CustomerListParams): PagePromise<Customer>;
779
869
  /** Retrieve a single customer by ID. */
780
870
  retrieve(id: string): Promise<Customer>;
781
871
  /** Create a new customer. */
@@ -798,7 +888,7 @@ declare class Vendors {
798
888
  * }
799
889
  * ```
800
890
  */
801
- list(params?: VendorListParams): Promise<Page<Vendor>>;
891
+ list(params?: VendorListParams): PagePromise<Vendor>;
802
892
  /** Retrieve a single vendor by ID. */
803
893
  retrieve(id: string): Promise<Vendor>;
804
894
  /** Create a new vendor. */
@@ -821,11 +911,9 @@ declare class Bills {
821
911
  * }
822
912
  * ```
823
913
  */
824
- list(params?: BillListParams): Promise<Page<Bill>>;
914
+ list(params?: BillListParams): PagePromise<Bill>;
825
915
  /** Retrieve a single bill by ID. */
826
916
  retrieve(id: string): Promise<Bill>;
827
- /** Create a new bill. */
828
- create(data: BillCreateInput, options?: RequestOptions): Promise<Bill>;
829
917
  /** Update an existing bill. */
830
918
  update(id: string, data: BillUpdateInput, options?: RequestOptions): Promise<Bill>;
831
919
  /** Delete a bill. Only draft bills can be deleted. */
@@ -851,7 +939,7 @@ declare class Items {
851
939
  * }
852
940
  * ```
853
941
  */
854
- list(params?: ItemListParams): Promise<Page<Item>>;
942
+ list(params?: ItemListParams): PagePromise<Item>;
855
943
  /** Retrieve a single item by ID. */
856
944
  retrieve(id: string): Promise<Item>;
857
945
  /** Create a new item. */
@@ -866,23 +954,18 @@ declare class Accounts {
866
954
  private readonly _client;
867
955
  constructor(_client: CyncoClient);
868
956
  /**
869
- * List chart of accounts with pagination.
957
+ * List chart of accounts.
870
958
  *
871
959
  * ```ts
872
- * for await (const account of cynco.accounts.list({ type: 'revenue' })) {
873
- * console.log(`${account.code} ${account.name}`);
960
+ * const page = await cynco.accounts.list({ account_type: 'revenue' });
961
+ * for (const account of page.data) {
962
+ * console.log(`${account.accountCode} — ${account.accountName}`);
874
963
  * }
875
964
  * ```
876
965
  */
877
- list(params?: AccountListParams): Promise<Page<Account>>;
966
+ list(params?: AccountListParams): PagePromise<Account>;
878
967
  /** Retrieve a single account by ID. */
879
968
  retrieve(id: string): Promise<Account>;
880
- /** Create a new account. */
881
- create(data: AccountCreateInput, options?: RequestOptions): Promise<Account>;
882
- /** Update an existing account. */
883
- update(id: string, data: AccountUpdateInput, options?: RequestOptions): Promise<Account>;
884
- /** Delete an account. Only unused accounts can be deleted. */
885
- delete(id: string, options?: RequestOptions): Promise<void>;
886
969
  }
887
970
 
888
971
  declare class JournalEntries {
@@ -897,7 +980,7 @@ declare class JournalEntries {
897
980
  * }
898
981
  * ```
899
982
  */
900
- list(params?: JournalEntryListParams): Promise<Page<JournalEntry>>;
983
+ list(params?: JournalEntryListParams): PagePromise<JournalEntry>;
901
984
  /** Retrieve a single journal entry by ID. */
902
985
  retrieve(id: string): Promise<JournalEntry>;
903
986
  /** Create a new journal entry. */
@@ -924,7 +1007,7 @@ declare class BankAccounts {
924
1007
  * }
925
1008
  * ```
926
1009
  */
927
- list(params?: BankAccountListParams): Promise<Page<BankAccount>>;
1010
+ list(params?: BankAccountListParams): PagePromise<BankAccount>;
928
1011
  /** Retrieve a single bank account by ID. */
929
1012
  retrieve(id: string): Promise<BankAccount>;
930
1013
  /** Create a new bank account. */
@@ -942,7 +1025,7 @@ declare class BankAccounts {
942
1025
  * }
943
1026
  * ```
944
1027
  */
945
- listTransactions(bankAccountId: string, params?: BankTransactionListParams): Promise<Page<BankTransaction>>;
1028
+ listTransactions(bankAccountId: string, params?: BankTransactionListParams): PagePromise<BankTransaction>;
946
1029
  }
947
1030
 
948
1031
  declare class Reports {
@@ -968,7 +1051,7 @@ declare class Webhooks {
968
1051
  * }
969
1052
  * ```
970
1053
  */
971
- list(params?: WebhookListParams): Promise<Page<Webhook>>;
1054
+ list(params?: WebhookListParams): PagePromise<Webhook>;
972
1055
  /** Retrieve a single webhook endpoint by ID. */
973
1056
  retrieve(id: string): Promise<Webhook>;
974
1057
  /** Create a new webhook endpoint. */
@@ -1166,4 +1249,4 @@ declare class Cynco {
1166
1249
  constructor(apiKey: string, options?: CyncoClientOptions);
1167
1250
  }
1168
1251
 
1169
- export { type Account, type AccountCreateInput, type AccountListParams, type AccountType, type AccountUpdateInput, Accounts, type Address, AuthenticationError, type BalanceSheetReport, type BankAccount, type BankAccountCreateInput, type BankAccountListParams, type BankAccountUpdateInput, BankAccounts, type BankDetails, type BankTransaction, type BankTransactionListParams, type Bill, type BillCreateInput, type BillLineItem, type BillLineItemInput, type BillListParams, type BillStatus, type BillUpdateInput, Bills, ConflictError, ConnectionError, CursorPage, type CursorPaginatedResponse, type CursorPagination, type Customer, type CustomerCreateInput, type CustomerListParams, type CustomerUpdateInput, Customers, Cynco, CyncoClient, type CyncoClientOptions, CyncoError, type CyncoResponse, type ErrorResponse, InternalError, type Invoice, type InvoiceCreateInput, type InvoiceLineItem, type InvoiceLineItemInput, type InvoiceListParams, type InvoiceStatus, type InvoiceUpdateInput, Invoices, type Item, type ItemCreateInput, type ItemListParams, type ItemUpdateInput, Items, JournalEntries, type JournalEntry, type JournalEntryCreateInput, type JournalEntryLine, type JournalEntryLineInput, type JournalEntryListParams, type JournalEntryUpdateInput, type ListParams, NotFoundError, type OffsetPagination, Page, type PaginatedResponse, type PaginationLinks, PermissionError, type ProfitAndLossReport, RateLimitError, type RateLimitInfo, type ReportParams, type ReportRow, type ReportSection, Reports, type RequestOptions, type ResponseMeta, TimeoutError, type TrialBalanceReport, type TrialBalanceRow, type ValidationDetail, ValidationError, type Vendor, type VendorCreateInput, type VendorListParams, type VendorUpdateInput, Vendors, type Webhook, type WebhookCreateInput, type WebhookEvent, type WebhookListParams, type WebhookPayload, type WebhookUpdateInput, Webhooks, Cynco as default, webhookVerifier };
1252
+ export { type Account, type AccountListParams, type AccountType, Accounts, AuthenticationError, type BalanceSheetReport, type BankAccount, type BankAccountCreateInput, type BankAccountListParams, type BankAccountUpdateInput, BankAccounts, type BankTransaction, type BankTransactionListParams, type Bill, type BillListParams, type BillStatus, type BillUpdateInput, Bills, ConflictError, ConnectionError, CursorPage, CursorPagePromise, type CursorPaginatedResponse, type CursorPagination, type Customer, type CustomerCreateInput, type CustomerListParams, type CustomerUpdateInput, Customers, Cynco, CyncoClient, type CyncoClientOptions, CyncoError, type CyncoResponse, type ErrorResponse, InternalError, type Invoice, type InvoiceListParams, type InvoiceStatus, type InvoiceUpdateInput, Invoices, type Item, type ItemCreateInput, type ItemListParams, type ItemUpdateInput, Items, JournalEntries, type JournalEntry, type JournalEntryCreateInput, type JournalEntryLine, type JournalEntryLineInput, type JournalEntryListParams, type JournalEntryUpdateInput, type ListParams, NotFoundError, type OffsetPagination, Page, PagePromise, type PaginatedResponse, type PaginationLinks, PermissionError, type ProfitAndLossReport, RateLimitError, type RateLimitInfo, type ReportParams, type ReportRow, type ReportSection, Reports, type RequestOptions, type ResponseMeta, TimeoutError, type TrialBalanceReport, type TrialBalanceRow, type ValidationDetail, ValidationError, type Vendor, type VendorCreateInput, type VendorListParams, type VendorUpdateInput, Vendors, type Webhook, type WebhookCreateInput, type WebhookEvent, type WebhookListParams, type WebhookPayload, type WebhookUpdateInput, Webhooks, Cynco as default, webhookVerifier };