@openmeter/sdk 1.0.0-beta.2 → 1.0.0-beta.200

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 (137) hide show
  1. package/README.md +44 -65
  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 +259 -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 +510 -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 +185 -0
  15. package/dist/cjs/src/client/customers.d.cts +163 -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 +442 -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 +93 -0
  30. package/dist/cjs/src/client/meters.d.cts +160 -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 +17504 -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 +57 -0
  54. package/dist/cjs/src/portal/index.d.cts +104 -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.0d5556c7.tsbuildinfo +1 -0
  60. package/dist/cjs/tsconfig.3c7da474.tsbuildinfo +1 -0
  61. package/dist/index.d.ts +1 -11
  62. package/dist/index.js +2 -11
  63. package/dist/index.js.map +1 -0
  64. package/dist/src/client/apps.d.ts +259 -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 +510 -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 +163 -0
  74. package/dist/src/client/customers.js +179 -0
  75. package/dist/src/client/customers.js.map +1 -0
  76. package/dist/src/client/entitlements.d.ts +442 -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 +160 -0
  89. package/dist/src/client/meters.js +89 -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 +17504 -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 +104 -0
  113. package/dist/src/portal/index.js +50 -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 +93 -49
  120. package/patches/openapi-typescript.patch +73 -0
  121. package/clients/client.ts +0 -153
  122. package/clients/event.ts +0 -109
  123. package/clients/meter.ts +0 -84
  124. package/dist/clients/client.d.ts +0 -40
  125. package/dist/clients/client.js +0 -101
  126. package/dist/clients/event.d.ts +0 -65
  127. package/dist/clients/event.js +0 -38
  128. package/dist/clients/meter.d.ts +0 -52
  129. package/dist/clients/meter.js +0 -52
  130. package/dist/schemas/openapi.d.ts +0 -414
  131. package/dist/schemas/openapi.js +0 -5
  132. package/dist/test/agent.d.ts +0 -2
  133. package/dist/test/agent.js +0 -105
  134. package/dist/test/mocks.d.ts +0 -11
  135. package/dist/test/mocks.js +0 -21
  136. package/index.ts +0 -17
  137. package/schemas/openapi.ts +0 -421
@@ -0,0 +1,510 @@
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
+ discounts?: import("./schemas.cjs").components["schemas"]["Discount"][];
140
+ readonly payment?: import("./schemas.cjs").components["schemas"]["InvoicePaymentTerms"];
141
+ readonly validationIssues?: import("./schemas.cjs").components["schemas"]["ValidationIssue"][];
142
+ readonly externalIds?: import("./schemas.cjs").components["schemas"]["InvoiceAppExternalIds"];
143
+ }>;
144
+ /**
145
+ * Update an invoice
146
+ * @description Only invoices in draft or earlier status can be updated.
147
+ * @param id - The ID of the invoice to update
148
+ * @param invoice - The invoice to update
149
+ * @param signal - An optional abort signal
150
+ * @returns The updated invoice
151
+ */
152
+ update(id: operations['updateInvoice']['parameters']['path']['invoiceId'], invoice: InvoiceReplaceUpdate, options?: RequestOptions): Promise<{
153
+ readonly id: string;
154
+ description?: string;
155
+ metadata?: import("./schemas.cjs").components["schemas"]["Metadata"] | null;
156
+ readonly createdAt: Date;
157
+ readonly updatedAt: Date;
158
+ readonly deletedAt?: Date;
159
+ readonly type: import("./schemas.cjs").components["schemas"]["InvoiceType"];
160
+ supplier: import("./schemas.cjs").components["schemas"]["BillingParty"];
161
+ customer: import("./schemas.cjs").components["schemas"]["BillingParty"];
162
+ readonly number: import("./schemas.cjs").components["schemas"]["InvoiceNumber"];
163
+ currency: import("./schemas.cjs").components["schemas"]["CurrencyCode"];
164
+ readonly preceding?: import("./schemas.cjs").components["schemas"]["InvoiceDocumentRef"][];
165
+ readonly totals: import("./schemas.cjs").components["schemas"]["InvoiceTotals"];
166
+ readonly status: import("./schemas.cjs").components["schemas"]["InvoiceStatus"];
167
+ readonly statusDetails: import("./schemas.cjs").components["schemas"]["InvoiceStatusDetails"];
168
+ readonly issuedAt?: Date;
169
+ draftUntil?: Date;
170
+ readonly dueAt?: Date;
171
+ period?: import("./schemas.cjs").components["schemas"]["Period"];
172
+ readonly voidedAt?: Date;
173
+ readonly sentToCustomerAt?: Date;
174
+ workflow: import("./schemas.cjs").components["schemas"]["InvoiceWorkflowSettings"];
175
+ lines?: import("./schemas.cjs").components["schemas"]["InvoiceLine"][];
176
+ discounts?: import("./schemas.cjs").components["schemas"]["Discount"][];
177
+ readonly payment?: import("./schemas.cjs").components["schemas"]["InvoicePaymentTerms"];
178
+ readonly validationIssues?: import("./schemas.cjs").components["schemas"]["ValidationIssue"][];
179
+ readonly externalIds?: import("./schemas.cjs").components["schemas"]["InvoiceAppExternalIds"];
180
+ }>;
181
+ /**
182
+ * Advance the invoice to the next status
183
+ * @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.
184
+ * @param id - The ID of the invoice to advance
185
+ * @param signal - An optional abort signal
186
+ * @returns The advanced invoice
187
+ */
188
+ advance(id: operations['advanceInvoiceAction']['parameters']['path']['invoiceId'], options?: RequestOptions): Promise<{
189
+ readonly id: string;
190
+ description?: string;
191
+ metadata?: import("./schemas.cjs").components["schemas"]["Metadata"] | null;
192
+ readonly createdAt: Date;
193
+ readonly updatedAt: Date;
194
+ readonly deletedAt?: Date;
195
+ readonly type: import("./schemas.cjs").components["schemas"]["InvoiceType"];
196
+ supplier: import("./schemas.cjs").components["schemas"]["BillingParty"];
197
+ customer: import("./schemas.cjs").components["schemas"]["BillingParty"];
198
+ readonly number: import("./schemas.cjs").components["schemas"]["InvoiceNumber"];
199
+ currency: import("./schemas.cjs").components["schemas"]["CurrencyCode"];
200
+ readonly preceding?: import("./schemas.cjs").components["schemas"]["InvoiceDocumentRef"][];
201
+ readonly totals: import("./schemas.cjs").components["schemas"]["InvoiceTotals"];
202
+ readonly status: import("./schemas.cjs").components["schemas"]["InvoiceStatus"];
203
+ readonly statusDetails: import("./schemas.cjs").components["schemas"]["InvoiceStatusDetails"];
204
+ readonly issuedAt?: Date;
205
+ draftUntil?: Date;
206
+ readonly dueAt?: Date;
207
+ period?: import("./schemas.cjs").components["schemas"]["Period"];
208
+ readonly voidedAt?: Date;
209
+ readonly sentToCustomerAt?: Date;
210
+ workflow: import("./schemas.cjs").components["schemas"]["InvoiceWorkflowSettings"];
211
+ lines?: import("./schemas.cjs").components["schemas"]["InvoiceLine"][];
212
+ discounts?: import("./schemas.cjs").components["schemas"]["Discount"][];
213
+ readonly payment?: import("./schemas.cjs").components["schemas"]["InvoicePaymentTerms"];
214
+ readonly validationIssues?: import("./schemas.cjs").components["schemas"]["ValidationIssue"][];
215
+ readonly externalIds?: import("./schemas.cjs").components["schemas"]["InvoiceAppExternalIds"];
216
+ }>;
217
+ /**
218
+ * Approve an invoice
219
+ * @description This call instantly sends the invoice to the customer using the configured billing profile app.
220
+ * @param id - The ID of the invoice to approve
221
+ * @param signal - An optional abort signal
222
+ * @returns The approved invoice
223
+ */
224
+ approve(id: operations['approveInvoiceAction']['parameters']['path']['invoiceId'], options?: RequestOptions): Promise<{
225
+ readonly id: string;
226
+ description?: string;
227
+ metadata?: import("./schemas.cjs").components["schemas"]["Metadata"] | null;
228
+ readonly createdAt: Date;
229
+ readonly updatedAt: Date;
230
+ readonly deletedAt?: Date;
231
+ readonly type: import("./schemas.cjs").components["schemas"]["InvoiceType"];
232
+ supplier: import("./schemas.cjs").components["schemas"]["BillingParty"];
233
+ customer: import("./schemas.cjs").components["schemas"]["BillingParty"];
234
+ readonly number: import("./schemas.cjs").components["schemas"]["InvoiceNumber"];
235
+ currency: import("./schemas.cjs").components["schemas"]["CurrencyCode"];
236
+ readonly preceding?: import("./schemas.cjs").components["schemas"]["InvoiceDocumentRef"][];
237
+ readonly totals: import("./schemas.cjs").components["schemas"]["InvoiceTotals"];
238
+ readonly status: import("./schemas.cjs").components["schemas"]["InvoiceStatus"];
239
+ readonly statusDetails: import("./schemas.cjs").components["schemas"]["InvoiceStatusDetails"];
240
+ readonly issuedAt?: Date;
241
+ draftUntil?: Date;
242
+ readonly dueAt?: Date;
243
+ period?: import("./schemas.cjs").components["schemas"]["Period"];
244
+ readonly voidedAt?: Date;
245
+ readonly sentToCustomerAt?: Date;
246
+ workflow: import("./schemas.cjs").components["schemas"]["InvoiceWorkflowSettings"];
247
+ lines?: import("./schemas.cjs").components["schemas"]["InvoiceLine"][];
248
+ discounts?: import("./schemas.cjs").components["schemas"]["Discount"][];
249
+ readonly payment?: import("./schemas.cjs").components["schemas"]["InvoicePaymentTerms"];
250
+ readonly validationIssues?: import("./schemas.cjs").components["schemas"]["ValidationIssue"][];
251
+ readonly externalIds?: import("./schemas.cjs").components["schemas"]["InvoiceAppExternalIds"];
252
+ }>;
253
+ /**
254
+ * Retry advancing the invoice after a failed attempt.
255
+ * @param id - The ID of the invoice to retry
256
+ * @param signal - An optional abort signal
257
+ * @returns The retried invoice
258
+ */
259
+ retry(id: operations['retryInvoiceAction']['parameters']['path']['invoiceId'], options?: RequestOptions): Promise<{
260
+ readonly id: string;
261
+ description?: string;
262
+ metadata?: import("./schemas.cjs").components["schemas"]["Metadata"] | null;
263
+ readonly createdAt: Date;
264
+ readonly updatedAt: Date;
265
+ readonly deletedAt?: Date;
266
+ readonly type: import("./schemas.cjs").components["schemas"]["InvoiceType"];
267
+ supplier: import("./schemas.cjs").components["schemas"]["BillingParty"];
268
+ customer: import("./schemas.cjs").components["schemas"]["BillingParty"];
269
+ readonly number: import("./schemas.cjs").components["schemas"]["InvoiceNumber"];
270
+ currency: import("./schemas.cjs").components["schemas"]["CurrencyCode"];
271
+ readonly preceding?: import("./schemas.cjs").components["schemas"]["InvoiceDocumentRef"][];
272
+ readonly totals: import("./schemas.cjs").components["schemas"]["InvoiceTotals"];
273
+ readonly status: import("./schemas.cjs").components["schemas"]["InvoiceStatus"];
274
+ readonly statusDetails: import("./schemas.cjs").components["schemas"]["InvoiceStatusDetails"];
275
+ readonly issuedAt?: Date;
276
+ draftUntil?: Date;
277
+ readonly dueAt?: Date;
278
+ period?: import("./schemas.cjs").components["schemas"]["Period"];
279
+ readonly voidedAt?: Date;
280
+ readonly sentToCustomerAt?: Date;
281
+ workflow: import("./schemas.cjs").components["schemas"]["InvoiceWorkflowSettings"];
282
+ lines?: import("./schemas.cjs").components["schemas"]["InvoiceLine"][];
283
+ discounts?: import("./schemas.cjs").components["schemas"]["Discount"][];
284
+ readonly payment?: import("./schemas.cjs").components["schemas"]["InvoicePaymentTerms"];
285
+ readonly validationIssues?: import("./schemas.cjs").components["schemas"]["ValidationIssue"][];
286
+ readonly externalIds?: import("./schemas.cjs").components["schemas"]["InvoiceAppExternalIds"];
287
+ }>;
288
+ /**
289
+ * Void an invoice
290
+ * @description Void an invoice
291
+ *
292
+ * Only invoices that have been alread issued can be voided.
293
+ * @param id - The ID of the invoice to void
294
+ * @param signal - An optional abort signal
295
+ * @returns The voided invoice
296
+ */
297
+ void(id: operations['voidInvoiceAction']['parameters']['path']['invoiceId'], body: VoidInvoiceActionInput, options?: RequestOptions): Promise<{
298
+ readonly id: string;
299
+ description?: string;
300
+ metadata?: import("./schemas.cjs").components["schemas"]["Metadata"] | null;
301
+ readonly createdAt: Date;
302
+ readonly updatedAt: Date;
303
+ readonly deletedAt?: Date;
304
+ readonly type: import("./schemas.cjs").components["schemas"]["InvoiceType"];
305
+ supplier: import("./schemas.cjs").components["schemas"]["BillingParty"];
306
+ customer: import("./schemas.cjs").components["schemas"]["BillingParty"];
307
+ readonly number: import("./schemas.cjs").components["schemas"]["InvoiceNumber"];
308
+ currency: import("./schemas.cjs").components["schemas"]["CurrencyCode"];
309
+ readonly preceding?: import("./schemas.cjs").components["schemas"]["InvoiceDocumentRef"][];
310
+ readonly totals: import("./schemas.cjs").components["schemas"]["InvoiceTotals"];
311
+ readonly status: import("./schemas.cjs").components["schemas"]["InvoiceStatus"];
312
+ readonly statusDetails: import("./schemas.cjs").components["schemas"]["InvoiceStatusDetails"];
313
+ readonly issuedAt?: Date;
314
+ draftUntil?: Date;
315
+ readonly dueAt?: Date;
316
+ period?: import("./schemas.cjs").components["schemas"]["Period"];
317
+ readonly voidedAt?: Date;
318
+ readonly sentToCustomerAt?: Date;
319
+ workflow: import("./schemas.cjs").components["schemas"]["InvoiceWorkflowSettings"];
320
+ lines?: import("./schemas.cjs").components["schemas"]["InvoiceLine"][];
321
+ discounts?: import("./schemas.cjs").components["schemas"]["Discount"][];
322
+ readonly payment?: import("./schemas.cjs").components["schemas"]["InvoicePaymentTerms"];
323
+ readonly validationIssues?: import("./schemas.cjs").components["schemas"]["ValidationIssue"][];
324
+ readonly externalIds?: import("./schemas.cjs").components["schemas"]["InvoiceAppExternalIds"];
325
+ }>;
326
+ /**
327
+ * Recalculate an invoice's tax amounts
328
+ * @param id - The ID of the invoice to recalculate
329
+ * @param signal - An optional abort signal
330
+ * @returns The recalculated invoice
331
+ */
332
+ recalculateTax(id: operations['recalculateInvoiceTaxAction']['parameters']['path']['invoiceId'], options?: RequestOptions): Promise<{
333
+ readonly id: string;
334
+ description?: string;
335
+ metadata?: import("./schemas.cjs").components["schemas"]["Metadata"] | null;
336
+ readonly createdAt: Date;
337
+ readonly updatedAt: Date;
338
+ readonly deletedAt?: Date;
339
+ readonly type: import("./schemas.cjs").components["schemas"]["InvoiceType"];
340
+ supplier: import("./schemas.cjs").components["schemas"]["BillingParty"];
341
+ customer: import("./schemas.cjs").components["schemas"]["BillingParty"];
342
+ readonly number: import("./schemas.cjs").components["schemas"]["InvoiceNumber"];
343
+ currency: import("./schemas.cjs").components["schemas"]["CurrencyCode"];
344
+ readonly preceding?: import("./schemas.cjs").components["schemas"]["InvoiceDocumentRef"][];
345
+ readonly totals: import("./schemas.cjs").components["schemas"]["InvoiceTotals"];
346
+ readonly status: import("./schemas.cjs").components["schemas"]["InvoiceStatus"];
347
+ readonly statusDetails: import("./schemas.cjs").components["schemas"]["InvoiceStatusDetails"];
348
+ readonly issuedAt?: Date;
349
+ draftUntil?: Date;
350
+ readonly dueAt?: Date;
351
+ period?: import("./schemas.cjs").components["schemas"]["Period"];
352
+ readonly voidedAt?: Date;
353
+ readonly sentToCustomerAt?: Date;
354
+ workflow: import("./schemas.cjs").components["schemas"]["InvoiceWorkflowSettings"];
355
+ lines?: import("./schemas.cjs").components["schemas"]["InvoiceLine"][];
356
+ discounts?: import("./schemas.cjs").components["schemas"]["Discount"][];
357
+ readonly payment?: import("./schemas.cjs").components["schemas"]["InvoicePaymentTerms"];
358
+ readonly validationIssues?: import("./schemas.cjs").components["schemas"]["ValidationIssue"][];
359
+ readonly externalIds?: import("./schemas.cjs").components["schemas"]["InvoiceAppExternalIds"];
360
+ }>;
361
+ /**
362
+ * Simulate an invoice for a customer
363
+ * @param id - The ID of the customer to simulate the invoice for
364
+ * @param signal - An optional abort signal
365
+ * @returns The simulated invoice
366
+ */
367
+ simulate(id: operations['simulateInvoice']['parameters']['path']['customerId'], body: InvoiceSimulationInput, options?: RequestOptions): Promise<{
368
+ readonly id: string;
369
+ description?: string;
370
+ metadata?: import("./schemas.cjs").components["schemas"]["Metadata"] | null;
371
+ readonly createdAt: Date;
372
+ readonly updatedAt: Date;
373
+ readonly deletedAt?: Date;
374
+ readonly type: import("./schemas.cjs").components["schemas"]["InvoiceType"];
375
+ supplier: import("./schemas.cjs").components["schemas"]["BillingParty"];
376
+ customer: import("./schemas.cjs").components["schemas"]["BillingParty"];
377
+ readonly number: import("./schemas.cjs").components["schemas"]["InvoiceNumber"];
378
+ currency: import("./schemas.cjs").components["schemas"]["CurrencyCode"];
379
+ readonly preceding?: import("./schemas.cjs").components["schemas"]["InvoiceDocumentRef"][];
380
+ readonly totals: import("./schemas.cjs").components["schemas"]["InvoiceTotals"];
381
+ readonly status: import("./schemas.cjs").components["schemas"]["InvoiceStatus"];
382
+ readonly statusDetails: import("./schemas.cjs").components["schemas"]["InvoiceStatusDetails"];
383
+ readonly issuedAt?: Date;
384
+ draftUntil?: Date;
385
+ readonly dueAt?: Date;
386
+ period?: import("./schemas.cjs").components["schemas"]["Period"];
387
+ readonly voidedAt?: Date;
388
+ readonly sentToCustomerAt?: Date;
389
+ workflow: import("./schemas.cjs").components["schemas"]["InvoiceWorkflowSettings"];
390
+ lines?: import("./schemas.cjs").components["schemas"]["InvoiceLine"][];
391
+ discounts?: import("./schemas.cjs").components["schemas"]["Discount"][];
392
+ readonly payment?: import("./schemas.cjs").components["schemas"]["InvoicePaymentTerms"];
393
+ readonly validationIssues?: import("./schemas.cjs").components["schemas"]["ValidationIssue"][];
394
+ readonly externalIds?: import("./schemas.cjs").components["schemas"]["InvoiceAppExternalIds"];
395
+ }>;
396
+ /**
397
+ * Create pending invoice line items
398
+ * @param body - The pending invoice line items to create
399
+ * @param signal - An optional abort signal
400
+ * @returns The created pending invoice line items
401
+ */
402
+ createLineItems(body: InvoicePendingLineCreate[], options?: RequestOptions): Promise<({
403
+ name: string;
404
+ description?: string;
405
+ metadata?: import("./schemas.cjs").components["schemas"]["Metadata"] | null;
406
+ readonly createdAt: Date;
407
+ readonly updatedAt: Date;
408
+ readonly deletedAt?: Date;
409
+ id: string;
410
+ readonly managedBy: import("./schemas.cjs").components["schemas"]["InvoiceLineManagedBy"];
411
+ readonly status: import("./schemas.cjs").components["schemas"]["InvoiceLineStatus"];
412
+ readonly discounts?: import("./schemas.cjs").components["schemas"]["InvoiceLineDiscount"][];
413
+ readonly charges?: import("./schemas.cjs").components["schemas"]["BillingLineCharge"][];
414
+ invoice?: import("./schemas.cjs").components["schemas"]["InvoiceReference"];
415
+ currency: import("./schemas.cjs").components["schemas"]["CurrencyCode"];
416
+ readonly taxes?: import("./schemas.cjs").components["schemas"]["InvoiceLineTaxItem"][];
417
+ taxConfig?: import("./schemas.cjs").components["schemas"]["TaxConfig"];
418
+ readonly children?: import("./schemas.cjs").components["schemas"]["InvoiceLine"][];
419
+ readonly totals: import("./schemas.cjs").components["schemas"]["InvoiceTotals"];
420
+ period: import("./schemas.cjs").components["schemas"]["Period"];
421
+ invoiceAt: Date;
422
+ readonly externalIds?: import("./schemas.cjs").components["schemas"]["InvoiceLineAppExternalIds"];
423
+ readonly subscriptions?: import("./schemas.cjs").components["schemas"]["InvoiceLineSubscriptionReference"];
424
+ type: "usage_based";
425
+ price: import("./schemas.cjs").components["schemas"]["RateCardUsageBasedPrice"];
426
+ featureKey: string;
427
+ readonly quantity?: import("./schemas.cjs").components["schemas"]["Numeric"];
428
+ readonly preLinePeriodQuantity?: import("./schemas.cjs").components["schemas"]["Numeric"];
429
+ } | {
430
+ name: string;
431
+ description?: string;
432
+ metadata?: import("./schemas.cjs").components["schemas"]["Metadata"] | null;
433
+ readonly createdAt: Date;
434
+ readonly updatedAt: Date;
435
+ readonly deletedAt?: Date;
436
+ id: string;
437
+ readonly managedBy: import("./schemas.cjs").components["schemas"]["InvoiceLineManagedBy"];
438
+ readonly status: import("./schemas.cjs").components["schemas"]["InvoiceLineStatus"];
439
+ readonly discounts?: import("./schemas.cjs").components["schemas"]["InvoiceLineDiscount"][];
440
+ readonly charges?: import("./schemas.cjs").components["schemas"]["BillingLineCharge"][];
441
+ invoice?: import("./schemas.cjs").components["schemas"]["InvoiceReference"];
442
+ currency: import("./schemas.cjs").components["schemas"]["CurrencyCode"];
443
+ readonly taxes?: import("./schemas.cjs").components["schemas"]["InvoiceLineTaxItem"][];
444
+ taxConfig?: import("./schemas.cjs").components["schemas"]["TaxConfig"];
445
+ readonly children?: import("./schemas.cjs").components["schemas"]["InvoiceLine"][];
446
+ readonly totals: import("./schemas.cjs").components["schemas"]["InvoiceTotals"];
447
+ period: import("./schemas.cjs").components["schemas"]["Period"];
448
+ invoiceAt: Date;
449
+ readonly externalIds?: import("./schemas.cjs").components["schemas"]["InvoiceLineAppExternalIds"];
450
+ readonly subscriptions?: import("./schemas.cjs").components["schemas"]["InvoiceLineSubscriptionReference"];
451
+ type: "flat_fee";
452
+ perUnitAmount: import("./schemas.cjs").components["schemas"]["Numeric"];
453
+ paymentTerm?: import("./schemas.cjs").components["schemas"]["PricePaymentTerm"];
454
+ quantity: import("./schemas.cjs").components["schemas"]["Numeric"];
455
+ category?: import("./schemas.cjs").components["schemas"]["InvoiceFlatFeeCategory"];
456
+ })[]>;
457
+ }
458
+ /**
459
+ * Billing Customer Invoices and Overrides
460
+ */
461
+ export declare class BillingCustomers {
462
+ private client;
463
+ constructor(client: Client<paths, `${string}/${string}`>);
464
+ /**
465
+ * Create or update a customer override
466
+ * @param id - The ID of the customer to create the override for
467
+ * @param body - The customer override to create
468
+ * @param signal - An optional abort signal
469
+ * @returns The created customer override
470
+ */
471
+ createOverride(id: operations['upsertBillingProfileCustomerOverride']['parameters']['path']['customerId'], body: BillingProfileCustomerOverrideCreate, options?: RequestOptions): Promise<{
472
+ readonly createdAt: Date;
473
+ readonly updatedAt: Date;
474
+ readonly deletedAt?: Date;
475
+ workflow?: import("./schemas.cjs").components["schemas"]["BillingProfileCustomerWorkflowOverride"];
476
+ billingProfile?: string;
477
+ }>;
478
+ /**
479
+ * Get a customer override
480
+ * @param id - The ID of the customer to get the override for
481
+ * @param signal - An optional abort signal
482
+ * @returns The customer override
483
+ */
484
+ getOverride(id: operations['getBillingProfileCustomerOverride']['parameters']['path']['customerId'], options?: RequestOptions): Promise<{
485
+ readonly createdAt: Date;
486
+ readonly updatedAt: Date;
487
+ readonly deletedAt?: Date;
488
+ workflow?: import("./schemas.cjs").components["schemas"]["BillingProfileCustomerWorkflowOverride"];
489
+ billingProfile?: string;
490
+ }>;
491
+ /**
492
+ * List customer overrides
493
+ * @param query - The query parameters
494
+ * @param signal - An optional abort signal
495
+ * @returns The customer overrides
496
+ */
497
+ listOverrides(query?: operations['listBillingProfileCustomerOverrides']['parameters']['query'], options?: RequestOptions): Promise<{
498
+ totalCount: number;
499
+ page: number;
500
+ pageSize: number;
501
+ items: import("./schemas.cjs").components["schemas"]["BillingProfileCustomerOverride"][];
502
+ }>;
503
+ /**
504
+ * Delete a customer override
505
+ * @param id - The ID of the customer to delete the override for
506
+ * @param signal - An optional abort signal
507
+ * @returns The deleted customer override
508
+ */
509
+ deleteOverride(id: operations['deleteBillingProfileCustomerOverride']['parameters']['path']['customerId'], options?: RequestOptions): Promise<undefined>;
510
+ }
@@ -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,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AG,MAAM,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,2BAA2B,EAAE;YAC9D,MAAM,EAAE,EAAE,KAAK,EAAE;YACjB,GAAG,OAAO;SACX,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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