@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/sdk/customers.d.ts
CHANGED
|
@@ -1,13 +1,47 @@
|
|
|
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, 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
|
+
import type { Charge, CreditGrant, CreditTransaction, Customer } from '../models/types.js';
|
|
4
5
|
export declare class Customers {
|
|
5
6
|
private readonly _client;
|
|
6
7
|
constructor(_client: Client);
|
|
8
|
+
/**
|
|
9
|
+
* Create customer
|
|
10
|
+
*
|
|
11
|
+
* POST /openmeter/customers
|
|
12
|
+
*/
|
|
7
13
|
create(request: CreateCustomerRequest, options?: RequestOptions): Promise<CreateCustomerResponse>;
|
|
14
|
+
/**
|
|
15
|
+
* Get customer
|
|
16
|
+
*
|
|
17
|
+
* GET /openmeter/customers/{customerId}
|
|
18
|
+
*/
|
|
8
19
|
get(request: GetCustomerRequest, options?: RequestOptions): Promise<GetCustomerResponse>;
|
|
20
|
+
/**
|
|
21
|
+
* List customers
|
|
22
|
+
*
|
|
23
|
+
* GET /openmeter/customers
|
|
24
|
+
*/
|
|
9
25
|
list(request?: ListCustomersRequest, options?: RequestOptions): Promise<ListCustomersResponse>;
|
|
26
|
+
/**
|
|
27
|
+
* List customers
|
|
28
|
+
*
|
|
29
|
+
* Iterates every item across all pages, fetching more as the returned iterable is consumed.
|
|
30
|
+
*
|
|
31
|
+
* GET /openmeter/customers
|
|
32
|
+
*/
|
|
33
|
+
listAll(request?: ListCustomersRequest, options?: RequestOptions): AsyncIterable<Customer>;
|
|
34
|
+
/**
|
|
35
|
+
* Upsert customer
|
|
36
|
+
*
|
|
37
|
+
* PUT /openmeter/customers/{customerId}
|
|
38
|
+
*/
|
|
10
39
|
upsert(request: UpsertCustomerRequest, options?: RequestOptions): Promise<UpsertCustomerResponse>;
|
|
40
|
+
/**
|
|
41
|
+
* Delete customer
|
|
42
|
+
*
|
|
43
|
+
* DELETE /openmeter/customers/{customerId}
|
|
44
|
+
*/
|
|
11
45
|
delete(request: DeleteCustomerRequest, options?: RequestOptions): Promise<DeleteCustomerResponse>;
|
|
12
46
|
private _billing?;
|
|
13
47
|
get billing(): CustomersBilling;
|
|
@@ -19,10 +53,54 @@ export declare class Customers {
|
|
|
19
53
|
export declare class CustomersBilling {
|
|
20
54
|
private readonly _client;
|
|
21
55
|
constructor(_client: Client);
|
|
56
|
+
/**
|
|
57
|
+
* Get customer billing data
|
|
58
|
+
*
|
|
59
|
+
* GET /openmeter/customers/{customerId}/billing
|
|
60
|
+
*/
|
|
22
61
|
get(request: GetCustomerBillingRequest, options?: RequestOptions): Promise<GetCustomerBillingResponse>;
|
|
62
|
+
/**
|
|
63
|
+
* Update customer billing data
|
|
64
|
+
*
|
|
65
|
+
* PUT /openmeter/customers/{customerId}/billing
|
|
66
|
+
*/
|
|
23
67
|
update(request: UpdateCustomerBillingRequest, options?: RequestOptions): Promise<UpdateCustomerBillingResponse>;
|
|
68
|
+
/**
|
|
69
|
+
* Update customer billing app data
|
|
70
|
+
*
|
|
71
|
+
* PUT /openmeter/customers/{customerId}/billing/app-data
|
|
72
|
+
*/
|
|
24
73
|
updateAppData(request: UpdateCustomerBillingAppDataRequest, options?: RequestOptions): Promise<UpdateCustomerBillingAppDataResponse>;
|
|
74
|
+
/**
|
|
75
|
+
* Create Stripe Checkout Session
|
|
76
|
+
*
|
|
77
|
+
* Create a [Stripe Checkout Session](https://docs.stripe.com/payments/checkout)
|
|
78
|
+
* for the customer.
|
|
79
|
+
*
|
|
80
|
+
* Creates a Checkout Session for collecting payment method information from
|
|
81
|
+
* customers. The session operates in "setup" mode, which collects payment details
|
|
82
|
+
* without charging the customer immediately. The collected payment method can be
|
|
83
|
+
* used for future subscription billing.
|
|
84
|
+
*
|
|
85
|
+
* For hosted checkout sessions, redirect customers to the returned URL. For
|
|
86
|
+
* embedded sessions, use the client_secret to initialize Stripe.js in your
|
|
87
|
+
* application.
|
|
88
|
+
*
|
|
89
|
+
* POST /openmeter/customers/{customerId}/billing/stripe/checkout-sessions
|
|
90
|
+
*/
|
|
25
91
|
createStripeCheckoutSession(request: CreateCustomerStripeCheckoutSessionRequest, options?: RequestOptions): Promise<CreateCustomerStripeCheckoutSessionResponse>;
|
|
92
|
+
/**
|
|
93
|
+
* Create Stripe customer portal session
|
|
94
|
+
*
|
|
95
|
+
* Create Stripe Customer Portal Session.
|
|
96
|
+
*
|
|
97
|
+
* Useful to redirect the customer to the Stripe Customer Portal to manage their
|
|
98
|
+
* payment methods, change their billing address and access their invoice history.
|
|
99
|
+
* Only returns URL if the customer billing profile is linked to a stripe app and
|
|
100
|
+
* customer.
|
|
101
|
+
*
|
|
102
|
+
* POST /openmeter/customers/{customerId}/billing/stripe/portal-sessions
|
|
103
|
+
*/
|
|
26
104
|
createStripePortalSession(request: CreateCustomerStripePortalSessionRequest, options?: RequestOptions): Promise<CreateCustomerStripePortalSessionResponse>;
|
|
27
105
|
}
|
|
28
106
|
export declare class CustomersCredits {
|
|
@@ -40,30 +118,161 @@ export declare class CustomersCredits {
|
|
|
40
118
|
export declare class CustomersCreditsGrants {
|
|
41
119
|
private readonly _client;
|
|
42
120
|
constructor(_client: Client);
|
|
121
|
+
/**
|
|
122
|
+
* Create a new credit grant
|
|
123
|
+
*
|
|
124
|
+
* Create a new credit grant. A credit grant represents an allocation of prepaid
|
|
125
|
+
* credits to a customer.
|
|
126
|
+
*
|
|
127
|
+
* POST /openmeter/customers/{customerId}/credits/grants
|
|
128
|
+
*/
|
|
43
129
|
create(request: CreateCreditGrantRequest, options?: RequestOptions): Promise<CreateCreditGrantResponse>;
|
|
130
|
+
/**
|
|
131
|
+
* Get a credit grant
|
|
132
|
+
*
|
|
133
|
+
* Get a credit grant.
|
|
134
|
+
*
|
|
135
|
+
* GET /openmeter/customers/{customerId}/credits/grants/{creditGrantId}
|
|
136
|
+
*/
|
|
44
137
|
get(request: GetCreditGrantRequest, options?: RequestOptions): Promise<GetCreditGrantResponse>;
|
|
138
|
+
/**
|
|
139
|
+
* List credit grants
|
|
140
|
+
*
|
|
141
|
+
* List credit grants.
|
|
142
|
+
*
|
|
143
|
+
* GET /openmeter/customers/{customerId}/credits/grants
|
|
144
|
+
*/
|
|
45
145
|
list(request: ListCreditGrantsRequest, options?: RequestOptions): Promise<ListCreditGrantsResponse>;
|
|
146
|
+
/**
|
|
147
|
+
* List credit grants
|
|
148
|
+
*
|
|
149
|
+
* List credit grants.
|
|
150
|
+
*
|
|
151
|
+
* Iterates every item across all pages, fetching more as the returned iterable is consumed.
|
|
152
|
+
*
|
|
153
|
+
* GET /openmeter/customers/{customerId}/credits/grants
|
|
154
|
+
*/
|
|
155
|
+
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
|
+
/**
|
|
173
|
+
* Update credit grant external settlement status
|
|
174
|
+
*
|
|
175
|
+
* Update the payment settlement status of an externally funded credit grant.
|
|
176
|
+
*
|
|
177
|
+
* Use this endpoint to synchronize the payment state of an external payment with
|
|
178
|
+
* the system so that revenue recognition and credit availability work as expected.
|
|
179
|
+
*
|
|
180
|
+
* POST /openmeter/customers/{customerId}/credits/grants/{creditGrantId}/settlement/external
|
|
181
|
+
*/
|
|
46
182
|
updateExternalSettlement(request: UpdateCreditGrantExternalSettlementRequest, options?: RequestOptions): Promise<UpdateCreditGrantExternalSettlementResponse>;
|
|
47
183
|
}
|
|
48
184
|
export declare class CustomersCreditsBalance {
|
|
49
185
|
private readonly _client;
|
|
50
186
|
constructor(_client: Client);
|
|
187
|
+
/**
|
|
188
|
+
* Get a customer's credit balance
|
|
189
|
+
*
|
|
190
|
+
* Get a credit balance.
|
|
191
|
+
*
|
|
192
|
+
* GET /openmeter/customers/{customerId}/credits/balance
|
|
193
|
+
*/
|
|
51
194
|
get(request: GetCustomerCreditBalanceRequest, options?: RequestOptions): Promise<GetCustomerCreditBalanceResponse>;
|
|
52
195
|
}
|
|
53
196
|
export declare class CustomersCreditsAdjustments {
|
|
54
197
|
private readonly _client;
|
|
55
198
|
constructor(_client: Client);
|
|
199
|
+
/**
|
|
200
|
+
* Create a credit adjustment
|
|
201
|
+
*
|
|
202
|
+
* A credit adjustment can be used to make manual adjustments to a customer's
|
|
203
|
+
* credit balance.
|
|
204
|
+
*
|
|
205
|
+
* Supported use-cases:
|
|
206
|
+
*
|
|
207
|
+
* - Usage correction
|
|
208
|
+
*
|
|
209
|
+
* POST /openmeter/customers/{customerId}/credits/adjustments
|
|
210
|
+
*/
|
|
56
211
|
create(request: CreateCreditAdjustmentRequest, options?: RequestOptions): Promise<CreateCreditAdjustmentResponse>;
|
|
57
212
|
}
|
|
58
213
|
export declare class CustomersCreditsTransactions {
|
|
59
214
|
private readonly _client;
|
|
60
215
|
constructor(_client: Client);
|
|
216
|
+
/**
|
|
217
|
+
* List credit transactions
|
|
218
|
+
*
|
|
219
|
+
* List credit transactions for a customer.
|
|
220
|
+
*
|
|
221
|
+
* Returns an immutable, chronological record of credit movements: funded credits
|
|
222
|
+
* and consumed credits. Transactions are returned in reverse chronological order
|
|
223
|
+
* by default.
|
|
224
|
+
*
|
|
225
|
+
* GET /openmeter/customers/{customerId}/credits/transactions
|
|
226
|
+
*/
|
|
61
227
|
list(request: ListCreditTransactionsRequest, options?: RequestOptions): Promise<ListCreditTransactionsResponse>;
|
|
228
|
+
/**
|
|
229
|
+
* List credit transactions
|
|
230
|
+
*
|
|
231
|
+
* List credit transactions for a customer.
|
|
232
|
+
*
|
|
233
|
+
* Returns an immutable, chronological record of credit movements: funded credits
|
|
234
|
+
* and consumed credits. Transactions are returned in reverse chronological order
|
|
235
|
+
* by default.
|
|
236
|
+
*
|
|
237
|
+
* Iterates every item across all pages, fetching more as the returned iterable is consumed.
|
|
238
|
+
*
|
|
239
|
+
* GET /openmeter/customers/{customerId}/credits/transactions
|
|
240
|
+
*/
|
|
241
|
+
listAll(request: ListCreditTransactionsRequest, options?: RequestOptions): AsyncIterable<CreditTransaction>;
|
|
62
242
|
}
|
|
63
243
|
export declare class CustomersCharges {
|
|
64
244
|
private readonly _client;
|
|
65
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
|
+
*/
|
|
66
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
|
+
*/
|
|
67
277
|
create(request: CreateCustomerChargesRequest, options?: RequestOptions): Promise<CreateCustomerChargesResponse>;
|
|
68
278
|
}
|
|
69
|
-
//# sourceMappingURL=customers.d.ts.map
|
package/dist/sdk/customers.js
CHANGED
|
@@ -1,22 +1,59 @@
|
|
|
1
|
+
// Code generated by @openmeter/typespec-typescript. DO NOT EDIT.
|
|
1
2
|
import { unwrap } from '../lib/types.js';
|
|
2
|
-
import {
|
|
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, voidCreditGrant, updateCreditGrantExternalSettlement, listCreditTransactions, listCustomerCharges, createCustomerCharges, } from '../funcs/customers.js';
|
|
3
5
|
export class Customers {
|
|
4
6
|
_client;
|
|
5
7
|
constructor(_client) {
|
|
6
8
|
this._client = _client;
|
|
7
9
|
}
|
|
10
|
+
/**
|
|
11
|
+
* Create customer
|
|
12
|
+
*
|
|
13
|
+
* POST /openmeter/customers
|
|
14
|
+
*/
|
|
8
15
|
async create(request, options) {
|
|
9
16
|
return unwrap(await createCustomer(this._client, request, options));
|
|
10
17
|
}
|
|
18
|
+
/**
|
|
19
|
+
* Get customer
|
|
20
|
+
*
|
|
21
|
+
* GET /openmeter/customers/{customerId}
|
|
22
|
+
*/
|
|
11
23
|
async get(request, options) {
|
|
12
24
|
return unwrap(await getCustomer(this._client, request, options));
|
|
13
25
|
}
|
|
26
|
+
/**
|
|
27
|
+
* List customers
|
|
28
|
+
*
|
|
29
|
+
* GET /openmeter/customers
|
|
30
|
+
*/
|
|
14
31
|
async list(request, options) {
|
|
15
32
|
return unwrap(await listCustomers(this._client, request, options));
|
|
16
33
|
}
|
|
34
|
+
/**
|
|
35
|
+
* List customers
|
|
36
|
+
*
|
|
37
|
+
* Iterates every item across all pages, fetching more as the returned iterable is consumed.
|
|
38
|
+
*
|
|
39
|
+
* GET /openmeter/customers
|
|
40
|
+
*/
|
|
41
|
+
listAll(request, options) {
|
|
42
|
+
return paginatePages((req, opts) => listCustomers(this._client, req, opts), request ?? {}, options);
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* Upsert customer
|
|
46
|
+
*
|
|
47
|
+
* PUT /openmeter/customers/{customerId}
|
|
48
|
+
*/
|
|
17
49
|
async upsert(request, options) {
|
|
18
50
|
return unwrap(await upsertCustomer(this._client, request, options));
|
|
19
51
|
}
|
|
52
|
+
/**
|
|
53
|
+
* Delete customer
|
|
54
|
+
*
|
|
55
|
+
* DELETE /openmeter/customers/{customerId}
|
|
56
|
+
*/
|
|
20
57
|
async delete(request, options) {
|
|
21
58
|
return unwrap(await deleteCustomer(this._client, request, options));
|
|
22
59
|
}
|
|
@@ -38,18 +75,62 @@ export class CustomersBilling {
|
|
|
38
75
|
constructor(_client) {
|
|
39
76
|
this._client = _client;
|
|
40
77
|
}
|
|
78
|
+
/**
|
|
79
|
+
* Get customer billing data
|
|
80
|
+
*
|
|
81
|
+
* GET /openmeter/customers/{customerId}/billing
|
|
82
|
+
*/
|
|
41
83
|
async get(request, options) {
|
|
42
84
|
return unwrap(await getCustomerBilling(this._client, request, options));
|
|
43
85
|
}
|
|
86
|
+
/**
|
|
87
|
+
* Update customer billing data
|
|
88
|
+
*
|
|
89
|
+
* PUT /openmeter/customers/{customerId}/billing
|
|
90
|
+
*/
|
|
44
91
|
async update(request, options) {
|
|
45
92
|
return unwrap(await updateCustomerBilling(this._client, request, options));
|
|
46
93
|
}
|
|
94
|
+
/**
|
|
95
|
+
* Update customer billing app data
|
|
96
|
+
*
|
|
97
|
+
* PUT /openmeter/customers/{customerId}/billing/app-data
|
|
98
|
+
*/
|
|
47
99
|
async updateAppData(request, options) {
|
|
48
100
|
return unwrap(await updateCustomerBillingAppData(this._client, request, options));
|
|
49
101
|
}
|
|
102
|
+
/**
|
|
103
|
+
* Create Stripe Checkout Session
|
|
104
|
+
*
|
|
105
|
+
* Create a [Stripe Checkout Session](https://docs.stripe.com/payments/checkout)
|
|
106
|
+
* for the customer.
|
|
107
|
+
*
|
|
108
|
+
* Creates a Checkout Session for collecting payment method information from
|
|
109
|
+
* customers. The session operates in "setup" mode, which collects payment details
|
|
110
|
+
* without charging the customer immediately. The collected payment method can be
|
|
111
|
+
* used for future subscription billing.
|
|
112
|
+
*
|
|
113
|
+
* For hosted checkout sessions, redirect customers to the returned URL. For
|
|
114
|
+
* embedded sessions, use the client_secret to initialize Stripe.js in your
|
|
115
|
+
* application.
|
|
116
|
+
*
|
|
117
|
+
* POST /openmeter/customers/{customerId}/billing/stripe/checkout-sessions
|
|
118
|
+
*/
|
|
50
119
|
async createStripeCheckoutSession(request, options) {
|
|
51
120
|
return unwrap(await createCustomerStripeCheckoutSession(this._client, request, options));
|
|
52
121
|
}
|
|
122
|
+
/**
|
|
123
|
+
* Create Stripe customer portal session
|
|
124
|
+
*
|
|
125
|
+
* Create Stripe Customer Portal Session.
|
|
126
|
+
*
|
|
127
|
+
* Useful to redirect the customer to the Stripe Customer Portal to manage their
|
|
128
|
+
* payment methods, change their billing address and access their invoice history.
|
|
129
|
+
* Only returns URL if the customer billing profile is linked to a stripe app and
|
|
130
|
+
* customer.
|
|
131
|
+
*
|
|
132
|
+
* POST /openmeter/customers/{customerId}/billing/stripe/portal-sessions
|
|
133
|
+
*/
|
|
53
134
|
async createStripePortalSession(request, options) {
|
|
54
135
|
return unwrap(await createCustomerStripePortalSession(this._client, request, options));
|
|
55
136
|
}
|
|
@@ -81,15 +162,77 @@ export class CustomersCreditsGrants {
|
|
|
81
162
|
constructor(_client) {
|
|
82
163
|
this._client = _client;
|
|
83
164
|
}
|
|
165
|
+
/**
|
|
166
|
+
* Create a new credit grant
|
|
167
|
+
*
|
|
168
|
+
* Create a new credit grant. A credit grant represents an allocation of prepaid
|
|
169
|
+
* credits to a customer.
|
|
170
|
+
*
|
|
171
|
+
* POST /openmeter/customers/{customerId}/credits/grants
|
|
172
|
+
*/
|
|
84
173
|
async create(request, options) {
|
|
85
174
|
return unwrap(await createCreditGrant(this._client, request, options));
|
|
86
175
|
}
|
|
176
|
+
/**
|
|
177
|
+
* Get a credit grant
|
|
178
|
+
*
|
|
179
|
+
* Get a credit grant.
|
|
180
|
+
*
|
|
181
|
+
* GET /openmeter/customers/{customerId}/credits/grants/{creditGrantId}
|
|
182
|
+
*/
|
|
87
183
|
async get(request, options) {
|
|
88
184
|
return unwrap(await getCreditGrant(this._client, request, options));
|
|
89
185
|
}
|
|
186
|
+
/**
|
|
187
|
+
* List credit grants
|
|
188
|
+
*
|
|
189
|
+
* List credit grants.
|
|
190
|
+
*
|
|
191
|
+
* GET /openmeter/customers/{customerId}/credits/grants
|
|
192
|
+
*/
|
|
90
193
|
async list(request, options) {
|
|
91
194
|
return unwrap(await listCreditGrants(this._client, request, options));
|
|
92
195
|
}
|
|
196
|
+
/**
|
|
197
|
+
* List credit grants
|
|
198
|
+
*
|
|
199
|
+
* List credit grants.
|
|
200
|
+
*
|
|
201
|
+
* Iterates every item across all pages, fetching more as the returned iterable is consumed.
|
|
202
|
+
*
|
|
203
|
+
* GET /openmeter/customers/{customerId}/credits/grants
|
|
204
|
+
*/
|
|
205
|
+
listAll(request, options) {
|
|
206
|
+
return paginatePages((req, opts) => listCreditGrants(this._client, req, opts), request, options);
|
|
207
|
+
}
|
|
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
|
+
/**
|
|
227
|
+
* Update credit grant external settlement status
|
|
228
|
+
*
|
|
229
|
+
* Update the payment settlement status of an externally funded credit grant.
|
|
230
|
+
*
|
|
231
|
+
* Use this endpoint to synchronize the payment state of an external payment with
|
|
232
|
+
* the system so that revenue recognition and credit availability work as expected.
|
|
233
|
+
*
|
|
234
|
+
* POST /openmeter/customers/{customerId}/credits/grants/{creditGrantId}/settlement/external
|
|
235
|
+
*/
|
|
93
236
|
async updateExternalSettlement(request, options) {
|
|
94
237
|
return unwrap(await updateCreditGrantExternalSettlement(this._client, request, options));
|
|
95
238
|
}
|
|
@@ -99,6 +242,13 @@ export class CustomersCreditsBalance {
|
|
|
99
242
|
constructor(_client) {
|
|
100
243
|
this._client = _client;
|
|
101
244
|
}
|
|
245
|
+
/**
|
|
246
|
+
* Get a customer's credit balance
|
|
247
|
+
*
|
|
248
|
+
* Get a credit balance.
|
|
249
|
+
*
|
|
250
|
+
* GET /openmeter/customers/{customerId}/credits/balance
|
|
251
|
+
*/
|
|
102
252
|
async get(request, options) {
|
|
103
253
|
return unwrap(await getCustomerCreditBalance(this._client, request, options));
|
|
104
254
|
}
|
|
@@ -108,6 +258,18 @@ export class CustomersCreditsAdjustments {
|
|
|
108
258
|
constructor(_client) {
|
|
109
259
|
this._client = _client;
|
|
110
260
|
}
|
|
261
|
+
/**
|
|
262
|
+
* Create a credit adjustment
|
|
263
|
+
*
|
|
264
|
+
* A credit adjustment can be used to make manual adjustments to a customer's
|
|
265
|
+
* credit balance.
|
|
266
|
+
*
|
|
267
|
+
* Supported use-cases:
|
|
268
|
+
*
|
|
269
|
+
* - Usage correction
|
|
270
|
+
*
|
|
271
|
+
* POST /openmeter/customers/{customerId}/credits/adjustments
|
|
272
|
+
*/
|
|
111
273
|
async create(request, options) {
|
|
112
274
|
return unwrap(await createCreditAdjustment(this._client, request, options));
|
|
113
275
|
}
|
|
@@ -117,20 +279,78 @@ export class CustomersCreditsTransactions {
|
|
|
117
279
|
constructor(_client) {
|
|
118
280
|
this._client = _client;
|
|
119
281
|
}
|
|
282
|
+
/**
|
|
283
|
+
* List credit transactions
|
|
284
|
+
*
|
|
285
|
+
* List credit transactions for a customer.
|
|
286
|
+
*
|
|
287
|
+
* Returns an immutable, chronological record of credit movements: funded credits
|
|
288
|
+
* and consumed credits. Transactions are returned in reverse chronological order
|
|
289
|
+
* by default.
|
|
290
|
+
*
|
|
291
|
+
* GET /openmeter/customers/{customerId}/credits/transactions
|
|
292
|
+
*/
|
|
120
293
|
async list(request, options) {
|
|
121
294
|
return unwrap(await listCreditTransactions(this._client, request, options));
|
|
122
295
|
}
|
|
296
|
+
/**
|
|
297
|
+
* List credit transactions
|
|
298
|
+
*
|
|
299
|
+
* List credit transactions for a customer.
|
|
300
|
+
*
|
|
301
|
+
* Returns an immutable, chronological record of credit movements: funded credits
|
|
302
|
+
* and consumed credits. Transactions are returned in reverse chronological order
|
|
303
|
+
* by default.
|
|
304
|
+
*
|
|
305
|
+
* Iterates every item across all pages, fetching more as the returned iterable is consumed.
|
|
306
|
+
*
|
|
307
|
+
* GET /openmeter/customers/{customerId}/credits/transactions
|
|
308
|
+
*/
|
|
309
|
+
listAll(request, options) {
|
|
310
|
+
return paginateCursor((req, opts) => listCreditTransactions(this._client, req, opts), request, options);
|
|
311
|
+
}
|
|
123
312
|
}
|
|
124
313
|
export class CustomersCharges {
|
|
125
314
|
_client;
|
|
126
315
|
constructor(_client) {
|
|
127
316
|
this._client = _client;
|
|
128
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
|
+
*/
|
|
129
328
|
async list(request, options) {
|
|
130
329
|
return unwrap(await listCustomerCharges(this._client, request, options));
|
|
131
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
|
+
*/
|
|
132
353
|
async create(request, options) {
|
|
133
354
|
return unwrap(await createCustomerCharges(this._client, request, options));
|
|
134
355
|
}
|
|
135
356
|
}
|
|
136
|
-
//# sourceMappingURL=customers.js.map
|
package/dist/sdk/defaults.d.ts
CHANGED
|
@@ -4,7 +4,16 @@ import type { GetOrganizationDefaultTaxCodesRequest, GetOrganizationDefaultTaxCo
|
|
|
4
4
|
export declare class Defaults {
|
|
5
5
|
private readonly _client;
|
|
6
6
|
constructor(_client: Client);
|
|
7
|
+
/**
|
|
8
|
+
* Get organization default tax codes
|
|
9
|
+
*
|
|
10
|
+
* GET /openmeter/defaults/tax-codes
|
|
11
|
+
*/
|
|
7
12
|
getOrganizationTaxCodes(request: GetOrganizationDefaultTaxCodesRequest, options?: RequestOptions): Promise<GetOrganizationDefaultTaxCodesResponse>;
|
|
13
|
+
/**
|
|
14
|
+
* Update organization default tax codes
|
|
15
|
+
*
|
|
16
|
+
* PUT /openmeter/defaults/tax-codes
|
|
17
|
+
*/
|
|
8
18
|
updateOrganizationTaxCodes(request: UpdateOrganizationDefaultTaxCodesRequest, options?: RequestOptions): Promise<UpdateOrganizationDefaultTaxCodesResponse>;
|
|
9
19
|
}
|
|
10
|
-
//# sourceMappingURL=defaults.d.ts.map
|
package/dist/sdk/defaults.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
// Code generated by @openmeter/typespec-typescript. DO NOT EDIT.
|
|
1
2
|
import { unwrap } from '../lib/types.js';
|
|
2
3
|
import { getOrganizationDefaultTaxCodes, updateOrganizationDefaultTaxCodes, } from '../funcs/defaults.js';
|
|
3
4
|
export class Defaults {
|
|
@@ -5,11 +6,20 @@ export class Defaults {
|
|
|
5
6
|
constructor(_client) {
|
|
6
7
|
this._client = _client;
|
|
7
8
|
}
|
|
9
|
+
/**
|
|
10
|
+
* Get organization default tax codes
|
|
11
|
+
*
|
|
12
|
+
* GET /openmeter/defaults/tax-codes
|
|
13
|
+
*/
|
|
8
14
|
async getOrganizationTaxCodes(request, options) {
|
|
9
15
|
return unwrap(await getOrganizationDefaultTaxCodes(this._client, request, options));
|
|
10
16
|
}
|
|
17
|
+
/**
|
|
18
|
+
* Update organization default tax codes
|
|
19
|
+
*
|
|
20
|
+
* PUT /openmeter/defaults/tax-codes
|
|
21
|
+
*/
|
|
11
22
|
async updateOrganizationTaxCodes(request, options) {
|
|
12
23
|
return unwrap(await updateOrganizationDefaultTaxCodes(this._client, request, options));
|
|
13
24
|
}
|
|
14
25
|
}
|
|
15
|
-
//# sourceMappingURL=defaults.js.map
|
|
@@ -4,6 +4,10 @@ import type { ListCustomerEntitlementAccessRequest, ListCustomerEntitlementAcces
|
|
|
4
4
|
export declare class Entitlements {
|
|
5
5
|
private readonly _client;
|
|
6
6
|
constructor(_client: Client);
|
|
7
|
+
/**
|
|
8
|
+
* List customer entitlement access
|
|
9
|
+
*
|
|
10
|
+
* GET /openmeter/customers/{customerId}/entitlement-access
|
|
11
|
+
*/
|
|
7
12
|
listCustomerAccess(request: ListCustomerEntitlementAccessRequest, options?: RequestOptions): Promise<ListCustomerEntitlementAccessResponse>;
|
|
8
13
|
}
|
|
9
|
-
//# sourceMappingURL=entitlements.d.ts.map
|
package/dist/sdk/entitlements.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
// Code generated by @openmeter/typespec-typescript. DO NOT EDIT.
|
|
1
2
|
import { unwrap } from '../lib/types.js';
|
|
2
3
|
import { listCustomerEntitlementAccess } from '../funcs/entitlements.js';
|
|
3
4
|
export class Entitlements {
|
|
@@ -5,8 +6,12 @@ export class Entitlements {
|
|
|
5
6
|
constructor(_client) {
|
|
6
7
|
this._client = _client;
|
|
7
8
|
}
|
|
9
|
+
/**
|
|
10
|
+
* List customer entitlement access
|
|
11
|
+
*
|
|
12
|
+
* GET /openmeter/customers/{customerId}/entitlement-access
|
|
13
|
+
*/
|
|
8
14
|
async listCustomerAccess(request, options) {
|
|
9
15
|
return unwrap(await listCustomerEntitlementAccess(this._client, request, options));
|
|
10
16
|
}
|
|
11
17
|
}
|
|
12
|
-
//# sourceMappingURL=entitlements.js.map
|