@openmeter/sdk 1.0.0-beta.21 → 1.0.0-beta.210

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 (138) hide show
  1. package/README.md +38 -150
  2. package/dist/cjs/index.cjs +18 -0
  3. package/dist/cjs/index.d.cts +1 -0
  4. package/dist/cjs/index.js.map +1 -0
  5. package/dist/cjs/src/client/apps.cjs +174 -0
  6. package/dist/cjs/src/client/apps.d.cts +285 -0
  7. package/dist/cjs/src/client/apps.js.map +1 -0
  8. package/dist/cjs/src/client/billing.cjs +309 -0
  9. package/dist/cjs/src/client/billing.d.cts +502 -0
  10. package/dist/cjs/src/client/billing.js.map +1 -0
  11. package/dist/cjs/src/client/common.cjs +47 -0
  12. package/dist/cjs/src/client/common.d.cts +30 -0
  13. package/dist/cjs/src/client/common.js.map +1 -0
  14. package/dist/cjs/src/client/customers.cjs +199 -0
  15. package/dist/cjs/src/client/customers.d.cts +176 -0
  16. package/dist/cjs/src/client/customers.js.map +1 -0
  17. package/dist/cjs/src/client/entitlements.cjs +244 -0
  18. package/dist/cjs/src/client/entitlements.d.cts +472 -0
  19. package/dist/cjs/src/client/entitlements.js.map +1 -0
  20. package/dist/cjs/src/client/events.cjs +66 -0
  21. package/dist/cjs/src/client/events.d.cts +31 -0
  22. package/dist/cjs/src/client/events.js.map +1 -0
  23. package/dist/cjs/src/client/features.cjs +78 -0
  24. package/dist/cjs/src/client/features.d.cts +78 -0
  25. package/dist/cjs/src/client/features.js.map +1 -0
  26. package/dist/cjs/src/client/index.cjs +108 -0
  27. package/dist/cjs/src/client/index.d.cts +45 -0
  28. package/dist/cjs/src/client/index.js.map +1 -0
  29. package/dist/cjs/src/client/meters.cjs +96 -0
  30. package/dist/cjs/src/client/meters.d.cts +99 -0
  31. package/dist/cjs/src/client/meters.js.map +1 -0
  32. package/dist/cjs/src/client/notifications.cjs +249 -0
  33. package/dist/cjs/src/client/notifications.d.cts +219 -0
  34. package/dist/cjs/src/client/notifications.js.map +1 -0
  35. package/dist/cjs/src/client/plans.cjs +127 -0
  36. package/dist/cjs/src/client/plans.d.cts +142 -0
  37. package/dist/cjs/src/client/plans.js.map +1 -0
  38. package/dist/cjs/src/client/portal.cjs +55 -0
  39. package/dist/cjs/src/client/portal.d.cts +48 -0
  40. package/dist/cjs/src/client/portal.js.map +1 -0
  41. package/dist/cjs/src/client/schemas.cjs +3 -0
  42. package/dist/cjs/src/client/schemas.d.cts +22268 -0
  43. package/dist/cjs/src/client/schemas.js.map +1 -0
  44. package/dist/cjs/src/client/subjects.cjs +76 -0
  45. package/dist/cjs/src/client/subjects.d.cts +70 -0
  46. package/dist/cjs/src/client/subjects.js.map +1 -0
  47. package/dist/cjs/src/client/subscriptions.cjs +116 -0
  48. package/dist/cjs/src/client/subscriptions.d.cts +147 -0
  49. package/dist/cjs/src/client/subscriptions.js.map +1 -0
  50. package/dist/cjs/src/client/utils.cjs +69 -0
  51. package/dist/cjs/src/client/utils.d.cts +12 -0
  52. package/dist/cjs/src/client/utils.js.map +1 -0
  53. package/dist/cjs/src/portal/index.cjs +60 -0
  54. package/dist/cjs/src/portal/index.d.cts +43 -0
  55. package/dist/cjs/src/portal/index.js.map +1 -0
  56. package/dist/cjs/src/react/context.cjs +35 -0
  57. package/dist/cjs/src/react/context.d.cts +9 -0
  58. package/dist/cjs/src/react/context.js.map +1 -0
  59. package/dist/cjs/tsconfig.1232d5e5.tsbuildinfo +1 -0
  60. package/dist/cjs/tsconfig.90ca0b5f.tsbuildinfo +1 -0
  61. package/dist/index.d.ts +1 -14
  62. package/dist/index.js +2 -15
  63. package/dist/index.js.map +1 -0
  64. package/dist/src/client/apps.d.ts +285 -0
  65. package/dist/src/client/apps.js +168 -0
  66. package/dist/src/client/apps.js.map +1 -0
  67. package/dist/src/client/billing.d.ts +502 -0
  68. package/dist/src/client/billing.js +302 -0
  69. package/dist/src/client/billing.js.map +1 -0
  70. package/dist/src/client/common.d.ts +30 -0
  71. package/dist/src/client/common.js +42 -0
  72. package/dist/src/client/common.js.map +1 -0
  73. package/dist/src/client/customers.d.ts +176 -0
  74. package/dist/src/client/customers.js +193 -0
  75. package/dist/src/client/customers.js.map +1 -0
  76. package/dist/src/client/entitlements.d.ts +472 -0
  77. package/dist/src/client/entitlements.js +239 -0
  78. package/dist/src/client/entitlements.js.map +1 -0
  79. package/dist/src/client/events.d.ts +31 -0
  80. package/dist/src/client/events.js +58 -0
  81. package/dist/src/client/events.js.map +1 -0
  82. package/dist/src/client/features.d.ts +78 -0
  83. package/dist/src/client/features.js +74 -0
  84. package/dist/src/client/features.js.map +1 -0
  85. package/dist/src/client/index.d.ts +45 -0
  86. package/dist/src/client/index.js +68 -0
  87. package/dist/src/client/index.js.map +1 -0
  88. package/dist/src/client/meters.d.ts +99 -0
  89. package/dist/src/client/meters.js +92 -0
  90. package/dist/src/client/meters.js.map +1 -0
  91. package/dist/src/client/notifications.d.ts +219 -0
  92. package/dist/src/client/notifications.js +242 -0
  93. package/dist/src/client/notifications.js.map +1 -0
  94. package/dist/src/client/plans.d.ts +142 -0
  95. package/dist/src/client/plans.js +123 -0
  96. package/dist/src/client/plans.js.map +1 -0
  97. package/dist/src/client/portal.d.ts +48 -0
  98. package/dist/src/client/portal.js +51 -0
  99. package/dist/src/client/portal.js.map +1 -0
  100. package/dist/src/client/schemas.d.ts +22268 -0
  101. package/dist/src/client/schemas.js +2 -0
  102. package/dist/src/client/schemas.js.map +1 -0
  103. package/dist/src/client/subjects.d.ts +70 -0
  104. package/dist/src/client/subjects.js +72 -0
  105. package/dist/src/client/subjects.js.map +1 -0
  106. package/dist/src/client/subscriptions.d.ts +147 -0
  107. package/dist/src/client/subscriptions.js +112 -0
  108. package/dist/src/client/subscriptions.js.map +1 -0
  109. package/dist/src/client/utils.d.ts +12 -0
  110. package/dist/src/client/utils.js +63 -0
  111. package/dist/src/client/utils.js.map +1 -0
  112. package/dist/src/portal/index.d.ts +43 -0
  113. package/dist/src/portal/index.js +53 -0
  114. package/dist/src/portal/index.js.map +1 -0
  115. package/dist/src/react/context.d.ts +9 -0
  116. package/dist/src/react/context.js +16 -0
  117. package/dist/src/react/context.js.map +1 -0
  118. package/dist/tsconfig.tsbuildinfo +1 -1
  119. package/package.json +75 -35
  120. package/patches/openapi-typescript.patch +73 -0
  121. package/dist/clients/client.d.ts +0 -40
  122. package/dist/clients/client.js +0 -104
  123. package/dist/clients/event.d.ts +0 -79
  124. package/dist/clients/event.js +0 -53
  125. package/dist/clients/meter.d.ts +0 -96
  126. package/dist/clients/meter.js +0 -64
  127. package/dist/clients/portal.d.ts +0 -23
  128. package/dist/clients/portal.js +0 -37
  129. package/dist/next.d.ts +0 -15
  130. package/dist/next.js +0 -46
  131. package/dist/schemas/openapi.d.ts +0 -460
  132. package/dist/schemas/openapi.js +0 -5
  133. package/dist/test/agent.d.ts +0 -2
  134. package/dist/test/agent.js +0 -178
  135. package/dist/test/mocks.d.ts +0 -12
  136. package/dist/test/mocks.js +0 -32
  137. package/index.ts +0 -22
  138. package/next.ts +0 -76
@@ -0,0 +1,502 @@
1
+ import type { RequestOptions } from './common.cjs';
2
+ import type { BillingProfileCreate, BillingProfileCustomerOverrideCreate, BillingProfileReplaceUpdateWithWorkflow, InvoicePendingLineCreate, InvoiceReplaceUpdate, InvoiceSimulationInput, operations, paths, VoidInvoiceActionInput } from './schemas.cjs';
3
+ import type { Client } from 'openapi-fetch';
4
+ /**
5
+ * Billing
6
+ */
7
+ export declare class Billing {
8
+ private client;
9
+ profiles: BillingProfiles;
10
+ invoices: BillingInvoices;
11
+ customers: BillingCustomers;
12
+ constructor(client: Client<paths, `${string}/${string}`>);
13
+ }
14
+ /**
15
+ * Billing Profiles
16
+ */
17
+ export declare class BillingProfiles {
18
+ private client;
19
+ constructor(client: Client<paths, `${string}/${string}`>);
20
+ /**
21
+ * Create a billing profile
22
+ * @param billingProfile - The billing profile to create
23
+ * @param signal - An optional abort signal
24
+ * @returns The created billing profile
25
+ */
26
+ create(billingProfile: BillingProfileCreate, options?: RequestOptions): Promise<{
27
+ readonly id: string;
28
+ name: string;
29
+ description?: string;
30
+ metadata?: import("./schemas.cjs").components["schemas"]["Metadata"] | null;
31
+ readonly createdAt: Date;
32
+ readonly updatedAt: Date;
33
+ readonly deletedAt?: Date;
34
+ supplier: import("./schemas.cjs").components["schemas"]["BillingParty"];
35
+ readonly workflow: import("./schemas.cjs").components["schemas"]["BillingWorkflow"];
36
+ readonly apps: import("./schemas.cjs").components["schemas"]["BillingProfileAppsOrReference"];
37
+ default: boolean;
38
+ }>;
39
+ /**
40
+ * Get a billing profile by ID
41
+ * @param id - The ID of the billing profile to get
42
+ * @param signal - An optional abort signal
43
+ * @returns The billing profile
44
+ */
45
+ get(id: operations['getBillingProfile']['parameters']['path']['id'], options?: RequestOptions): Promise<{
46
+ readonly id: string;
47
+ name: string;
48
+ description?: string;
49
+ metadata?: import("./schemas.cjs").components["schemas"]["Metadata"] | null;
50
+ readonly createdAt: Date;
51
+ readonly updatedAt: Date;
52
+ readonly deletedAt?: Date;
53
+ supplier: import("./schemas.cjs").components["schemas"]["BillingParty"];
54
+ readonly workflow: import("./schemas.cjs").components["schemas"]["BillingWorkflow"];
55
+ readonly apps: import("./schemas.cjs").components["schemas"]["BillingProfileAppsOrReference"];
56
+ default: boolean;
57
+ }>;
58
+ /**
59
+ * List billing profiles
60
+ * @param query - The query parameters
61
+ * @param signal - An optional abort signal
62
+ * @returns The billing profiles
63
+ */
64
+ list(query?: operations['listBillingProfiles']['parameters']['query'], options?: RequestOptions): Promise<{
65
+ totalCount: number;
66
+ page: number;
67
+ pageSize: number;
68
+ items: import("./schemas.cjs").components["schemas"]["BillingProfile"][];
69
+ }>;
70
+ /**
71
+ * Update a billing profile
72
+ * @param id - The ID of the billing profile to update
73
+ * @param billingProfile - The billing profile to update
74
+ * @param signal - An optional abort signal
75
+ * @returns The updated billing profile
76
+ */
77
+ update(id: operations['updateBillingProfile']['parameters']['path']['id'], billingProfile: BillingProfileReplaceUpdateWithWorkflow, options?: RequestOptions): Promise<{
78
+ readonly id: string;
79
+ name: string;
80
+ description?: string;
81
+ metadata?: import("./schemas.cjs").components["schemas"]["Metadata"] | null;
82
+ readonly createdAt: Date;
83
+ readonly updatedAt: Date;
84
+ readonly deletedAt?: Date;
85
+ supplier: import("./schemas.cjs").components["schemas"]["BillingParty"];
86
+ readonly workflow: import("./schemas.cjs").components["schemas"]["BillingWorkflow"];
87
+ readonly apps: import("./schemas.cjs").components["schemas"]["BillingProfileAppsOrReference"];
88
+ default: boolean;
89
+ }>;
90
+ }
91
+ /**
92
+ * Billing Invoices
93
+ */
94
+ export declare class BillingInvoices {
95
+ private client;
96
+ constructor(client: Client<paths, `${string}/${string}`>);
97
+ /**
98
+ * List invoices
99
+ * @param query - The query parameters
100
+ * @param signal - An optional abort signal
101
+ * @returns The invoices
102
+ */
103
+ list(query?: operations['listInvoices']['parameters']['query'], options?: RequestOptions): Promise<{
104
+ totalCount: number;
105
+ page: number;
106
+ pageSize: number;
107
+ items: import("./schemas.cjs").components["schemas"]["Invoice"][];
108
+ }>;
109
+ /**
110
+ * Get an invoice by ID
111
+ * @param id - The ID of the invoice to get
112
+ * @param signal - An optional abort signal
113
+ * @returns The invoice
114
+ */
115
+ get(id: operations['getInvoice']['parameters']['path']['invoiceId'], options?: RequestOptions): Promise<{
116
+ readonly id: string;
117
+ description?: string;
118
+ metadata?: import("./schemas.cjs").components["schemas"]["Metadata"] | null;
119
+ readonly createdAt: Date;
120
+ readonly updatedAt: Date;
121
+ readonly deletedAt?: Date;
122
+ readonly type: import("./schemas.cjs").components["schemas"]["InvoiceType"];
123
+ supplier: import("./schemas.cjs").components["schemas"]["BillingParty"];
124
+ customer: import("./schemas.cjs").components["schemas"]["BillingParty"];
125
+ readonly number: import("./schemas.cjs").components["schemas"]["InvoiceNumber"];
126
+ currency: import("./schemas.cjs").components["schemas"]["CurrencyCode"];
127
+ readonly preceding?: import("./schemas.cjs").components["schemas"]["InvoiceDocumentRef"][];
128
+ readonly totals: import("./schemas.cjs").components["schemas"]["InvoiceTotals"];
129
+ readonly status: import("./schemas.cjs").components["schemas"]["InvoiceStatus"];
130
+ readonly statusDetails: import("./schemas.cjs").components["schemas"]["InvoiceStatusDetails"];
131
+ readonly issuedAt?: Date;
132
+ draftUntil?: Date;
133
+ readonly dueAt?: Date;
134
+ period?: import("./schemas.cjs").components["schemas"]["Period"];
135
+ readonly voidedAt?: Date;
136
+ readonly sentToCustomerAt?: Date;
137
+ workflow: import("./schemas.cjs").components["schemas"]["InvoiceWorkflowSettings"];
138
+ lines?: import("./schemas.cjs").components["schemas"]["InvoiceLine"][];
139
+ readonly payment?: import("./schemas.cjs").components["schemas"]["InvoicePaymentTerms"];
140
+ readonly validationIssues?: import("./schemas.cjs").components["schemas"]["ValidationIssue"][];
141
+ readonly externalIds?: import("./schemas.cjs").components["schemas"]["InvoiceAppExternalIds"];
142
+ }>;
143
+ /**
144
+ * Update an invoice
145
+ * @description Only invoices in draft or earlier status can be updated.
146
+ * @param id - The ID of the invoice to update
147
+ * @param invoice - The invoice to update
148
+ * @param signal - An optional abort signal
149
+ * @returns The updated invoice
150
+ */
151
+ update(id: operations['updateInvoice']['parameters']['path']['invoiceId'], invoice: InvoiceReplaceUpdate, options?: RequestOptions): Promise<{
152
+ readonly id: string;
153
+ description?: string;
154
+ metadata?: import("./schemas.cjs").components["schemas"]["Metadata"] | null;
155
+ readonly createdAt: Date;
156
+ readonly updatedAt: Date;
157
+ readonly deletedAt?: Date;
158
+ readonly type: import("./schemas.cjs").components["schemas"]["InvoiceType"];
159
+ supplier: import("./schemas.cjs").components["schemas"]["BillingParty"];
160
+ customer: import("./schemas.cjs").components["schemas"]["BillingParty"];
161
+ readonly number: import("./schemas.cjs").components["schemas"]["InvoiceNumber"];
162
+ currency: import("./schemas.cjs").components["schemas"]["CurrencyCode"];
163
+ readonly preceding?: import("./schemas.cjs").components["schemas"]["InvoiceDocumentRef"][];
164
+ readonly totals: import("./schemas.cjs").components["schemas"]["InvoiceTotals"];
165
+ readonly status: import("./schemas.cjs").components["schemas"]["InvoiceStatus"];
166
+ readonly statusDetails: import("./schemas.cjs").components["schemas"]["InvoiceStatusDetails"];
167
+ readonly issuedAt?: Date;
168
+ draftUntil?: Date;
169
+ readonly dueAt?: Date;
170
+ period?: import("./schemas.cjs").components["schemas"]["Period"];
171
+ readonly voidedAt?: Date;
172
+ readonly sentToCustomerAt?: Date;
173
+ workflow: import("./schemas.cjs").components["schemas"]["InvoiceWorkflowSettings"];
174
+ lines?: import("./schemas.cjs").components["schemas"]["InvoiceLine"][];
175
+ readonly payment?: import("./schemas.cjs").components["schemas"]["InvoicePaymentTerms"];
176
+ readonly validationIssues?: import("./schemas.cjs").components["schemas"]["ValidationIssue"][];
177
+ readonly externalIds?: import("./schemas.cjs").components["schemas"]["InvoiceAppExternalIds"];
178
+ }>;
179
+ /**
180
+ * Advance the invoice to the next status
181
+ * @description The call doesn't "approve the invoice", it only advances the invoice to the next status if the transition would be automatic. The action can be called when the invoice's statusDetails' actions field contain the "advance" action.
182
+ * @param id - The ID of the invoice to advance
183
+ * @param signal - An optional abort signal
184
+ * @returns The advanced invoice
185
+ */
186
+ advance(id: operations['advanceInvoiceAction']['parameters']['path']['invoiceId'], options?: RequestOptions): Promise<{
187
+ readonly id: string;
188
+ description?: string;
189
+ metadata?: import("./schemas.cjs").components["schemas"]["Metadata"] | null;
190
+ readonly createdAt: Date;
191
+ readonly updatedAt: Date;
192
+ readonly deletedAt?: Date;
193
+ readonly type: import("./schemas.cjs").components["schemas"]["InvoiceType"];
194
+ supplier: import("./schemas.cjs").components["schemas"]["BillingParty"];
195
+ customer: import("./schemas.cjs").components["schemas"]["BillingParty"];
196
+ readonly number: import("./schemas.cjs").components["schemas"]["InvoiceNumber"];
197
+ currency: import("./schemas.cjs").components["schemas"]["CurrencyCode"];
198
+ readonly preceding?: import("./schemas.cjs").components["schemas"]["InvoiceDocumentRef"][];
199
+ readonly totals: import("./schemas.cjs").components["schemas"]["InvoiceTotals"];
200
+ readonly status: import("./schemas.cjs").components["schemas"]["InvoiceStatus"];
201
+ readonly statusDetails: import("./schemas.cjs").components["schemas"]["InvoiceStatusDetails"];
202
+ readonly issuedAt?: Date;
203
+ draftUntil?: Date;
204
+ readonly dueAt?: Date;
205
+ period?: import("./schemas.cjs").components["schemas"]["Period"];
206
+ readonly voidedAt?: Date;
207
+ readonly sentToCustomerAt?: Date;
208
+ workflow: import("./schemas.cjs").components["schemas"]["InvoiceWorkflowSettings"];
209
+ lines?: import("./schemas.cjs").components["schemas"]["InvoiceLine"][];
210
+ readonly payment?: import("./schemas.cjs").components["schemas"]["InvoicePaymentTerms"];
211
+ readonly validationIssues?: import("./schemas.cjs").components["schemas"]["ValidationIssue"][];
212
+ readonly externalIds?: import("./schemas.cjs").components["schemas"]["InvoiceAppExternalIds"];
213
+ }>;
214
+ /**
215
+ * Approve an invoice
216
+ * @description This call instantly sends the invoice to the customer using the configured billing profile app.
217
+ * @param id - The ID of the invoice to approve
218
+ * @param signal - An optional abort signal
219
+ * @returns The approved invoice
220
+ */
221
+ approve(id: operations['approveInvoiceAction']['parameters']['path']['invoiceId'], options?: RequestOptions): Promise<{
222
+ readonly id: string;
223
+ description?: string;
224
+ metadata?: import("./schemas.cjs").components["schemas"]["Metadata"] | null;
225
+ readonly createdAt: Date;
226
+ readonly updatedAt: Date;
227
+ readonly deletedAt?: Date;
228
+ readonly type: import("./schemas.cjs").components["schemas"]["InvoiceType"];
229
+ supplier: import("./schemas.cjs").components["schemas"]["BillingParty"];
230
+ customer: import("./schemas.cjs").components["schemas"]["BillingParty"];
231
+ readonly number: import("./schemas.cjs").components["schemas"]["InvoiceNumber"];
232
+ currency: import("./schemas.cjs").components["schemas"]["CurrencyCode"];
233
+ readonly preceding?: import("./schemas.cjs").components["schemas"]["InvoiceDocumentRef"][];
234
+ readonly totals: import("./schemas.cjs").components["schemas"]["InvoiceTotals"];
235
+ readonly status: import("./schemas.cjs").components["schemas"]["InvoiceStatus"];
236
+ readonly statusDetails: import("./schemas.cjs").components["schemas"]["InvoiceStatusDetails"];
237
+ readonly issuedAt?: Date;
238
+ draftUntil?: Date;
239
+ readonly dueAt?: Date;
240
+ period?: import("./schemas.cjs").components["schemas"]["Period"];
241
+ readonly voidedAt?: Date;
242
+ readonly sentToCustomerAt?: Date;
243
+ workflow: import("./schemas.cjs").components["schemas"]["InvoiceWorkflowSettings"];
244
+ lines?: import("./schemas.cjs").components["schemas"]["InvoiceLine"][];
245
+ readonly payment?: import("./schemas.cjs").components["schemas"]["InvoicePaymentTerms"];
246
+ readonly validationIssues?: import("./schemas.cjs").components["schemas"]["ValidationIssue"][];
247
+ readonly externalIds?: import("./schemas.cjs").components["schemas"]["InvoiceAppExternalIds"];
248
+ }>;
249
+ /**
250
+ * Retry advancing the invoice after a failed attempt.
251
+ * @param id - The ID of the invoice to retry
252
+ * @param signal - An optional abort signal
253
+ * @returns The retried invoice
254
+ */
255
+ retry(id: operations['retryInvoiceAction']['parameters']['path']['invoiceId'], options?: RequestOptions): Promise<{
256
+ readonly id: string;
257
+ description?: string;
258
+ metadata?: import("./schemas.cjs").components["schemas"]["Metadata"] | null;
259
+ readonly createdAt: Date;
260
+ readonly updatedAt: Date;
261
+ readonly deletedAt?: Date;
262
+ readonly type: import("./schemas.cjs").components["schemas"]["InvoiceType"];
263
+ supplier: import("./schemas.cjs").components["schemas"]["BillingParty"];
264
+ customer: import("./schemas.cjs").components["schemas"]["BillingParty"];
265
+ readonly number: import("./schemas.cjs").components["schemas"]["InvoiceNumber"];
266
+ currency: import("./schemas.cjs").components["schemas"]["CurrencyCode"];
267
+ readonly preceding?: import("./schemas.cjs").components["schemas"]["InvoiceDocumentRef"][];
268
+ readonly totals: import("./schemas.cjs").components["schemas"]["InvoiceTotals"];
269
+ readonly status: import("./schemas.cjs").components["schemas"]["InvoiceStatus"];
270
+ readonly statusDetails: import("./schemas.cjs").components["schemas"]["InvoiceStatusDetails"];
271
+ readonly issuedAt?: Date;
272
+ draftUntil?: Date;
273
+ readonly dueAt?: Date;
274
+ period?: import("./schemas.cjs").components["schemas"]["Period"];
275
+ readonly voidedAt?: Date;
276
+ readonly sentToCustomerAt?: Date;
277
+ workflow: import("./schemas.cjs").components["schemas"]["InvoiceWorkflowSettings"];
278
+ lines?: import("./schemas.cjs").components["schemas"]["InvoiceLine"][];
279
+ readonly payment?: import("./schemas.cjs").components["schemas"]["InvoicePaymentTerms"];
280
+ readonly validationIssues?: import("./schemas.cjs").components["schemas"]["ValidationIssue"][];
281
+ readonly externalIds?: import("./schemas.cjs").components["schemas"]["InvoiceAppExternalIds"];
282
+ }>;
283
+ /**
284
+ * Void an invoice
285
+ * @description Void an invoice
286
+ *
287
+ * Only invoices that have been alread issued can be voided.
288
+ * @param id - The ID of the invoice to void
289
+ * @param signal - An optional abort signal
290
+ * @returns The voided invoice
291
+ */
292
+ void(id: operations['voidInvoiceAction']['parameters']['path']['invoiceId'], body: VoidInvoiceActionInput, options?: RequestOptions): Promise<{
293
+ readonly id: string;
294
+ description?: string;
295
+ metadata?: import("./schemas.cjs").components["schemas"]["Metadata"] | null;
296
+ readonly createdAt: Date;
297
+ readonly updatedAt: Date;
298
+ readonly deletedAt?: Date;
299
+ readonly type: import("./schemas.cjs").components["schemas"]["InvoiceType"];
300
+ supplier: import("./schemas.cjs").components["schemas"]["BillingParty"];
301
+ customer: import("./schemas.cjs").components["schemas"]["BillingParty"];
302
+ readonly number: import("./schemas.cjs").components["schemas"]["InvoiceNumber"];
303
+ currency: import("./schemas.cjs").components["schemas"]["CurrencyCode"];
304
+ readonly preceding?: import("./schemas.cjs").components["schemas"]["InvoiceDocumentRef"][];
305
+ readonly totals: import("./schemas.cjs").components["schemas"]["InvoiceTotals"];
306
+ readonly status: import("./schemas.cjs").components["schemas"]["InvoiceStatus"];
307
+ readonly statusDetails: import("./schemas.cjs").components["schemas"]["InvoiceStatusDetails"];
308
+ readonly issuedAt?: Date;
309
+ draftUntil?: Date;
310
+ readonly dueAt?: Date;
311
+ period?: import("./schemas.cjs").components["schemas"]["Period"];
312
+ readonly voidedAt?: Date;
313
+ readonly sentToCustomerAt?: Date;
314
+ workflow: import("./schemas.cjs").components["schemas"]["InvoiceWorkflowSettings"];
315
+ lines?: import("./schemas.cjs").components["schemas"]["InvoiceLine"][];
316
+ readonly payment?: import("./schemas.cjs").components["schemas"]["InvoicePaymentTerms"];
317
+ readonly validationIssues?: import("./schemas.cjs").components["schemas"]["ValidationIssue"][];
318
+ readonly externalIds?: import("./schemas.cjs").components["schemas"]["InvoiceAppExternalIds"];
319
+ }>;
320
+ /**
321
+ * Recalculate an invoice's tax amounts
322
+ * @param id - The ID of the invoice to recalculate
323
+ * @param signal - An optional abort signal
324
+ * @returns The recalculated invoice
325
+ */
326
+ recalculateTax(id: operations['recalculateInvoiceTaxAction']['parameters']['path']['invoiceId'], options?: RequestOptions): Promise<{
327
+ readonly id: string;
328
+ description?: string;
329
+ metadata?: import("./schemas.cjs").components["schemas"]["Metadata"] | null;
330
+ readonly createdAt: Date;
331
+ readonly updatedAt: Date;
332
+ readonly deletedAt?: Date;
333
+ readonly type: import("./schemas.cjs").components["schemas"]["InvoiceType"];
334
+ supplier: import("./schemas.cjs").components["schemas"]["BillingParty"];
335
+ customer: import("./schemas.cjs").components["schemas"]["BillingParty"];
336
+ readonly number: import("./schemas.cjs").components["schemas"]["InvoiceNumber"];
337
+ currency: import("./schemas.cjs").components["schemas"]["CurrencyCode"];
338
+ readonly preceding?: import("./schemas.cjs").components["schemas"]["InvoiceDocumentRef"][];
339
+ readonly totals: import("./schemas.cjs").components["schemas"]["InvoiceTotals"];
340
+ readonly status: import("./schemas.cjs").components["schemas"]["InvoiceStatus"];
341
+ readonly statusDetails: import("./schemas.cjs").components["schemas"]["InvoiceStatusDetails"];
342
+ readonly issuedAt?: Date;
343
+ draftUntil?: Date;
344
+ readonly dueAt?: Date;
345
+ period?: import("./schemas.cjs").components["schemas"]["Period"];
346
+ readonly voidedAt?: Date;
347
+ readonly sentToCustomerAt?: Date;
348
+ workflow: import("./schemas.cjs").components["schemas"]["InvoiceWorkflowSettings"];
349
+ lines?: import("./schemas.cjs").components["schemas"]["InvoiceLine"][];
350
+ readonly payment?: import("./schemas.cjs").components["schemas"]["InvoicePaymentTerms"];
351
+ readonly validationIssues?: import("./schemas.cjs").components["schemas"]["ValidationIssue"][];
352
+ readonly externalIds?: import("./schemas.cjs").components["schemas"]["InvoiceAppExternalIds"];
353
+ }>;
354
+ /**
355
+ * Simulate an invoice for a customer
356
+ * @param id - The ID of the customer to simulate the invoice for
357
+ * @param signal - An optional abort signal
358
+ * @returns The simulated invoice
359
+ */
360
+ simulate(id: operations['simulateInvoice']['parameters']['path']['customerId'], body: InvoiceSimulationInput, options?: RequestOptions): Promise<{
361
+ readonly id: string;
362
+ description?: string;
363
+ metadata?: import("./schemas.cjs").components["schemas"]["Metadata"] | null;
364
+ readonly createdAt: Date;
365
+ readonly updatedAt: Date;
366
+ readonly deletedAt?: Date;
367
+ readonly type: import("./schemas.cjs").components["schemas"]["InvoiceType"];
368
+ supplier: import("./schemas.cjs").components["schemas"]["BillingParty"];
369
+ customer: import("./schemas.cjs").components["schemas"]["BillingParty"];
370
+ readonly number: import("./schemas.cjs").components["schemas"]["InvoiceNumber"];
371
+ currency: import("./schemas.cjs").components["schemas"]["CurrencyCode"];
372
+ readonly preceding?: import("./schemas.cjs").components["schemas"]["InvoiceDocumentRef"][];
373
+ readonly totals: import("./schemas.cjs").components["schemas"]["InvoiceTotals"];
374
+ readonly status: import("./schemas.cjs").components["schemas"]["InvoiceStatus"];
375
+ readonly statusDetails: import("./schemas.cjs").components["schemas"]["InvoiceStatusDetails"];
376
+ readonly issuedAt?: Date;
377
+ draftUntil?: Date;
378
+ readonly dueAt?: Date;
379
+ period?: import("./schemas.cjs").components["schemas"]["Period"];
380
+ readonly voidedAt?: Date;
381
+ readonly sentToCustomerAt?: Date;
382
+ workflow: import("./schemas.cjs").components["schemas"]["InvoiceWorkflowSettings"];
383
+ lines?: import("./schemas.cjs").components["schemas"]["InvoiceLine"][];
384
+ readonly payment?: import("./schemas.cjs").components["schemas"]["InvoicePaymentTerms"];
385
+ readonly validationIssues?: import("./schemas.cjs").components["schemas"]["ValidationIssue"][];
386
+ readonly externalIds?: import("./schemas.cjs").components["schemas"]["InvoiceAppExternalIds"];
387
+ }>;
388
+ /**
389
+ * Create pending invoice line items
390
+ * @param body - The pending invoice line items to create
391
+ * @param signal - An optional abort signal
392
+ * @returns The created pending invoice line items
393
+ */
394
+ createLineItems(body: InvoicePendingLineCreate[], options?: RequestOptions): Promise<({
395
+ name: string;
396
+ description?: string;
397
+ metadata?: import("./schemas.cjs").components["schemas"]["Metadata"] | null;
398
+ readonly createdAt: Date;
399
+ readonly updatedAt: Date;
400
+ readonly deletedAt?: Date;
401
+ id: string;
402
+ readonly managedBy: import("./schemas.cjs").components["schemas"]["InvoiceLineManagedBy"];
403
+ readonly status: import("./schemas.cjs").components["schemas"]["InvoiceLineStatus"];
404
+ readonly discounts?: import("./schemas.cjs").components["schemas"]["InvoiceLineDiscounts"];
405
+ invoice?: import("./schemas.cjs").components["schemas"]["InvoiceReference"];
406
+ currency: import("./schemas.cjs").components["schemas"]["CurrencyCode"];
407
+ readonly taxes?: import("./schemas.cjs").components["schemas"]["InvoiceLineTaxItem"][];
408
+ taxConfig?: import("./schemas.cjs").components["schemas"]["TaxConfig"];
409
+ readonly children?: import("./schemas.cjs").components["schemas"]["InvoiceLine"][];
410
+ readonly totals: import("./schemas.cjs").components["schemas"]["InvoiceTotals"];
411
+ period: import("./schemas.cjs").components["schemas"]["Period"];
412
+ invoiceAt: Date;
413
+ readonly externalIds?: import("./schemas.cjs").components["schemas"]["InvoiceLineAppExternalIds"];
414
+ readonly subscription?: import("./schemas.cjs").components["schemas"]["InvoiceLineSubscriptionReference"];
415
+ type: "usage_based";
416
+ price?: import("./schemas.cjs").components["schemas"]["RateCardUsageBasedPrice"];
417
+ featureKey?: string;
418
+ rateCard?: import("./schemas.cjs").components["schemas"]["InvoiceUsageBasedRateCard"];
419
+ readonly quantity?: import("./schemas.cjs").components["schemas"]["Numeric"];
420
+ readonly meteredQuantity?: import("./schemas.cjs").components["schemas"]["Numeric"];
421
+ readonly preLinePeriodQuantity?: import("./schemas.cjs").components["schemas"]["Numeric"];
422
+ readonly meteredPreLinePeriodQuantity?: import("./schemas.cjs").components["schemas"]["Numeric"];
423
+ } | {
424
+ name: string;
425
+ description?: string;
426
+ metadata?: import("./schemas.cjs").components["schemas"]["Metadata"] | null;
427
+ readonly createdAt: Date;
428
+ readonly updatedAt: Date;
429
+ readonly deletedAt?: Date;
430
+ id: string;
431
+ readonly managedBy: import("./schemas.cjs").components["schemas"]["InvoiceLineManagedBy"];
432
+ readonly status: import("./schemas.cjs").components["schemas"]["InvoiceLineStatus"];
433
+ readonly discounts?: import("./schemas.cjs").components["schemas"]["InvoiceLineDiscounts"];
434
+ invoice?: import("./schemas.cjs").components["schemas"]["InvoiceReference"];
435
+ currency: import("./schemas.cjs").components["schemas"]["CurrencyCode"];
436
+ readonly taxes?: import("./schemas.cjs").components["schemas"]["InvoiceLineTaxItem"][];
437
+ taxConfig?: import("./schemas.cjs").components["schemas"]["TaxConfig"];
438
+ readonly children?: import("./schemas.cjs").components["schemas"]["InvoiceLine"][];
439
+ readonly totals: import("./schemas.cjs").components["schemas"]["InvoiceTotals"];
440
+ period: import("./schemas.cjs").components["schemas"]["Period"];
441
+ invoiceAt: Date;
442
+ readonly externalIds?: import("./schemas.cjs").components["schemas"]["InvoiceLineAppExternalIds"];
443
+ readonly subscription?: import("./schemas.cjs").components["schemas"]["InvoiceLineSubscriptionReference"];
444
+ type: "flat_fee";
445
+ perUnitAmount?: import("./schemas.cjs").components["schemas"]["Numeric"];
446
+ paymentTerm?: import("./schemas.cjs").components["schemas"]["PricePaymentTerm"];
447
+ quantity?: import("./schemas.cjs").components["schemas"]["Numeric"];
448
+ rateCard?: import("./schemas.cjs").components["schemas"]["InvoiceFlatFeeRateCard"];
449
+ category?: import("./schemas.cjs").components["schemas"]["InvoiceFlatFeeCategory"];
450
+ })[]>;
451
+ }
452
+ /**
453
+ * Billing Customer Invoices and Overrides
454
+ */
455
+ export declare class BillingCustomers {
456
+ private client;
457
+ constructor(client: Client<paths, `${string}/${string}`>);
458
+ /**
459
+ * Create or update a customer override
460
+ * @param id - The ID of the customer to create the override for
461
+ * @param body - The customer override to create
462
+ * @param signal - An optional abort signal
463
+ * @returns The created customer override
464
+ */
465
+ createOverride(id: operations['upsertBillingProfileCustomerOverride']['parameters']['path']['customerId'], body: BillingProfileCustomerOverrideCreate, options?: RequestOptions): Promise<{
466
+ customerOverride?: import("./schemas.cjs").components["schemas"]["BillingProfileCustomerOverride"];
467
+ baseBillingProfileId: string;
468
+ customerProfile?: import("./schemas.cjs").components["schemas"]["BillingCustomerProfile"];
469
+ customer?: import("./schemas.cjs").components["schemas"]["Customer"];
470
+ }>;
471
+ /**
472
+ * Get a customer override
473
+ * @param id - The ID of the customer to get the override for
474
+ * @param signal - An optional abort signal
475
+ * @returns The customer override
476
+ */
477
+ getOverride(id: operations['getBillingProfileCustomerOverride']['parameters']['path']['customerId'], options?: RequestOptions): Promise<{
478
+ customerOverride?: import("./schemas.cjs").components["schemas"]["BillingProfileCustomerOverride"];
479
+ baseBillingProfileId: string;
480
+ customerProfile?: import("./schemas.cjs").components["schemas"]["BillingCustomerProfile"];
481
+ customer?: import("./schemas.cjs").components["schemas"]["Customer"];
482
+ }>;
483
+ /**
484
+ * List customer overrides
485
+ * @param query - The query parameters
486
+ * @param signal - An optional abort signal
487
+ * @returns The customer overrides
488
+ */
489
+ listOverrides(query?: operations['listBillingProfileCustomerOverrides']['parameters']['query'], options?: RequestOptions): Promise<{
490
+ totalCount: number;
491
+ page: number;
492
+ pageSize: number;
493
+ items: import("./schemas.cjs").components["schemas"]["BillingProfileCustomerOverrideWithDetails"][];
494
+ }>;
495
+ /**
496
+ * Delete a customer override
497
+ * @param id - The ID of the customer to delete the override for
498
+ * @param signal - An optional abort signal
499
+ * @returns The deleted customer override
500
+ */
501
+ deleteOverride(id: operations['deleteBillingProfileCustomerOverride']['parameters']['path']['customerId'], options?: RequestOptions): Promise<undefined>;
502
+ }
@@ -0,0 +1 @@
1
+ {"version":3,"file":"billing.js","sourceRoot":"","sources":["../../../../src/client/billing.ts"],"names":[],"mappings":";;;AAAA,yCAA8C;AAc9C;;GAEG;AACH,MAAa,OAAO;IAKE;IAJb,QAAQ,CAAiB;IACzB,QAAQ,CAAiB;IACzB,SAAS,CAAkB;IAElC,YAAoB,MAA4C;QAA5C,WAAM,GAAN,MAAM,CAAsC;QAC9D,IAAI,CAAC,QAAQ,GAAG,IAAI,eAAe,CAAC,IAAI,CAAC,MAAM,CAAC,CAAA;QAChD,IAAI,CAAC,QAAQ,GAAG,IAAI,eAAe,CAAC,IAAI,CAAC,MAAM,CAAC,CAAA;QAChD,IAAI,CAAC,SAAS,GAAG,IAAI,gBAAgB,CAAC,IAAI,CAAC,MAAM,CAAC,CAAA;IACpD,CAAC;CACF;AAVD,0BAUC;AAED;;GAEG;AACH,MAAa,eAAe;IACN;IAApB,YAAoB,MAA4C;QAA5C,WAAM,GAAN,MAAM,CAAsC;IAAG,CAAC;IAEpE;;;;;OAKG;IACI,KAAK,CAAC,MAAM,CACjB,cAAoC,EACpC,OAAwB;QAExB,MAAM,IAAI,GAAG,MAAM,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,0BAA0B,EAAE;YAC9D,IAAI,EAAE,cAAc;YACpB,GAAG,OAAO;SACX,CAAC,CAAA;QAEF,OAAO,IAAA,4BAAiB,EAAC,IAAI,CAAC,CAAA;IAChC,CAAC;IAED;;;;;OAKG;IACI,KAAK,CAAC,GAAG,CACd,EAA+D,EAC/D,OAAwB;QAExB,MAAM,IAAI,GAAG,MAAM,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,+BAA+B,EAAE;YAClE,MAAM,EAAE;gBACN,IAAI,EAAE,EAAE,EAAE,EAAE;aACb;YACD,GAAG,OAAO;SACX,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,CAAC,CAAA;QAEF,OAAO,IAAA,4BAAiB,EAAC,IAAI,CAAC,CAAA;IAChC,CAAC;IAED;;;;;OAKG;IACI,KAAK,CAAC,cAAc,CACzB,EAA0F,EAC1F,OAAwB;QAExB,MAAM,IAAI,GAAG,MAAM,IAAI,CAAC,MAAM,CAAC,MAAM,CACnC,wCAAwC,EACxC;YACE,MAAM,EAAE,EAAE,IAAI,EAAE,EAAE,UAAU,EAAE,EAAE,EAAE,EAAE;YACpC,GAAG,OAAO;SACX,CACF,CAAA;QAED,OAAO,IAAA,4BAAiB,EAAC,IAAI,CAAC,CAAA;IAChC,CAAC;CACF;AAtFD,4CAsFC"}
@@ -0,0 +1,47 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.HTTPError = void 0;
4
+ exports.isHTTPError = isHTTPError;
5
+ /**
6
+ * An error that occurred during an HTTP request
7
+ */
8
+ class HTTPError extends Error {
9
+ message;
10
+ type;
11
+ title;
12
+ status;
13
+ url;
14
+ __raw;
15
+ name = 'HTTPError';
16
+ client = 'OpenMeter';
17
+ constructor(message, type, title, status, url, __raw) {
18
+ super(message);
19
+ this.message = message;
20
+ this.type = type;
21
+ this.title = title;
22
+ this.status = status;
23
+ this.url = url;
24
+ this.__raw = __raw;
25
+ }
26
+ static fromResponse(resp) {
27
+ if (resp.response.headers.get('Content-Type') ===
28
+ 'application/problem+json' &&
29
+ resp.error) {
30
+ return new HTTPError(`Request failed (${resp.response.url}) [${resp.response.status}]: ${resp.error.detail}`, resp.error.type, resp.error.title, resp.error.status ?? resp.response.status, resp.response.url, resp.error);
31
+ }
32
+ return new HTTPError(`Request failed (${resp.response.url}) [${resp.response.status}]: ${resp.response.statusText}`, resp.response.statusText, resp.response.statusText, resp.response.status, resp.response.url);
33
+ }
34
+ getField(key) {
35
+ return this.__raw?.[key];
36
+ }
37
+ }
38
+ exports.HTTPError = HTTPError;
39
+ /**
40
+ * Check if an error is an HTTPError
41
+ * @param error - The error to check
42
+ * @returns Whether the error is an HTTPError
43
+ */
44
+ function isHTTPError(error) {
45
+ return error instanceof HTTPError;
46
+ }
47
+ //# sourceMappingURL=common.js.map
@@ -0,0 +1,30 @@
1
+ import type { UnexpectedProblemResponse } from './schemas.cjs';
2
+ /**
3
+ * Request options
4
+ */
5
+ export type RequestOptions = Pick<RequestInit, 'signal'>;
6
+ /**
7
+ * An error that occurred during an HTTP request
8
+ */
9
+ export declare class HTTPError extends Error {
10
+ message: string;
11
+ type: string;
12
+ title: string;
13
+ status: number;
14
+ url: string;
15
+ protected __raw?: Record<string, any> | undefined;
16
+ name: string;
17
+ client: string;
18
+ constructor(message: string, type: string, title: string, status: number, url: string, __raw?: Record<string, any> | undefined);
19
+ static fromResponse(resp: {
20
+ response: Response;
21
+ error?: UnexpectedProblemResponse;
22
+ }): HTTPError;
23
+ getField(key: string): any;
24
+ }
25
+ /**
26
+ * Check if an error is an HTTPError
27
+ * @param error - The error to check
28
+ * @returns Whether the error is an HTTPError
29
+ */
30
+ export declare function isHTTPError(error: unknown): error is HTTPError;
@@ -0,0 +1 @@
1
+ {"version":3,"file":"common.js","sourceRoot":"","sources":["../../../../src/client/common.ts"],"names":[],"mappings":";;;AA+DA,kCAEC;AA1DD;;GAEG;AACH,MAAa,SAAU,SAAQ,KAAK;IAKzB;IACA;IACA;IACA;IACA;IACG;IATL,IAAI,GAAG,WAAW,CAAA;IAClB,MAAM,GAAG,WAAW,CAAA;IAE3B,YACS,OAAe,EACf,IAAY,EACZ,KAAa,EACb,MAAc,EACd,GAAW,EACR,KAA2B;QAErC,KAAK,CAAC,OAAO,CAAC,CAAA;QAPP,YAAO,GAAP,OAAO,CAAQ;QACf,SAAI,GAAJ,IAAI,CAAQ;QACZ,UAAK,GAAL,KAAK,CAAQ;QACb,WAAM,GAAN,MAAM,CAAQ;QACd,QAAG,GAAH,GAAG,CAAQ;QACR,UAAK,GAAL,KAAK,CAAsB;IAGvC,CAAC;IAED,MAAM,CAAC,YAAY,CAAC,IA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