@openmeter/client 1.0.0-beta.231 → 1.0.0-beta.233
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.
- package/README.md +95 -54
- package/dist/core.js +7 -4
- package/dist/funcs/addons.js +59 -11
- package/dist/funcs/apps.d.ts +41 -1
- package/dist/funcs/apps.js +170 -4
- package/dist/funcs/billing.js +40 -8
- package/dist/funcs/charges.d.ts +14 -0
- package/dist/funcs/charges.js +42 -0
- package/dist/funcs/currencies.d.ts +9 -1
- package/dist/funcs/currencies.js +62 -5
- package/dist/funcs/customers.js +214 -43
- package/dist/funcs/{governance.d.ts → entitlementAccess.d.ts} +4 -4
- package/dist/funcs/{governance.js → entitlementAccess.js} +10 -10
- package/dist/funcs/entitlements.d.ts +9 -1
- package/dist/funcs/entitlements.js +61 -3
- package/dist/funcs/events.js +3 -0
- package/dist/funcs/features.js +48 -9
- package/dist/funcs/index.d.ts +2 -1
- package/dist/funcs/index.js +2 -1
- package/dist/funcs/invoices.d.ts +58 -1
- package/dist/funcs/invoices.js +202 -7
- package/dist/funcs/llmCost.js +26 -5
- package/dist/funcs/meters.js +59 -11
- package/dist/funcs/planAddons.js +71 -18
- package/dist/funcs/plans.js +59 -11
- package/dist/funcs/subscriptions.d.ts +60 -1
- package/dist/funcs/subscriptions.js +291 -17
- package/dist/funcs/tax.js +34 -7
- package/dist/index.d.ts +3 -2
- package/dist/lib/config.d.ts +2 -2
- package/dist/lib/paginate.d.ts +1 -1
- package/dist/lib/version.d.ts +1 -1
- package/dist/lib/version.js +1 -1
- package/dist/lib/wire.d.ts +1 -0
- package/dist/lib/wire.js +88 -10
- package/dist/models/operations/apps.d.ts +41 -1
- package/dist/models/operations/billing.d.ts +19 -1
- package/dist/models/operations/charges.d.ts +54 -0
- package/dist/models/operations/currencies.d.ts +10 -0
- package/dist/models/operations/customers.d.ts +21 -6
- package/dist/models/operations/entitlementAccess.d.ts +9 -0
- package/dist/models/operations/entitlementAccess.js +2 -0
- package/dist/models/operations/entitlements.d.ts +18 -1
- package/dist/models/operations/invoices.d.ts +16 -0
- package/dist/models/operations/planAddons.d.ts +14 -1
- package/dist/models/operations/subscriptions.d.ts +27 -3
- package/dist/models/schemas.d.ts +52291 -22631
- package/dist/models/schemas.js +3981 -1823
- package/dist/models/types.d.ts +4481 -2018
- package/dist/sdk/apps.d.ts +1 -20
- package/dist/sdk/apps.js +1 -24
- package/dist/sdk/customers.d.ts +2 -56
- package/dist/sdk/customers.js +1 -67
- package/dist/sdk/entitlements.d.ts +9 -1
- package/dist/sdk/entitlements.js +11 -1
- package/dist/sdk/internal.d.ts +324 -15
- package/dist/sdk/internal.js +402 -17
- package/dist/sdk/invoices.d.ts +127 -0
- package/dist/sdk/invoices.js +147 -0
- package/dist/sdk/planAddons.d.ts +1 -20
- package/dist/sdk/planAddons.js +1 -24
- package/dist/sdk/subscriptions.d.ts +20 -1
- package/dist/sdk/subscriptions.js +24 -1
- package/package.json +3 -3
- package/dist/models/operations/governance.d.ts +0 -9
- /package/dist/models/operations/{governance.js → charges.js} +0 -0
package/dist/sdk/apps.d.ts
CHANGED
|
@@ -1,28 +1,9 @@
|
|
|
1
1
|
import { type Client } from '../core.js';
|
|
2
2
|
import { type RequestOptions } from '../lib/types.js';
|
|
3
|
-
import type {
|
|
4
|
-
import type { App } from '../models/types.js';
|
|
3
|
+
import type { GetAppRequest, GetAppResponse } from '../models/operations/apps.js';
|
|
5
4
|
export declare class Apps {
|
|
6
5
|
private readonly _client;
|
|
7
6
|
constructor(_client: Client);
|
|
8
|
-
/**
|
|
9
|
-
* List apps
|
|
10
|
-
*
|
|
11
|
-
* List installed apps.
|
|
12
|
-
*
|
|
13
|
-
* GET /openmeter/apps
|
|
14
|
-
*/
|
|
15
|
-
list(request?: ListAppsRequest, options?: RequestOptions): Promise<ListAppsResponse>;
|
|
16
|
-
/**
|
|
17
|
-
* List apps
|
|
18
|
-
*
|
|
19
|
-
* List installed apps.
|
|
20
|
-
*
|
|
21
|
-
* Iterates every item across all pages, fetching more as the returned iterable is consumed.
|
|
22
|
-
*
|
|
23
|
-
* GET /openmeter/apps
|
|
24
|
-
*/
|
|
25
|
-
listAll(request?: ListAppsRequest, options?: RequestOptions): AsyncIterable<App>;
|
|
26
7
|
/**
|
|
27
8
|
* Get app
|
|
28
9
|
*
|
package/dist/sdk/apps.js
CHANGED
|
@@ -1,34 +1,11 @@
|
|
|
1
1
|
// Code generated by @openmeter/typespec-typescript. DO NOT EDIT.
|
|
2
2
|
import { unwrap } from '../lib/types.js';
|
|
3
|
-
import {
|
|
4
|
-
import { listApps, getApp } from '../funcs/apps.js';
|
|
3
|
+
import { getApp } from '../funcs/apps.js';
|
|
5
4
|
export class Apps {
|
|
6
5
|
_client;
|
|
7
6
|
constructor(_client) {
|
|
8
7
|
this._client = _client;
|
|
9
8
|
}
|
|
10
|
-
/**
|
|
11
|
-
* List apps
|
|
12
|
-
*
|
|
13
|
-
* List installed apps.
|
|
14
|
-
*
|
|
15
|
-
* GET /openmeter/apps
|
|
16
|
-
*/
|
|
17
|
-
async list(request, options) {
|
|
18
|
-
return unwrap(await listApps(this._client, request, options));
|
|
19
|
-
}
|
|
20
|
-
/**
|
|
21
|
-
* List apps
|
|
22
|
-
*
|
|
23
|
-
* List installed apps.
|
|
24
|
-
*
|
|
25
|
-
* Iterates every item across all pages, fetching more as the returned iterable is consumed.
|
|
26
|
-
*
|
|
27
|
-
* GET /openmeter/apps
|
|
28
|
-
*/
|
|
29
|
-
listAll(request, options) {
|
|
30
|
-
return paginatePages((req, opts) => listApps(this._client, req, opts), request ?? {}, options);
|
|
31
|
-
}
|
|
32
9
|
/**
|
|
33
10
|
* Get app
|
|
34
11
|
*
|
package/dist/sdk/customers.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { type Client } from '../core.js';
|
|
2
2
|
import { type RequestOptions } from '../lib/types.js';
|
|
3
|
-
import type { CreateCustomerRequest, CreateCustomerResponse, GetCustomerRequest, GetCustomerResponse, ListCustomersRequest, ListCustomersResponse, UpsertCustomerRequest, UpsertCustomerResponse, DeleteCustomerRequest, DeleteCustomerResponse, GetCustomerBillingRequest, GetCustomerBillingResponse, UpdateCustomerBillingRequest, UpdateCustomerBillingResponse, UpdateCustomerBillingAppDataRequest, UpdateCustomerBillingAppDataResponse, CreateCustomerStripeCheckoutSessionRequest, CreateCustomerStripeCheckoutSessionResponse, CreateCustomerStripePortalSessionRequest, CreateCustomerStripePortalSessionResponse, CreateCreditGrantRequest, CreateCreditGrantResponse, GetCreditGrantRequest, GetCreditGrantResponse, ListCreditGrantsRequest, ListCreditGrantsResponse, GetCustomerCreditBalanceRequest, GetCustomerCreditBalanceResponse, CreateCreditAdjustmentRequest, CreateCreditAdjustmentResponse,
|
|
4
|
-
import type {
|
|
3
|
+
import type { CreateCustomerRequest, CreateCustomerResponse, GetCustomerRequest, GetCustomerResponse, ListCustomersRequest, ListCustomersResponse, UpsertCustomerRequest, UpsertCustomerResponse, DeleteCustomerRequest, DeleteCustomerResponse, GetCustomerBillingRequest, GetCustomerBillingResponse, UpdateCustomerBillingRequest, UpdateCustomerBillingResponse, UpdateCustomerBillingAppDataRequest, UpdateCustomerBillingAppDataResponse, CreateCustomerStripeCheckoutSessionRequest, CreateCustomerStripeCheckoutSessionResponse, CreateCustomerStripePortalSessionRequest, CreateCustomerStripePortalSessionResponse, CreateCreditGrantRequest, CreateCreditGrantResponse, GetCreditGrantRequest, GetCreditGrantResponse, ListCreditGrantsRequest, ListCreditGrantsResponse, GetCustomerCreditBalanceRequest, GetCustomerCreditBalanceResponse, CreateCreditAdjustmentRequest, CreateCreditAdjustmentResponse, UpdateCreditGrantExternalSettlementRequest, UpdateCreditGrantExternalSettlementResponse, ListCreditTransactionsRequest, ListCreditTransactionsResponse } from '../models/operations/customers.js';
|
|
4
|
+
import type { CreditGrant, CreditTransaction, Customer } from '../models/types.js';
|
|
5
5
|
export declare class Customers {
|
|
6
6
|
private readonly _client;
|
|
7
7
|
constructor(_client: Client);
|
|
@@ -47,8 +47,6 @@ export declare class Customers {
|
|
|
47
47
|
get billing(): CustomersBilling;
|
|
48
48
|
private _credits?;
|
|
49
49
|
get credits(): CustomersCredits;
|
|
50
|
-
private _charges?;
|
|
51
|
-
get charges(): CustomersCharges;
|
|
52
50
|
}
|
|
53
51
|
export declare class CustomersBilling {
|
|
54
52
|
private readonly _client;
|
|
@@ -153,22 +151,6 @@ export declare class CustomersCreditsGrants {
|
|
|
153
151
|
* GET /openmeter/customers/{customerId}/credits/grants
|
|
154
152
|
*/
|
|
155
153
|
listAll(request: ListCreditGrantsRequest, options?: RequestOptions): AsyncIterable<CreditGrant>;
|
|
156
|
-
/**
|
|
157
|
-
* Void credit grant
|
|
158
|
-
*
|
|
159
|
-
* Void a credit grant, forfeiting the remaining unused balance.
|
|
160
|
-
*
|
|
161
|
-
* Voiding is a forward-looking, irreversible operation. Credits already consumed
|
|
162
|
-
* by usage remain unaffected — only the remaining balance is forfeited. The grant
|
|
163
|
-
* reads as `voided` status afterwards. Payment state is not adjusted when
|
|
164
|
-
* `payment_adjustment` is `none`, so invoice-backed or externally collected
|
|
165
|
-
* payments may still collect the original amount. Only `active` grants can be
|
|
166
|
-
* voided; voiding a pending, expired, or fully consumed grant returns a conflict.
|
|
167
|
-
* Retrying a successful void is an idempotent success.
|
|
168
|
-
*
|
|
169
|
-
* POST /openmeter/customers/{customerId}/credits/grants/{creditGrantId}/void
|
|
170
|
-
*/
|
|
171
|
-
void(request: VoidCreditGrantRequest, options?: RequestOptions): Promise<VoidCreditGrantResponse>;
|
|
172
154
|
/**
|
|
173
155
|
* Update credit grant external settlement status
|
|
174
156
|
*
|
|
@@ -240,39 +222,3 @@ export declare class CustomersCreditsTransactions {
|
|
|
240
222
|
*/
|
|
241
223
|
listAll(request: ListCreditTransactionsRequest, options?: RequestOptions): AsyncIterable<CreditTransaction>;
|
|
242
224
|
}
|
|
243
|
-
export declare class CustomersCharges {
|
|
244
|
-
private readonly _client;
|
|
245
|
-
constructor(_client: Client);
|
|
246
|
-
/**
|
|
247
|
-
* List customer charges
|
|
248
|
-
*
|
|
249
|
-
* List customer charges.
|
|
250
|
-
*
|
|
251
|
-
* Returns the customer's charges that are represented as either flat fee or
|
|
252
|
-
* usage-based charges.
|
|
253
|
-
*
|
|
254
|
-
* GET /openmeter/customers/{customerId}/charges
|
|
255
|
-
*/
|
|
256
|
-
list(request: ListCustomerChargesRequest, options?: RequestOptions): Promise<ListCustomerChargesResponse>;
|
|
257
|
-
/**
|
|
258
|
-
* List customer charges
|
|
259
|
-
*
|
|
260
|
-
* List customer charges.
|
|
261
|
-
*
|
|
262
|
-
* Returns the customer's charges that are represented as either flat fee or
|
|
263
|
-
* usage-based charges.
|
|
264
|
-
*
|
|
265
|
-
* Iterates every item across all pages, fetching more as the returned iterable is consumed.
|
|
266
|
-
*
|
|
267
|
-
* GET /openmeter/customers/{customerId}/charges
|
|
268
|
-
*/
|
|
269
|
-
listAll(request: ListCustomerChargesRequest, options?: RequestOptions): AsyncIterable<Charge>;
|
|
270
|
-
/**
|
|
271
|
-
* Create customer charge
|
|
272
|
-
*
|
|
273
|
-
* Create customer charge.
|
|
274
|
-
*
|
|
275
|
-
* POST /openmeter/customers/{customerId}/charges
|
|
276
|
-
*/
|
|
277
|
-
create(request: CreateCustomerChargesRequest, options?: RequestOptions): Promise<CreateCustomerChargesResponse>;
|
|
278
|
-
}
|
package/dist/sdk/customers.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// Code generated by @openmeter/typespec-typescript. DO NOT EDIT.
|
|
2
2
|
import { unwrap } from '../lib/types.js';
|
|
3
3
|
import { paginateCursor, paginatePages } from '../lib/paginate.js';
|
|
4
|
-
import { createCustomer, getCustomer, listCustomers, upsertCustomer, deleteCustomer, getCustomerBilling, updateCustomerBilling, updateCustomerBillingAppData, createCustomerStripeCheckoutSession, createCustomerStripePortalSession, createCreditGrant, getCreditGrant, listCreditGrants, getCustomerCreditBalance, createCreditAdjustment,
|
|
4
|
+
import { createCustomer, getCustomer, listCustomers, upsertCustomer, deleteCustomer, getCustomerBilling, updateCustomerBilling, updateCustomerBillingAppData, createCustomerStripeCheckoutSession, createCustomerStripePortalSession, createCreditGrant, getCreditGrant, listCreditGrants, getCustomerCreditBalance, createCreditAdjustment, updateCreditGrantExternalSettlement, listCreditTransactions, } from '../funcs/customers.js';
|
|
5
5
|
export class Customers {
|
|
6
6
|
_client;
|
|
7
7
|
constructor(_client) {
|
|
@@ -65,10 +65,6 @@ export class Customers {
|
|
|
65
65
|
get credits() {
|
|
66
66
|
return (this._credits ??= new CustomersCredits(this._client));
|
|
67
67
|
}
|
|
68
|
-
_charges;
|
|
69
|
-
get charges() {
|
|
70
|
-
return (this._charges ??= new CustomersCharges(this._client));
|
|
71
|
-
}
|
|
72
68
|
}
|
|
73
69
|
export class CustomersBilling {
|
|
74
70
|
_client;
|
|
@@ -205,24 +201,6 @@ export class CustomersCreditsGrants {
|
|
|
205
201
|
listAll(request, options) {
|
|
206
202
|
return paginatePages((req, opts) => listCreditGrants(this._client, req, opts), request, options);
|
|
207
203
|
}
|
|
208
|
-
/**
|
|
209
|
-
* Void credit grant
|
|
210
|
-
*
|
|
211
|
-
* Void a credit grant, forfeiting the remaining unused balance.
|
|
212
|
-
*
|
|
213
|
-
* Voiding is a forward-looking, irreversible operation. Credits already consumed
|
|
214
|
-
* by usage remain unaffected — only the remaining balance is forfeited. The grant
|
|
215
|
-
* reads as `voided` status afterwards. Payment state is not adjusted when
|
|
216
|
-
* `payment_adjustment` is `none`, so invoice-backed or externally collected
|
|
217
|
-
* payments may still collect the original amount. Only `active` grants can be
|
|
218
|
-
* voided; voiding a pending, expired, or fully consumed grant returns a conflict.
|
|
219
|
-
* Retrying a successful void is an idempotent success.
|
|
220
|
-
*
|
|
221
|
-
* POST /openmeter/customers/{customerId}/credits/grants/{creditGrantId}/void
|
|
222
|
-
*/
|
|
223
|
-
async void(request, options) {
|
|
224
|
-
return unwrap(await voidCreditGrant(this._client, request, options));
|
|
225
|
-
}
|
|
226
204
|
/**
|
|
227
205
|
* Update credit grant external settlement status
|
|
228
206
|
*
|
|
@@ -310,47 +288,3 @@ export class CustomersCreditsTransactions {
|
|
|
310
288
|
return paginateCursor((req, opts) => listCreditTransactions(this._client, req, opts), request, options);
|
|
311
289
|
}
|
|
312
290
|
}
|
|
313
|
-
export class CustomersCharges {
|
|
314
|
-
_client;
|
|
315
|
-
constructor(_client) {
|
|
316
|
-
this._client = _client;
|
|
317
|
-
}
|
|
318
|
-
/**
|
|
319
|
-
* List customer charges
|
|
320
|
-
*
|
|
321
|
-
* List customer charges.
|
|
322
|
-
*
|
|
323
|
-
* Returns the customer's charges that are represented as either flat fee or
|
|
324
|
-
* usage-based charges.
|
|
325
|
-
*
|
|
326
|
-
* GET /openmeter/customers/{customerId}/charges
|
|
327
|
-
*/
|
|
328
|
-
async list(request, options) {
|
|
329
|
-
return unwrap(await listCustomerCharges(this._client, request, options));
|
|
330
|
-
}
|
|
331
|
-
/**
|
|
332
|
-
* List customer charges
|
|
333
|
-
*
|
|
334
|
-
* List customer charges.
|
|
335
|
-
*
|
|
336
|
-
* Returns the customer's charges that are represented as either flat fee or
|
|
337
|
-
* usage-based charges.
|
|
338
|
-
*
|
|
339
|
-
* Iterates every item across all pages, fetching more as the returned iterable is consumed.
|
|
340
|
-
*
|
|
341
|
-
* GET /openmeter/customers/{customerId}/charges
|
|
342
|
-
*/
|
|
343
|
-
listAll(request, options) {
|
|
344
|
-
return paginatePages((req, opts) => listCustomerCharges(this._client, req, opts), request, options);
|
|
345
|
-
}
|
|
346
|
-
/**
|
|
347
|
-
* Create customer charge
|
|
348
|
-
*
|
|
349
|
-
* Create customer charge.
|
|
350
|
-
*
|
|
351
|
-
* POST /openmeter/customers/{customerId}/charges
|
|
352
|
-
*/
|
|
353
|
-
async create(request, options) {
|
|
354
|
-
return unwrap(await createCustomerCharges(this._client, request, options));
|
|
355
|
-
}
|
|
356
|
-
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { type Client } from '../core.js';
|
|
2
2
|
import { type RequestOptions } from '../lib/types.js';
|
|
3
|
-
import type { ListCustomerEntitlementAccessRequest, ListCustomerEntitlementAccessResponse } from '../models/operations/entitlements.js';
|
|
3
|
+
import type { ListCustomerEntitlementAccessRequest, ListCustomerEntitlementAccessResponse, GetCustomerEntitlementAccessRequest, GetCustomerEntitlementAccessResponse } from '../models/operations/entitlements.js';
|
|
4
4
|
export declare class Entitlements {
|
|
5
5
|
private readonly _client;
|
|
6
6
|
constructor(_client: Client);
|
|
@@ -10,4 +10,12 @@ export declare class Entitlements {
|
|
|
10
10
|
* GET /openmeter/customers/{customerId}/entitlement-access
|
|
11
11
|
*/
|
|
12
12
|
listCustomerAccess(request: ListCustomerEntitlementAccessRequest, options?: RequestOptions): Promise<ListCustomerEntitlementAccessResponse>;
|
|
13
|
+
/**
|
|
14
|
+
* Get customer entitlement access
|
|
15
|
+
*
|
|
16
|
+
* Get the customer's access to a single feature.
|
|
17
|
+
*
|
|
18
|
+
* GET /openmeter/customers/{customerId}/entitlement-access/features/{featureKey}
|
|
19
|
+
*/
|
|
20
|
+
getCustomerAccess(request: GetCustomerEntitlementAccessRequest, options?: RequestOptions): Promise<GetCustomerEntitlementAccessResponse>;
|
|
13
21
|
}
|
package/dist/sdk/entitlements.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// Code generated by @openmeter/typespec-typescript. DO NOT EDIT.
|
|
2
2
|
import { unwrap } from '../lib/types.js';
|
|
3
|
-
import { listCustomerEntitlementAccess } from '../funcs/entitlements.js';
|
|
3
|
+
import { listCustomerEntitlementAccess, getCustomerEntitlementAccess, } from '../funcs/entitlements.js';
|
|
4
4
|
export class Entitlements {
|
|
5
5
|
_client;
|
|
6
6
|
constructor(_client) {
|
|
@@ -14,4 +14,14 @@ export class Entitlements {
|
|
|
14
14
|
async listCustomerAccess(request, options) {
|
|
15
15
|
return unwrap(await listCustomerEntitlementAccess(this._client, request, options));
|
|
16
16
|
}
|
|
17
|
+
/**
|
|
18
|
+
* Get customer entitlement access
|
|
19
|
+
*
|
|
20
|
+
* Get the customer's access to a single feature.
|
|
21
|
+
*
|
|
22
|
+
* GET /openmeter/customers/{customerId}/entitlement-access/features/{featureKey}
|
|
23
|
+
*/
|
|
24
|
+
async getCustomerAccess(request, options) {
|
|
25
|
+
return unwrap(await getCustomerEntitlementAccess(this._client, request, options));
|
|
26
|
+
}
|
|
17
27
|
}
|