@openmeter/client 1.0.0-beta.230 → 1.0.0-beta.232
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/LICENSE +202 -0
- package/README.md +365 -76
- package/dist/core.d.ts +0 -1
- package/dist/core.js +11 -1
- package/dist/funcs/addons.d.ts +49 -1
- package/dist/funcs/addons.js +109 -12
- package/dist/funcs/apps.d.ts +55 -2
- package/dist/funcs/apps.js +179 -4
- package/dist/funcs/billing.d.ts +46 -1
- package/dist/funcs/billing.js +81 -8
- package/dist/funcs/currencies.d.ts +39 -2
- package/dist/funcs/currencies.js +93 -6
- package/dist/funcs/customers.d.ts +165 -2
- package/dist/funcs/customers.js +402 -40
- package/dist/funcs/defaults.d.ts +10 -1
- package/dist/funcs/defaults.js +11 -1
- package/dist/funcs/entitlements.d.ts +5 -1
- package/dist/funcs/entitlements.js +18 -4
- package/dist/funcs/events.d.ts +14 -1
- package/dist/funcs/events.js +18 -1
- package/dist/funcs/features.d.ts +42 -1
- package/dist/funcs/features.js +91 -10
- package/dist/funcs/governance.d.ts +14 -1
- package/dist/funcs/governance.js +15 -1
- package/dist/funcs/index.d.ts +0 -1
- package/dist/funcs/index.js +1 -1
- package/dist/funcs/invoices.d.ts +102 -2
- package/dist/funcs/invoices.js +247 -8
- package/dist/funcs/llmCost.d.ts +36 -1
- package/dist/funcs/llmCost.js +63 -6
- package/dist/funcs/meters.d.ts +53 -1
- package/dist/funcs/meters.js +113 -12
- package/dist/funcs/planAddons.d.ts +35 -1
- package/dist/funcs/planAddons.js +101 -18
- package/dist/funcs/plans.d.ts +49 -1
- package/dist/funcs/plans.js +109 -12
- package/dist/funcs/subscriptions.d.ts +59 -1
- package/dist/funcs/subscriptions.js +147 -18
- package/dist/funcs/tax.d.ts +25 -1
- package/dist/funcs/tax.js +60 -8
- package/dist/index.d.ts +4 -7
- package/dist/index.js +4 -6
- package/dist/lib/config.d.ts +2 -3
- package/dist/lib/config.js +1 -1
- package/dist/lib/encodings.d.ts +0 -1
- package/dist/lib/encodings.js +1 -1
- package/dist/lib/paginate.d.ts +56 -0
- package/dist/lib/paginate.js +60 -0
- package/dist/lib/request.d.ts +0 -1
- package/dist/lib/request.js +1 -1
- package/dist/lib/to-error.d.ts +0 -1
- package/dist/lib/to-error.js +1 -1
- package/dist/lib/types.d.ts +0 -1
- package/dist/lib/types.js +1 -1
- package/dist/lib/version.d.ts +1 -0
- package/dist/lib/version.js +5 -0
- package/dist/lib/wire.d.ts +4 -1
- package/dist/lib/wire.js +118 -7
- package/dist/models/errors.d.ts +13 -2
- package/dist/models/errors.js +31 -4
- package/dist/models/operations/addons.d.ts +0 -1
- package/dist/models/operations/addons.js +1 -1
- package/dist/models/operations/apps.d.ts +26 -5
- package/dist/models/operations/apps.js +1 -1
- package/dist/models/operations/billing.d.ts +0 -1
- package/dist/models/operations/billing.js +1 -1
- package/dist/models/operations/currencies.d.ts +10 -1
- package/dist/models/operations/currencies.js +1 -1
- package/dist/models/operations/customers.d.ts +11 -7
- package/dist/models/operations/customers.js +1 -1
- package/dist/models/operations/defaults.d.ts +0 -1
- package/dist/models/operations/defaults.js +1 -1
- package/dist/models/operations/entitlements.d.ts +0 -1
- package/dist/models/operations/entitlements.js +1 -1
- package/dist/models/operations/events.d.ts +0 -1
- package/dist/models/operations/events.js +1 -1
- package/dist/models/operations/features.d.ts +0 -1
- package/dist/models/operations/features.js +1 -1
- package/dist/models/operations/governance.d.ts +0 -1
- package/dist/models/operations/governance.js +1 -1
- package/dist/models/operations/invoices.d.ts +20 -7
- package/dist/models/operations/invoices.js +1 -1
- package/dist/models/operations/llmCost.d.ts +0 -1
- package/dist/models/operations/llmCost.js +1 -1
- package/dist/models/operations/meters.d.ts +0 -1
- package/dist/models/operations/meters.js +1 -1
- package/dist/models/operations/planAddons.d.ts +0 -1
- package/dist/models/operations/planAddons.js +1 -1
- package/dist/models/operations/plans.d.ts +0 -1
- package/dist/models/operations/plans.js +1 -1
- package/dist/models/operations/subscriptions.d.ts +0 -1
- package/dist/models/operations/subscriptions.js +1 -1
- package/dist/models/operations/tax.d.ts +0 -1
- package/dist/models/operations/tax.js +1 -1
- package/dist/models/schemas.d.ts +11651 -6090
- package/dist/models/schemas.js +991 -468
- package/dist/models/types.d.ts +941 -810
- package/dist/models/types.js +1 -1
- package/dist/sdk/addons.d.ts +60 -1
- package/dist/sdk/addons.js +63 -1
- package/dist/sdk/apps.d.ts +68 -2
- package/dist/sdk/apps.js +81 -2
- package/dist/sdk/billing.d.ts +57 -1
- package/dist/sdk/billing.js +60 -1
- package/dist/sdk/customers.d.ts +211 -2
- package/dist/sdk/customers.js +222 -2
- package/dist/sdk/defaults.d.ts +10 -1
- package/dist/sdk/defaults.js +11 -1
- package/dist/sdk/entitlements.d.ts +5 -1
- package/dist/sdk/entitlements.js +6 -1
- package/dist/sdk/events.d.ts +25 -1
- package/dist/sdk/events.js +28 -1
- package/dist/sdk/features.d.ts +53 -1
- package/dist/sdk/features.js +56 -1
- package/dist/sdk/internal.d.ts +328 -0
- package/dist/sdk/internal.js +404 -0
- package/dist/sdk/invoices.d.ts +5 -2
- package/dist/sdk/invoices.js +13 -2
- package/dist/sdk/llmCost.d.ts +57 -1
- package/dist/sdk/llmCost.js +62 -1
- package/dist/sdk/meters.d.ts +64 -1
- package/dist/sdk/meters.js +67 -1
- package/dist/sdk/planAddons.d.ts +46 -1
- package/dist/sdk/planAddons.js +49 -1
- package/dist/sdk/plans.d.ts +60 -1
- package/dist/sdk/plans.js +63 -1
- package/dist/sdk/sdk.d.ts +9 -13
- package/dist/sdk/sdk.js +11 -20
- package/dist/sdk/subscriptions.d.ts +72 -3
- package/dist/sdk/subscriptions.js +77 -5
- package/dist/sdk/tax.d.ts +34 -1
- package/dist/sdk/tax.js +37 -1
- package/package.json +30 -6
- package/dist/sdk/currencies.d.ts +0 -12
- package/dist/sdk/currencies.js +0 -21
- package/dist/sdk/governance.d.ts +0 -9
- package/dist/sdk/governance.js +0 -12
package/dist/funcs/billing.js
CHANGED
|
@@ -1,8 +1,16 @@
|
|
|
1
|
+
// Code generated by @openmeter/typespec-typescript. DO NOT EDIT.
|
|
1
2
|
import { http } from '../core.js';
|
|
2
3
|
import { request } from '../lib/request.js';
|
|
3
4
|
import { toURLSearchParams } from '../lib/encodings.js';
|
|
4
|
-
import { toWire, fromWire, assertValid } from '../lib/wire.js';
|
|
5
|
+
import { toWire, toPathWire, fromWire, assertValid } from '../lib/wire.js';
|
|
5
6
|
import * as schemas from '../models/schemas.js';
|
|
7
|
+
/**
|
|
8
|
+
* List billing profiles
|
|
9
|
+
*
|
|
10
|
+
* List billing profiles.
|
|
11
|
+
*
|
|
12
|
+
* GET /openmeter/profiles
|
|
13
|
+
*/
|
|
6
14
|
export function listBillingProfiles(client, req = {}, options) {
|
|
7
15
|
return request(() => {
|
|
8
16
|
const query = toWire({
|
|
@@ -23,6 +31,18 @@ export function listBillingProfiles(client, req = {}, options) {
|
|
|
23
31
|
});
|
|
24
32
|
});
|
|
25
33
|
}
|
|
34
|
+
/**
|
|
35
|
+
* Create a new billing profile
|
|
36
|
+
*
|
|
37
|
+
* Create a new billing profile.
|
|
38
|
+
*
|
|
39
|
+
* Billing profiles contain the settings for billing and controls invoice
|
|
40
|
+
* generation. An organization can have multiple billing profiles defined. A
|
|
41
|
+
* billing profile is linked to a specific app. This association is established
|
|
42
|
+
* during the billing profile's creation and remains immutable.
|
|
43
|
+
*
|
|
44
|
+
* POST /openmeter/profiles
|
|
45
|
+
*/
|
|
26
46
|
export function createBillingProfile(client, req, options) {
|
|
27
47
|
return request(() => {
|
|
28
48
|
const body = toWire(req, schemas.createBillingProfileBody);
|
|
@@ -40,13 +60,29 @@ export function createBillingProfile(client, req, options) {
|
|
|
40
60
|
});
|
|
41
61
|
});
|
|
42
62
|
}
|
|
63
|
+
/**
|
|
64
|
+
* Get a billing profile
|
|
65
|
+
*
|
|
66
|
+
* Get a billing profile.
|
|
67
|
+
*
|
|
68
|
+
* GET /openmeter/profiles/{id}
|
|
69
|
+
*/
|
|
43
70
|
export function getBillingProfile(client, req, options) {
|
|
44
71
|
return request(() => {
|
|
72
|
+
const pathParamsInput = {
|
|
73
|
+
id: req.id,
|
|
74
|
+
};
|
|
75
|
+
const pathParams = client._options.validate
|
|
76
|
+
? toPathWire(pathParamsInput, schemas.getBillingProfilePathParams)
|
|
77
|
+
: pathParamsInput;
|
|
78
|
+
if (client._options.validate) {
|
|
79
|
+
assertValid(schemas.getBillingProfilePathParamsWire, pathParams);
|
|
80
|
+
}
|
|
45
81
|
const path = `openmeter/profiles/${(() => {
|
|
46
|
-
if (
|
|
82
|
+
if (pathParams.id === undefined) {
|
|
47
83
|
throw new Error('missing path parameter: id');
|
|
48
84
|
}
|
|
49
|
-
return encodeURIComponent(String(
|
|
85
|
+
return encodeURIComponent(String(pathParams.id));
|
|
50
86
|
})()}`;
|
|
51
87
|
return http(client)
|
|
52
88
|
.get(path, options)
|
|
@@ -59,13 +95,29 @@ export function getBillingProfile(client, req, options) {
|
|
|
59
95
|
});
|
|
60
96
|
});
|
|
61
97
|
}
|
|
98
|
+
/**
|
|
99
|
+
* Update a billing profile
|
|
100
|
+
*
|
|
101
|
+
* Update a billing profile.
|
|
102
|
+
*
|
|
103
|
+
* PUT /openmeter/profiles/{id}
|
|
104
|
+
*/
|
|
62
105
|
export function updateBillingProfile(client, req, options) {
|
|
63
106
|
return request(() => {
|
|
107
|
+
const pathParamsInput = {
|
|
108
|
+
id: req.id,
|
|
109
|
+
};
|
|
110
|
+
const pathParams = client._options.validate
|
|
111
|
+
? toPathWire(pathParamsInput, schemas.updateBillingProfilePathParams)
|
|
112
|
+
: pathParamsInput;
|
|
113
|
+
if (client._options.validate) {
|
|
114
|
+
assertValid(schemas.updateBillingProfilePathParamsWire, pathParams);
|
|
115
|
+
}
|
|
64
116
|
const path = `openmeter/profiles/${(() => {
|
|
65
|
-
if (
|
|
117
|
+
if (pathParams.id === undefined) {
|
|
66
118
|
throw new Error('missing path parameter: id');
|
|
67
119
|
}
|
|
68
|
-
return encodeURIComponent(String(
|
|
120
|
+
return encodeURIComponent(String(pathParams.id));
|
|
69
121
|
})()}`;
|
|
70
122
|
const body = toWire(req.body, schemas.updateBillingProfileBody);
|
|
71
123
|
if (client._options.validate) {
|
|
@@ -82,15 +134,36 @@ export function updateBillingProfile(client, req, options) {
|
|
|
82
134
|
});
|
|
83
135
|
});
|
|
84
136
|
}
|
|
137
|
+
/**
|
|
138
|
+
* Delete a billing profile
|
|
139
|
+
*
|
|
140
|
+
* Delete a billing profile.
|
|
141
|
+
*
|
|
142
|
+
* Only such billing profiles can be deleted that are:
|
|
143
|
+
*
|
|
144
|
+
* - not the default profile
|
|
145
|
+
* - not pinned to any customer using customer overrides
|
|
146
|
+
* - only have finalized invoices
|
|
147
|
+
*
|
|
148
|
+
* DELETE /openmeter/profiles/{id}
|
|
149
|
+
*/
|
|
85
150
|
export function deleteBillingProfile(client, req, options) {
|
|
86
151
|
return request(async () => {
|
|
152
|
+
const pathParamsInput = {
|
|
153
|
+
id: req.id,
|
|
154
|
+
};
|
|
155
|
+
const pathParams = client._options.validate
|
|
156
|
+
? toPathWire(pathParamsInput, schemas.deleteBillingProfilePathParams)
|
|
157
|
+
: pathParamsInput;
|
|
158
|
+
if (client._options.validate) {
|
|
159
|
+
assertValid(schemas.deleteBillingProfilePathParamsWire, pathParams);
|
|
160
|
+
}
|
|
87
161
|
const path = `openmeter/profiles/${(() => {
|
|
88
|
-
if (
|
|
162
|
+
if (pathParams.id === undefined) {
|
|
89
163
|
throw new Error('missing path parameter: id');
|
|
90
164
|
}
|
|
91
|
-
return encodeURIComponent(String(
|
|
165
|
+
return encodeURIComponent(String(pathParams.id));
|
|
92
166
|
})()}`;
|
|
93
167
|
await http(client).delete(path, options);
|
|
94
168
|
});
|
|
95
169
|
}
|
|
96
|
-
//# sourceMappingURL=billing.js.map
|
|
@@ -1,8 +1,45 @@
|
|
|
1
1
|
import { type Client } from '../core.js';
|
|
2
2
|
import { type Result, type RequestOptions } from '../lib/types.js';
|
|
3
|
-
import type { ListCurrenciesRequest, ListCurrenciesResponse, CreateCustomCurrencyRequest, CreateCustomCurrencyResponse, ListCostBasesRequest, ListCostBasesResponse, CreateCostBasisRequest, CreateCostBasisResponse } from '../models/operations/currencies.js';
|
|
3
|
+
import type { ListCurrenciesRequest, ListCurrenciesResponse, CreateCustomCurrencyRequest, CreateCustomCurrencyResponse, GetCustomCurrencyRequest, GetCustomCurrencyResponse, ListCostBasesRequest, ListCostBasesResponse, CreateCostBasisRequest, CreateCostBasisResponse } from '../models/operations/currencies.js';
|
|
4
|
+
/**
|
|
5
|
+
* List currencies
|
|
6
|
+
*
|
|
7
|
+
* List currencies supported by the billing system.
|
|
8
|
+
*
|
|
9
|
+
* GET /openmeter/currencies
|
|
10
|
+
*/
|
|
4
11
|
export declare function listCurrencies(client: Client, req?: ListCurrenciesRequest, options?: RequestOptions): Promise<Result<ListCurrenciesResponse>>;
|
|
12
|
+
/**
|
|
13
|
+
* Create custom currency
|
|
14
|
+
*
|
|
15
|
+
* Create a custom currency. This operation allows defining your own custom
|
|
16
|
+
* currency for billing purposes.
|
|
17
|
+
*
|
|
18
|
+
* POST /openmeter/currencies/custom
|
|
19
|
+
*/
|
|
5
20
|
export declare function createCustomCurrency(client: Client, req: CreateCustomCurrencyRequest, options?: RequestOptions): Promise<Result<CreateCustomCurrencyResponse>>;
|
|
21
|
+
/**
|
|
22
|
+
* Get custom currency
|
|
23
|
+
*
|
|
24
|
+
* Get a custom currency.
|
|
25
|
+
*
|
|
26
|
+
* GET /openmeter/currencies/custom/{currencyId}
|
|
27
|
+
*/
|
|
28
|
+
export declare function getCustomCurrency(client: Client, req: GetCustomCurrencyRequest, options?: RequestOptions): Promise<Result<GetCustomCurrencyResponse>>;
|
|
29
|
+
/**
|
|
30
|
+
* List cost bases
|
|
31
|
+
*
|
|
32
|
+
* List cost bases for a currency. For custom currencies, there can be multiple
|
|
33
|
+
* cost bases with different `effective_from` dates.
|
|
34
|
+
*
|
|
35
|
+
* GET /openmeter/currencies/custom/{currencyId}/cost-bases
|
|
36
|
+
*/
|
|
6
37
|
export declare function listCostBases(client: Client, req: ListCostBasesRequest, options?: RequestOptions): Promise<Result<ListCostBasesResponse>>;
|
|
38
|
+
/**
|
|
39
|
+
* Create cost basis
|
|
40
|
+
*
|
|
41
|
+
* Create a cost basis for a currency.
|
|
42
|
+
*
|
|
43
|
+
* POST /openmeter/currencies/custom/{currencyId}/cost-bases
|
|
44
|
+
*/
|
|
7
45
|
export declare function createCostBasis(client: Client, req: CreateCostBasisRequest, options?: RequestOptions): Promise<Result<CreateCostBasisResponse>>;
|
|
8
|
-
//# sourceMappingURL=currencies.d.ts.map
|
package/dist/funcs/currencies.js
CHANGED
|
@@ -1,14 +1,26 @@
|
|
|
1
|
+
// Code generated by @openmeter/typespec-typescript. DO NOT EDIT.
|
|
1
2
|
import { http } from '../core.js';
|
|
2
3
|
import { request } from '../lib/request.js';
|
|
3
4
|
import { toURLSearchParams, encodeSort } from '../lib/encodings.js';
|
|
4
|
-
import { toWire, fromWire, assertValid, toSnakeCase } from '../lib/wire.js';
|
|
5
|
+
import { toWire, toPathWire, fromWire, assertValid, toSnakeCase, } from '../lib/wire.js';
|
|
5
6
|
import * as schemas from '../models/schemas.js';
|
|
7
|
+
/**
|
|
8
|
+
* List currencies
|
|
9
|
+
*
|
|
10
|
+
* List currencies supported by the billing system.
|
|
11
|
+
*
|
|
12
|
+
* GET /openmeter/currencies
|
|
13
|
+
*/
|
|
6
14
|
export function listCurrencies(client, req = {}, options) {
|
|
7
15
|
return request(() => {
|
|
16
|
+
if (client._options.validate && req.sort !== undefined) {
|
|
17
|
+
assertValid(schemas.listCurrenciesQueryParams.shape.sort, req.sort);
|
|
18
|
+
}
|
|
8
19
|
const query = toWire({
|
|
9
20
|
page: req.page,
|
|
10
21
|
sort: encodeSort(req.sort, toSnakeCase),
|
|
11
22
|
filter: req.filter,
|
|
23
|
+
expand: req.expand,
|
|
12
24
|
}, schemas.listCurrenciesQueryParams);
|
|
13
25
|
if (client._options.validate) {
|
|
14
26
|
assertValid(schemas.listCurrenciesQueryParamsWire, query);
|
|
@@ -25,6 +37,14 @@ export function listCurrencies(client, req = {}, options) {
|
|
|
25
37
|
});
|
|
26
38
|
});
|
|
27
39
|
}
|
|
40
|
+
/**
|
|
41
|
+
* Create custom currency
|
|
42
|
+
*
|
|
43
|
+
* Create a custom currency. This operation allows defining your own custom
|
|
44
|
+
* currency for billing purposes.
|
|
45
|
+
*
|
|
46
|
+
* POST /openmeter/currencies/custom
|
|
47
|
+
*/
|
|
28
48
|
export function createCustomCurrency(client, req, options) {
|
|
29
49
|
return request(() => {
|
|
30
50
|
const body = toWire(req, schemas.createCustomCurrencyBody);
|
|
@@ -42,13 +62,65 @@ export function createCustomCurrency(client, req, options) {
|
|
|
42
62
|
});
|
|
43
63
|
});
|
|
44
64
|
}
|
|
65
|
+
/**
|
|
66
|
+
* Get custom currency
|
|
67
|
+
*
|
|
68
|
+
* Get a custom currency.
|
|
69
|
+
*
|
|
70
|
+
* GET /openmeter/currencies/custom/{currencyId}
|
|
71
|
+
*/
|
|
72
|
+
export function getCustomCurrency(client, req, options) {
|
|
73
|
+
return request(() => {
|
|
74
|
+
const pathParamsInput = {
|
|
75
|
+
currencyId: req.currencyId,
|
|
76
|
+
};
|
|
77
|
+
const pathParams = client._options.validate
|
|
78
|
+
? toPathWire(pathParamsInput, schemas.getCustomCurrencyPathParams)
|
|
79
|
+
: pathParamsInput;
|
|
80
|
+
if (client._options.validate) {
|
|
81
|
+
assertValid(schemas.getCustomCurrencyPathParamsWire, pathParams);
|
|
82
|
+
}
|
|
83
|
+
const path = `openmeter/currencies/custom/${(() => {
|
|
84
|
+
if (pathParams.currencyId === undefined) {
|
|
85
|
+
throw new Error('missing path parameter: currencyId');
|
|
86
|
+
}
|
|
87
|
+
return encodeURIComponent(String(pathParams.currencyId));
|
|
88
|
+
})()}`;
|
|
89
|
+
return http(client)
|
|
90
|
+
.get(path, options)
|
|
91
|
+
.json()
|
|
92
|
+
.then((data) => {
|
|
93
|
+
if (client._options.validate) {
|
|
94
|
+
assertValid(schemas.getCustomCurrencyResponseWire, data);
|
|
95
|
+
}
|
|
96
|
+
return fromWire(data, schemas.getCustomCurrencyResponse);
|
|
97
|
+
});
|
|
98
|
+
});
|
|
99
|
+
}
|
|
100
|
+
/**
|
|
101
|
+
* List cost bases
|
|
102
|
+
*
|
|
103
|
+
* List cost bases for a currency. For custom currencies, there can be multiple
|
|
104
|
+
* cost bases with different `effective_from` dates.
|
|
105
|
+
*
|
|
106
|
+
* GET /openmeter/currencies/custom/{currencyId}/cost-bases
|
|
107
|
+
*/
|
|
45
108
|
export function listCostBases(client, req, options) {
|
|
46
109
|
return request(() => {
|
|
110
|
+
const pathParamsInput = {
|
|
111
|
+
currencyId: req.currencyId,
|
|
112
|
+
};
|
|
113
|
+
const pathParams = client._options.validate
|
|
114
|
+
? toPathWire(pathParamsInput, schemas.listCostBasesPathParams)
|
|
115
|
+
: pathParamsInput;
|
|
116
|
+
if (client._options.validate) {
|
|
117
|
+
assertValid(schemas.listCostBasesPathParamsWire, pathParams);
|
|
118
|
+
}
|
|
47
119
|
const path = `openmeter/currencies/custom/${(() => {
|
|
48
|
-
if (
|
|
120
|
+
if (pathParams.currencyId === undefined) {
|
|
49
121
|
throw new Error('missing path parameter: currencyId');
|
|
50
122
|
}
|
|
51
|
-
return encodeURIComponent(String(
|
|
123
|
+
return encodeURIComponent(String(pathParams.currencyId));
|
|
52
124
|
})()}/cost-bases`;
|
|
53
125
|
const query = toWire({
|
|
54
126
|
filter: req.filter,
|
|
@@ -69,13 +141,29 @@ export function listCostBases(client, req, options) {
|
|
|
69
141
|
});
|
|
70
142
|
});
|
|
71
143
|
}
|
|
144
|
+
/**
|
|
145
|
+
* Create cost basis
|
|
146
|
+
*
|
|
147
|
+
* Create a cost basis for a currency.
|
|
148
|
+
*
|
|
149
|
+
* POST /openmeter/currencies/custom/{currencyId}/cost-bases
|
|
150
|
+
*/
|
|
72
151
|
export function createCostBasis(client, req, options) {
|
|
73
152
|
return request(() => {
|
|
153
|
+
const pathParamsInput = {
|
|
154
|
+
currencyId: req.currencyId,
|
|
155
|
+
};
|
|
156
|
+
const pathParams = client._options.validate
|
|
157
|
+
? toPathWire(pathParamsInput, schemas.createCostBasisPathParams)
|
|
158
|
+
: pathParamsInput;
|
|
159
|
+
if (client._options.validate) {
|
|
160
|
+
assertValid(schemas.createCostBasisPathParamsWire, pathParams);
|
|
161
|
+
}
|
|
74
162
|
const path = `openmeter/currencies/custom/${(() => {
|
|
75
|
-
if (
|
|
163
|
+
if (pathParams.currencyId === undefined) {
|
|
76
164
|
throw new Error('missing path parameter: currencyId');
|
|
77
165
|
}
|
|
78
|
-
return encodeURIComponent(String(
|
|
166
|
+
return encodeURIComponent(String(pathParams.currencyId));
|
|
79
167
|
})()}/cost-bases`;
|
|
80
168
|
const body = toWire(req.body, schemas.createCostBasisBody);
|
|
81
169
|
if (client._options.validate) {
|
|
@@ -92,4 +180,3 @@ export function createCostBasis(client, req, options) {
|
|
|
92
180
|
});
|
|
93
181
|
});
|
|
94
182
|
}
|
|
95
|
-
//# sourceMappingURL=currencies.js.map
|
|
@@ -1,23 +1,186 @@
|
|
|
1
1
|
import { type Client } from '../core.js';
|
|
2
2
|
import { type Result, 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, ListCustomerChargesRequest, ListCustomerChargesResponse, CreateCustomerChargesRequest, CreateCustomerChargesResponse } from '../models/operations/customers.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, VoidCreditGrantRequest, VoidCreditGrantResponse, UpdateCreditGrantExternalSettlementRequest, UpdateCreditGrantExternalSettlementResponse, ListCreditTransactionsRequest, ListCreditTransactionsResponse, ListCustomerChargesRequest, ListCustomerChargesResponse, CreateCustomerChargesRequest, CreateCustomerChargesResponse } from '../models/operations/customers.js';
|
|
4
|
+
/**
|
|
5
|
+
* Create customer
|
|
6
|
+
*
|
|
7
|
+
* POST /openmeter/customers
|
|
8
|
+
*/
|
|
4
9
|
export declare function createCustomer(client: Client, req: CreateCustomerRequest, options?: RequestOptions): Promise<Result<CreateCustomerResponse>>;
|
|
10
|
+
/**
|
|
11
|
+
* Get customer
|
|
12
|
+
*
|
|
13
|
+
* GET /openmeter/customers/{customerId}
|
|
14
|
+
*/
|
|
5
15
|
export declare function getCustomer(client: Client, req: GetCustomerRequest, options?: RequestOptions): Promise<Result<GetCustomerResponse>>;
|
|
16
|
+
/**
|
|
17
|
+
* List customers
|
|
18
|
+
*
|
|
19
|
+
* GET /openmeter/customers
|
|
20
|
+
*/
|
|
6
21
|
export declare function listCustomers(client: Client, req?: ListCustomersRequest, options?: RequestOptions): Promise<Result<ListCustomersResponse>>;
|
|
22
|
+
/**
|
|
23
|
+
* Upsert customer
|
|
24
|
+
*
|
|
25
|
+
* PUT /openmeter/customers/{customerId}
|
|
26
|
+
*/
|
|
7
27
|
export declare function upsertCustomer(client: Client, req: UpsertCustomerRequest, options?: RequestOptions): Promise<Result<UpsertCustomerResponse>>;
|
|
28
|
+
/**
|
|
29
|
+
* Delete customer
|
|
30
|
+
*
|
|
31
|
+
* DELETE /openmeter/customers/{customerId}
|
|
32
|
+
*/
|
|
8
33
|
export declare function deleteCustomer(client: Client, req: DeleteCustomerRequest, options?: RequestOptions): Promise<Result<DeleteCustomerResponse>>;
|
|
34
|
+
/**
|
|
35
|
+
* Get customer billing data
|
|
36
|
+
*
|
|
37
|
+
* GET /openmeter/customers/{customerId}/billing
|
|
38
|
+
*/
|
|
9
39
|
export declare function getCustomerBilling(client: Client, req: GetCustomerBillingRequest, options?: RequestOptions): Promise<Result<GetCustomerBillingResponse>>;
|
|
40
|
+
/**
|
|
41
|
+
* Update customer billing data
|
|
42
|
+
*
|
|
43
|
+
* PUT /openmeter/customers/{customerId}/billing
|
|
44
|
+
*/
|
|
10
45
|
export declare function updateCustomerBilling(client: Client, req: UpdateCustomerBillingRequest, options?: RequestOptions): Promise<Result<UpdateCustomerBillingResponse>>;
|
|
46
|
+
/**
|
|
47
|
+
* Update customer billing app data
|
|
48
|
+
*
|
|
49
|
+
* PUT /openmeter/customers/{customerId}/billing/app-data
|
|
50
|
+
*/
|
|
11
51
|
export declare function updateCustomerBillingAppData(client: Client, req: UpdateCustomerBillingAppDataRequest, options?: RequestOptions): Promise<Result<UpdateCustomerBillingAppDataResponse>>;
|
|
52
|
+
/**
|
|
53
|
+
* Create Stripe Checkout Session
|
|
54
|
+
*
|
|
55
|
+
* Create a [Stripe Checkout Session](https://docs.stripe.com/payments/checkout)
|
|
56
|
+
* for the customer.
|
|
57
|
+
*
|
|
58
|
+
* Creates a Checkout Session for collecting payment method information from
|
|
59
|
+
* customers. The session operates in "setup" mode, which collects payment details
|
|
60
|
+
* without charging the customer immediately. The collected payment method can be
|
|
61
|
+
* used for future subscription billing.
|
|
62
|
+
*
|
|
63
|
+
* For hosted checkout sessions, redirect customers to the returned URL. For
|
|
64
|
+
* embedded sessions, use the client_secret to initialize Stripe.js in your
|
|
65
|
+
* application.
|
|
66
|
+
*
|
|
67
|
+
* POST /openmeter/customers/{customerId}/billing/stripe/checkout-sessions
|
|
68
|
+
*/
|
|
12
69
|
export declare function createCustomerStripeCheckoutSession(client: Client, req: CreateCustomerStripeCheckoutSessionRequest, options?: RequestOptions): Promise<Result<CreateCustomerStripeCheckoutSessionResponse>>;
|
|
70
|
+
/**
|
|
71
|
+
* Create Stripe customer portal session
|
|
72
|
+
*
|
|
73
|
+
* Create Stripe Customer Portal Session.
|
|
74
|
+
*
|
|
75
|
+
* Useful to redirect the customer to the Stripe Customer Portal to manage their
|
|
76
|
+
* payment methods, change their billing address and access their invoice history.
|
|
77
|
+
* Only returns URL if the customer billing profile is linked to a stripe app and
|
|
78
|
+
* customer.
|
|
79
|
+
*
|
|
80
|
+
* POST /openmeter/customers/{customerId}/billing/stripe/portal-sessions
|
|
81
|
+
*/
|
|
13
82
|
export declare function createCustomerStripePortalSession(client: Client, req: CreateCustomerStripePortalSessionRequest, options?: RequestOptions): Promise<Result<CreateCustomerStripePortalSessionResponse>>;
|
|
83
|
+
/**
|
|
84
|
+
* Create a new credit grant
|
|
85
|
+
*
|
|
86
|
+
* Create a new credit grant. A credit grant represents an allocation of prepaid
|
|
87
|
+
* credits to a customer.
|
|
88
|
+
*
|
|
89
|
+
* POST /openmeter/customers/{customerId}/credits/grants
|
|
90
|
+
*/
|
|
14
91
|
export declare function createCreditGrant(client: Client, req: CreateCreditGrantRequest, options?: RequestOptions): Promise<Result<CreateCreditGrantResponse>>;
|
|
92
|
+
/**
|
|
93
|
+
* Get a credit grant
|
|
94
|
+
*
|
|
95
|
+
* Get a credit grant.
|
|
96
|
+
*
|
|
97
|
+
* GET /openmeter/customers/{customerId}/credits/grants/{creditGrantId}
|
|
98
|
+
*/
|
|
15
99
|
export declare function getCreditGrant(client: Client, req: GetCreditGrantRequest, options?: RequestOptions): Promise<Result<GetCreditGrantResponse>>;
|
|
100
|
+
/**
|
|
101
|
+
* List credit grants
|
|
102
|
+
*
|
|
103
|
+
* List credit grants.
|
|
104
|
+
*
|
|
105
|
+
* GET /openmeter/customers/{customerId}/credits/grants
|
|
106
|
+
*/
|
|
16
107
|
export declare function listCreditGrants(client: Client, req: ListCreditGrantsRequest, options?: RequestOptions): Promise<Result<ListCreditGrantsResponse>>;
|
|
108
|
+
/**
|
|
109
|
+
* Get a customer's credit balance
|
|
110
|
+
*
|
|
111
|
+
* Get a credit balance.
|
|
112
|
+
*
|
|
113
|
+
* GET /openmeter/customers/{customerId}/credits/balance
|
|
114
|
+
*/
|
|
17
115
|
export declare function getCustomerCreditBalance(client: Client, req: GetCustomerCreditBalanceRequest, options?: RequestOptions): Promise<Result<GetCustomerCreditBalanceResponse>>;
|
|
116
|
+
/**
|
|
117
|
+
* Create a credit adjustment
|
|
118
|
+
*
|
|
119
|
+
* A credit adjustment can be used to make manual adjustments to a customer's
|
|
120
|
+
* credit balance.
|
|
121
|
+
*
|
|
122
|
+
* Supported use-cases:
|
|
123
|
+
*
|
|
124
|
+
* - Usage correction
|
|
125
|
+
*
|
|
126
|
+
* POST /openmeter/customers/{customerId}/credits/adjustments
|
|
127
|
+
*/
|
|
18
128
|
export declare function createCreditAdjustment(client: Client, req: CreateCreditAdjustmentRequest, options?: RequestOptions): Promise<Result<CreateCreditAdjustmentResponse>>;
|
|
129
|
+
/**
|
|
130
|
+
* Void credit grant
|
|
131
|
+
*
|
|
132
|
+
* Void a credit grant, forfeiting the remaining unused balance.
|
|
133
|
+
*
|
|
134
|
+
* Voiding is a forward-looking, irreversible operation. Credits already consumed
|
|
135
|
+
* by usage remain unaffected — only the remaining balance is forfeited. The grant
|
|
136
|
+
* reads as `voided` status afterwards. Payment state is not adjusted when
|
|
137
|
+
* `payment_adjustment` is `none`, so invoice-backed or externally collected
|
|
138
|
+
* payments may still collect the original amount. Only `active` grants can be
|
|
139
|
+
* voided; voiding a pending, expired, or fully consumed grant returns a conflict.
|
|
140
|
+
* Retrying a successful void is an idempotent success.
|
|
141
|
+
*
|
|
142
|
+
* POST /openmeter/customers/{customerId}/credits/grants/{creditGrantId}/void
|
|
143
|
+
*/
|
|
144
|
+
export declare function voidCreditGrant(client: Client, req: VoidCreditGrantRequest, options?: RequestOptions): Promise<Result<VoidCreditGrantResponse>>;
|
|
145
|
+
/**
|
|
146
|
+
* Update credit grant external settlement status
|
|
147
|
+
*
|
|
148
|
+
* Update the payment settlement status of an externally funded credit grant.
|
|
149
|
+
*
|
|
150
|
+
* Use this endpoint to synchronize the payment state of an external payment with
|
|
151
|
+
* the system so that revenue recognition and credit availability work as expected.
|
|
152
|
+
*
|
|
153
|
+
* POST /openmeter/customers/{customerId}/credits/grants/{creditGrantId}/settlement/external
|
|
154
|
+
*/
|
|
19
155
|
export declare function updateCreditGrantExternalSettlement(client: Client, req: UpdateCreditGrantExternalSettlementRequest, options?: RequestOptions): Promise<Result<UpdateCreditGrantExternalSettlementResponse>>;
|
|
156
|
+
/**
|
|
157
|
+
* List credit transactions
|
|
158
|
+
*
|
|
159
|
+
* List credit transactions for a customer.
|
|
160
|
+
*
|
|
161
|
+
* Returns an immutable, chronological record of credit movements: funded credits
|
|
162
|
+
* and consumed credits. Transactions are returned in reverse chronological order
|
|
163
|
+
* by default.
|
|
164
|
+
*
|
|
165
|
+
* GET /openmeter/customers/{customerId}/credits/transactions
|
|
166
|
+
*/
|
|
20
167
|
export declare function listCreditTransactions(client: Client, req: ListCreditTransactionsRequest, options?: RequestOptions): Promise<Result<ListCreditTransactionsResponse>>;
|
|
168
|
+
/**
|
|
169
|
+
* List customer charges
|
|
170
|
+
*
|
|
171
|
+
* List customer charges.
|
|
172
|
+
*
|
|
173
|
+
* Returns the customer's charges that are represented as either flat fee or
|
|
174
|
+
* usage-based charges.
|
|
175
|
+
*
|
|
176
|
+
* GET /openmeter/customers/{customerId}/charges
|
|
177
|
+
*/
|
|
21
178
|
export declare function listCustomerCharges(client: Client, req: ListCustomerChargesRequest, options?: RequestOptions): Promise<Result<ListCustomerChargesResponse>>;
|
|
179
|
+
/**
|
|
180
|
+
* Create customer charge
|
|
181
|
+
*
|
|
182
|
+
* Create customer charge.
|
|
183
|
+
*
|
|
184
|
+
* POST /openmeter/customers/{customerId}/charges
|
|
185
|
+
*/
|
|
22
186
|
export declare function createCustomerCharges(client: Client, req: CreateCustomerChargesRequest, options?: RequestOptions): Promise<Result<CreateCustomerChargesResponse>>;
|
|
23
|
-
//# sourceMappingURL=customers.d.ts.map
|