@openmeter/client 1.0.0-beta.230 → 1.0.0-beta.231

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (137) hide show
  1. package/LICENSE +202 -0
  2. package/README.md +347 -68
  3. package/dist/core.d.ts +0 -1
  4. package/dist/core.js +8 -1
  5. package/dist/funcs/addons.d.ts +49 -1
  6. package/dist/funcs/addons.js +50 -1
  7. package/dist/funcs/apps.d.ts +14 -1
  8. package/dist/funcs/apps.js +15 -1
  9. package/dist/funcs/billing.d.ts +46 -1
  10. package/dist/funcs/billing.js +47 -1
  11. package/dist/funcs/currencies.d.ts +30 -1
  12. package/dist/funcs/currencies.js +31 -1
  13. package/dist/funcs/customers.d.ts +165 -2
  14. package/dist/funcs/customers.js +192 -1
  15. package/dist/funcs/defaults.d.ts +10 -1
  16. package/dist/funcs/defaults.js +11 -1
  17. package/dist/funcs/entitlements.d.ts +5 -1
  18. package/dist/funcs/entitlements.js +6 -1
  19. package/dist/funcs/events.d.ts +14 -1
  20. package/dist/funcs/events.js +15 -1
  21. package/dist/funcs/features.d.ts +42 -1
  22. package/dist/funcs/features.js +43 -1
  23. package/dist/funcs/governance.d.ts +14 -1
  24. package/dist/funcs/governance.js +15 -1
  25. package/dist/funcs/index.d.ts +0 -1
  26. package/dist/funcs/index.js +1 -1
  27. package/dist/funcs/invoices.d.ts +44 -1
  28. package/dist/funcs/invoices.js +45 -1
  29. package/dist/funcs/llmCost.d.ts +36 -1
  30. package/dist/funcs/llmCost.js +37 -1
  31. package/dist/funcs/meters.d.ts +53 -1
  32. package/dist/funcs/meters.js +54 -1
  33. package/dist/funcs/planAddons.d.ts +35 -1
  34. package/dist/funcs/planAddons.js +36 -1
  35. package/dist/funcs/plans.d.ts +49 -1
  36. package/dist/funcs/plans.js +50 -1
  37. package/dist/funcs/subscriptions.d.ts +59 -1
  38. package/dist/funcs/subscriptions.js +60 -1
  39. package/dist/funcs/tax.d.ts +25 -1
  40. package/dist/funcs/tax.js +26 -1
  41. package/dist/index.d.ts +4 -6
  42. package/dist/index.js +4 -5
  43. package/dist/lib/config.d.ts +0 -1
  44. package/dist/lib/config.js +1 -1
  45. package/dist/lib/encodings.d.ts +0 -1
  46. package/dist/lib/encodings.js +1 -1
  47. package/dist/lib/paginate.d.ts +56 -0
  48. package/dist/lib/paginate.js +60 -0
  49. package/dist/lib/request.d.ts +0 -1
  50. package/dist/lib/request.js +1 -1
  51. package/dist/lib/to-error.d.ts +0 -1
  52. package/dist/lib/to-error.js +1 -1
  53. package/dist/lib/types.d.ts +0 -1
  54. package/dist/lib/types.js +1 -1
  55. package/dist/lib/version.d.ts +1 -0
  56. package/dist/lib/version.js +5 -0
  57. package/dist/lib/wire.d.ts +3 -1
  58. package/dist/lib/wire.js +93 -4
  59. package/dist/models/errors.d.ts +13 -2
  60. package/dist/models/errors.js +31 -4
  61. package/dist/models/operations/addons.d.ts +0 -1
  62. package/dist/models/operations/addons.js +1 -1
  63. package/dist/models/operations/apps.d.ts +2 -5
  64. package/dist/models/operations/apps.js +1 -1
  65. package/dist/models/operations/billing.d.ts +0 -1
  66. package/dist/models/operations/billing.js +1 -1
  67. package/dist/models/operations/currencies.d.ts +0 -1
  68. package/dist/models/operations/currencies.js +1 -1
  69. package/dist/models/operations/customers.d.ts +9 -6
  70. package/dist/models/operations/customers.js +1 -1
  71. package/dist/models/operations/defaults.d.ts +0 -1
  72. package/dist/models/operations/defaults.js +1 -1
  73. package/dist/models/operations/entitlements.d.ts +0 -1
  74. package/dist/models/operations/entitlements.js +1 -1
  75. package/dist/models/operations/events.d.ts +0 -1
  76. package/dist/models/operations/events.js +1 -1
  77. package/dist/models/operations/features.d.ts +0 -1
  78. package/dist/models/operations/features.js +1 -1
  79. package/dist/models/operations/governance.d.ts +0 -1
  80. package/dist/models/operations/governance.js +1 -1
  81. package/dist/models/operations/invoices.d.ts +4 -7
  82. package/dist/models/operations/invoices.js +1 -1
  83. package/dist/models/operations/llmCost.d.ts +0 -1
  84. package/dist/models/operations/llmCost.js +1 -1
  85. package/dist/models/operations/meters.d.ts +0 -1
  86. package/dist/models/operations/meters.js +1 -1
  87. package/dist/models/operations/planAddons.d.ts +0 -1
  88. package/dist/models/operations/planAddons.js +1 -1
  89. package/dist/models/operations/plans.d.ts +0 -1
  90. package/dist/models/operations/plans.js +1 -1
  91. package/dist/models/operations/subscriptions.d.ts +0 -1
  92. package/dist/models/operations/subscriptions.js +1 -1
  93. package/dist/models/operations/tax.d.ts +0 -1
  94. package/dist/models/operations/tax.js +1 -1
  95. package/dist/models/schemas.d.ts +162 -1
  96. package/dist/models/schemas.js +37 -5
  97. package/dist/models/types.d.ts +464 -577
  98. package/dist/models/types.js +1 -1
  99. package/dist/sdk/addons.d.ts +60 -1
  100. package/dist/sdk/addons.js +63 -1
  101. package/dist/sdk/apps.d.ts +25 -1
  102. package/dist/sdk/apps.js +28 -1
  103. package/dist/sdk/billing.d.ts +57 -1
  104. package/dist/sdk/billing.js +60 -1
  105. package/dist/sdk/customers.d.ts +211 -2
  106. package/dist/sdk/customers.js +222 -2
  107. package/dist/sdk/defaults.d.ts +10 -1
  108. package/dist/sdk/defaults.js +11 -1
  109. package/dist/sdk/entitlements.d.ts +5 -1
  110. package/dist/sdk/entitlements.js +6 -1
  111. package/dist/sdk/events.d.ts +25 -1
  112. package/dist/sdk/events.js +28 -1
  113. package/dist/sdk/features.d.ts +53 -1
  114. package/dist/sdk/features.js +56 -1
  115. package/dist/sdk/internal.d.ts +180 -0
  116. package/dist/sdk/internal.js +224 -0
  117. package/dist/sdk/llmCost.d.ts +57 -1
  118. package/dist/sdk/llmCost.js +62 -1
  119. package/dist/sdk/meters.d.ts +64 -1
  120. package/dist/sdk/meters.js +67 -1
  121. package/dist/sdk/planAddons.d.ts +46 -1
  122. package/dist/sdk/planAddons.js +49 -1
  123. package/dist/sdk/plans.d.ts +60 -1
  124. package/dist/sdk/plans.js +63 -1
  125. package/dist/sdk/sdk.d.ts +9 -10
  126. package/dist/sdk/sdk.js +11 -15
  127. package/dist/sdk/subscriptions.d.ts +72 -3
  128. package/dist/sdk/subscriptions.js +77 -5
  129. package/dist/sdk/tax.d.ts +34 -1
  130. package/dist/sdk/tax.js +37 -1
  131. package/package.json +28 -4
  132. package/dist/sdk/currencies.d.ts +0 -12
  133. package/dist/sdk/currencies.js +0 -21
  134. package/dist/sdk/governance.d.ts +0 -9
  135. package/dist/sdk/governance.js +0 -12
  136. package/dist/sdk/invoices.d.ts +0 -12
  137. package/dist/sdk/invoices.js +0 -21
@@ -1,22 +1,59 @@
1
+ // Code generated by @openmeter/typespec-typescript. DO NOT EDIT.
1
2
  import { unwrap } from '../lib/types.js';
2
- import { createCustomer, getCustomer, listCustomers, upsertCustomer, deleteCustomer, getCustomerBilling, updateCustomerBilling, updateCustomerBillingAppData, createCustomerStripeCheckoutSession, createCustomerStripePortalSession, createCreditGrant, getCreditGrant, listCreditGrants, getCustomerCreditBalance, createCreditAdjustment, updateCreditGrantExternalSettlement, listCreditTransactions, listCustomerCharges, createCustomerCharges, } from '../funcs/customers.js';
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
@@ -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
@@ -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
@@ -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
@@ -1,10 +1,34 @@
1
1
  import { type Client } from '../core.js';
2
2
  import { type RequestOptions } from '../lib/types.js';
3
3
  import type { ListMeteringEventsRequest, ListMeteringEventsResponse, IngestMeteringEventsRequest, IngestMeteringEventsResponse } from '../models/operations/events.js';
4
+ import type { IngestedEvent } from '../models/types.js';
4
5
  export declare class Events {
5
6
  private readonly _client;
6
7
  constructor(_client: Client);
8
+ /**
9
+ * List metering events
10
+ *
11
+ * List ingested events.
12
+ *
13
+ * GET /openmeter/events
14
+ */
7
15
  list(request?: ListMeteringEventsRequest, options?: RequestOptions): Promise<ListMeteringEventsResponse>;
16
+ /**
17
+ * List metering events
18
+ *
19
+ * List ingested events.
20
+ *
21
+ * Iterates every item across all pages, fetching more as the returned iterable is consumed.
22
+ *
23
+ * GET /openmeter/events
24
+ */
25
+ listAll(request?: ListMeteringEventsRequest, options?: RequestOptions): AsyncIterable<IngestedEvent>;
26
+ /**
27
+ * Ingest metering events
28
+ *
29
+ * Ingests an event or batch of events following the CloudEvents specification.
30
+ *
31
+ * POST /openmeter/events
32
+ */
8
33
  ingest(request: IngestMeteringEventsRequest, options?: RequestOptions): Promise<IngestMeteringEventsResponse>;
9
34
  }
10
- //# sourceMappingURL=events.d.ts.map
@@ -1,15 +1,42 @@
1
+ // Code generated by @openmeter/typespec-typescript. DO NOT EDIT.
1
2
  import { unwrap } from '../lib/types.js';
3
+ import { paginateCursor } from '../lib/paginate.js';
2
4
  import { listMeteringEvents, ingestMeteringEvents } from '../funcs/events.js';
3
5
  export class Events {
4
6
  _client;
5
7
  constructor(_client) {
6
8
  this._client = _client;
7
9
  }
10
+ /**
11
+ * List metering events
12
+ *
13
+ * List ingested events.
14
+ *
15
+ * GET /openmeter/events
16
+ */
8
17
  async list(request, options) {
9
18
  return unwrap(await listMeteringEvents(this._client, request, options));
10
19
  }
20
+ /**
21
+ * List metering events
22
+ *
23
+ * List ingested events.
24
+ *
25
+ * Iterates every item across all pages, fetching more as the returned iterable is consumed.
26
+ *
27
+ * GET /openmeter/events
28
+ */
29
+ listAll(request, options) {
30
+ return paginateCursor((req, opts) => listMeteringEvents(this._client, req, opts), request ?? {}, options);
31
+ }
32
+ /**
33
+ * Ingest metering events
34
+ *
35
+ * Ingests an event or batch of events following the CloudEvents specification.
36
+ *
37
+ * POST /openmeter/events
38
+ */
11
39
  async ingest(request, options) {
12
40
  return unwrap(await ingestMeteringEvents(this._client, request, options));
13
41
  }
14
42
  }
15
- //# sourceMappingURL=events.js.map
@@ -1,14 +1,66 @@
1
1
  import { type Client } from '../core.js';
2
2
  import { type RequestOptions } from '../lib/types.js';
3
3
  import type { ListFeaturesRequest, ListFeaturesResponse, CreateFeatureRequest, CreateFeatureResponse, GetFeatureRequest, GetFeatureResponse, UpdateFeatureRequest, UpdateFeatureResponse, DeleteFeatureRequest, DeleteFeatureResponse, QueryFeatureCostRequest, QueryFeatureCostResponse } from '../models/operations/features.js';
4
+ import type { Feature } from '../models/types.js';
4
5
  export declare class Features {
5
6
  private readonly _client;
6
7
  constructor(_client: Client);
8
+ /**
9
+ * List features
10
+ *
11
+ * List all features.
12
+ *
13
+ * GET /openmeter/features
14
+ */
7
15
  list(request?: ListFeaturesRequest, options?: RequestOptions): Promise<ListFeaturesResponse>;
16
+ /**
17
+ * List features
18
+ *
19
+ * List all features.
20
+ *
21
+ * Iterates every item across all pages, fetching more as the returned iterable is consumed.
22
+ *
23
+ * GET /openmeter/features
24
+ */
25
+ listAll(request?: ListFeaturesRequest, options?: RequestOptions): AsyncIterable<Feature>;
26
+ /**
27
+ * Create feature
28
+ *
29
+ * Create a feature.
30
+ *
31
+ * POST /openmeter/features
32
+ */
8
33
  create(request: CreateFeatureRequest, options?: RequestOptions): Promise<CreateFeatureResponse>;
34
+ /**
35
+ * Get feature
36
+ *
37
+ * Get a feature by id.
38
+ *
39
+ * GET /openmeter/features/{featureId}
40
+ */
9
41
  get(request: GetFeatureRequest, options?: RequestOptions): Promise<GetFeatureResponse>;
42
+ /**
43
+ * Update feature
44
+ *
45
+ * Update a feature by id. Currently only the unit_cost field can be updated.
46
+ *
47
+ * PATCH /openmeter/features/{featureId}
48
+ */
10
49
  update(request: UpdateFeatureRequest, options?: RequestOptions): Promise<UpdateFeatureResponse>;
50
+ /**
51
+ * Delete feature
52
+ *
53
+ * Delete a feature by id.
54
+ *
55
+ * DELETE /openmeter/features/{featureId}
56
+ */
11
57
  delete(request: DeleteFeatureRequest, options?: RequestOptions): Promise<DeleteFeatureResponse>;
58
+ /**
59
+ * Query feature cost
60
+ *
61
+ * Query the cost of a feature.
62
+ *
63
+ * POST /openmeter/features/{featureId}/cost/query
64
+ */
12
65
  queryCost(request: QueryFeatureCostRequest, options?: RequestOptions): Promise<QueryFeatureCostResponse>;
13
66
  }
14
- //# sourceMappingURL=features.d.ts.map
@@ -1,27 +1,82 @@
1
+ // Code generated by @openmeter/typespec-typescript. DO NOT EDIT.
1
2
  import { unwrap } from '../lib/types.js';
3
+ import { paginatePages } from '../lib/paginate.js';
2
4
  import { listFeatures, createFeature, getFeature, updateFeature, deleteFeature, queryFeatureCost, } from '../funcs/features.js';
3
5
  export class Features {
4
6
  _client;
5
7
  constructor(_client) {
6
8
  this._client = _client;
7
9
  }
10
+ /**
11
+ * List features
12
+ *
13
+ * List all features.
14
+ *
15
+ * GET /openmeter/features
16
+ */
8
17
  async list(request, options) {
9
18
  return unwrap(await listFeatures(this._client, request, options));
10
19
  }
20
+ /**
21
+ * List features
22
+ *
23
+ * List all features.
24
+ *
25
+ * Iterates every item across all pages, fetching more as the returned iterable is consumed.
26
+ *
27
+ * GET /openmeter/features
28
+ */
29
+ listAll(request, options) {
30
+ return paginatePages((req, opts) => listFeatures(this._client, req, opts), request ?? {}, options);
31
+ }
32
+ /**
33
+ * Create feature
34
+ *
35
+ * Create a feature.
36
+ *
37
+ * POST /openmeter/features
38
+ */
11
39
  async create(request, options) {
12
40
  return unwrap(await createFeature(this._client, request, options));
13
41
  }
42
+ /**
43
+ * Get feature
44
+ *
45
+ * Get a feature by id.
46
+ *
47
+ * GET /openmeter/features/{featureId}
48
+ */
14
49
  async get(request, options) {
15
50
  return unwrap(await getFeature(this._client, request, options));
16
51
  }
52
+ /**
53
+ * Update feature
54
+ *
55
+ * Update a feature by id. Currently only the unit_cost field can be updated.
56
+ *
57
+ * PATCH /openmeter/features/{featureId}
58
+ */
17
59
  async update(request, options) {
18
60
  return unwrap(await updateFeature(this._client, request, options));
19
61
  }
62
+ /**
63
+ * Delete feature
64
+ *
65
+ * Delete a feature by id.
66
+ *
67
+ * DELETE /openmeter/features/{featureId}
68
+ */
20
69
  async delete(request, options) {
21
70
  return unwrap(await deleteFeature(this._client, request, options));
22
71
  }
72
+ /**
73
+ * Query feature cost
74
+ *
75
+ * Query the cost of a feature.
76
+ *
77
+ * POST /openmeter/features/{featureId}/cost/query
78
+ */
23
79
  async queryCost(request, options) {
24
80
  return unwrap(await queryFeatureCost(this._client, request, options));
25
81
  }
26
82
  }
27
- //# sourceMappingURL=features.js.map