@gpt-platform/client 0.11.1 → 0.11.2

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.
Files changed (44) hide show
  1. package/dist/_internal/sdk.gen.d.ts +1101 -8
  2. package/dist/_internal/sdk.gen.d.ts.map +1 -1
  3. package/dist/_internal/types.gen.d.ts +38447 -64456
  4. package/dist/_internal/types.gen.d.ts.map +1 -1
  5. package/dist/gpt-client.d.ts +341 -73
  6. package/dist/gpt-client.d.ts.map +1 -1
  7. package/dist/index.d.ts +5 -2
  8. package/dist/index.d.ts.map +1 -1
  9. package/dist/index.js +8001 -415
  10. package/dist/index.js.map +1 -1
  11. package/dist/index.mjs +8000 -415
  12. package/dist/index.mjs.map +1 -1
  13. package/dist/namespaces/agents.d.ts +125 -1
  14. package/dist/namespaces/agents.d.ts.map +1 -1
  15. package/dist/namespaces/ai.d.ts +144 -0
  16. package/dist/namespaces/ai.d.ts.map +1 -1
  17. package/dist/namespaces/billing.d.ts +36 -0
  18. package/dist/namespaces/billing.d.ts.map +1 -1
  19. package/dist/namespaces/campaigns.d.ts +410 -15
  20. package/dist/namespaces/campaigns.d.ts.map +1 -1
  21. package/dist/namespaces/channels.d.ts +4 -0
  22. package/dist/namespaces/channels.d.ts.map +1 -1
  23. package/dist/namespaces/clinical.d.ts +40 -8
  24. package/dist/namespaces/clinical.d.ts.map +1 -1
  25. package/dist/namespaces/crm.d.ts +299 -10
  26. package/dist/namespaces/crm.d.ts.map +1 -1
  27. package/dist/namespaces/email.d.ts +534 -257
  28. package/dist/namespaces/email.d.ts.map +1 -1
  29. package/dist/namespaces/extraction.d.ts +369 -1
  30. package/dist/namespaces/extraction.d.ts.map +1 -1
  31. package/dist/namespaces/imports.d.ts +12 -25
  32. package/dist/namespaces/imports.d.ts.map +1 -1
  33. package/dist/namespaces/index.d.ts +9 -4
  34. package/dist/namespaces/index.d.ts.map +1 -1
  35. package/dist/namespaces/invoices.d.ts +1055 -0
  36. package/dist/namespaces/invoices.d.ts.map +1 -0
  37. package/dist/namespaces/recipes.d.ts +478 -0
  38. package/dist/namespaces/recipes.d.ts.map +1 -0
  39. package/dist/namespaces/scheduling.d.ts.map +1 -1
  40. package/dist/request-builder.d.ts +7 -0
  41. package/dist/request-builder.d.ts.map +1 -1
  42. package/dist/version.d.ts +1 -1
  43. package/llms.txt +283 -0
  44. package/package.json +1 -1
@@ -0,0 +1,1055 @@
1
+ import type { InvoicesInvoice, InvoicesLine, InvoicesPayment, InvoicesTemplate, InvoicesRule, InvoicesRecurringSchedule, InvoicesContact, InvoicesActivity } from "../_internal/types.gen";
2
+ import type { RequestOptions } from "../base-client";
3
+ import { RequestBuilder } from "../request-builder";
4
+ /** Attributes accepted when creating an invoice. */
5
+ export type CreateInvoiceAttributes = {
6
+ workspace_id: string;
7
+ direction?: string;
8
+ source?: string;
9
+ reference_number?: string;
10
+ contact_id?: string;
11
+ issue_date?: string;
12
+ due_date?: string;
13
+ currency?: string;
14
+ subtotal?: number;
15
+ tax_total?: number;
16
+ total?: number;
17
+ amount_paid?: number;
18
+ amount_due?: number;
19
+ payment_terms?: string;
20
+ notes?: string;
21
+ metadata?: Record<string, unknown>;
22
+ ai_confidence?: number;
23
+ ai_suggestions?: Record<string, unknown>;
24
+ template_id?: string;
25
+ recurring_schedule_id?: string;
26
+ extraction_result_id?: string;
27
+ billing_address?: Record<string, unknown>;
28
+ shipping_address?: Record<string, unknown>;
29
+ [key: string]: unknown;
30
+ };
31
+ /** Attributes accepted when updating an invoice (PATCH semantics). */
32
+ export type UpdateInvoiceAttributes = {
33
+ reference_number?: string;
34
+ contact_id?: string;
35
+ issue_date?: string;
36
+ due_date?: string;
37
+ currency?: string;
38
+ payment_terms?: string;
39
+ notes?: string;
40
+ metadata?: Record<string, unknown>;
41
+ subtotal?: number;
42
+ tax_total?: number;
43
+ total?: number;
44
+ amount_paid?: number;
45
+ amount_due?: number;
46
+ billing_address?: Record<string, unknown>;
47
+ shipping_address?: Record<string, unknown>;
48
+ [key: string]: unknown;
49
+ };
50
+ /** Attributes accepted when creating an invoice line item. */
51
+ export type CreateInvoiceLineAttributes = {
52
+ invoice_id: string;
53
+ position?: number;
54
+ description?: string;
55
+ quantity?: number;
56
+ unit_price?: number;
57
+ tax_rate?: number;
58
+ gl_code?: string;
59
+ category?: string;
60
+ ai_suggested_gl?: string;
61
+ ai_gl_confidence?: number;
62
+ metadata?: Record<string, unknown>;
63
+ [key: string]: unknown;
64
+ };
65
+ /** Attributes accepted when updating an invoice line item (PATCH semantics). */
66
+ export type UpdateInvoiceLineAttributes = {
67
+ position?: number;
68
+ description?: string;
69
+ quantity?: number;
70
+ unit_price?: number;
71
+ tax_rate?: number;
72
+ gl_code?: string;
73
+ category?: string;
74
+ ai_suggested_gl?: string;
75
+ ai_gl_confidence?: number;
76
+ metadata?: Record<string, unknown>;
77
+ [key: string]: unknown;
78
+ };
79
+ /** Attributes accepted when creating a payment. */
80
+ export type CreatePaymentAttributes = {
81
+ invoice_id: string;
82
+ amount: number;
83
+ currency?: string;
84
+ method?: string;
85
+ reference?: string;
86
+ provider_transaction_id?: string;
87
+ paid_at?: string;
88
+ notes?: string;
89
+ metadata?: Record<string, unknown>;
90
+ provider?: string;
91
+ [key: string]: unknown;
92
+ };
93
+ /** Attributes accepted when creating a template. */
94
+ export type CreateTemplateAttributes = {
95
+ workspace_id: string;
96
+ name: string;
97
+ description?: string;
98
+ layout?: Record<string, unknown>;
99
+ default_payment_terms?: string;
100
+ default_notes?: string;
101
+ branding?: Record<string, unknown>;
102
+ is_default?: boolean;
103
+ metadata?: Record<string, unknown>;
104
+ [key: string]: unknown;
105
+ };
106
+ /** Attributes accepted when updating a template (PATCH semantics). */
107
+ export type UpdateTemplateAttributes = {
108
+ name?: string;
109
+ description?: string;
110
+ layout?: Record<string, unknown>;
111
+ default_payment_terms?: string;
112
+ default_notes?: string;
113
+ branding?: Record<string, unknown>;
114
+ is_default?: boolean;
115
+ metadata?: Record<string, unknown>;
116
+ [key: string]: unknown;
117
+ };
118
+ /** Attributes accepted when creating a rule. */
119
+ export type CreateRuleAttributes = {
120
+ workspace_id: string;
121
+ name: string;
122
+ rule_type?: string;
123
+ source?: string;
124
+ conditions?: Record<string, unknown>;
125
+ actions?: Record<string, unknown>;
126
+ confidence?: number;
127
+ active?: boolean;
128
+ metadata?: Record<string, unknown>;
129
+ [key: string]: unknown;
130
+ };
131
+ /** Attributes accepted when updating a rule (PATCH semantics). */
132
+ export type UpdateRuleAttributes = {
133
+ name?: string;
134
+ conditions?: Record<string, unknown>;
135
+ actions?: Record<string, unknown>;
136
+ confidence?: number;
137
+ active?: boolean;
138
+ metadata?: Record<string, unknown>;
139
+ [key: string]: unknown;
140
+ };
141
+ /** Attributes accepted when creating a recurring schedule. */
142
+ export type CreateRecurringScheduleAttributes = {
143
+ workspace_id: string;
144
+ contact_id?: string;
145
+ template_id?: string;
146
+ name: string;
147
+ frequency?: string;
148
+ start_date?: string;
149
+ end_date?: string;
150
+ next_run_date?: string;
151
+ line_items?: Record<string, unknown>[];
152
+ auto_send?: boolean;
153
+ active?: boolean;
154
+ metadata?: Record<string, unknown>;
155
+ [key: string]: unknown;
156
+ };
157
+ /** Attributes accepted when updating a recurring schedule (PATCH semantics). */
158
+ export type UpdateRecurringScheduleAttributes = {
159
+ name?: string;
160
+ contact_id?: string;
161
+ template_id?: string;
162
+ frequency?: string;
163
+ end_date?: string;
164
+ line_items?: Record<string, unknown>[];
165
+ auto_send?: boolean;
166
+ metadata?: Record<string, unknown>;
167
+ [key: string]: unknown;
168
+ };
169
+ /** Attributes accepted when creating an invoices contact. */
170
+ export type CreateContactAttributes = {
171
+ workspace_id: string;
172
+ name: string;
173
+ email?: string;
174
+ phone?: string;
175
+ tax_id?: string;
176
+ type?: string;
177
+ payment_terms_default?: string;
178
+ notes?: string;
179
+ metadata?: Record<string, unknown>;
180
+ [key: string]: unknown;
181
+ };
182
+ /** Attributes accepted when updating an invoices contact (PATCH semantics). */
183
+ export type UpdateContactAttributes = {
184
+ name?: string;
185
+ email?: string;
186
+ phone?: string;
187
+ tax_id?: string;
188
+ type?: string;
189
+ payment_terms_default?: string;
190
+ notes?: string;
191
+ metadata?: Record<string, unknown>;
192
+ [key: string]: unknown;
193
+ };
194
+ export type { InvoicesInvoice, InvoicesLine, InvoicesPayment, InvoicesTemplate, InvoicesRule, InvoicesRecurringSchedule, InvoicesContact, InvoicesActivity, };
195
+ /**
196
+ * Invoices namespace for invoice management, payments, templates, rules,
197
+ * recurring schedules, contacts, and activities.
198
+ *
199
+ * Provides sub-namespaces covering the full invoicing lifecycle: invoices
200
+ * (create, approve, send, track payments), line items, payments, templates,
201
+ * rules (AI-powered categorisation and GL coding), recurring schedules,
202
+ * contacts (invoice-specific contact records), and activities (audit trail).
203
+ *
204
+ * @example
205
+ * ```typescript
206
+ * const client = new GptClient({ apiKey: 'sk_app_...' });
207
+ *
208
+ * // Create an invoice
209
+ * const invoice = await client.invoices.invoices.create({
210
+ * workspace_id: 'ws_abc123',
211
+ * direction: 'outbound',
212
+ * contact_id: 'con_xyz',
213
+ * currency: 'USD',
214
+ * });
215
+ *
216
+ * // Add a line item
217
+ * await client.invoices.lines.create({
218
+ * invoice_id: invoice.id,
219
+ * description: 'Consulting services',
220
+ * quantity: 10,
221
+ * unit_price: 15000,
222
+ * });
223
+ *
224
+ * // Submit for approval and send
225
+ * await client.invoices.invoices.submitForApproval(invoice.id);
226
+ * await client.invoices.invoices.approve(invoice.id);
227
+ * await client.invoices.invoices.send(invoice.id);
228
+ * ```
229
+ */
230
+ export declare function createInvoicesNamespace(rb: RequestBuilder): {
231
+ /**
232
+ * Invoices -- core invoice records and lifecycle management.
233
+ *
234
+ * Invoices progress through a state machine: draft -> submitted ->
235
+ * approved -> sent -> viewed -> paid (or voided/disputed at various
236
+ * stages). Each status transition is exposed as a dedicated method.
237
+ */
238
+ invoices: {
239
+ /**
240
+ * Fetch a single invoice by its unique ID.
241
+ *
242
+ * @param id - The unique identifier of the invoice to retrieve.
243
+ * @param options - Optional request-level overrides.
244
+ * @returns A promise that resolves to the matching {@link InvoicesInvoice}.
245
+ *
246
+ * @example
247
+ * ```typescript
248
+ * const invoice = await client.invoices.invoices.get('inv_abc123');
249
+ * console.log(invoice.attributes.status);
250
+ * ```
251
+ */
252
+ get: (id: string, options?: RequestOptions) => Promise<InvoicesInvoice>;
253
+ /**
254
+ * Create a new invoice.
255
+ *
256
+ * @param attributes - Key/value map of invoice attributes. Must include
257
+ * `workspace_id`. Common fields include `direction`, `contact_id`,
258
+ * `currency`, `issue_date`, and `due_date`.
259
+ * @param options - Optional request-level overrides.
260
+ * @returns A promise that resolves to the newly created {@link InvoicesInvoice}.
261
+ *
262
+ * @example
263
+ * ```typescript
264
+ * const invoice = await client.invoices.invoices.create({
265
+ * workspace_id: 'ws_abc123',
266
+ * direction: 'outbound',
267
+ * contact_id: 'con_xyz',
268
+ * currency: 'USD',
269
+ * issue_date: '2026-03-28',
270
+ * due_date: '2026-04-28',
271
+ * });
272
+ * console.log(invoice.id);
273
+ * ```
274
+ */
275
+ create: (attributes: CreateInvoiceAttributes, options?: RequestOptions) => Promise<InvoicesInvoice>;
276
+ /**
277
+ * Update an existing invoice's attributes.
278
+ *
279
+ * Only the fields present in `attributes` are changed (PATCH semantics).
280
+ *
281
+ * @param id - The unique identifier of the invoice to update.
282
+ * @param attributes - Key/value map of attributes to change.
283
+ * @param options - Optional request-level overrides.
284
+ * @returns A promise that resolves to the updated {@link InvoicesInvoice}.
285
+ *
286
+ * @example
287
+ * ```typescript
288
+ * const invoice = await client.invoices.invoices.update('inv_abc123', {
289
+ * due_date: '2026-05-01',
290
+ * notes: 'Extended payment terms per agreement',
291
+ * });
292
+ * ```
293
+ */
294
+ update: (id: string, attributes: UpdateInvoiceAttributes, options?: RequestOptions) => Promise<InvoicesInvoice>;
295
+ /**
296
+ * Permanently delete an invoice.
297
+ *
298
+ * This is an irreversible hard delete. Only draft invoices should
299
+ * typically be deleted; use {@link void} for sent invoices.
300
+ *
301
+ * @param id - The unique identifier of the invoice to delete.
302
+ * @param options - Optional request-level overrides.
303
+ * @returns A promise that resolves to `true` on successful deletion.
304
+ *
305
+ * @example
306
+ * ```typescript
307
+ * await client.invoices.invoices.delete('inv_abc123');
308
+ * ```
309
+ */
310
+ delete: (id: string, options?: RequestOptions) => Promise<true>;
311
+ /**
312
+ * List invoices in a workspace.
313
+ *
314
+ * Paginate large result sets with `page` and `pageSize`.
315
+ *
316
+ * @param workspaceId - The ID of the workspace to list invoices from.
317
+ * @param options - Optional pagination controls and request-level overrides.
318
+ * @returns A promise that resolves to an array of {@link InvoicesInvoice} records.
319
+ *
320
+ * @example
321
+ * ```typescript
322
+ * const invoices = await client.invoices.invoices.listByWorkspace('ws_abc123', {
323
+ * page: 1,
324
+ * pageSize: 25,
325
+ * });
326
+ * ```
327
+ */
328
+ listByWorkspace: (workspaceId: string, options?: {
329
+ page?: number;
330
+ pageSize?: number;
331
+ } & RequestOptions) => Promise<InvoicesInvoice[]>;
332
+ /**
333
+ * Submit an invoice for approval.
334
+ *
335
+ * Transitions the invoice from `draft` to `submitted` status.
336
+ *
337
+ * @param id - The unique identifier of the invoice to submit.
338
+ * @param options - Optional request-level overrides.
339
+ * @returns A promise that resolves to the updated {@link InvoicesInvoice}.
340
+ *
341
+ * @example
342
+ * ```typescript
343
+ * const invoice = await client.invoices.invoices.submitForApproval('inv_abc123');
344
+ * console.log(invoice.attributes.status); // 'submitted'
345
+ * ```
346
+ */
347
+ submitForApproval: (id: string, options?: RequestOptions) => Promise<InvoicesInvoice>;
348
+ /**
349
+ * Approve an invoice.
350
+ *
351
+ * Transitions the invoice from `submitted` to `approved` status.
352
+ *
353
+ * @param id - The unique identifier of the invoice to approve.
354
+ * @param options - Optional request-level overrides.
355
+ * @returns A promise that resolves to the updated {@link InvoicesInvoice}.
356
+ *
357
+ * @example
358
+ * ```typescript
359
+ * const invoice = await client.invoices.invoices.approve('inv_abc123');
360
+ * console.log(invoice.attributes.status); // 'approved'
361
+ * ```
362
+ */
363
+ approve: (id: string, options?: RequestOptions) => Promise<InvoicesInvoice>;
364
+ /**
365
+ * Send an invoice to its contact.
366
+ *
367
+ * Transitions the invoice from `approved` to `sent` status.
368
+ *
369
+ * @param id - The unique identifier of the invoice to send.
370
+ * @param options - Optional request-level overrides.
371
+ * @returns A promise that resolves to the updated {@link InvoicesInvoice}.
372
+ *
373
+ * @example
374
+ * ```typescript
375
+ * const invoice = await client.invoices.invoices.send('inv_abc123');
376
+ * console.log(invoice.attributes.status); // 'sent'
377
+ * ```
378
+ */
379
+ send: (id: string, options?: RequestOptions) => Promise<InvoicesInvoice>;
380
+ /**
381
+ * Mark an invoice as viewed by the recipient.
382
+ *
383
+ * Transitions the invoice to `viewed` status.
384
+ *
385
+ * @param id - The unique identifier of the invoice to mark as viewed.
386
+ * @param options - Optional request-level overrides.
387
+ * @returns A promise that resolves to the updated {@link InvoicesInvoice}.
388
+ *
389
+ * @example
390
+ * ```typescript
391
+ * const invoice = await client.invoices.invoices.markViewed('inv_abc123');
392
+ * console.log(invoice.attributes.status); // 'viewed'
393
+ * ```
394
+ */
395
+ markViewed: (id: string, options?: RequestOptions) => Promise<InvoicesInvoice>;
396
+ /**
397
+ * Void an invoice.
398
+ *
399
+ * Cancels the invoice and prevents further payment. A reason must be
400
+ * provided for audit purposes.
401
+ *
402
+ * @param id - The unique identifier of the invoice to void.
403
+ * @param voidedReason - A human-readable explanation for voiding.
404
+ * @param options - Optional request-level overrides.
405
+ * @returns A promise that resolves to the updated {@link InvoicesInvoice}.
406
+ *
407
+ * @example
408
+ * ```typescript
409
+ * const invoice = await client.invoices.invoices.void('inv_abc123', 'Duplicate invoice');
410
+ * console.log(invoice.attributes.status); // 'voided'
411
+ * ```
412
+ */
413
+ void: (id: string, voidedReason: string, options?: RequestOptions) => Promise<InvoicesInvoice>;
414
+ /**
415
+ * Mark an invoice as overdue.
416
+ *
417
+ * Transitions the invoice to `overdue` status when payment has not
418
+ * been received by the due date.
419
+ *
420
+ * @param id - The unique identifier of the invoice to mark as overdue.
421
+ * @param options - Optional request-level overrides.
422
+ * @returns A promise that resolves to the updated {@link InvoicesInvoice}.
423
+ *
424
+ * @example
425
+ * ```typescript
426
+ * const invoice = await client.invoices.invoices.markOverdue('inv_abc123');
427
+ * console.log(invoice.attributes.status); // 'overdue'
428
+ * ```
429
+ */
430
+ markOverdue: (id: string, options?: RequestOptions) => Promise<InvoicesInvoice>;
431
+ /**
432
+ * Dispute an invoice.
433
+ *
434
+ * Transitions the invoice to `disputed` status when the recipient
435
+ * raises a dispute about the invoice contents or charges.
436
+ *
437
+ * @param id - The unique identifier of the invoice to dispute.
438
+ * @param options - Optional request-level overrides.
439
+ * @returns A promise that resolves to the updated {@link InvoicesInvoice}.
440
+ *
441
+ * @example
442
+ * ```typescript
443
+ * const invoice = await client.invoices.invoices.dispute('inv_abc123');
444
+ * console.log(invoice.attributes.status); // 'disputed'
445
+ * ```
446
+ */
447
+ dispute: (id: string, options?: RequestOptions) => Promise<InvoicesInvoice>;
448
+ /**
449
+ * Resolve a dispute on an invoice.
450
+ *
451
+ * Transitions the invoice out of `disputed` status back to a payable
452
+ * state.
453
+ *
454
+ * @param id - The unique identifier of the disputed invoice to resolve.
455
+ * @param options - Optional request-level overrides.
456
+ * @returns A promise that resolves to the updated {@link InvoicesInvoice}.
457
+ *
458
+ * @example
459
+ * ```typescript
460
+ * const invoice = await client.invoices.invoices.resolveDispute('inv_abc123');
461
+ * ```
462
+ */
463
+ resolveDispute: (id: string, options?: RequestOptions) => Promise<InvoicesInvoice>;
464
+ /**
465
+ * Schedule a payment for an invoice.
466
+ *
467
+ * Transitions the invoice to `payment_scheduled` status.
468
+ *
469
+ * @param id - The unique identifier of the invoice to schedule payment for.
470
+ * @param options - Optional request-level overrides.
471
+ * @returns A promise that resolves to the updated {@link InvoicesInvoice}.
472
+ *
473
+ * @example
474
+ * ```typescript
475
+ * const invoice = await client.invoices.invoices.schedulePayment('inv_abc123');
476
+ * ```
477
+ */
478
+ schedulePayment: (id: string, options?: RequestOptions) => Promise<InvoicesInvoice>;
479
+ /**
480
+ * Mark an invoice as paid.
481
+ *
482
+ * Transitions the invoice to `paid` status. Typically called after
483
+ * a payment has been recorded via the payments namespace.
484
+ *
485
+ * @param id - The unique identifier of the invoice to mark as paid.
486
+ * @param options - Optional request-level overrides.
487
+ * @returns A promise that resolves to the updated {@link InvoicesInvoice}.
488
+ *
489
+ * @example
490
+ * ```typescript
491
+ * const invoice = await client.invoices.invoices.markPaid('inv_abc123');
492
+ * console.log(invoice.attributes.status); // 'paid'
493
+ * ```
494
+ */
495
+ markPaid: (id: string, options?: RequestOptions) => Promise<InvoicesInvoice>;
496
+ /**
497
+ * Apply AI-generated suggestions to an invoice.
498
+ *
499
+ * Accepts a list of suggestion keys to apply from the invoice's
500
+ * `ai_suggestions` field. Only the specified keys are applied.
501
+ *
502
+ * @param id - The unique identifier of the invoice.
503
+ * @param acceptedKeys - Array of suggestion keys to accept and apply.
504
+ * @param options - Optional request-level overrides.
505
+ * @returns A promise that resolves to the updated {@link InvoicesInvoice}.
506
+ *
507
+ * @example
508
+ * ```typescript
509
+ * const invoice = await client.invoices.invoices.applyAiSuggestions('inv_abc123', [
510
+ * 'contact_id',
511
+ * 'gl_codes',
512
+ * ]);
513
+ * ```
514
+ */
515
+ applyAiSuggestions: (id: string, acceptedKeys: string[], options?: RequestOptions) => Promise<InvoicesInvoice>;
516
+ };
517
+ /**
518
+ * Lines -- invoice line items.
519
+ *
520
+ * Each invoice contains one or more line items that describe the goods
521
+ * or services being billed. Lines include quantity, unit price, tax rate,
522
+ * and optional GL coding (which may be AI-suggested).
523
+ */
524
+ lines: {
525
+ /**
526
+ * Fetch a single invoice line item by its unique ID.
527
+ *
528
+ * @param id - The unique identifier of the line item to retrieve.
529
+ * @param options - Optional request-level overrides.
530
+ * @returns A promise that resolves to the matching {@link InvoicesLine}.
531
+ *
532
+ * @example
533
+ * ```typescript
534
+ * const line = await client.invoices.lines.get('line_abc123');
535
+ * console.log(line.attributes.description);
536
+ * ```
537
+ */
538
+ get: (id: string, options?: RequestOptions) => Promise<InvoicesLine>;
539
+ /**
540
+ * Create a new line item on an invoice.
541
+ *
542
+ * @param attributes - Key/value map of line attributes. Must include
543
+ * `invoice_id`. Common fields include `description`, `quantity`,
544
+ * `unit_price`, and `tax_rate`.
545
+ * @param options - Optional request-level overrides.
546
+ * @returns A promise that resolves to the newly created {@link InvoicesLine}.
547
+ *
548
+ * @example
549
+ * ```typescript
550
+ * const line = await client.invoices.lines.create({
551
+ * invoice_id: 'inv_abc123',
552
+ * description: 'Consulting services',
553
+ * quantity: 10,
554
+ * unit_price: 15000,
555
+ * tax_rate: 0.1,
556
+ * });
557
+ * ```
558
+ */
559
+ create: (attributes: CreateInvoiceLineAttributes, options?: RequestOptions) => Promise<InvoicesLine>;
560
+ /**
561
+ * Update an existing line item's attributes.
562
+ *
563
+ * Only the fields present in `attributes` are changed (PATCH semantics).
564
+ *
565
+ * @param id - The unique identifier of the line item to update.
566
+ * @param attributes - Key/value map of attributes to change.
567
+ * @param options - Optional request-level overrides.
568
+ * @returns A promise that resolves to the updated {@link InvoicesLine}.
569
+ *
570
+ * @example
571
+ * ```typescript
572
+ * const line = await client.invoices.lines.update('line_abc123', {
573
+ * quantity: 15,
574
+ * unit_price: 12000,
575
+ * });
576
+ * ```
577
+ */
578
+ update: (id: string, attributes: UpdateInvoiceLineAttributes, options?: RequestOptions) => Promise<InvoicesLine>;
579
+ /**
580
+ * Permanently delete a line item.
581
+ *
582
+ * @param id - The unique identifier of the line item to delete.
583
+ * @param options - Optional request-level overrides.
584
+ * @returns A promise that resolves to `true` on successful deletion.
585
+ *
586
+ * @example
587
+ * ```typescript
588
+ * await client.invoices.lines.delete('line_abc123');
589
+ * ```
590
+ */
591
+ delete: (id: string, options?: RequestOptions) => Promise<true>;
592
+ };
593
+ /**
594
+ * Payments -- payment records against invoices.
595
+ *
596
+ * Each payment represents a financial transaction applied to an invoice.
597
+ * An invoice may have multiple partial payments. Payments are immutable
598
+ * once created (no update endpoint); delete and re-create if correction
599
+ * is needed.
600
+ */
601
+ payments: {
602
+ /**
603
+ * Fetch a single payment by its unique ID.
604
+ *
605
+ * @param id - The unique identifier of the payment to retrieve.
606
+ * @param options - Optional request-level overrides.
607
+ * @returns A promise that resolves to the matching {@link InvoicesPayment}.
608
+ *
609
+ * @example
610
+ * ```typescript
611
+ * const payment = await client.invoices.payments.get('pay_abc123');
612
+ * console.log(payment.attributes.amount);
613
+ * ```
614
+ */
615
+ get: (id: string, options?: RequestOptions) => Promise<InvoicesPayment>;
616
+ /**
617
+ * Record a new payment against an invoice.
618
+ *
619
+ * @param attributes - Key/value map of payment attributes. Must include
620
+ * `invoice_id` and `amount`. Common fields include `currency`,
621
+ * `method`, `reference`, and `paid_at`.
622
+ * @param options - Optional request-level overrides.
623
+ * @returns A promise that resolves to the newly created {@link InvoicesPayment}.
624
+ *
625
+ * @example
626
+ * ```typescript
627
+ * const payment = await client.invoices.payments.create({
628
+ * invoice_id: 'inv_abc123',
629
+ * amount: 50000,
630
+ * currency: 'USD',
631
+ * method: 'bank_transfer',
632
+ * reference: 'TXN-12345',
633
+ * paid_at: '2026-03-28T10:00:00Z',
634
+ * });
635
+ * ```
636
+ */
637
+ create: (attributes: CreatePaymentAttributes, options?: RequestOptions) => Promise<InvoicesPayment>;
638
+ /**
639
+ * Delete a payment record.
640
+ *
641
+ * @param id - The unique identifier of the payment to delete.
642
+ * @param options - Optional request-level overrides.
643
+ * @returns A promise that resolves to `true` on successful deletion.
644
+ *
645
+ * @example
646
+ * ```typescript
647
+ * await client.invoices.payments.delete('pay_abc123');
648
+ * ```
649
+ */
650
+ delete: (id: string, options?: RequestOptions) => Promise<true>;
651
+ };
652
+ /**
653
+ * Templates -- reusable invoice templates.
654
+ *
655
+ * Templates define default layouts, payment terms, notes, and branding
656
+ * that are applied when creating new invoices. One template per workspace
657
+ * can be marked as the default.
658
+ */
659
+ templates: {
660
+ /**
661
+ * Fetch a single template by its unique ID.
662
+ *
663
+ * @param id - The unique identifier of the template to retrieve.
664
+ * @param options - Optional request-level overrides.
665
+ * @returns A promise that resolves to the matching {@link InvoicesTemplate}.
666
+ *
667
+ * @example
668
+ * ```typescript
669
+ * const template = await client.invoices.templates.get('tpl_abc123');
670
+ * console.log(template.attributes.name);
671
+ * ```
672
+ */
673
+ get: (id: string, options?: RequestOptions) => Promise<InvoicesTemplate>;
674
+ /**
675
+ * Create a new invoice template.
676
+ *
677
+ * @param attributes - Key/value map of template attributes. Must include
678
+ * `workspace_id` and `name`.
679
+ * @param options - Optional request-level overrides.
680
+ * @returns A promise that resolves to the newly created {@link InvoicesTemplate}.
681
+ *
682
+ * @example
683
+ * ```typescript
684
+ * const template = await client.invoices.templates.create({
685
+ * workspace_id: 'ws_abc123',
686
+ * name: 'Standard Invoice',
687
+ * default_payment_terms: 'Net 30',
688
+ * is_default: true,
689
+ * });
690
+ * ```
691
+ */
692
+ create: (attributes: CreateTemplateAttributes, options?: RequestOptions) => Promise<InvoicesTemplate>;
693
+ /**
694
+ * Update an existing template's attributes.
695
+ *
696
+ * Only the fields present in `attributes` are changed (PATCH semantics).
697
+ *
698
+ * @param id - The unique identifier of the template to update.
699
+ * @param attributes - Key/value map of attributes to change.
700
+ * @param options - Optional request-level overrides.
701
+ * @returns A promise that resolves to the updated {@link InvoicesTemplate}.
702
+ *
703
+ * @example
704
+ * ```typescript
705
+ * const template = await client.invoices.templates.update('tpl_abc123', {
706
+ * default_payment_terms: 'Net 60',
707
+ * });
708
+ * ```
709
+ */
710
+ update: (id: string, attributes: UpdateTemplateAttributes, options?: RequestOptions) => Promise<InvoicesTemplate>;
711
+ /**
712
+ * Permanently delete a template.
713
+ *
714
+ * @param id - The unique identifier of the template to delete.
715
+ * @param options - Optional request-level overrides.
716
+ * @returns A promise that resolves to `true` on successful deletion.
717
+ *
718
+ * @example
719
+ * ```typescript
720
+ * await client.invoices.templates.delete('tpl_abc123');
721
+ * ```
722
+ */
723
+ delete: (id: string, options?: RequestOptions) => Promise<true>;
724
+ };
725
+ /**
726
+ * Rules -- AI-powered categorisation and GL coding rules.
727
+ *
728
+ * Rules define conditions and actions for automatically categorising
729
+ * invoice line items, suggesting GL codes, and applying other
730
+ * transformations. Rules can be deactivated without deletion.
731
+ */
732
+ rules: {
733
+ /**
734
+ * Fetch a single rule by its unique ID.
735
+ *
736
+ * @param id - The unique identifier of the rule to retrieve.
737
+ * @param options - Optional request-level overrides.
738
+ * @returns A promise that resolves to the matching {@link InvoicesRule}.
739
+ *
740
+ * @example
741
+ * ```typescript
742
+ * const rule = await client.invoices.rules.get('rule_abc123');
743
+ * console.log(rule.attributes.name);
744
+ * ```
745
+ */
746
+ get: (id: string, options?: RequestOptions) => Promise<InvoicesRule>;
747
+ /**
748
+ * Create a new rule.
749
+ *
750
+ * @param attributes - Key/value map of rule attributes. Must include
751
+ * `workspace_id` and `name`. Common fields include `rule_type`,
752
+ * `conditions`, `actions`, and `confidence`.
753
+ * @param options - Optional request-level overrides.
754
+ * @returns A promise that resolves to the newly created {@link InvoicesRule}.
755
+ *
756
+ * @example
757
+ * ```typescript
758
+ * const rule = await client.invoices.rules.create({
759
+ * workspace_id: 'ws_abc123',
760
+ * name: 'Auto-categorise office supplies',
761
+ * rule_type: 'categorisation',
762
+ * conditions: { description_contains: 'office' },
763
+ * actions: { gl_code: '6000', category: 'Office Supplies' },
764
+ * });
765
+ * ```
766
+ */
767
+ create: (attributes: CreateRuleAttributes, options?: RequestOptions) => Promise<InvoicesRule>;
768
+ /**
769
+ * Update an existing rule's attributes.
770
+ *
771
+ * Only the fields present in `attributes` are changed (PATCH semantics).
772
+ *
773
+ * @param id - The unique identifier of the rule to update.
774
+ * @param attributes - Key/value map of attributes to change.
775
+ * @param options - Optional request-level overrides.
776
+ * @returns A promise that resolves to the updated {@link InvoicesRule}.
777
+ *
778
+ * @example
779
+ * ```typescript
780
+ * const rule = await client.invoices.rules.update('rule_abc123', {
781
+ * confidence: 0.95,
782
+ * actions: { gl_code: '6100', category: 'IT Equipment' },
783
+ * });
784
+ * ```
785
+ */
786
+ update: (id: string, attributes: UpdateRuleAttributes, options?: RequestOptions) => Promise<InvoicesRule>;
787
+ /**
788
+ * Permanently delete a rule.
789
+ *
790
+ * For reversible removal, prefer {@link deactivate} instead.
791
+ *
792
+ * @param id - The unique identifier of the rule to delete.
793
+ * @param options - Optional request-level overrides.
794
+ * @returns A promise that resolves to `true` on successful deletion.
795
+ *
796
+ * @example
797
+ * ```typescript
798
+ * await client.invoices.rules.delete('rule_abc123');
799
+ * ```
800
+ */
801
+ delete: (id: string, options?: RequestOptions) => Promise<true>;
802
+ /**
803
+ * Deactivate a rule without deleting it.
804
+ *
805
+ * The rule remains in the system but is no longer applied to new
806
+ * invoices. It can be reactivated by updating `active` to `true`.
807
+ *
808
+ * @param id - The unique identifier of the rule to deactivate.
809
+ * @param options - Optional request-level overrides.
810
+ * @returns A promise that resolves to the updated {@link InvoicesRule}.
811
+ *
812
+ * @example
813
+ * ```typescript
814
+ * const rule = await client.invoices.rules.deactivate('rule_abc123');
815
+ * console.log(rule.attributes.active); // false
816
+ * ```
817
+ */
818
+ deactivate: (id: string, options?: RequestOptions) => Promise<InvoicesRule>;
819
+ };
820
+ /**
821
+ * Recurring Schedules -- automated invoice generation on a schedule.
822
+ *
823
+ * Recurring schedules define templates and frequencies for automatically
824
+ * generating invoices. Schedules can be paused and resumed without
825
+ * deletion.
826
+ */
827
+ recurringSchedules: {
828
+ /**
829
+ * Fetch a single recurring schedule by its unique ID.
830
+ *
831
+ * @param id - The unique identifier of the schedule to retrieve.
832
+ * @param options - Optional request-level overrides.
833
+ * @returns A promise that resolves to the matching {@link InvoicesRecurringSchedule}.
834
+ *
835
+ * @example
836
+ * ```typescript
837
+ * const schedule = await client.invoices.recurringSchedules.get('sched_abc123');
838
+ * console.log(schedule.attributes.frequency);
839
+ * ```
840
+ */
841
+ get: (id: string, options?: RequestOptions) => Promise<InvoicesRecurringSchedule>;
842
+ /**
843
+ * Create a new recurring schedule.
844
+ *
845
+ * @param attributes - Key/value map of schedule attributes. Must include
846
+ * `workspace_id` and `name`. Common fields include `frequency`,
847
+ * `contact_id`, `template_id`, `start_date`, and `line_items`.
848
+ * @param options - Optional request-level overrides.
849
+ * @returns A promise that resolves to the newly created {@link InvoicesRecurringSchedule}.
850
+ *
851
+ * @example
852
+ * ```typescript
853
+ * const schedule = await client.invoices.recurringSchedules.create({
854
+ * workspace_id: 'ws_abc123',
855
+ * name: 'Monthly retainer',
856
+ * contact_id: 'con_xyz',
857
+ * frequency: 'monthly',
858
+ * start_date: '2026-04-01',
859
+ * auto_send: true,
860
+ * });
861
+ * ```
862
+ */
863
+ create: (attributes: CreateRecurringScheduleAttributes, options?: RequestOptions) => Promise<InvoicesRecurringSchedule>;
864
+ /**
865
+ * Update an existing recurring schedule's attributes.
866
+ *
867
+ * Only the fields present in `attributes` are changed (PATCH semantics).
868
+ *
869
+ * @param id - The unique identifier of the schedule to update.
870
+ * @param attributes - Key/value map of attributes to change.
871
+ * @param options - Optional request-level overrides.
872
+ * @returns A promise that resolves to the updated {@link InvoicesRecurringSchedule}.
873
+ *
874
+ * @example
875
+ * ```typescript
876
+ * const schedule = await client.invoices.recurringSchedules.update('sched_abc123', {
877
+ * frequency: 'quarterly',
878
+ * auto_send: false,
879
+ * });
880
+ * ```
881
+ */
882
+ update: (id: string, attributes: UpdateRecurringScheduleAttributes, options?: RequestOptions) => Promise<InvoicesRecurringSchedule>;
883
+ /**
884
+ * Permanently delete a recurring schedule.
885
+ *
886
+ * For reversible removal, prefer {@link pause} instead.
887
+ *
888
+ * @param id - The unique identifier of the schedule to delete.
889
+ * @param options - Optional request-level overrides.
890
+ * @returns A promise that resolves to `true` on successful deletion.
891
+ *
892
+ * @example
893
+ * ```typescript
894
+ * await client.invoices.recurringSchedules.delete('sched_abc123');
895
+ * ```
896
+ */
897
+ delete: (id: string, options?: RequestOptions) => Promise<true>;
898
+ /**
899
+ * Pause a recurring schedule.
900
+ *
901
+ * The schedule remains in the system but no new invoices will be
902
+ * generated until it is resumed via {@link resume}.
903
+ *
904
+ * @param id - The unique identifier of the schedule to pause.
905
+ * @param options - Optional request-level overrides.
906
+ * @returns A promise that resolves to the updated {@link InvoicesRecurringSchedule}.
907
+ *
908
+ * @example
909
+ * ```typescript
910
+ * const schedule = await client.invoices.recurringSchedules.pause('sched_abc123');
911
+ * console.log(schedule.attributes.active); // false
912
+ * ```
913
+ */
914
+ pause: (id: string, options?: RequestOptions) => Promise<InvoicesRecurringSchedule>;
915
+ /**
916
+ * Resume a paused recurring schedule.
917
+ *
918
+ * Reactivates the schedule so that invoices will be generated on the
919
+ * next scheduled date.
920
+ *
921
+ * @param id - The unique identifier of the schedule to resume.
922
+ * @param options - Optional request-level overrides.
923
+ * @returns A promise that resolves to the updated {@link InvoicesRecurringSchedule}.
924
+ *
925
+ * @example
926
+ * ```typescript
927
+ * const schedule = await client.invoices.recurringSchedules.resume('sched_abc123');
928
+ * console.log(schedule.attributes.active); // true
929
+ * ```
930
+ */
931
+ resume: (id: string, options?: RequestOptions) => Promise<InvoicesRecurringSchedule>;
932
+ };
933
+ /**
934
+ * Contacts -- invoice-specific contact records.
935
+ *
936
+ * Invoices contacts represent the billing entities (customers or vendors)
937
+ * associated with invoices. They may link to CRM contacts but maintain
938
+ * their own billing-specific attributes like tax IDs and default payment
939
+ * terms.
940
+ */
941
+ contacts: {
942
+ /**
943
+ * Fetch a single invoices contact by their unique ID.
944
+ *
945
+ * @param id - The unique identifier of the contact to retrieve.
946
+ * @param options - Optional request-level overrides.
947
+ * @returns A promise that resolves to the matching {@link InvoicesContact}.
948
+ *
949
+ * @example
950
+ * ```typescript
951
+ * const contact = await client.invoices.contacts.get('icon_abc123');
952
+ * console.log(contact.attributes.name);
953
+ * ```
954
+ */
955
+ get: (id: string, options?: RequestOptions) => Promise<InvoicesContact>;
956
+ /**
957
+ * Create a new invoices contact.
958
+ *
959
+ * @param attributes - Key/value map of contact attributes. Must include
960
+ * `workspace_id` and `name`. Common fields include `email`, `phone`,
961
+ * `tax_id`, and `payment_terms_default`.
962
+ * @param options - Optional request-level overrides.
963
+ * @returns A promise that resolves to the newly created {@link InvoicesContact}.
964
+ *
965
+ * @example
966
+ * ```typescript
967
+ * const contact = await client.invoices.contacts.create({
968
+ * workspace_id: 'ws_abc123',
969
+ * name: 'Acme Corp',
970
+ * email: 'billing@acme.com',
971
+ * tax_id: 'US-12-3456789',
972
+ * payment_terms_default: 'Net 30',
973
+ * });
974
+ * ```
975
+ */
976
+ create: (attributes: CreateContactAttributes, options?: RequestOptions) => Promise<InvoicesContact>;
977
+ /**
978
+ * Update an existing invoices contact's attributes.
979
+ *
980
+ * Only the fields present in `attributes` are changed (PATCH semantics).
981
+ *
982
+ * @param id - The unique identifier of the contact to update.
983
+ * @param attributes - Key/value map of attributes to change.
984
+ * @param options - Optional request-level overrides.
985
+ * @returns A promise that resolves to the updated {@link InvoicesContact}.
986
+ *
987
+ * @example
988
+ * ```typescript
989
+ * const contact = await client.invoices.contacts.update('icon_abc123', {
990
+ * payment_terms_default: 'Net 60',
991
+ * });
992
+ * ```
993
+ */
994
+ update: (id: string, attributes: UpdateContactAttributes, options?: RequestOptions) => Promise<InvoicesContact>;
995
+ /**
996
+ * Permanently delete an invoices contact.
997
+ *
998
+ * @param id - The unique identifier of the contact to delete.
999
+ * @param options - Optional request-level overrides.
1000
+ * @returns A promise that resolves to `true` on successful deletion.
1001
+ *
1002
+ * @example
1003
+ * ```typescript
1004
+ * await client.invoices.contacts.delete('icon_abc123');
1005
+ * ```
1006
+ */
1007
+ delete: (id: string, options?: RequestOptions) => Promise<true>;
1008
+ /**
1009
+ * List invoices contacts in a workspace.
1010
+ *
1011
+ * Paginate large result sets with `page` and `pageSize`.
1012
+ *
1013
+ * @param workspaceId - The ID of the workspace to list contacts from.
1014
+ * @param options - Optional pagination controls and request-level overrides.
1015
+ * @returns A promise that resolves to an array of {@link InvoicesContact} records.
1016
+ *
1017
+ * @example
1018
+ * ```typescript
1019
+ * const contacts = await client.invoices.contacts.listByWorkspace('ws_abc123', {
1020
+ * page: 1,
1021
+ * pageSize: 50,
1022
+ * });
1023
+ * ```
1024
+ */
1025
+ listByWorkspace: (workspaceId: string, options?: {
1026
+ page?: number;
1027
+ pageSize?: number;
1028
+ } & RequestOptions) => Promise<InvoicesContact[]>;
1029
+ };
1030
+ /**
1031
+ * Activities -- read-only audit trail of invoice events.
1032
+ *
1033
+ * Activities record all significant events in the invoice lifecycle:
1034
+ * creation, status transitions, payments, AI suggestions applied, etc.
1035
+ * Activities are system-generated and cannot be created or modified
1036
+ * through the API.
1037
+ */
1038
+ activities: {
1039
+ /**
1040
+ * Fetch a single activity by its unique ID.
1041
+ *
1042
+ * @param id - The unique identifier of the activity to retrieve.
1043
+ * @param options - Optional request-level overrides.
1044
+ * @returns A promise that resolves to the matching {@link InvoicesActivity}.
1045
+ *
1046
+ * @example
1047
+ * ```typescript
1048
+ * const activity = await client.invoices.activities.get('act_abc123');
1049
+ * console.log(activity.attributes.activity_type);
1050
+ * ```
1051
+ */
1052
+ get: (id: string, options?: RequestOptions) => Promise<InvoicesActivity>;
1053
+ };
1054
+ };
1055
+ //# sourceMappingURL=invoices.d.ts.map