@cynco/sdk 0.1.1 → 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.cjs +8 -43
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +265 -226
- package/dist/index.d.ts +265 -226
- package/dist/index.js +8 -43
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.cts
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
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
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
|
-
|
|
172
|
-
|
|
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
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
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
|
-
|
|
208
|
-
|
|
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
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
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
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
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
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
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
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
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
|
-
|
|
274
|
-
|
|
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
|
-
|
|
279
|
-
|
|
280
|
-
|
|
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
|
|
299
|
-
cost?: number;
|
|
357
|
+
unitPrice: number;
|
|
300
358
|
taxRate?: number;
|
|
301
|
-
|
|
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
|
-
|
|
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
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
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
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
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
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
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
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
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
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
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
|
-
|
|
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
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
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
|
-
|
|
464
|
-
|
|
522
|
+
source: string | null;
|
|
523
|
+
lineItems: unknown[] | null;
|
|
465
524
|
createdAt: string;
|
|
466
525
|
updatedAt: string;
|
|
467
526
|
}
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
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
|
|
485
|
-
|
|
486
|
-
|
|
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
|
-
|
|
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
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
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
|
-
|
|
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,
|
|
@@ -786,9 +834,7 @@ declare class Invoices {
|
|
|
786
834
|
list(params?: InvoiceListParams): PagePromise<Invoice>;
|
|
787
835
|
/** Retrieve a single invoice by ID. */
|
|
788
836
|
retrieve(id: string): Promise<Invoice>;
|
|
789
|
-
/**
|
|
790
|
-
create(data: InvoiceCreateInput, options?: RequestOptions): Promise<Invoice>;
|
|
791
|
-
/** Update an existing invoice. */
|
|
837
|
+
/** Update an existing invoice (memo, paymentTerms, dueDate only). */
|
|
792
838
|
update(id: string, data: InvoiceUpdateInput, options?: RequestOptions): Promise<Invoice>;
|
|
793
839
|
/** Delete an invoice. Only draft invoices can be deleted. */
|
|
794
840
|
delete(id: string, options?: RequestOptions): Promise<void>;
|
|
@@ -868,8 +914,6 @@ declare class Bills {
|
|
|
868
914
|
list(params?: BillListParams): PagePromise<Bill>;
|
|
869
915
|
/** Retrieve a single bill by ID. */
|
|
870
916
|
retrieve(id: string): Promise<Bill>;
|
|
871
|
-
/** Create a new bill. */
|
|
872
|
-
create(data: BillCreateInput, options?: RequestOptions): Promise<Bill>;
|
|
873
917
|
/** Update an existing bill. */
|
|
874
918
|
update(id: string, data: BillUpdateInput, options?: RequestOptions): Promise<Bill>;
|
|
875
919
|
/** Delete a bill. Only draft bills can be deleted. */
|
|
@@ -910,23 +954,18 @@ declare class Accounts {
|
|
|
910
954
|
private readonly _client;
|
|
911
955
|
constructor(_client: CyncoClient);
|
|
912
956
|
/**
|
|
913
|
-
* List chart of accounts
|
|
957
|
+
* List chart of accounts.
|
|
914
958
|
*
|
|
915
959
|
* ```ts
|
|
916
|
-
*
|
|
917
|
-
*
|
|
960
|
+
* const page = await cynco.accounts.list({ account_type: 'revenue' });
|
|
961
|
+
* for (const account of page.data) {
|
|
962
|
+
* console.log(`${account.accountCode} — ${account.accountName}`);
|
|
918
963
|
* }
|
|
919
964
|
* ```
|
|
920
965
|
*/
|
|
921
966
|
list(params?: AccountListParams): PagePromise<Account>;
|
|
922
967
|
/** Retrieve a single account by ID. */
|
|
923
968
|
retrieve(id: string): Promise<Account>;
|
|
924
|
-
/** Create a new account. */
|
|
925
|
-
create(data: AccountCreateInput, options?: RequestOptions): Promise<Account>;
|
|
926
|
-
/** Update an existing account. */
|
|
927
|
-
update(id: string, data: AccountUpdateInput, options?: RequestOptions): Promise<Account>;
|
|
928
|
-
/** Delete an account. Only unused accounts can be deleted. */
|
|
929
|
-
delete(id: string, options?: RequestOptions): Promise<void>;
|
|
930
969
|
}
|
|
931
970
|
|
|
932
971
|
declare class JournalEntries {
|
|
@@ -1210,4 +1249,4 @@ declare class Cynco {
|
|
|
1210
1249
|
constructor(apiKey: string, options?: CyncoClientOptions);
|
|
1211
1250
|
}
|
|
1212
1251
|
|
|
1213
|
-
export { type Account, type
|
|
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 };
|