@openmeter/client 1.0.0-beta-72c0e4789aae → 1.0.0-beta-482d55e8993a
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 +125 -149
- package/dist/index.d.ts +6 -0
- package/dist/index.js +6 -0
- package/dist/lib/version.d.ts +1 -1
- package/dist/lib/version.js +1 -1
- package/dist/sdk/apps.d.ts +52 -2
- package/dist/sdk/apps.js +63 -1
- package/dist/sdk/charges.d.ts +32 -0
- package/dist/sdk/charges.js +38 -0
- package/dist/sdk/currencies.d.ts +71 -0
- package/dist/sdk/currencies.js +87 -0
- package/dist/sdk/customers.d.ts +205 -2
- package/dist/sdk/customers.js +246 -1
- package/dist/sdk/entitlementAccess.d.ts +22 -0
- package/dist/sdk/entitlementAccess.js +26 -0
- package/dist/sdk/entitlements.d.ts +59 -1
- package/dist/sdk/entitlements.js +71 -1
- package/dist/sdk/grants.d.ts +43 -0
- package/dist/sdk/grants.js +51 -0
- package/dist/sdk/internal.d.ts +1 -756
- package/dist/sdk/internal.js +1 -936
- package/dist/sdk/planAddons.d.ts +20 -1
- package/dist/sdk/planAddons.js +24 -1
- package/dist/sdk/sdk.d.ts +18 -0
- package/dist/sdk/sdk.js +30 -0
- package/dist/sdk/subscriptions.d.ts +39 -1
- package/dist/sdk/subscriptions.js +45 -1
- package/package.json +1 -1
package/dist/sdk/apps.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 { ListAppsRequest, ListAppsResponse, GetAppRequest, GetAppResponse } from '../models/operations/apps.js';
|
|
4
|
-
import type { App } from '../models/types.js';
|
|
3
|
+
import type { ListAppsRequest, ListAppsResponse, GetAppRequest, GetAppResponse, UninstallAppRequest, UninstallAppResponse, UpdateAppRequest, UpdateAppResponse, ListAppCatalogRequest, ListAppCatalogResponse, GetAppCatalogItemRequest, GetAppCatalogItemResponse, InstallAppRequest, InstallAppResponse } from '../models/operations/apps.js';
|
|
4
|
+
import type { App, AppCatalogItem } from '../models/types.js';
|
|
5
5
|
export declare class Apps {
|
|
6
6
|
private readonly _client;
|
|
7
7
|
constructor(_client: Client);
|
|
@@ -31,4 +31,54 @@ export declare class Apps {
|
|
|
31
31
|
* GET /openmeter/apps/{appId}
|
|
32
32
|
*/
|
|
33
33
|
get(request: GetAppRequest, options?: RequestOptions): Promise<GetAppResponse>;
|
|
34
|
+
/**
|
|
35
|
+
* Uninstall app
|
|
36
|
+
*
|
|
37
|
+
* Uninstall an app by ID.
|
|
38
|
+
*
|
|
39
|
+
* DELETE /openmeter/apps/{appId}
|
|
40
|
+
*/
|
|
41
|
+
uninstall(request: UninstallAppRequest, options?: RequestOptions): Promise<UninstallAppResponse>;
|
|
42
|
+
/**
|
|
43
|
+
* Update app
|
|
44
|
+
*
|
|
45
|
+
* Update an installed app.
|
|
46
|
+
*
|
|
47
|
+
* PUT /openmeter/apps/{appId}
|
|
48
|
+
*/
|
|
49
|
+
update(request: UpdateAppRequest, options?: RequestOptions): Promise<UpdateAppResponse>;
|
|
50
|
+
/**
|
|
51
|
+
* List app catalog
|
|
52
|
+
*
|
|
53
|
+
* List available apps.
|
|
54
|
+
*
|
|
55
|
+
* GET /openmeter/app-catalog
|
|
56
|
+
*/
|
|
57
|
+
listCatalog(request?: ListAppCatalogRequest, options?: RequestOptions): Promise<ListAppCatalogResponse>;
|
|
58
|
+
/**
|
|
59
|
+
* List app catalog
|
|
60
|
+
*
|
|
61
|
+
* List available apps.
|
|
62
|
+
*
|
|
63
|
+
* Iterates every item across all pages, fetching more as the returned iterable is consumed.
|
|
64
|
+
*
|
|
65
|
+
* GET /openmeter/app-catalog
|
|
66
|
+
*/
|
|
67
|
+
listCatalogAll(request?: ListAppCatalogRequest, options?: RequestOptions): AsyncIterable<AppCatalogItem>;
|
|
68
|
+
/**
|
|
69
|
+
* Get app catalog item by type
|
|
70
|
+
*
|
|
71
|
+
* Get an app catalog item by type.
|
|
72
|
+
*
|
|
73
|
+
* GET /openmeter/app-catalog/{appType}
|
|
74
|
+
*/
|
|
75
|
+
getCatalogItem(request: GetAppCatalogItemRequest, options?: RequestOptions): Promise<GetAppCatalogItemResponse>;
|
|
76
|
+
/**
|
|
77
|
+
* Install app from the catalog
|
|
78
|
+
*
|
|
79
|
+
* Install an app from the catalog.
|
|
80
|
+
*
|
|
81
|
+
* POST /openmeter/app-catalog/install
|
|
82
|
+
*/
|
|
83
|
+
install(request: InstallAppRequest, options?: RequestOptions): Promise<InstallAppResponse>;
|
|
34
84
|
}
|
package/dist/sdk/apps.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 { paginatePages } from '../lib/paginate.js';
|
|
4
|
-
import { listApps, getApp } from '../funcs/apps.js';
|
|
4
|
+
import { listApps, getApp, uninstallApp, updateApp, listAppCatalog, getAppCatalogItem, installApp, } from '../funcs/apps.js';
|
|
5
5
|
export class Apps {
|
|
6
6
|
_client;
|
|
7
7
|
constructor(_client) {
|
|
@@ -39,4 +39,66 @@ export class Apps {
|
|
|
39
39
|
async get(request, options) {
|
|
40
40
|
return unwrap(await getApp(this._client, request, options));
|
|
41
41
|
}
|
|
42
|
+
/**
|
|
43
|
+
* Uninstall app
|
|
44
|
+
*
|
|
45
|
+
* Uninstall an app by ID.
|
|
46
|
+
*
|
|
47
|
+
* DELETE /openmeter/apps/{appId}
|
|
48
|
+
*/
|
|
49
|
+
async uninstall(request, options) {
|
|
50
|
+
return unwrap(await uninstallApp(this._client, request, options));
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* Update app
|
|
54
|
+
*
|
|
55
|
+
* Update an installed app.
|
|
56
|
+
*
|
|
57
|
+
* PUT /openmeter/apps/{appId}
|
|
58
|
+
*/
|
|
59
|
+
async update(request, options) {
|
|
60
|
+
return unwrap(await updateApp(this._client, request, options));
|
|
61
|
+
}
|
|
62
|
+
/**
|
|
63
|
+
* List app catalog
|
|
64
|
+
*
|
|
65
|
+
* List available apps.
|
|
66
|
+
*
|
|
67
|
+
* GET /openmeter/app-catalog
|
|
68
|
+
*/
|
|
69
|
+
async listCatalog(request, options) {
|
|
70
|
+
return unwrap(await listAppCatalog(this._client, request, options));
|
|
71
|
+
}
|
|
72
|
+
/**
|
|
73
|
+
* List app catalog
|
|
74
|
+
*
|
|
75
|
+
* List available apps.
|
|
76
|
+
*
|
|
77
|
+
* Iterates every item across all pages, fetching more as the returned iterable is consumed.
|
|
78
|
+
*
|
|
79
|
+
* GET /openmeter/app-catalog
|
|
80
|
+
*/
|
|
81
|
+
listCatalogAll(request, options) {
|
|
82
|
+
return paginatePages((req, opts) => listAppCatalog(this._client, req, opts), request ?? {}, options);
|
|
83
|
+
}
|
|
84
|
+
/**
|
|
85
|
+
* Get app catalog item by type
|
|
86
|
+
*
|
|
87
|
+
* Get an app catalog item by type.
|
|
88
|
+
*
|
|
89
|
+
* GET /openmeter/app-catalog/{appType}
|
|
90
|
+
*/
|
|
91
|
+
async getCatalogItem(request, options) {
|
|
92
|
+
return unwrap(await getAppCatalogItem(this._client, request, options));
|
|
93
|
+
}
|
|
94
|
+
/**
|
|
95
|
+
* Install app from the catalog
|
|
96
|
+
*
|
|
97
|
+
* Install an app from the catalog.
|
|
98
|
+
*
|
|
99
|
+
* POST /openmeter/app-catalog/install
|
|
100
|
+
*/
|
|
101
|
+
async install(request, options) {
|
|
102
|
+
return unwrap(await installApp(this._client, request, options));
|
|
103
|
+
}
|
|
42
104
|
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { type Client } from '../core.js';
|
|
2
|
+
import { type RequestOptions } from '../lib/types.js';
|
|
3
|
+
import type { ListChargesRequest, ListChargesResponse } from '../models/operations/charges.js';
|
|
4
|
+
import type { Charge } from '../models/types.js';
|
|
5
|
+
export declare class Charges {
|
|
6
|
+
private readonly _client;
|
|
7
|
+
constructor(_client: Client);
|
|
8
|
+
/**
|
|
9
|
+
* List charges
|
|
10
|
+
*
|
|
11
|
+
* List charges.
|
|
12
|
+
*
|
|
13
|
+
* Returns the charges of every customer that are represented as either flat fee or
|
|
14
|
+
* usage-based charges.
|
|
15
|
+
*
|
|
16
|
+
* GET /openmeter/charges
|
|
17
|
+
*/
|
|
18
|
+
list(request?: ListChargesRequest, options?: RequestOptions): Promise<ListChargesResponse>;
|
|
19
|
+
/**
|
|
20
|
+
* List charges
|
|
21
|
+
*
|
|
22
|
+
* List charges.
|
|
23
|
+
*
|
|
24
|
+
* Returns the charges of every customer that are represented as either flat fee or
|
|
25
|
+
* usage-based charges.
|
|
26
|
+
*
|
|
27
|
+
* Iterates every item across all pages, fetching more as the returned iterable is consumed.
|
|
28
|
+
*
|
|
29
|
+
* GET /openmeter/charges
|
|
30
|
+
*/
|
|
31
|
+
listAll(request?: ListChargesRequest, options?: RequestOptions): AsyncIterable<Charge>;
|
|
32
|
+
}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
// Code generated by @openmeter/typespec-typescript. DO NOT EDIT.
|
|
2
|
+
import { unwrap } from '../lib/types.js';
|
|
3
|
+
import { paginatePages } from '../lib/paginate.js';
|
|
4
|
+
import { listCharges } from '../funcs/charges.js';
|
|
5
|
+
export class Charges {
|
|
6
|
+
_client;
|
|
7
|
+
constructor(_client) {
|
|
8
|
+
this._client = _client;
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* List charges
|
|
12
|
+
*
|
|
13
|
+
* List charges.
|
|
14
|
+
*
|
|
15
|
+
* Returns the charges of every customer that are represented as either flat fee or
|
|
16
|
+
* usage-based charges.
|
|
17
|
+
*
|
|
18
|
+
* GET /openmeter/charges
|
|
19
|
+
*/
|
|
20
|
+
async list(request, options) {
|
|
21
|
+
return unwrap(await listCharges(this._client, request, options));
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* List charges
|
|
25
|
+
*
|
|
26
|
+
* List charges.
|
|
27
|
+
*
|
|
28
|
+
* Returns the charges of every customer that are represented as either flat fee or
|
|
29
|
+
* usage-based charges.
|
|
30
|
+
*
|
|
31
|
+
* Iterates every item across all pages, fetching more as the returned iterable is consumed.
|
|
32
|
+
*
|
|
33
|
+
* GET /openmeter/charges
|
|
34
|
+
*/
|
|
35
|
+
listAll(request, options) {
|
|
36
|
+
return paginatePages((req, opts) => listCharges(this._client, req, opts), request ?? {}, options);
|
|
37
|
+
}
|
|
38
|
+
}
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import { type Client } from '../core.js';
|
|
2
|
+
import { type RequestOptions } from '../lib/types.js';
|
|
3
|
+
import type { ListCurrenciesRequest, ListCurrenciesResponse, CreateCustomCurrencyRequest, CreateCustomCurrencyResponse, GetCustomCurrencyRequest, GetCustomCurrencyResponse, ListCostBasesRequest, ListCostBasesResponse, CreateCostBasisRequest, CreateCostBasisResponse } from '../models/operations/currencies.js';
|
|
4
|
+
import type { CostBasis, Currency } from '../models/types.js';
|
|
5
|
+
export declare class Currencies {
|
|
6
|
+
private readonly _client;
|
|
7
|
+
constructor(_client: Client);
|
|
8
|
+
/**
|
|
9
|
+
* List currencies
|
|
10
|
+
*
|
|
11
|
+
* List currencies supported by the billing system.
|
|
12
|
+
*
|
|
13
|
+
* GET /openmeter/currencies
|
|
14
|
+
*/
|
|
15
|
+
list(request?: ListCurrenciesRequest, options?: RequestOptions): Promise<ListCurrenciesResponse>;
|
|
16
|
+
/**
|
|
17
|
+
* List currencies
|
|
18
|
+
*
|
|
19
|
+
* List currencies supported by the billing system.
|
|
20
|
+
*
|
|
21
|
+
* Iterates every item across all pages, fetching more as the returned iterable is consumed.
|
|
22
|
+
*
|
|
23
|
+
* GET /openmeter/currencies
|
|
24
|
+
*/
|
|
25
|
+
listAll(request?: ListCurrenciesRequest, options?: RequestOptions): AsyncIterable<Currency>;
|
|
26
|
+
/**
|
|
27
|
+
* Create custom currency
|
|
28
|
+
*
|
|
29
|
+
* Create a custom currency. This operation allows defining your own custom
|
|
30
|
+
* currency for billing purposes.
|
|
31
|
+
*
|
|
32
|
+
* POST /openmeter/currencies/custom
|
|
33
|
+
*/
|
|
34
|
+
createCustomCurrency(request: CreateCustomCurrencyRequest, options?: RequestOptions): Promise<CreateCustomCurrencyResponse>;
|
|
35
|
+
/**
|
|
36
|
+
* Get custom currency
|
|
37
|
+
*
|
|
38
|
+
* Get a custom currency.
|
|
39
|
+
*
|
|
40
|
+
* GET /openmeter/currencies/custom/{currencyId}
|
|
41
|
+
*/
|
|
42
|
+
getCustomCurrency(request: GetCustomCurrencyRequest, options?: RequestOptions): Promise<GetCustomCurrencyResponse>;
|
|
43
|
+
/**
|
|
44
|
+
* List cost bases
|
|
45
|
+
*
|
|
46
|
+
* List cost bases for a currency. For custom currencies, there can be multiple
|
|
47
|
+
* cost bases with different `effective_from` dates.
|
|
48
|
+
*
|
|
49
|
+
* GET /openmeter/currencies/custom/{currencyId}/cost-bases
|
|
50
|
+
*/
|
|
51
|
+
listCostBases(request: ListCostBasesRequest, options?: RequestOptions): Promise<ListCostBasesResponse>;
|
|
52
|
+
/**
|
|
53
|
+
* List cost bases
|
|
54
|
+
*
|
|
55
|
+
* List cost bases for a currency. For custom currencies, there can be multiple
|
|
56
|
+
* cost bases with different `effective_from` dates.
|
|
57
|
+
*
|
|
58
|
+
* Iterates every item across all pages, fetching more as the returned iterable is consumed.
|
|
59
|
+
*
|
|
60
|
+
* GET /openmeter/currencies/custom/{currencyId}/cost-bases
|
|
61
|
+
*/
|
|
62
|
+
listCostBasesAll(request: ListCostBasesRequest, options?: RequestOptions): AsyncIterable<CostBasis>;
|
|
63
|
+
/**
|
|
64
|
+
* Create cost basis
|
|
65
|
+
*
|
|
66
|
+
* Create a cost basis for a currency.
|
|
67
|
+
*
|
|
68
|
+
* POST /openmeter/currencies/custom/{currencyId}/cost-bases
|
|
69
|
+
*/
|
|
70
|
+
createCostBasis(request: CreateCostBasisRequest, options?: RequestOptions): Promise<CreateCostBasisResponse>;
|
|
71
|
+
}
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
// Code generated by @openmeter/typespec-typescript. DO NOT EDIT.
|
|
2
|
+
import { unwrap } from '../lib/types.js';
|
|
3
|
+
import { paginatePages } from '../lib/paginate.js';
|
|
4
|
+
import { listCurrencies, createCustomCurrency, getCustomCurrency, listCostBases, createCostBasis, } from '../funcs/currencies.js';
|
|
5
|
+
export class Currencies {
|
|
6
|
+
_client;
|
|
7
|
+
constructor(_client) {
|
|
8
|
+
this._client = _client;
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* List currencies
|
|
12
|
+
*
|
|
13
|
+
* List currencies supported by the billing system.
|
|
14
|
+
*
|
|
15
|
+
* GET /openmeter/currencies
|
|
16
|
+
*/
|
|
17
|
+
async list(request, options) {
|
|
18
|
+
return unwrap(await listCurrencies(this._client, request, options));
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* List currencies
|
|
22
|
+
*
|
|
23
|
+
* List currencies supported by the billing system.
|
|
24
|
+
*
|
|
25
|
+
* Iterates every item across all pages, fetching more as the returned iterable is consumed.
|
|
26
|
+
*
|
|
27
|
+
* GET /openmeter/currencies
|
|
28
|
+
*/
|
|
29
|
+
listAll(request, options) {
|
|
30
|
+
return paginatePages((req, opts) => listCurrencies(this._client, req, opts), request ?? {}, options);
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Create custom currency
|
|
34
|
+
*
|
|
35
|
+
* Create a custom currency. This operation allows defining your own custom
|
|
36
|
+
* currency for billing purposes.
|
|
37
|
+
*
|
|
38
|
+
* POST /openmeter/currencies/custom
|
|
39
|
+
*/
|
|
40
|
+
async createCustomCurrency(request, options) {
|
|
41
|
+
return unwrap(await createCustomCurrency(this._client, request, options));
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* Get custom currency
|
|
45
|
+
*
|
|
46
|
+
* Get a custom currency.
|
|
47
|
+
*
|
|
48
|
+
* GET /openmeter/currencies/custom/{currencyId}
|
|
49
|
+
*/
|
|
50
|
+
async getCustomCurrency(request, options) {
|
|
51
|
+
return unwrap(await getCustomCurrency(this._client, request, options));
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* List cost bases
|
|
55
|
+
*
|
|
56
|
+
* List cost bases for a currency. For custom currencies, there can be multiple
|
|
57
|
+
* cost bases with different `effective_from` dates.
|
|
58
|
+
*
|
|
59
|
+
* GET /openmeter/currencies/custom/{currencyId}/cost-bases
|
|
60
|
+
*/
|
|
61
|
+
async listCostBases(request, options) {
|
|
62
|
+
return unwrap(await listCostBases(this._client, request, options));
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* List cost bases
|
|
66
|
+
*
|
|
67
|
+
* List cost bases for a currency. For custom currencies, there can be multiple
|
|
68
|
+
* cost bases with different `effective_from` dates.
|
|
69
|
+
*
|
|
70
|
+
* Iterates every item across all pages, fetching more as the returned iterable is consumed.
|
|
71
|
+
*
|
|
72
|
+
* GET /openmeter/currencies/custom/{currencyId}/cost-bases
|
|
73
|
+
*/
|
|
74
|
+
listCostBasesAll(request, options) {
|
|
75
|
+
return paginatePages((req, opts) => listCostBases(this._client, req, opts), request, options);
|
|
76
|
+
}
|
|
77
|
+
/**
|
|
78
|
+
* Create cost basis
|
|
79
|
+
*
|
|
80
|
+
* Create a cost basis for a currency.
|
|
81
|
+
*
|
|
82
|
+
* POST /openmeter/currencies/custom/{currencyId}/cost-bases
|
|
83
|
+
*/
|
|
84
|
+
async createCostBasis(request, options) {
|
|
85
|
+
return unwrap(await createCostBasis(this._client, request, options));
|
|
86
|
+
}
|
|
87
|
+
}
|
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, UpdateCreditGrantExternalSettlementRequest, UpdateCreditGrantExternalSettlementResponse, ListCreditTransactionsRequest, ListCreditTransactionsResponse } from '../models/operations/customers.js';
|
|
4
|
-
import type { CreditGrant, CreditTransaction, Customer } from '../models/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, CreateCustomerEntitlementRequest, CreateCustomerEntitlementResponse, OverrideCustomerEntitlementRequest, OverrideCustomerEntitlementResponse, GetCustomerEntitlementHistoryRequest, GetCustomerEntitlementHistoryResponse, GetCustomerEntitlementRequest, GetCustomerEntitlementResponse, ListCustomerEntitlementsRequest, ListCustomerEntitlementsResponse, ResetCustomerEntitlementUsageRequest, ResetCustomerEntitlementUsageResponse, DeleteCustomerEntitlementRequest, DeleteCustomerEntitlementResponse, CreateCustomerEntitlementGrantRequest, CreateCustomerEntitlementGrantResponse, ListCustomerEntitlementGrantsRequest, ListCustomerEntitlementGrantsResponse, CreateCreditGrantRequest, CreateCreditGrantResponse, GetCreditGrantRequest, GetCreditGrantResponse, ListCreditGrantsRequest, ListCreditGrantsResponse, GetCustomerCreditBalanceRequest, GetCustomerCreditBalanceResponse, CreateCreditAdjustmentRequest, CreateCreditAdjustmentResponse, VoidCreditGrantRequest, VoidCreditGrantResponse, UpdateCreditGrantExternalSettlementRequest, UpdateCreditGrantExternalSettlementResponse, ListCreditTransactionsRequest, ListCreditTransactionsResponse, ListCustomerChargesRequest, ListCustomerChargesResponse, CreateCustomerChargesRequest, CreateCustomerChargesResponse } from '../models/operations/customers.js';
|
|
4
|
+
import type { Charge, CreditGrant, CreditTransaction, Customer, Entitlement, EntitlementGrant } from '../models/types.js';
|
|
5
5
|
export declare class Customers {
|
|
6
6
|
private readonly _client;
|
|
7
7
|
constructor(_client: Client);
|
|
@@ -45,8 +45,12 @@ export declare class Customers {
|
|
|
45
45
|
delete(request: DeleteCustomerRequest, options?: RequestOptions): Promise<DeleteCustomerResponse>;
|
|
46
46
|
private _billing?;
|
|
47
47
|
get billing(): CustomersBilling;
|
|
48
|
+
private _entitlements?;
|
|
49
|
+
get entitlements(): CustomersEntitlements;
|
|
48
50
|
private _credits?;
|
|
49
51
|
get credits(): CustomersCredits;
|
|
52
|
+
private _charges?;
|
|
53
|
+
get charges(): CustomersCharges;
|
|
50
54
|
}
|
|
51
55
|
export declare class CustomersBilling {
|
|
52
56
|
private readonly _client;
|
|
@@ -101,6 +105,153 @@ export declare class CustomersBilling {
|
|
|
101
105
|
*/
|
|
102
106
|
createStripePortalSession(request: CreateCustomerStripePortalSessionRequest, options?: RequestOptions): Promise<CreateCustomerStripePortalSessionResponse>;
|
|
103
107
|
}
|
|
108
|
+
export declare class CustomersEntitlements {
|
|
109
|
+
private readonly _client;
|
|
110
|
+
constructor(_client: Client);
|
|
111
|
+
/**
|
|
112
|
+
* Create customer entitlement
|
|
113
|
+
*
|
|
114
|
+
* Create an entitlement for the customer.
|
|
115
|
+
*
|
|
116
|
+
* A customer can have only one active entitlement per feature. The feature must be
|
|
117
|
+
* compatible with the entitlement type. Entitlements cannot be modified after
|
|
118
|
+
* creation, only deleted.
|
|
119
|
+
*
|
|
120
|
+
* POST /openmeter/customers/{customerId}/entitlements
|
|
121
|
+
*/
|
|
122
|
+
create(request: CreateCustomerEntitlementRequest, options?: RequestOptions): Promise<CreateCustomerEntitlementResponse>;
|
|
123
|
+
/**
|
|
124
|
+
* Override customer entitlement
|
|
125
|
+
*
|
|
126
|
+
* Override an entitlement of the customer with a new one.
|
|
127
|
+
*
|
|
128
|
+
* The referenced entitlement ends and the new one starts at the same instant, so
|
|
129
|
+
* access continues without a gap. Both must belong to the same feature. Use this
|
|
130
|
+
* for upgrades and downgrades.
|
|
131
|
+
*
|
|
132
|
+
* Fails if the referenced entitlement does not exist, is deleted, or is no longer
|
|
133
|
+
* active.
|
|
134
|
+
*
|
|
135
|
+
* PUT /openmeter/customers/{customerId}/entitlements/{entitlementId}/override
|
|
136
|
+
*/
|
|
137
|
+
override(request: OverrideCustomerEntitlementRequest, options?: RequestOptions): Promise<OverrideCustomerEntitlementResponse>;
|
|
138
|
+
/**
|
|
139
|
+
* Get customer entitlement history
|
|
140
|
+
*
|
|
141
|
+
* Get the balance and usage history of a metered entitlement. The queried range
|
|
142
|
+
* may span multiple usage periods.
|
|
143
|
+
*
|
|
144
|
+
* `windowed_history` groups usage into windows of the requested size and reports
|
|
145
|
+
* the balance at the start of each window. `burndown_history` lists the periods in
|
|
146
|
+
* which grants were consumed in a fixed order, together with the usage taken from
|
|
147
|
+
* each grant.
|
|
148
|
+
*
|
|
149
|
+
* GET /openmeter/customers/{customerId}/entitlements/{entitlementId}/history
|
|
150
|
+
*/
|
|
151
|
+
getHistory(request: GetCustomerEntitlementHistoryRequest, options?: RequestOptions): Promise<GetCustomerEntitlementHistoryResponse>;
|
|
152
|
+
/**
|
|
153
|
+
* Get customer entitlement
|
|
154
|
+
*
|
|
155
|
+
* Get an entitlement of the customer by ID. For checking entitlement access, use
|
|
156
|
+
* the entitlement access endpoints instead.
|
|
157
|
+
*
|
|
158
|
+
* GET /openmeter/customers/{customerId}/entitlements/{entitlementId}
|
|
159
|
+
*/
|
|
160
|
+
get(request: GetCustomerEntitlementRequest, options?: RequestOptions): Promise<GetCustomerEntitlementResponse>;
|
|
161
|
+
/**
|
|
162
|
+
* List customer entitlements
|
|
163
|
+
*
|
|
164
|
+
* List the entitlements of the customer that are active at the time of the
|
|
165
|
+
* request. For checking entitlement access, use the entitlement access endpoints
|
|
166
|
+
* instead.
|
|
167
|
+
*
|
|
168
|
+
* GET /openmeter/customers/{customerId}/entitlements
|
|
169
|
+
*/
|
|
170
|
+
list(request: ListCustomerEntitlementsRequest, options?: RequestOptions): Promise<ListCustomerEntitlementsResponse>;
|
|
171
|
+
/**
|
|
172
|
+
* List customer entitlements
|
|
173
|
+
*
|
|
174
|
+
* List the entitlements of the customer that are active at the time of the
|
|
175
|
+
* request. For checking entitlement access, use the entitlement access endpoints
|
|
176
|
+
* instead.
|
|
177
|
+
*
|
|
178
|
+
* Iterates every item across all pages, fetching more as the returned iterable is consumed.
|
|
179
|
+
*
|
|
180
|
+
* GET /openmeter/customers/{customerId}/entitlements
|
|
181
|
+
*/
|
|
182
|
+
listAll(request: ListCustomerEntitlementsRequest, options?: RequestOptions): AsyncIterable<Entitlement>;
|
|
183
|
+
/**
|
|
184
|
+
* Reset customer entitlement usage
|
|
185
|
+
*
|
|
186
|
+
* Reset the usage of a metered entitlement. The reset starts a new usage period:
|
|
187
|
+
* usage is zeroed and grants roll over according to their rollover settings.
|
|
188
|
+
*
|
|
189
|
+
* Usage is reset automatically at the end of each usage period. Use this operation
|
|
190
|
+
* to reset it earlier, for example to align the entitlement with the customer's
|
|
191
|
+
* billing period. The usage period anchor can be moved at the same time.
|
|
192
|
+
*
|
|
193
|
+
* POST /openmeter/customers/{customerId}/entitlements/{entitlementId}/reset
|
|
194
|
+
*/
|
|
195
|
+
resetUsage(request: ResetCustomerEntitlementUsageRequest, options?: RequestOptions): Promise<ResetCustomerEntitlementUsageResponse>;
|
|
196
|
+
/**
|
|
197
|
+
* Delete customer entitlement
|
|
198
|
+
*
|
|
199
|
+
* Deletes the entitlement and revokes access to its feature. A customer can hold
|
|
200
|
+
* only one active entitlement per feature, so migrating a feature requires
|
|
201
|
+
* deleting the previous entitlement first.
|
|
202
|
+
*
|
|
203
|
+
* Deletion sets the `deleted_at` timestamp instead of removing history. Access and
|
|
204
|
+
* status queries for earlier points in time still treat the entitlement as active,
|
|
205
|
+
* so access changes are never retroactive.
|
|
206
|
+
*
|
|
207
|
+
* DELETE /openmeter/customers/{customerId}/entitlements/{entitlementId}
|
|
208
|
+
*/
|
|
209
|
+
delete(request: DeleteCustomerEntitlementRequest, options?: RequestOptions): Promise<DeleteCustomerEntitlementResponse>;
|
|
210
|
+
private _grants?;
|
|
211
|
+
get grants(): CustomersEntitlementsGrants;
|
|
212
|
+
}
|
|
213
|
+
export declare class CustomersEntitlementsGrants {
|
|
214
|
+
private readonly _client;
|
|
215
|
+
constructor(_client: Client);
|
|
216
|
+
/**
|
|
217
|
+
* Create customer entitlement grant
|
|
218
|
+
*
|
|
219
|
+
* Issue a grant for a metered entitlement of the customer. Boolean and static
|
|
220
|
+
* entitlements cannot have grants, so the request is rejected for them.
|
|
221
|
+
*
|
|
222
|
+
* Grants are immutable. The amount is added to the balance from `effective_at`,
|
|
223
|
+
* which cannot be earlier than the start of the current usage period.
|
|
224
|
+
*
|
|
225
|
+
* POST /openmeter/customers/{customerId}/entitlements/{entitlementId}/grants
|
|
226
|
+
*/
|
|
227
|
+
create(request: CreateCustomerEntitlementGrantRequest, options?: RequestOptions): Promise<CreateCustomerEntitlementGrantResponse>;
|
|
228
|
+
/**
|
|
229
|
+
* List customer entitlement grants
|
|
230
|
+
*
|
|
231
|
+
* List the grants issued for an entitlement of the customer. Grants only exist for
|
|
232
|
+
* metered entitlements, so the list is empty for boolean and static entitlements.
|
|
233
|
+
*
|
|
234
|
+
* Deleted grants are excluded unless `include_deleted` is set. Voided and expired
|
|
235
|
+
* grants are always included, as they are part of the balance history.
|
|
236
|
+
*
|
|
237
|
+
* GET /openmeter/customers/{customerId}/entitlements/{entitlementId}/grants
|
|
238
|
+
*/
|
|
239
|
+
list(request: ListCustomerEntitlementGrantsRequest, options?: RequestOptions): Promise<ListCustomerEntitlementGrantsResponse>;
|
|
240
|
+
/**
|
|
241
|
+
* List customer entitlement grants
|
|
242
|
+
*
|
|
243
|
+
* List the grants issued for an entitlement of the customer. Grants only exist for
|
|
244
|
+
* metered entitlements, so the list is empty for boolean and static entitlements.
|
|
245
|
+
*
|
|
246
|
+
* Deleted grants are excluded unless `include_deleted` is set. Voided and expired
|
|
247
|
+
* grants are always included, as they are part of the balance history.
|
|
248
|
+
*
|
|
249
|
+
* Iterates every item across all pages, fetching more as the returned iterable is consumed.
|
|
250
|
+
*
|
|
251
|
+
* GET /openmeter/customers/{customerId}/entitlements/{entitlementId}/grants
|
|
252
|
+
*/
|
|
253
|
+
listAll(request: ListCustomerEntitlementGrantsRequest, options?: RequestOptions): AsyncIterable<EntitlementGrant>;
|
|
254
|
+
}
|
|
104
255
|
export declare class CustomersCredits {
|
|
105
256
|
private readonly _client;
|
|
106
257
|
constructor(_client: Client);
|
|
@@ -151,6 +302,22 @@ export declare class CustomersCreditsGrants {
|
|
|
151
302
|
* GET /openmeter/customers/{customerId}/credits/grants
|
|
152
303
|
*/
|
|
153
304
|
listAll(request: ListCreditGrantsRequest, options?: RequestOptions): AsyncIterable<CreditGrant>;
|
|
305
|
+
/**
|
|
306
|
+
* Void credit grant
|
|
307
|
+
*
|
|
308
|
+
* Void a credit grant, forfeiting the remaining unused balance.
|
|
309
|
+
*
|
|
310
|
+
* Voiding is a forward-looking, irreversible operation. Credits already consumed
|
|
311
|
+
* by usage remain unaffected — only the remaining balance is forfeited. The grant
|
|
312
|
+
* reads as `voided` status afterwards. Payment state is not adjusted when
|
|
313
|
+
* `payment_adjustment` is `none`, so invoice-backed or externally collected
|
|
314
|
+
* payments may still collect the original amount. Only `active` grants can be
|
|
315
|
+
* voided; voiding a pending, expired, or fully consumed grant returns a conflict.
|
|
316
|
+
* Retrying a successful void is an idempotent success.
|
|
317
|
+
*
|
|
318
|
+
* POST /openmeter/customers/{customerId}/credits/grants/{creditGrantId}/void
|
|
319
|
+
*/
|
|
320
|
+
void(request: VoidCreditGrantRequest, options?: RequestOptions): Promise<VoidCreditGrantResponse>;
|
|
154
321
|
/**
|
|
155
322
|
* Update credit grant external settlement status
|
|
156
323
|
*
|
|
@@ -222,3 +389,39 @@ export declare class CustomersCreditsTransactions {
|
|
|
222
389
|
*/
|
|
223
390
|
listAll(request: ListCreditTransactionsRequest, options?: RequestOptions): AsyncIterable<CreditTransaction>;
|
|
224
391
|
}
|
|
392
|
+
export declare class CustomersCharges {
|
|
393
|
+
private readonly _client;
|
|
394
|
+
constructor(_client: Client);
|
|
395
|
+
/**
|
|
396
|
+
* List customer charges
|
|
397
|
+
*
|
|
398
|
+
* List customer charges.
|
|
399
|
+
*
|
|
400
|
+
* Returns the customer's charges that are represented as either flat fee or
|
|
401
|
+
* usage-based charges.
|
|
402
|
+
*
|
|
403
|
+
* GET /openmeter/customers/{customerId}/charges
|
|
404
|
+
*/
|
|
405
|
+
list(request: ListCustomerChargesRequest, options?: RequestOptions): Promise<ListCustomerChargesResponse>;
|
|
406
|
+
/**
|
|
407
|
+
* List customer charges
|
|
408
|
+
*
|
|
409
|
+
* List customer charges.
|
|
410
|
+
*
|
|
411
|
+
* Returns the customer's charges that are represented as either flat fee or
|
|
412
|
+
* usage-based charges.
|
|
413
|
+
*
|
|
414
|
+
* Iterates every item across all pages, fetching more as the returned iterable is consumed.
|
|
415
|
+
*
|
|
416
|
+
* GET /openmeter/customers/{customerId}/charges
|
|
417
|
+
*/
|
|
418
|
+
listAll(request: ListCustomerChargesRequest, options?: RequestOptions): AsyncIterable<Charge>;
|
|
419
|
+
/**
|
|
420
|
+
* Create customer charge
|
|
421
|
+
*
|
|
422
|
+
* Create customer charge.
|
|
423
|
+
*
|
|
424
|
+
* POST /openmeter/customers/{customerId}/charges
|
|
425
|
+
*/
|
|
426
|
+
create(request: CreateCustomerChargesRequest, options?: RequestOptions): Promise<CreateCustomerChargesResponse>;
|
|
427
|
+
}
|