@leaflow/sdk 0.116.0 → 0.117.1

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 (63) hide show
  1. package/dist/billing/v1/generated/functions.d.ts +172 -35
  2. package/dist/billing/v1/generated/functions.js +199 -29
  3. package/dist/billing/v1/generated/models.d.ts +247 -105
  4. package/dist/billing/v1/generated/models.js +14 -5
  5. package/dist/billing/v1/generated/schemas.zod.d.ts +125 -31
  6. package/dist/billing/v1/generated/schemas.zod.js +128 -22
  7. package/dist/billing/v1/generated/validators/accountBalance.zod.d.ts +3 -1
  8. package/dist/billing/v1/generated/validators/accountBalance.zod.js +5 -3
  9. package/dist/billing/v1/generated/validators/billingAccount.zod.d.ts +1 -9
  10. package/dist/billing/v1/generated/validators/billingAccount.zod.js +4 -12
  11. package/dist/billing/v1/generated/validators/billingAccountCreate.zod.d.ts +0 -4
  12. package/dist/billing/v1/generated/validators/billingAccountCreate.zod.js +0 -4
  13. package/dist/billing/v1/generated/validators/billingAccountList.zod.d.ts +1 -9
  14. package/dist/billing/v1/generated/validators/billingAccountUpdate.zod.d.ts +1 -19
  15. package/dist/billing/v1/generated/validators/billingAccountUpdate.zod.js +4 -23
  16. package/dist/billing/v1/generated/validators/contact.zod.d.ts +37 -0
  17. package/dist/billing/v1/generated/validators/contact.zod.js +37 -0
  18. package/dist/billing/v1/generated/validators/contactCreate.zod.d.ts +32 -0
  19. package/dist/billing/v1/generated/validators/contactCreate.zod.js +30 -0
  20. package/dist/billing/v1/generated/validators/contactList.zod.d.ts +34 -0
  21. package/dist/billing/v1/generated/validators/contactList.zod.js +14 -0
  22. package/dist/billing/v1/generated/validators/contactUpdate.zod.d.ts +33 -0
  23. package/dist/billing/v1/generated/validators/contactUpdate.zod.js +31 -0
  24. package/dist/billing/v1/generated/validators/getStatementUsageParams.zod.d.ts +29 -0
  25. package/dist/billing/v1/generated/validators/getStatementUsageParams.zod.js +33 -0
  26. package/dist/billing/v1/generated/validators/invoice.zod.d.ts +1 -6
  27. package/dist/billing/v1/generated/validators/invoice.zod.js +4 -8
  28. package/dist/billing/v1/generated/validators/invoiceItem.zod.d.ts +0 -2
  29. package/dist/billing/v1/generated/validators/invoiceItem.zod.js +0 -5
  30. package/dist/billing/v1/generated/validators/invoiceItemList.zod.d.ts +0 -2
  31. package/dist/billing/v1/generated/validators/invoiceList.zod.d.ts +1 -6
  32. package/dist/billing/v1/generated/validators/invoiceStatus.zod.js +1 -1
  33. package/dist/billing/v1/generated/validators/listContactsParams.zod.d.ts +18 -0
  34. package/dist/billing/v1/generated/validators/listContactsParams.zod.js +20 -0
  35. package/dist/billing/v1/generated/validators/listStatementsParams.zod.d.ts +25 -0
  36. package/dist/billing/v1/generated/validators/listStatementsParams.zod.js +25 -0
  37. package/dist/billing/v1/generated/validators/listUsageChargesParams.zod.d.ts +1 -0
  38. package/dist/billing/v1/generated/validators/listUsageChargesParams.zod.js +1 -0
  39. package/dist/billing/v1/generated/validators/order.zod.d.ts +1 -0
  40. package/dist/billing/v1/generated/validators/orderItem.zod.d.ts +1 -0
  41. package/dist/billing/v1/generated/validators/orderItem.zod.js +4 -0
  42. package/dist/billing/v1/generated/validators/orderItemList.zod.d.ts +1 -0
  43. package/dist/billing/v1/generated/validators/orderList.zod.d.ts +1 -0
  44. package/dist/billing/v1/generated/validators/statement.zod.d.ts +34 -0
  45. package/dist/billing/v1/generated/validators/statement.zod.js +36 -0
  46. package/dist/billing/v1/generated/validators/statementAmounts.zod.d.ts +16 -0
  47. package/dist/billing/v1/generated/validators/statementAmounts.zod.js +15 -0
  48. package/dist/billing/v1/generated/validators/statementItem.zod.d.ts +20 -0
  49. package/dist/billing/v1/generated/validators/statementItem.zod.js +25 -0
  50. package/dist/billing/v1/generated/validators/statementList.zod.d.ts +41 -0
  51. package/dist/billing/v1/generated/validators/statementList.zod.js +14 -0
  52. package/dist/billing/v1/generated/validators/statementStatus.zod.d.ts +14 -0
  53. package/dist/billing/v1/generated/validators/statementStatus.zod.js +9 -0
  54. package/dist/billing/v1/generated/validators/statementSummary.zod.d.ts +36 -0
  55. package/dist/billing/v1/generated/validators/statementSummary.zod.js +19 -0
  56. package/dist/billing/v1/generated/validators/usageCharge.zod.d.ts +1 -0
  57. package/dist/billing/v1/generated/validators/usageCharge.zod.js +3 -2
  58. package/dist/billing/v1/generated/validators/usageChargeList.zod.d.ts +1 -0
  59. package/dist/routes.d.ts +64 -8
  60. package/dist/routes.js +72 -9
  61. package/package.json +1 -1
  62. package/dist/billing/v1/generated/validators/meteredUsage.zod.d.ts +0 -20
  63. package/dist/billing/v1/generated/validators/meteredUsage.zod.js +0 -27
@@ -6,6 +6,70 @@
6
6
  * OpenAPI spec version: v1
7
7
  */
8
8
  import * as zod from "zod";
9
+ /**
10
+ * @summary List contacts
11
+ */
12
+ export declare const ListContactsParams: zod.ZodObject<{
13
+ accountId: zod.ZodInt;
14
+ }, zod.z.core.$strict>;
15
+ export declare const listContactsQueryPageDefault = 1;
16
+ export declare const listContactsQueryPageMax = 2147483647;
17
+ export declare const listContactsQueryPageSizeDefault = 50;
18
+ export declare const listContactsQueryPageSizeMax = 200;
19
+ export declare const ListContactsQueryParams: zod.ZodObject<{
20
+ page: zod.ZodDefault<zod.ZodInt>;
21
+ page_size: zod.ZodDefault<zod.ZodInt>;
22
+ }, zod.z.core.$strict>;
23
+ /**
24
+ * @summary Create contact
25
+ */
26
+ export declare const CreateContactParams: zod.ZodObject<{
27
+ accountId: zod.ZodInt;
28
+ }, zod.z.core.$strict>;
29
+ export declare const CreateContactBody: zod.ZodObject<{
30
+ name: zod.ZodString;
31
+ legal_name: zod.ZodOptional<zod.ZodString>;
32
+ email: zod.ZodOptional<zod.ZodString>;
33
+ tax_id: zod.ZodOptional<zod.ZodString>;
34
+ address_line1: zod.ZodOptional<zod.ZodString>;
35
+ address_line2: zod.ZodOptional<zod.ZodString>;
36
+ address_city: zod.ZodOptional<zod.ZodString>;
37
+ address_state: zod.ZodOptional<zod.ZodString>;
38
+ address_postal_code: zod.ZodOptional<zod.ZodString>;
39
+ address_country: zod.ZodOptional<zod.ZodString>;
40
+ }, zod.z.core.$strict>;
41
+ /**
42
+ * @summary Get contact
43
+ */
44
+ export declare const GetContactParams: zod.ZodObject<{
45
+ contactId: zod.ZodUUID;
46
+ }, zod.z.core.$strict>;
47
+ /**
48
+ * @summary Update contact
49
+ */
50
+ export declare const UpdateContactParams: zod.ZodObject<{
51
+ contactId: zod.ZodUUID;
52
+ }, zod.z.core.$strict>;
53
+ export declare const UpdateContactBody: zod.ZodObject<{
54
+ name: zod.ZodOptional<zod.ZodString>;
55
+ legal_name: zod.ZodOptional<zod.ZodString>;
56
+ email: zod.ZodOptional<zod.ZodString>;
57
+ tax_id: zod.ZodOptional<zod.ZodString>;
58
+ address_line1: zod.ZodOptional<zod.ZodString>;
59
+ address_line2: zod.ZodOptional<zod.ZodString>;
60
+ address_city: zod.ZodOptional<zod.ZodString>;
61
+ address_state: zod.ZodOptional<zod.ZodString>;
62
+ address_postal_code: zod.ZodOptional<zod.ZodString>;
63
+ address_country: zod.ZodOptional<zod.ZodString>;
64
+ active: zod.ZodOptional<zod.ZodBoolean>;
65
+ }, zod.z.core.$strict>;
66
+ /**
67
+ * The selected invoice contact must be cleared or replaced before deletion. Issued invoice snapshots are retained.
68
+ * @summary Delete contact
69
+ */
70
+ export declare const DeleteContactParams: zod.ZodObject<{
71
+ contactId: zod.ZodUUID;
72
+ }, zod.z.core.$strict>;
9
73
  /**
10
74
  * The currencies a new billing account can be opened in. A retired currency is not listed,
11
75
  * although accounts already opened in it keep working. Results are paginated.
@@ -40,8 +104,6 @@ export declare const ListBillingAccountsQueryParams: zod.ZodObject<{
40
104
  export declare const CreateBillingAccountBody: zod.ZodObject<{
41
105
  currency: zod.ZodString;
42
106
  name: zod.ZodOptional<zod.ZodString>;
43
- legal_name: zod.ZodOptional<zod.ZodString>;
44
- email: zod.ZodOptional<zod.ZodString>;
45
107
  }, zod.z.core.$strict>;
46
108
  /**
47
109
  * @summary Get billing account
@@ -50,26 +112,17 @@ export declare const GetBillingAccountParams: zod.ZodObject<{
50
112
  accountId: zod.ZodInt;
51
113
  }, zod.z.core.$strict>;
52
114
  /**
53
- * The legal name, address and tax identifier are copied onto each invoice when it is
54
- * issued. Changing them here affects invoices issued afterwards, not those already sent.
55
- *
56
- * The currency cannot be changed.
115
+ * Select an active contact belonging to this account for future invoices. Its legal name,
116
+ * address and tax identifier are copied when an invoice is issued; issued snapshots are
117
+ * retained. Set invoice_contact_id to null to clear the selection. The currency cannot change.
57
118
  * @summary Update billing account
58
119
  */
59
120
  export declare const UpdateBillingAccountParams: zod.ZodObject<{
60
121
  accountId: zod.ZodInt;
61
122
  }, zod.z.core.$strict>;
62
123
  export declare const UpdateBillingAccountBody: zod.ZodObject<{
124
+ invoice_contact_id: zod.ZodOptional<zod.ZodNullable<zod.ZodUUID>>;
63
125
  name: zod.ZodOptional<zod.ZodString>;
64
- legal_name: zod.ZodOptional<zod.ZodString>;
65
- email: zod.ZodOptional<zod.ZodString>;
66
- address_line1: zod.ZodOptional<zod.ZodString>;
67
- address_line2: zod.ZodOptional<zod.ZodString>;
68
- address_city: zod.ZodOptional<zod.ZodString>;
69
- address_state: zod.ZodOptional<zod.ZodString>;
70
- address_postal_code: zod.ZodOptional<zod.ZodString>;
71
- address_country: zod.ZodOptional<zod.ZodString>;
72
- tax_id: zod.ZodOptional<zod.ZodString>;
73
126
  }, zod.z.core.$strict>;
74
127
  /**
75
128
  * @summary Get account balance
@@ -77,15 +130,6 @@ export declare const UpdateBillingAccountBody: zod.ZodObject<{
77
130
  export declare const GetAccountBalanceParams: zod.ZodObject<{
78
131
  accountId: zod.ZodInt;
79
132
  }, zod.z.core.$strict>;
80
- /**
81
- * Whether the account has anything billed by usage, and what that usage has cost over the last
82
- * seven days. Usage is paid from the balance, so this tells how much of the balance it is likely
83
- * to need: the balance divided by `average_daily_amount` is roughly how many days it lasts.
84
- * @summary Get account metered usage
85
- */
86
- export declare const GetAccountMeteredUsageParams: zod.ZodObject<{
87
- accountId: zod.ZodInt;
88
- }, zod.z.core.$strict>;
89
133
  /**
90
134
  * Lists the payment gateways and methods that currently accept payment in this account's currency, the
91
135
  * preferred gateway first. Top-ups and invoice payments must name a gateway and method listed here;
@@ -480,9 +524,7 @@ export declare const ListRefundsQueryParams: zod.ZodObject<{
480
524
  order_id: zod.ZodOptional<zod.ZodUUID>;
481
525
  }, zod.z.core.$strict>;
482
526
  /**
483
- * Each charge is added to the month's usage invoice as it is priced, summed into one line per
484
- * subscription, project, resource, meter and rate. Filter by `invoice_item_id` to see the
485
- * charges behind a line. Charges still waiting to be priced are included too.
527
+ * Lists priced and unrated usage charges. Requires `statement_id`, `invoice_item_id`, or both `from` and `to` spanning at most 31 days; use the statement summary or spend report for longer periods. Charges are summed into one line per subscription, project, resource, meter and rate when their statement closes; filter by `invoice_item_id` to see the charges behind a line. Unrated charges had no applicable price when the usage occurred and are not billed.
486
528
  *
487
529
  * Only charges recorded against your billing accounts are included, before filtering, counting and pagination. Reassigning a project does not move previously recorded charges to its new account.
488
530
  * @summary List usage charges
@@ -505,6 +547,7 @@ export declare const ListUsageChargesQueryParams: zod.ZodObject<{
505
547
  to: zod.ZodOptional<zod.z.ZodISODateTime>;
506
548
  project_ids: zod.ZodOptional<zod.ZodArray<zod.ZodUUID>>;
507
549
  meter_id: zod.ZodOptional<zod.ZodUUID>;
550
+ statement_id: zod.ZodOptional<zod.ZodUUID>;
508
551
  }, zod.z.core.$strict>;
509
552
  /**
510
553
  * Lists subscriptions visible to the authorized billing account. Soft-deleted subscriptions are excluded.
@@ -1159,10 +1202,11 @@ export declare const ListActiveResourcesQueryParams: zod.ZodObject<{
1159
1202
  }>>;
1160
1203
  }, zod.z.core.$strict>;
1161
1204
  /**
1162
- * Aggregates rated and invoiced usage charges in the specified time range for one billing account.
1163
- * Includes usage not yet invoiced. Project filters use the account recorded on each charge, including
1164
- * charges for projects later assigned to another account. The total covers all matching groups, not
1165
- * just the returned page.
1205
+ * Sums priced usage for one billing account by UTC day, including usage not yet invoiced. Amounts are
1206
+ * before tax and before the tier adjustments made when a statement closes; minimum charges added at
1207
+ * closing are included. `from` and `to` must fall on UTC day boundaries and span at most 92 days.
1208
+ * Project filters use the account recorded on each charge, including charges for projects later
1209
+ * assigned to another account. The total covers all matching groups, not just the returned page.
1166
1210
  * @summary List account spend
1167
1211
  */
1168
1212
  export declare const listSpendQueryGroupByDefault = "product";
@@ -1187,3 +1231,53 @@ export declare const ListSpendQueryParams: zod.ZodObject<{
1187
1231
  billing_account_id: zod.ZodInt;
1188
1232
  project_ids: zod.ZodOptional<zod.ZodArray<zod.ZodUUID>>;
1189
1233
  }, zod.z.core.$strict>;
1234
+ /**
1235
+ * @summary List statements
1236
+ */
1237
+ export declare const listStatementsQueryPageDefault = 1;
1238
+ export declare const listStatementsQueryPageMax = 2147483647;
1239
+ export declare const listStatementsQueryPageSizeDefault = 50;
1240
+ export declare const listStatementsQueryPageSizeMax = 200;
1241
+ export declare const ListStatementsQueryParams: zod.ZodObject<{
1242
+ billing_account_id: zod.ZodOptional<zod.ZodInt>;
1243
+ status: zod.ZodOptional<zod.ZodEnum<{
1244
+ open: "open";
1245
+ closed: "closed";
1246
+ }>>;
1247
+ from: zod.ZodOptional<zod.z.ZodISODateTime>;
1248
+ to: zod.ZodOptional<zod.z.ZodISODateTime>;
1249
+ page: zod.ZodDefault<zod.ZodInt>;
1250
+ page_size: zod.ZodDefault<zod.ZodInt>;
1251
+ }, zod.z.core.$strict>;
1252
+ /**
1253
+ * @summary Get statement
1254
+ */
1255
+ export declare const GetStatementParams: zod.ZodObject<{
1256
+ statementId: zod.ZodUUID;
1257
+ }, zod.z.core.$strict>;
1258
+ /**
1259
+ * Reads the consumption summary that is updated in the same transaction as usage is priced. Group by project, product or meter and filter within the statement. Quantities are included only for meter groups so different units are never combined.
1260
+ * @summary Get grouped consumption
1261
+ */
1262
+ export declare const GetStatementUsageParams: zod.ZodObject<{
1263
+ statementId: zod.ZodUUID;
1264
+ }, zod.z.core.$strict>;
1265
+ export declare const getStatementUsageQueryGroupByDefault = "meter";
1266
+ export declare const getStatementUsageQueryProjectIdsMax = 100;
1267
+ export declare const getStatementUsageQueryProductIdMax = 64;
1268
+ export declare const getStatementUsageQueryPageDefault = 1;
1269
+ export declare const getStatementUsageQueryPageMax = 2147483647;
1270
+ export declare const getStatementUsageQueryPageSizeDefault = 50;
1271
+ export declare const getStatementUsageQueryPageSizeMax = 200;
1272
+ export declare const GetStatementUsageQueryParams: zod.ZodObject<{
1273
+ group_by: zod.ZodDefault<zod.ZodEnum<{
1274
+ project: "project";
1275
+ product: "product";
1276
+ meter: "meter";
1277
+ }>>;
1278
+ project_ids: zod.ZodOptional<zod.ZodArray<zod.ZodUUID>>;
1279
+ product_id: zod.ZodOptional<zod.ZodString>;
1280
+ meter_id: zod.ZodOptional<zod.ZodUUID>;
1281
+ page: zod.ZodDefault<zod.ZodInt>;
1282
+ page_size: zod.ZodDefault<zod.ZodInt>;
1283
+ }, zod.z.core.$strict>;
@@ -12,6 +12,8 @@ import { BillingAccountUpdate } from "./validators/billingAccountUpdate.zod.js";
12
12
  import { CancelSubscriptionRequest } from "./validators/cancelSubscriptionRequest.zod.js";
13
13
  import { CancellationCreate } from "./validators/cancellationCreate.zod.js";
14
14
  import { CheckoutOrderRequest } from "./validators/checkoutOrderRequest.zod.js";
15
+ import { ContactCreate } from "./validators/contactCreate.zod.js";
16
+ import { ContactUpdate } from "./validators/contactUpdate.zod.js";
15
17
  import { OrderCancel } from "./validators/orderCancel.zod.js";
16
18
  import { PayInvoiceRequest } from "./validators/payInvoiceRequest.zod.js";
17
19
  import { PayTogetherRequest } from "./validators/payTogetherRequest.zod.js";
@@ -21,6 +23,57 @@ import { RenewRequest } from "./validators/renewRequest.zod.js";
21
23
  import { RenewalOrderRequest } from "./validators/renewalOrderRequest.zod.js";
22
24
  import { SetProjectAssignmentRequest } from "./validators/setProjectAssignmentRequest.zod.js";
23
25
  import { TopUpCreate } from "./validators/topUpCreate.zod.js";
26
+ /**
27
+ * @summary List contacts
28
+ */
29
+ export const ListContactsParams = zod.strictObject({
30
+ accountId: zod.int(),
31
+ });
32
+ export const listContactsQueryPageDefault = 1;
33
+ export const listContactsQueryPageMax = 2147483647;
34
+ export const listContactsQueryPageSizeDefault = 50;
35
+ export const listContactsQueryPageSizeMax = 200;
36
+ export const ListContactsQueryParams = zod.strictObject({
37
+ page: zod
38
+ .int()
39
+ .min(1)
40
+ .max(listContactsQueryPageMax)
41
+ .default(listContactsQueryPageDefault)
42
+ .describe("1-based page number. Defaults to 1."),
43
+ page_size: zod
44
+ .int()
45
+ .min(1)
46
+ .max(listContactsQueryPageSizeMax)
47
+ .default(listContactsQueryPageSizeDefault)
48
+ .describe("Items per page. Defaults to 50; at most 200."),
49
+ });
50
+ /**
51
+ * @summary Create contact
52
+ */
53
+ export const CreateContactParams = zod.strictObject({
54
+ accountId: zod.int(),
55
+ });
56
+ export const CreateContactBody = ContactCreate;
57
+ /**
58
+ * @summary Get contact
59
+ */
60
+ export const GetContactParams = zod.strictObject({
61
+ contactId: zod.uuid(),
62
+ });
63
+ /**
64
+ * @summary Update contact
65
+ */
66
+ export const UpdateContactParams = zod.strictObject({
67
+ contactId: zod.uuid(),
68
+ });
69
+ export const UpdateContactBody = ContactUpdate;
70
+ /**
71
+ * The selected invoice contact must be cleared or replaced before deletion. Issued invoice snapshots are retained.
72
+ * @summary Delete contact
73
+ */
74
+ export const DeleteContactParams = zod.strictObject({
75
+ contactId: zod.uuid(),
76
+ });
24
77
  /**
25
78
  * The currencies a new billing account can be opened in. A retired currency is not listed,
26
79
  * although accounts already opened in it keep working. Results are paginated.
@@ -80,10 +133,9 @@ export const GetBillingAccountParams = zod.strictObject({
80
133
  accountId: zod.int(),
81
134
  });
82
135
  /**
83
- * The legal name, address and tax identifier are copied onto each invoice when it is
84
- * issued. Changing them here affects invoices issued afterwards, not those already sent.
85
- *
86
- * The currency cannot be changed.
136
+ * Select an active contact belonging to this account for future invoices. Its legal name,
137
+ * address and tax identifier are copied when an invoice is issued; issued snapshots are
138
+ * retained. Set invoice_contact_id to null to clear the selection. The currency cannot change.
87
139
  * @summary Update billing account
88
140
  */
89
141
  export const UpdateBillingAccountParams = zod.strictObject({
@@ -96,15 +148,6 @@ export const UpdateBillingAccountBody = BillingAccountUpdate;
96
148
  export const GetAccountBalanceParams = zod.strictObject({
97
149
  accountId: zod.int(),
98
150
  });
99
- /**
100
- * Whether the account has anything billed by usage, and what that usage has cost over the last
101
- * seven days. Usage is paid from the balance, so this tells how much of the balance it is likely
102
- * to need: the balance divided by `average_daily_amount` is roughly how many days it lasts.
103
- * @summary Get account metered usage
104
- */
105
- export const GetAccountMeteredUsageParams = zod.strictObject({
106
- accountId: zod.int(),
107
- });
108
151
  /**
109
152
  * Lists the payment gateways and methods that currently accept payment in this account's currency, the
110
153
  * preferred gateway first. Top-ups and invoice payments must name a gateway and method listed here;
@@ -415,7 +458,7 @@ export const ListInvoicesQueryParams = zod.strictObject({
415
458
  status: zod
416
459
  .enum(["draft", "open", "paid", "refunded", "void", "uncollectible"])
417
460
  .optional()
418
- .describe("An order invoice stays `draft` until checkout confirms its discount and final amounts. It\ncannot be collected while draft. Confirmation makes it `open`, or `paid` when its total is zero\nwithout creating a payment transaction. A quote never changes this status.\n\nA usage invoice stays `draft` through its month: each charge is added to it as it is priced\nand paid from credits and balance as it goes. It is issued at the end of the month, becoming\n`paid` when everything was covered and `open` when something is still owed.\n\n`refunded` means the invoice was paid and has since been refunded in full; a partial refund\nleaves it `paid`, with the refunded part in `amount_refunded`.\n\n`void` means the invoice will not be paid and holds no money: nothing was paid, or its order\nfailed or was canceled and everything paid toward it has been returned, as `amount_paid` and\n`amount_refunded` show."),
461
+ .describe("Draft invoices are private to administrators and cannot be read, listed or paid by customers.\nAn issued invoice is open until settled; a zero-total issued invoice is immediately paid.\nUnbilled usage remains separate from invoices until it is invoiced.\nrefunded means a full refund; a partial refund leaves the invoice paid.\nvoid means collection has stopped and any funds received have been returned."),
419
462
  from: zod.iso.datetime({ offset: true }).optional(),
420
463
  to: zod.iso.datetime({ offset: true }).optional().describe("Exclusive."),
421
464
  });
@@ -622,9 +665,7 @@ export const ListRefundsQueryParams = zod.strictObject({
622
665
  .describe("Only the refunds that belong to this order: those of its invoice, such as the refund of a\npurchase that could not be delivered, and those it caused on an earlier invoice, such as\nthe difference returned after a downgrade."),
623
666
  });
624
667
  /**
625
- * Each charge is added to the month's usage invoice as it is priced, summed into one line per
626
- * subscription, project, resource, meter and rate. Filter by `invoice_item_id` to see the
627
- * charges behind a line. Charges still waiting to be priced are included too.
668
+ * Lists priced and unrated usage charges. Requires `statement_id`, `invoice_item_id`, or both `from` and `to` spanning at most 31 days; use the statement summary or spend report for longer periods. Charges are summed into one line per subscription, project, resource, meter and rate when their statement closes; filter by `invoice_item_id` to see the charges behind a line. Unrated charges had no applicable price when the usage occurred and are not billed.
628
669
  *
629
670
  * Only charges recorded against your billing accounts are included, before filtering, counting and pagination. Reassigning a project does not move previously recorded charges to its new account.
630
671
  * @summary List usage charges
@@ -674,6 +715,7 @@ export const ListUsageChargesQueryParams = zod.strictObject({
674
715
  .optional()
675
716
  .describe("Restrict the account-authorized results to these projects. Omit for all projects and account-level records. This filter does not grant access to another billing account."),
676
717
  meter_id: zod.uuid().optional(),
718
+ statement_id: zod.uuid().optional(),
677
719
  });
678
720
  /**
679
721
  * Lists subscriptions visible to the authorized billing account. Soft-deleted subscriptions are excluded.
@@ -1453,10 +1495,11 @@ export const ListActiveResourcesQueryParams = zod.strictObject({
1453
1495
  status: zod.enum(["active", "suspended", "closing", "completed"]).optional(),
1454
1496
  });
1455
1497
  /**
1456
- * Aggregates rated and invoiced usage charges in the specified time range for one billing account.
1457
- * Includes usage not yet invoiced. Project filters use the account recorded on each charge, including
1458
- * charges for projects later assigned to another account. The total covers all matching groups, not
1459
- * just the returned page.
1498
+ * Sums priced usage for one billing account by UTC day, including usage not yet invoiced. Amounts are
1499
+ * before tax and before the tier adjustments made when a statement closes; minimum charges added at
1500
+ * closing are included. `from` and `to` must fall on UTC day boundaries and span at most 92 days.
1501
+ * Project filters use the account recorded on each charge, including charges for projects later
1502
+ * assigned to another account. The total covers all matching groups, not just the returned page.
1460
1503
  * @summary List account spend
1461
1504
  */
1462
1505
  export const listSpendQueryGroupByDefault = `product`;
@@ -1475,7 +1518,7 @@ export const ListSpendQueryParams = zod.strictObject({
1475
1518
  group_by: zod
1476
1519
  .enum(["product", "plan", "resource"])
1477
1520
  .default(listSpendQueryGroupByDefault)
1478
- .describe("`resource` groups by the resource each charge names. Items billed under their own\nidentifier — a disk, a public address — appear as their own rows rather than under\nthe machine they are attached to, since the relationship between them is known to\nthe owning service and not here."),
1521
+ .describe("`plan` groups by the plan of the price each charge was priced with, which stays the same after the\nsubscription changes plan. `resource` groups by the resource each charge names. Items billed under their own\nidentifier — a disk, a public address — appear as their own rows rather than under\nthe machine they are attached to, since the relationship between them is known to\nthe owning service and not here."),
1479
1522
  product_id: zod
1480
1523
  .string()
1481
1524
  .min(1)
@@ -1505,3 +1548,66 @@ export const ListSpendQueryParams = zod.strictObject({
1505
1548
  .optional()
1506
1549
  .describe("Restrict the account-authorized results to these projects. Omit for all projects and account-level records. This filter does not grant access to another billing account."),
1507
1550
  });
1551
+ /**
1552
+ * @summary List statements
1553
+ */
1554
+ export const listStatementsQueryPageDefault = 1;
1555
+ export const listStatementsQueryPageMax = 2147483647;
1556
+ export const listStatementsQueryPageSizeDefault = 50;
1557
+ export const listStatementsQueryPageSizeMax = 200;
1558
+ export const ListStatementsQueryParams = zod.strictObject({
1559
+ billing_account_id: zod.int().optional(),
1560
+ status: zod.enum(["open", "closed"]).optional(),
1561
+ from: zod.iso.datetime({ offset: true }).optional(),
1562
+ to: zod.iso.datetime({ offset: true }).optional(),
1563
+ page: zod
1564
+ .int()
1565
+ .min(1)
1566
+ .max(listStatementsQueryPageMax)
1567
+ .default(listStatementsQueryPageDefault)
1568
+ .describe("1-based page number. Defaults to 1."),
1569
+ page_size: zod
1570
+ .int()
1571
+ .min(1)
1572
+ .max(listStatementsQueryPageSizeMax)
1573
+ .default(listStatementsQueryPageSizeDefault)
1574
+ .describe("Items per page. Defaults to 50; at most 200."),
1575
+ });
1576
+ /**
1577
+ * @summary Get statement
1578
+ */
1579
+ export const GetStatementParams = zod.strictObject({
1580
+ statementId: zod.uuid(),
1581
+ });
1582
+ /**
1583
+ * Reads the consumption summary that is updated in the same transaction as usage is priced. Group by project, product or meter and filter within the statement. Quantities are included only for meter groups so different units are never combined.
1584
+ * @summary Get grouped consumption
1585
+ */
1586
+ export const GetStatementUsageParams = zod.strictObject({
1587
+ statementId: zod.uuid(),
1588
+ });
1589
+ export const getStatementUsageQueryGroupByDefault = `meter`;
1590
+ export const getStatementUsageQueryProjectIdsMax = 100;
1591
+ export const getStatementUsageQueryProductIdMax = 64;
1592
+ export const getStatementUsageQueryPageDefault = 1;
1593
+ export const getStatementUsageQueryPageMax = 2147483647;
1594
+ export const getStatementUsageQueryPageSizeDefault = 50;
1595
+ export const getStatementUsageQueryPageSizeMax = 200;
1596
+ export const GetStatementUsageQueryParams = zod.strictObject({
1597
+ group_by: zod.enum(["project", "product", "meter"]).default(getStatementUsageQueryGroupByDefault),
1598
+ project_ids: zod.array(zod.uuid()).max(getStatementUsageQueryProjectIdsMax).optional(),
1599
+ product_id: zod.string().max(getStatementUsageQueryProductIdMax).optional(),
1600
+ meter_id: zod.uuid().optional(),
1601
+ page: zod
1602
+ .int()
1603
+ .min(1)
1604
+ .max(getStatementUsageQueryPageMax)
1605
+ .default(getStatementUsageQueryPageDefault)
1606
+ .describe("1-based page number. Defaults to 1."),
1607
+ page_size: zod
1608
+ .int()
1609
+ .min(1)
1610
+ .max(getStatementUsageQueryPageSizeMax)
1611
+ .default(getStatementUsageQueryPageSizeDefault)
1612
+ .describe("Items per page. Defaults to 50; at most 200."),
1613
+ });
@@ -7,11 +7,12 @@
7
7
  */
8
8
  import * as zod from "zod";
9
9
  export declare const AccountBalance: zod.ZodObject<{
10
+ available_credit: zod.ZodString;
11
+ unbilled_amount: zod.ZodString;
10
12
  billing_account_id: zod.ZodInt;
11
13
  currency: zod.ZodString;
12
14
  balance: zod.ZodString;
13
15
  credits: zod.ZodString;
14
- total: zod.ZodString;
15
16
  restricted_credits: zod.ZodString;
16
17
  credit_groups: zod.ZodArray<zod.ZodObject<{
17
18
  applies_to: zod.ZodObject<{
@@ -116,6 +117,7 @@ export declare const AccountBalance: zod.ZodObject<{
116
117
  amount: zod.ZodString;
117
118
  }, zod.z.core.$strict>>;
118
119
  due: zod.ZodString;
120
+ pending_returns_amount: zod.ZodString;
119
121
  }, zod.z.core.$strict>;
120
122
  export type AccountBalance = zod.input<typeof AccountBalance>;
121
123
  export type AccountBalanceOutput = zod.output<typeof AccountBalance>;
@@ -10,15 +10,17 @@ import { CreditGroup } from "./creditGroup.zod.js";
10
10
  import { Money } from "./money.zod.js";
11
11
  export const AccountBalance = zod
12
12
  .strictObject({
13
+ available_credit: Money.describe("Balance minus pending balance returns, unbilled usage estimates and issued unpaid amounts. Credit grants are excluded; the result may be negative."),
14
+ unbilled_amount: Money.describe("Current estimate of rated usage that has not been invoiced. Final pricing and tax are fixed at issuance."),
13
15
  billing_account_id: zod.int(),
14
16
  currency: zod.string(),
15
17
  balance: Money.describe("Prepaid funds in the account currency, excluding credits. May be negative after a payment\ndispute. Outstanding charges are reported separately in due; this value is not a withdrawal quote."),
16
18
  credits: Money.describe("The recorded remaining credit, including restricted grants. It is not withdrawable\nand is not part of balance. credit_groups describes currently valid credit by permitted use; a positive\ncredits balance does not imply that due is zero."),
17
- total: Money.describe("balance plus credits, the sum shown as the account's funds. Credits count at their recorded remaining\namount, including restricted grants that only pay for what they allow, so total is an upper bound of what\nthe account can pay with rather than a withdrawable amount. due is reported separately and is not subtracted."),
18
- restricted_credits: Money.describe("The part of currently valid credit that only pays for what its restrictions allow, such as a single\nservice, a billing type or a first purchase. The rest of the valid credit pays for anything on the account.\nIncluded in credits and therefore in total."),
19
+ restricted_credits: Money.describe("Currently valid credit whose use has applicable product, operation or eligibility conditions. Included in credits, separate from the balance."),
19
20
  credit_groups: zod
20
21
  .array(CreditGroup)
21
22
  .describe("Currently valid, unspent credit grouped by permitted use. Restrictions and\nvalidity dates determine which charges a group can cover, so these groups are not a general\nspendable balance and may differ from the recorded credits total."),
22
- due: Money.describe("Owed and not yet paid: metered usage that balance and applicable credit could not cover as it was\ncharged, and issued usage invoices still unpaid. The account is in arrears while this\nis above zero. Topping up pays it on the next collection."),
23
+ due: Money.describe("Amount still payable on issued invoices. Unbilled usage is reported separately; arrears depend on actual eligible funding and grace terms."),
24
+ pending_returns_amount: Money,
23
25
  })
24
26
  .describe("Account balance, credits, and unpaid charges are reported separately.");
@@ -7,17 +7,9 @@
7
7
  */
8
8
  import * as zod from "zod";
9
9
  export declare const BillingAccount: zod.ZodObject<{
10
+ invoice_contact_id: zod.ZodOptional<zod.ZodNullable<zod.ZodUUID>>;
10
11
  id: zod.ZodInt;
11
12
  name: zod.ZodOptional<zod.ZodString>;
12
- legal_name: zod.ZodOptional<zod.ZodString>;
13
- email: zod.ZodOptional<zod.ZodString>;
14
- address_line1: zod.ZodOptional<zod.ZodString>;
15
- address_line2: zod.ZodOptional<zod.ZodString>;
16
- address_city: zod.ZodOptional<zod.ZodString>;
17
- address_state: zod.ZodOptional<zod.ZodString>;
18
- address_postal_code: zod.ZodOptional<zod.ZodString>;
19
- address_country: zod.ZodOptional<zod.ZodString>;
20
- tax_id: zod.ZodOptional<zod.ZodString>;
21
13
  currency: zod.ZodString;
22
14
  status: zod.ZodEnum<{
23
15
  active: "active";
@@ -7,20 +7,12 @@
7
7
  */
8
8
  import * as zod from "zod";
9
9
  export const BillingAccount = zod.strictObject({
10
+ invoice_contact_id: zod
11
+ .uuid()
12
+ .nullish()
13
+ .describe("The active contact used for invoicing. Must belong to this account; null clears the selection."),
10
14
  id: zod.int(),
11
15
  name: zod.string().optional().describe("What you call this account."),
12
- legal_name: zod
13
- .string()
14
- .optional()
15
- .describe("The name invoices are made out to. Copied onto each invoice when it is issued."),
16
- email: zod.string().optional().describe("Where invoices are sent."),
17
- address_line1: zod.string().optional(),
18
- address_line2: zod.string().optional(),
19
- address_city: zod.string().optional(),
20
- address_state: zod.string().optional(),
21
- address_postal_code: zod.string().optional(),
22
- address_country: zod.string().optional().describe("Two-letter code."),
23
- tax_id: zod.string().optional(),
24
16
  currency: zod.string().describe("Fixed when the account was opened."),
25
17
  status: zod.enum(["active", "suspended", "closed"]),
26
18
  grace_amount: zod
@@ -9,13 +9,9 @@ import * as zod from "zod";
9
9
  export declare const billingAccountCreateCurrencyMin = 3;
10
10
  export declare const billingAccountCreateCurrencyMax = 3;
11
11
  export declare const billingAccountCreateNameMax = 255;
12
- export declare const billingAccountCreateLegalNameMax = 255;
13
- export declare const billingAccountCreateEmailMax = 255;
14
12
  export declare const BillingAccountCreate: zod.ZodObject<{
15
13
  currency: zod.ZodString;
16
14
  name: zod.ZodOptional<zod.ZodString>;
17
- legal_name: zod.ZodOptional<zod.ZodString>;
18
- email: zod.ZodOptional<zod.ZodString>;
19
15
  }, zod.z.core.$strict>;
20
16
  export type BillingAccountCreate = zod.input<typeof BillingAccountCreate>;
21
17
  export type BillingAccountCreateOutput = zod.output<typeof BillingAccountCreate>;
@@ -9,11 +9,7 @@ import * as zod from "zod";
9
9
  export const billingAccountCreateCurrencyMin = 3;
10
10
  export const billingAccountCreateCurrencyMax = 3;
11
11
  export const billingAccountCreateNameMax = 255;
12
- export const billingAccountCreateLegalNameMax = 255;
13
- export const billingAccountCreateEmailMax = 255;
14
12
  export const BillingAccountCreate = zod.strictObject({
15
13
  currency: zod.string().min(billingAccountCreateCurrencyMin).max(billingAccountCreateCurrencyMax),
16
14
  name: zod.string().max(billingAccountCreateNameMax).optional(),
17
- legal_name: zod.string().max(billingAccountCreateLegalNameMax).optional(),
18
- email: zod.string().max(billingAccountCreateEmailMax).optional(),
19
15
  });
@@ -8,17 +8,9 @@
8
8
  import * as zod from "zod";
9
9
  export declare const BillingAccountList: zod.ZodObject<{
10
10
  items: zod.ZodArray<zod.ZodObject<{
11
+ invoice_contact_id: zod.ZodOptional<zod.ZodNullable<zod.ZodUUID>>;
11
12
  id: zod.ZodInt;
12
13
  name: zod.ZodOptional<zod.ZodString>;
13
- legal_name: zod.ZodOptional<zod.ZodString>;
14
- email: zod.ZodOptional<zod.ZodString>;
15
- address_line1: zod.ZodOptional<zod.ZodString>;
16
- address_line2: zod.ZodOptional<zod.ZodString>;
17
- address_city: zod.ZodOptional<zod.ZodString>;
18
- address_state: zod.ZodOptional<zod.ZodString>;
19
- address_postal_code: zod.ZodOptional<zod.ZodString>;
20
- address_country: zod.ZodOptional<zod.ZodString>;
21
- tax_id: zod.ZodOptional<zod.ZodString>;
22
14
  currency: zod.ZodString;
23
15
  status: zod.ZodEnum<{
24
16
  active: "active";
@@ -7,27 +7,9 @@
7
7
  */
8
8
  import * as zod from "zod";
9
9
  export declare const billingAccountUpdateNameMax = 255;
10
- export declare const billingAccountUpdateLegalNameMax = 255;
11
- export declare const billingAccountUpdateEmailMax = 255;
12
- export declare const billingAccountUpdateAddressLine1Max = 255;
13
- export declare const billingAccountUpdateAddressLine2Max = 255;
14
- export declare const billingAccountUpdateAddressCityMax = 128;
15
- export declare const billingAccountUpdateAddressStateMax = 128;
16
- export declare const billingAccountUpdateAddressPostalCodeMax = 32;
17
- export declare const billingAccountUpdateAddressCountryMin = 2;
18
- export declare const billingAccountUpdateAddressCountryMax = 2;
19
- export declare const billingAccountUpdateTaxIdMax = 64;
20
10
  export declare const BillingAccountUpdate: zod.ZodObject<{
11
+ invoice_contact_id: zod.ZodOptional<zod.ZodNullable<zod.ZodUUID>>;
21
12
  name: zod.ZodOptional<zod.ZodString>;
22
- legal_name: zod.ZodOptional<zod.ZodString>;
23
- email: zod.ZodOptional<zod.ZodString>;
24
- address_line1: zod.ZodOptional<zod.ZodString>;
25
- address_line2: zod.ZodOptional<zod.ZodString>;
26
- address_city: zod.ZodOptional<zod.ZodString>;
27
- address_state: zod.ZodOptional<zod.ZodString>;
28
- address_postal_code: zod.ZodOptional<zod.ZodString>;
29
- address_country: zod.ZodOptional<zod.ZodString>;
30
- tax_id: zod.ZodOptional<zod.ZodString>;
31
13
  }, zod.z.core.$strict>;
32
14
  export type BillingAccountUpdate = zod.input<typeof BillingAccountUpdate>;
33
15
  export type BillingAccountUpdateOutput = zod.output<typeof BillingAccountUpdate>;
@@ -7,29 +7,10 @@
7
7
  */
8
8
  import * as zod from "zod";
9
9
  export const billingAccountUpdateNameMax = 255;
10
- export const billingAccountUpdateLegalNameMax = 255;
11
- export const billingAccountUpdateEmailMax = 255;
12
- export const billingAccountUpdateAddressLine1Max = 255;
13
- export const billingAccountUpdateAddressLine2Max = 255;
14
- export const billingAccountUpdateAddressCityMax = 128;
15
- export const billingAccountUpdateAddressStateMax = 128;
16
- export const billingAccountUpdateAddressPostalCodeMax = 32;
17
- export const billingAccountUpdateAddressCountryMin = 2;
18
- export const billingAccountUpdateAddressCountryMax = 2;
19
- export const billingAccountUpdateTaxIdMax = 64;
20
10
  export const BillingAccountUpdate = zod.strictObject({
11
+ invoice_contact_id: zod
12
+ .uuid()
13
+ .nullish()
14
+ .describe("The active contact used for invoicing. Must belong to this account; null clears the selection."),
21
15
  name: zod.string().max(billingAccountUpdateNameMax).optional(),
22
- legal_name: zod.string().max(billingAccountUpdateLegalNameMax).optional(),
23
- email: zod.string().max(billingAccountUpdateEmailMax).optional(),
24
- address_line1: zod.string().max(billingAccountUpdateAddressLine1Max).optional(),
25
- address_line2: zod.string().max(billingAccountUpdateAddressLine2Max).optional(),
26
- address_city: zod.string().max(billingAccountUpdateAddressCityMax).optional(),
27
- address_state: zod.string().max(billingAccountUpdateAddressStateMax).optional(),
28
- address_postal_code: zod.string().max(billingAccountUpdateAddressPostalCodeMax).optional(),
29
- address_country: zod
30
- .string()
31
- .min(billingAccountUpdateAddressCountryMin)
32
- .max(billingAccountUpdateAddressCountryMax)
33
- .optional(),
34
- tax_id: zod.string().max(billingAccountUpdateTaxIdMax).optional(),
35
16
  });