@openmeter/sdk 1.0.0-beta-7b2d9ed372e3 → 1.0.0-beta-bbb2af6bf3b0

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 (90) hide show
  1. package/dist/cjs/{tsconfig.3bd7bdb7.tsbuildinfo → tsconfig.7b29505b.tsbuildinfo} +1 -1
  2. package/dist/cjs/{tsconfig.769a7751.tsbuildinfo → tsconfig.e592f80c.tsbuildinfo} +1 -1
  3. package/dist/tsconfig.tsbuildinfo +1 -1
  4. package/package.json +1 -1
  5. package/dist/cjs/src/apps.cjs +0 -176
  6. package/dist/cjs/src/apps.d.cts +0 -338
  7. package/dist/cjs/src/apps.js.map +0 -1
  8. package/dist/cjs/src/billing.cjs +0 -309
  9. package/dist/cjs/src/billing.d.cts +0 -645
  10. package/dist/cjs/src/billing.js.map +0 -1
  11. package/dist/cjs/src/customers.cjs +0 -185
  12. package/dist/cjs/src/customers.d.cts +0 -231
  13. package/dist/cjs/src/customers.js.map +0 -1
  14. package/dist/cjs/src/entitlements.cjs +0 -244
  15. package/dist/cjs/src/entitlements.d.cts +0 -505
  16. package/dist/cjs/src/entitlements.js.map +0 -1
  17. package/dist/cjs/src/events.cjs +0 -65
  18. package/dist/cjs/src/events.d.cts +0 -101
  19. package/dist/cjs/src/events.js.map +0 -1
  20. package/dist/cjs/src/features.cjs +0 -78
  21. package/dist/cjs/src/features.d.cts +0 -153
  22. package/dist/cjs/src/features.js.map +0 -1
  23. package/dist/cjs/src/meters.cjs +0 -93
  24. package/dist/cjs/src/meters.d.cts +0 -184
  25. package/dist/cjs/src/meters.js.map +0 -1
  26. package/dist/cjs/src/notifications.cjs +0 -249
  27. package/dist/cjs/src/notifications.d.cts +0 -314
  28. package/dist/cjs/src/notifications.js.map +0 -1
  29. package/dist/cjs/src/plans.cjs +0 -127
  30. package/dist/cjs/src/plans.d.cts +0 -192
  31. package/dist/cjs/src/plans.js.map +0 -1
  32. package/dist/cjs/src/subjects.cjs +0 -76
  33. package/dist/cjs/src/subjects.d.cts +0 -101
  34. package/dist/cjs/src/subjects.js.map +0 -1
  35. package/dist/cjs/src/subscriptions.cjs +0 -116
  36. package/dist/cjs/src/subscriptions.d.cts +0 -197
  37. package/dist/cjs/src/subscriptions.js.map +0 -1
  38. package/dist/cjs/src/utils.cjs +0 -93
  39. package/dist/cjs/src/utils.d.cts +0 -29
  40. package/dist/cjs/src/utils.js.map +0 -1
  41. package/dist/cjs/tsconfig.01ab6c6b.tsbuildinfo +0 -1
  42. package/dist/cjs/tsconfig.1e12acbb.tsbuildinfo +0 -1
  43. package/dist/cjs/tsconfig.38849cd1.tsbuildinfo +0 -1
  44. package/dist/cjs/tsconfig.3db00db7.tsbuildinfo +0 -1
  45. package/dist/cjs/tsconfig.5cd8af0a.tsbuildinfo +0 -1
  46. package/dist/cjs/tsconfig.64c40770.tsbuildinfo +0 -1
  47. package/dist/cjs/tsconfig.8fd1c6cd.tsbuildinfo +0 -1
  48. package/dist/cjs/tsconfig.c9e83bdd.tsbuildinfo +0 -1
  49. package/dist/cjs/tsconfig.d3cb3b9e.tsbuildinfo +0 -1
  50. package/dist/cjs/tsconfig.db7aa141.tsbuildinfo +0 -1
  51. package/dist/cjs/tsconfig.edd7b7ed.tsbuildinfo +0 -1
  52. package/dist/cjs/tsconfig.f343a141.tsbuildinfo +0 -1
  53. package/dist/cjs/tsconfig.f36f8639.tsbuildinfo +0 -1
  54. package/dist/cjs/tsconfig.fc8d5fa4.tsbuildinfo +0 -1
  55. package/dist/src/apps.d.ts +0 -338
  56. package/dist/src/apps.js +0 -170
  57. package/dist/src/apps.js.map +0 -1
  58. package/dist/src/billing.d.ts +0 -645
  59. package/dist/src/billing.js +0 -302
  60. package/dist/src/billing.js.map +0 -1
  61. package/dist/src/customers.d.ts +0 -231
  62. package/dist/src/customers.js +0 -179
  63. package/dist/src/customers.js.map +0 -1
  64. package/dist/src/entitlements.d.ts +0 -505
  65. package/dist/src/entitlements.js +0 -239
  66. package/dist/src/entitlements.js.map +0 -1
  67. package/dist/src/events.d.ts +0 -101
  68. package/dist/src/events.js +0 -58
  69. package/dist/src/events.js.map +0 -1
  70. package/dist/src/features.d.ts +0 -153
  71. package/dist/src/features.js +0 -74
  72. package/dist/src/features.js.map +0 -1
  73. package/dist/src/meters.d.ts +0 -184
  74. package/dist/src/meters.js +0 -89
  75. package/dist/src/meters.js.map +0 -1
  76. package/dist/src/notifications.d.ts +0 -314
  77. package/dist/src/notifications.js +0 -242
  78. package/dist/src/notifications.js.map +0 -1
  79. package/dist/src/plans.d.ts +0 -192
  80. package/dist/src/plans.js +0 -123
  81. package/dist/src/plans.js.map +0 -1
  82. package/dist/src/subjects.d.ts +0 -101
  83. package/dist/src/subjects.js +0 -72
  84. package/dist/src/subjects.js.map +0 -1
  85. package/dist/src/subscriptions.d.ts +0 -197
  86. package/dist/src/subscriptions.js +0 -112
  87. package/dist/src/subscriptions.js.map +0 -1
  88. package/dist/src/utils.d.ts +0 -29
  89. package/dist/src/utils.js +0 -85
  90. package/dist/src/utils.js.map +0 -1
@@ -1,338 +0,0 @@
1
- import type { AppBaseReplaceUpdate, CreateStripeCheckoutSessionRequest, operations, paths } from './schemas.cjs';
2
- import type { Client } from 'openapi-fetch';
3
- /**
4
- * Apps
5
- * Manage integrations for extending OpenMeter's functionality.
6
- */
7
- export declare class Apps {
8
- private client;
9
- marketplace: AppMarketplace;
10
- stripe: AppStripe;
11
- constructor(client: Client<paths, `${string}/${string}`>);
12
- /**
13
- * List apps
14
- * @param query - The query parameters
15
- * @param signal - An optional abort signal
16
- * @returns The apps
17
- */
18
- list(query?: operations['listApps']['parameters']['query'], signal?: AbortSignal): Promise<{
19
- data?: never;
20
- error: import("./utils.cjs").Problem;
21
- response: Response;
22
- } | {
23
- data: {
24
- page: number;
25
- pageSize: number;
26
- totalCount: number;
27
- items: import("./schemas.cjs").components["schemas"]["App"][];
28
- };
29
- error?: never;
30
- response: Response;
31
- }>;
32
- /**
33
- * Get an app
34
- * @param id - The ID of the app
35
- * @param signal - An optional abort signal
36
- * @returns The app
37
- */
38
- get(id: operations['getApp']['parameters']['path']['id'], signal?: AbortSignal): Promise<{
39
- data?: never;
40
- error: import("./utils.cjs").Problem;
41
- response: Response;
42
- } | {
43
- data: import("openapi-typescript-helpers").SuccessResponse<{
44
- 200: {
45
- headers: {
46
- [name: string]: unknown;
47
- };
48
- content: {
49
- "application/json": import("./schemas.cjs").components["schemas"]["App"];
50
- };
51
- };
52
- 400: {
53
- headers: {
54
- [name: string]: unknown;
55
- };
56
- content: {
57
- "application/problem+json": import("./schemas.cjs").components["schemas"]["BadRequestProblemResponse"];
58
- };
59
- };
60
- 401: {
61
- headers: {
62
- [name: string]: unknown;
63
- };
64
- content: {
65
- "application/problem+json": import("./schemas.cjs").components["schemas"]["UnauthorizedProblemResponse"];
66
- };
67
- };
68
- 403: {
69
- headers: {
70
- [name: string]: unknown;
71
- };
72
- content: {
73
- "application/problem+json": import("./schemas.cjs").components["schemas"]["ForbiddenProblemResponse"];
74
- };
75
- };
76
- 404: {
77
- headers: {
78
- [name: string]: unknown;
79
- };
80
- content: {
81
- "application/problem+json": import("./schemas.cjs").components["schemas"]["NotFoundProblemResponse"];
82
- };
83
- };
84
- 500: {
85
- headers: {
86
- [name: string]: unknown;
87
- };
88
- content: {
89
- "application/problem+json": import("./schemas.cjs").components["schemas"]["InternalServerErrorProblemResponse"];
90
- };
91
- };
92
- 503: {
93
- headers: {
94
- [name: string]: unknown;
95
- };
96
- content: {
97
- "application/problem+json": import("./schemas.cjs").components["schemas"]["ServiceUnavailableProblemResponse"];
98
- };
99
- };
100
- default: {
101
- headers: {
102
- [name: string]: unknown;
103
- };
104
- content: {
105
- "application/problem+json": import("./schemas.cjs").components["schemas"]["UnexpectedProblemResponse"];
106
- };
107
- };
108
- }, `${string}/${string}`>;
109
- error?: never;
110
- response: Response;
111
- }>;
112
- /**
113
- * Update an app
114
- * @param id - The ID of the app
115
- * @param body - The body of the request
116
- * @param signal - An optional abort signal
117
- * @returns The app
118
- */
119
- update(id: operations['updateApp']['parameters']['path']['id'], body: AppBaseReplaceUpdate, signal?: AbortSignal): Promise<{
120
- data?: never;
121
- error: import("./utils.cjs").Problem;
122
- response: Response;
123
- } | {
124
- data: import("openapi-typescript-helpers").SuccessResponse<{
125
- 200: {
126
- headers: {
127
- [name: string]: unknown;
128
- };
129
- content: {
130
- "application/json": import("./schemas.cjs").components["schemas"]["App"];
131
- };
132
- };
133
- 400: {
134
- headers: {
135
- [name: string]: unknown;
136
- };
137
- content: {
138
- "application/problem+json": import("./schemas.cjs").components["schemas"]["BadRequestProblemResponse"];
139
- };
140
- };
141
- 401: {
142
- headers: {
143
- [name: string]: unknown;
144
- };
145
- content: {
146
- "application/problem+json": import("./schemas.cjs").components["schemas"]["UnauthorizedProblemResponse"];
147
- };
148
- };
149
- 403: {
150
- headers: {
151
- [name: string]: unknown;
152
- };
153
- content: {
154
- "application/problem+json": import("./schemas.cjs").components["schemas"]["ForbiddenProblemResponse"];
155
- };
156
- };
157
- 404: {
158
- headers: {
159
- [name: string]: unknown;
160
- };
161
- content: {
162
- "application/problem+json": import("./schemas.cjs").components["schemas"]["NotFoundProblemResponse"];
163
- };
164
- };
165
- 500: {
166
- headers: {
167
- [name: string]: unknown;
168
- };
169
- content: {
170
- "application/problem+json": import("./schemas.cjs").components["schemas"]["InternalServerErrorProblemResponse"];
171
- };
172
- };
173
- 503: {
174
- headers: {
175
- [name: string]: unknown;
176
- };
177
- content: {
178
- "application/problem+json": import("./schemas.cjs").components["schemas"]["ServiceUnavailableProblemResponse"];
179
- };
180
- };
181
- default: {
182
- headers: {
183
- [name: string]: unknown;
184
- };
185
- content: {
186
- "application/problem+json": import("./schemas.cjs").components["schemas"]["UnexpectedProblemResponse"];
187
- };
188
- };
189
- }, `${string}/${string}`>;
190
- error?: never;
191
- response: Response;
192
- }>;
193
- /**
194
- * Uninstall an app
195
- * @param id - The ID of the app
196
- * @param signal - An optional abort signal
197
- * @returns The app
198
- */
199
- uninstall(id: operations['uninstallApp']['parameters']['path']['id'], signal?: AbortSignal): Promise<{
200
- data?: never;
201
- error: import("./utils.cjs").Problem;
202
- response: Response;
203
- } | {
204
- data: undefined;
205
- error?: never;
206
- response: Response;
207
- }>;
208
- }
209
- /**
210
- * App Marketplace
211
- * Available apps from the OpenMeter Marketplace.
212
- */
213
- export declare class AppMarketplace {
214
- private client;
215
- constructor(client: Client<paths, `${string}/${string}`>);
216
- /**
217
- * List available apps
218
- * @param query - The query parameters
219
- * @param signal - An optional abort signal
220
- * @returns The apps
221
- */
222
- list(query?: operations['listMarketplaceListings']['parameters']['query'], signal?: AbortSignal): Promise<{
223
- data?: never;
224
- error: import("./utils.cjs").Problem;
225
- response: Response;
226
- } | {
227
- data: {
228
- page: number;
229
- pageSize: number;
230
- totalCount: number;
231
- items: import("./schemas.cjs").components["schemas"]["MarketplaceListing"][];
232
- };
233
- error?: never;
234
- response: Response;
235
- }>;
236
- /**
237
- * Get details for a listing
238
- * @param type - The type of the listing
239
- * @param signal - An optional abort signal
240
- * @returns The listing
241
- */
242
- get(type: operations['getMarketplaceListing']['parameters']['path']['type'], signal?: AbortSignal): Promise<{
243
- data?: never;
244
- error: import("./utils.cjs").Problem;
245
- response: Response;
246
- } | {
247
- data: {
248
- type: import("./schemas.cjs").components["schemas"]["AppType"];
249
- name: string;
250
- description: string;
251
- capabilities: import("./schemas.cjs").components["schemas"]["AppCapability"][];
252
- };
253
- error?: never;
254
- response: Response;
255
- }>;
256
- /**
257
- * Install an app via OAuth. Returns a URL to start the OAuth 2.0 flow.
258
- * @param type - The type of the listing
259
- * @param signal - An optional abort signal
260
- * @returns The OAuth2 install URL
261
- */
262
- getOauth2InstallUrl(type: operations['marketplaceOAuth2InstallGetURL']['parameters']['path']['type'], signal?: AbortSignal): Promise<{
263
- data?: never;
264
- error: import("./utils.cjs").Problem;
265
- response: Response;
266
- } | {
267
- data: {
268
- url: string;
269
- };
270
- error?: never;
271
- response: Response;
272
- }>;
273
- /**
274
- * Authorize OAuth2 code. Verifies the OAuth code and exchanges it for a token and refresh token
275
- * @param type - The type of the listing
276
- * @param signal - An optional abort signal
277
- * @returns The authorization URL
278
- */
279
- authorizeOauth2(type: operations['marketplaceOAuth2InstallAuthorize']['parameters']['path']['type'], signal?: AbortSignal): Promise<{
280
- data?: never;
281
- error: import("./utils.cjs").Problem;
282
- response: Response;
283
- } | {
284
- data: never;
285
- error?: never;
286
- response: Response;
287
- }>;
288
- /**
289
- * Install an app via API key.
290
- * @param type - The type of the listing
291
- * @param signal - An optional abort signal
292
- * @returns The installation
293
- */
294
- installWithAPIKey(type: operations['marketplaceAppAPIKeyInstall']['parameters']['path']['type'], body: operations['marketplaceAppAPIKeyInstall']['requestBody']['content']['application/json'], signal?: AbortSignal): Promise<{
295
- data?: never;
296
- error: import("./utils.cjs").Problem;
297
- response: Response;
298
- } | {
299
- data: {
300
- app: import("./schemas.cjs").components["schemas"]["App"];
301
- defaultForCapabilityTypes: import("./schemas.cjs").components["schemas"]["AppCapabilityType"][];
302
- };
303
- error?: never;
304
- response: Response;
305
- }>;
306
- }
307
- /**
308
- * Stripe App
309
- */
310
- export declare class AppStripe {
311
- private client;
312
- constructor(client: Client<paths, `${string}/${string}`>);
313
- /**
314
- * Create a checkout session
315
- * @param body - The body of the request
316
- * @param signal - An optional abort signal
317
- * @returns The checkout session
318
- */
319
- createCheckoutSession(body: CreateStripeCheckoutSessionRequest, signal?: AbortSignal): Promise<{
320
- data?: never;
321
- error: import("./utils.cjs").Problem;
322
- response: Response;
323
- } | {
324
- data: {
325
- customerId: string;
326
- stripeCustomerId: string;
327
- sessionId: string;
328
- setupIntentId: string;
329
- url: string;
330
- mode: import("./schemas.cjs").components["schemas"]["StripeCheckoutSessionMode"];
331
- cancelURL?: string;
332
- successURL?: string;
333
- returnURL?: string;
334
- };
335
- error?: never;
336
- response: Response;
337
- }>;
338
- }
@@ -1 +0,0 @@
1
- {"version":3,"file":"apps.js","sourceRoot":"","sources":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AAiB,EAAC,IAAI,CAAC,CAAA;IAChC,CAAC;IAED;;;;;OAKG;IACI,KAAK,CAAC,eAAe,CAC1B,IAAmF,EACnF,MAAoB;QAEpB,MAAM,IAAI,GAAG,MAAM,IAAI,CAAC,MAAM,CAAC,GAAG,CAChC,8DAA8D,EAC9D;YACE,MAAM;YACN,MAAM,EAAE,EAAE,IAAI,EAAE,EAAE,IAAI,EAAE,EAAE;SAC3B,CACF,CAAA;QAED,OAAO,IAAA,4BAAiB,EAAC,IAAI,CAAC,CAAA;IAChC,CAAC;IAED;;;;;OAKG;IACI,KAAK,CAAC,iBAAiB,CAC5B,IAA6E,EAC7E,IAA6F,EAC7F,MAAoB;QAEpB,MAAM,IAAI,GAAG,MAAM,IAAI,CAAC,MAAM,CAAC,IAAI,CACjC,oDAAoD,EACpD;YACE,IAAI;YACJ,MAAM;YACN,MAAM,EAAE,EAAE,IAAI,EAAE,EAAE,IAAI,EAAE,EAAE;SAC3B,CACF,CAAA;QAED,OAAO,IAAA,4BAAiB,EAAC,IAAI,CAAC,CAAA;IAChC,CAAC;CACF;AAvGD,wCAuGC;AAED;;GAEG;AACH,MAAa,SAAS;IACA;IAApB,YAAoB,MAA4C;QAA5C,WAAM,GAAN,MAAM,CAAsC;IAAG,CAAC;IAEpE;;;;;OAKG;IACI,KAAK,CAAC,qBAAqB,CAChC,IAAwC,EACxC,MAAoB;QAEpB,MAAM,IAAI,GAAG,MAAM,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,kCAAkC,EAAE;YACtE,IAAI;YACJ,MAAM;SACP,CAAC,CAAA;QAEF,OAAO,IAAA,4BAAiB,EAAC,IAAI,CAAC,CAAA;IAChC,CAAC;CACF;AApBD,8BAoBC"}
@@ -1,309 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.BillingCustomers = exports.BillingInvoices = exports.BillingProfiles = exports.Billing = void 0;
4
- const utils_js_1 = require("./utils.cjs");
5
- /**
6
- * Billing
7
- */
8
- class Billing {
9
- client;
10
- profiles;
11
- invoices;
12
- customers;
13
- constructor(client) {
14
- this.client = client;
15
- this.profiles = new BillingProfiles(this.client);
16
- this.invoices = new BillingInvoices(this.client);
17
- this.customers = new BillingCustomers(this.client);
18
- }
19
- }
20
- exports.Billing = Billing;
21
- /**
22
- * Billing Profiles
23
- */
24
- class BillingProfiles {
25
- client;
26
- constructor(client) {
27
- this.client = client;
28
- }
29
- /**
30
- * Create a billing profile
31
- * @param billingProfile - The billing profile to create
32
- * @param signal - An optional abort signal
33
- * @returns The created billing profile
34
- */
35
- async create(billingProfile, signal) {
36
- const resp = await this.client.POST('/api/v1/billing/profiles', {
37
- signal,
38
- body: billingProfile,
39
- });
40
- return (0, utils_js_1.transformResponse)(resp);
41
- }
42
- /**
43
- * Get a billing profile by ID
44
- * @param id - The ID of the billing profile to get
45
- * @param signal - An optional abort signal
46
- * @returns The billing profile
47
- */
48
- async get(id, signal) {
49
- const resp = await this.client.GET('/api/v1/billing/profiles/{id}', {
50
- signal,
51
- params: {
52
- path: { id },
53
- },
54
- });
55
- return (0, utils_js_1.transformResponse)(resp);
56
- }
57
- /**
58
- * List billing profiles
59
- * @param query - The query parameters
60
- * @param signal - An optional abort signal
61
- * @returns The billing profiles
62
- */
63
- async list(query, signal) {
64
- const resp = await this.client.GET('/api/v1/billing/profiles', {
65
- signal,
66
- params: {
67
- query,
68
- },
69
- });
70
- return (0, utils_js_1.transformResponse)(resp);
71
- }
72
- /**
73
- * Update a billing profile
74
- * @param id - The ID of the billing profile to update
75
- * @param billingProfile - The billing profile to update
76
- * @param signal - An optional abort signal
77
- * @returns The updated billing profile
78
- */
79
- async update(id, billingProfile, signal) {
80
- const resp = await this.client.PUT('/api/v1/billing/profiles/{id}', {
81
- signal,
82
- params: {
83
- path: { id },
84
- },
85
- body: billingProfile,
86
- });
87
- return (0, utils_js_1.transformResponse)(resp);
88
- }
89
- }
90
- exports.BillingProfiles = BillingProfiles;
91
- /**
92
- * Billing Invoices
93
- */
94
- class BillingInvoices {
95
- client;
96
- constructor(client) {
97
- this.client = client;
98
- }
99
- /**
100
- * List invoices
101
- * @param query - The query parameters
102
- * @param signal - An optional abort signal
103
- * @returns The invoices
104
- */
105
- async list(query, signal) {
106
- const resp = await this.client.GET('/api/v1/billing/invoices', {
107
- signal,
108
- params: {
109
- query,
110
- },
111
- });
112
- return (0, utils_js_1.transformResponse)(resp);
113
- }
114
- /**
115
- * Get an invoice by ID
116
- * @param id - The ID of the invoice to get
117
- * @param signal - An optional abort signal
118
- * @returns The invoice
119
- */
120
- async get(id, signal) {
121
- const resp = await this.client.GET('/api/v1/billing/invoices/{invoiceId}', {
122
- signal,
123
- params: {
124
- path: { invoiceId: id },
125
- },
126
- });
127
- return (0, utils_js_1.transformResponse)(resp);
128
- }
129
- /**
130
- * Update an invoice
131
- * @description Only invoices in draft or earlier status can be updated.
132
- * @param id - The ID of the invoice to update
133
- * @param invoice - The invoice to update
134
- * @param signal - An optional abort signal
135
- * @returns The updated invoice
136
- */
137
- async update(id, invoice, signal) {
138
- const resp = await this.client.PUT('/api/v1/billing/invoices/{invoiceId}', {
139
- signal,
140
- params: { path: { invoiceId: id } },
141
- body: invoice,
142
- });
143
- return (0, utils_js_1.transformResponse)(resp);
144
- }
145
- /**
146
- * Advance the invoice to the next status
147
- * @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.
148
- * @param id - The ID of the invoice to advance
149
- * @param signal - An optional abort signal
150
- * @returns The advanced invoice
151
- */
152
- async advance(id, signal) {
153
- const resp = await this.client.POST('/api/v1/billing/invoices/{invoiceId}/advance', {
154
- signal,
155
- params: { path: { invoiceId: id } },
156
- });
157
- return (0, utils_js_1.transformResponse)(resp);
158
- }
159
- /**
160
- * Approve an invoice
161
- * @description This call instantly sends the invoice to the customer using the configured billing profile app.
162
- * @param id - The ID of the invoice to approve
163
- * @param signal - An optional abort signal
164
- * @returns The approved invoice
165
- */
166
- async approve(id, signal) {
167
- const resp = await this.client.POST('/api/v1/billing/invoices/{invoiceId}/approve', {
168
- signal,
169
- params: { path: { invoiceId: id } },
170
- });
171
- return (0, utils_js_1.transformResponse)(resp);
172
- }
173
- /**
174
- * Retry advancing the invoice after a failed attempt.
175
- * @param id - The ID of the invoice to retry
176
- * @param signal - An optional abort signal
177
- * @returns The retried invoice
178
- */
179
- async retry(id, signal) {
180
- const resp = await this.client.POST('/api/v1/billing/invoices/{invoiceId}/retry', {
181
- signal,
182
- params: { path: { invoiceId: id } },
183
- });
184
- return (0, utils_js_1.transformResponse)(resp);
185
- }
186
- /**
187
- * Void an invoice
188
- * @description Void an invoice
189
- *
190
- * Only invoices that have been alread issued can be voided.
191
- * @param id - The ID of the invoice to void
192
- * @param signal - An optional abort signal
193
- * @returns The voided invoice
194
- */
195
- async void(id, body, signal) {
196
- const resp = await this.client.POST('/api/v1/billing/invoices/{invoiceId}/void', {
197
- signal,
198
- params: { path: { invoiceId: id } },
199
- body,
200
- });
201
- return (0, utils_js_1.transformResponse)(resp);
202
- }
203
- /**
204
- * Recalculate an invoice's tax amounts
205
- * @param id - The ID of the invoice to recalculate
206
- * @param signal - An optional abort signal
207
- * @returns The recalculated invoice
208
- */
209
- async recalculateTax(id, signal) {
210
- const resp = await this.client.POST('/api/v1/billing/invoices/{invoiceId}/taxes/recalculate', {
211
- signal,
212
- params: { path: { invoiceId: id } },
213
- });
214
- return (0, utils_js_1.transformResponse)(resp);
215
- }
216
- /**
217
- * Simulate an invoice for a customer
218
- * @param id - The ID of the customer to simulate the invoice for
219
- * @param signal - An optional abort signal
220
- * @returns The simulated invoice
221
- */
222
- async simulate(id, body, signal) {
223
- const resp = await this.client.POST('/api/v1/billing/customers/{customerId}/invoices/simulate', {
224
- signal,
225
- params: { path: { customerId: id } },
226
- body,
227
- });
228
- return (0, utils_js_1.transformResponse)(resp);
229
- }
230
- /**
231
- * Create pending invoice line items
232
- * @param body - The pending invoice line items to create
233
- * @param signal - An optional abort signal
234
- * @returns The created pending invoice line items
235
- */
236
- async createLineItems(body, signal) {
237
- const resp = await this.client.POST('/api/v1/billing/invoices/lines', {
238
- signal,
239
- body,
240
- });
241
- return (0, utils_js_1.transformResponse)(resp);
242
- }
243
- }
244
- exports.BillingInvoices = BillingInvoices;
245
- /**
246
- * Billing Customer Invoices and Overrides
247
- */
248
- class BillingCustomers {
249
- client;
250
- constructor(client) {
251
- this.client = client;
252
- }
253
- /**
254
- * Create or update a customer override
255
- * @param id - The ID of the customer to create the override for
256
- * @param body - The customer override to create
257
- * @param signal - An optional abort signal
258
- * @returns The created customer override
259
- */
260
- async createOverride(id, body, signal) {
261
- const resp = await this.client.POST('/api/v1/billing/customers/{customerId}', {
262
- signal,
263
- params: { path: { customerId: id } },
264
- body,
265
- });
266
- return (0, utils_js_1.transformResponse)(resp);
267
- }
268
- /**
269
- * Get a customer override
270
- * @param id - The ID of the customer to get the override for
271
- * @param signal - An optional abort signal
272
- * @returns The customer override
273
- */
274
- async getOverride(id, signal) {
275
- const resp = await this.client.GET('/api/v1/billing/customers/{customerId}', {
276
- signal,
277
- params: { path: { customerId: id } },
278
- });
279
- return (0, utils_js_1.transformResponse)(resp);
280
- }
281
- /**
282
- * List customer overrides
283
- * @param query - The query parameters
284
- * @param signal - An optional abort signal
285
- * @returns The customer overrides
286
- */
287
- async listOverrides(query, signal) {
288
- const resp = await this.client.GET('/api/v1/billing/customers', {
289
- signal,
290
- params: { query },
291
- });
292
- return (0, utils_js_1.transformResponse)(resp);
293
- }
294
- /**
295
- * Delete a customer override
296
- * @param id - The ID of the customer to delete the override for
297
- * @param signal - An optional abort signal
298
- * @returns The deleted customer override
299
- */
300
- async deleteOverride(id, signal) {
301
- const resp = await this.client.DELETE('/api/v1/billing/customers/{customerId}', {
302
- signal,
303
- params: { path: { customerId: id } },
304
- });
305
- return (0, utils_js_1.transformResponse)(resp);
306
- }
307
- }
308
- exports.BillingCustomers = BillingCustomers;
309
- //# sourceMappingURL=billing.js.map