@openmeter/client 1.0.0-beta-4d26c6d3c7fe → 1.0.0-beta-e7a04be10ed8

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 +316 -55
  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 +148 -1
  14. package/dist/funcs/customers.js +149 -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/index.d.ts +0 -3
  24. package/dist/funcs/index.js +1 -3
  25. package/dist/funcs/llmCost.d.ts +36 -1
  26. package/dist/funcs/llmCost.js +37 -1
  27. package/dist/funcs/meters.d.ts +53 -1
  28. package/dist/funcs/meters.js +54 -1
  29. package/dist/funcs/planAddons.d.ts +35 -1
  30. package/dist/funcs/planAddons.js +36 -1
  31. package/dist/funcs/plans.d.ts +49 -1
  32. package/dist/funcs/plans.js +50 -1
  33. package/dist/funcs/subscriptions.d.ts +59 -1
  34. package/dist/funcs/subscriptions.js +60 -1
  35. package/dist/funcs/tax.d.ts +25 -1
  36. package/dist/funcs/tax.js +26 -1
  37. package/dist/index.d.ts +4 -8
  38. package/dist/index.js +4 -5
  39. package/dist/lib/config.d.ts +0 -1
  40. package/dist/lib/config.js +1 -1
  41. package/dist/lib/encodings.d.ts +0 -1
  42. package/dist/lib/encodings.js +1 -1
  43. package/dist/lib/paginate.d.ts +56 -0
  44. package/dist/lib/paginate.js +60 -0
  45. package/dist/lib/request.d.ts +0 -1
  46. package/dist/lib/request.js +1 -1
  47. package/dist/lib/to-error.d.ts +0 -1
  48. package/dist/lib/to-error.js +1 -1
  49. package/dist/lib/types.d.ts +0 -1
  50. package/dist/lib/types.js +1 -1
  51. package/dist/lib/version.d.ts +1 -0
  52. package/dist/lib/version.js +5 -0
  53. package/dist/lib/wire.d.ts +3 -1
  54. package/dist/lib/wire.js +93 -4
  55. package/dist/models/errors.d.ts +13 -2
  56. package/dist/models/errors.js +31 -4
  57. package/dist/models/operations/addons.d.ts +0 -1
  58. package/dist/models/operations/addons.js +1 -1
  59. package/dist/models/operations/apps.d.ts +2 -5
  60. package/dist/models/operations/apps.js +1 -1
  61. package/dist/models/operations/billing.d.ts +0 -1
  62. package/dist/models/operations/billing.js +1 -1
  63. package/dist/models/operations/currencies.d.ts +0 -1
  64. package/dist/models/operations/currencies.js +1 -1
  65. package/dist/models/operations/customers.d.ts +3 -6
  66. package/dist/models/operations/customers.js +1 -1
  67. package/dist/models/operations/defaults.d.ts +0 -1
  68. package/dist/models/operations/defaults.js +1 -1
  69. package/dist/models/operations/entitlements.d.ts +0 -1
  70. package/dist/models/operations/entitlements.js +1 -1
  71. package/dist/models/operations/events.d.ts +0 -1
  72. package/dist/models/operations/events.js +1 -1
  73. package/dist/models/operations/features.d.ts +0 -1
  74. package/dist/models/operations/features.js +1 -1
  75. package/dist/models/operations/llmCost.d.ts +0 -1
  76. package/dist/models/operations/llmCost.js +1 -1
  77. package/dist/models/operations/meters.d.ts +0 -1
  78. package/dist/models/operations/meters.js +1 -1
  79. package/dist/models/operations/planAddons.d.ts +0 -1
  80. package/dist/models/operations/planAddons.js +1 -1
  81. package/dist/models/operations/plans.d.ts +0 -1
  82. package/dist/models/operations/plans.js +1 -1
  83. package/dist/models/operations/subscriptions.d.ts +0 -1
  84. package/dist/models/operations/subscriptions.js +1 -1
  85. package/dist/models/operations/tax.d.ts +0 -1
  86. package/dist/models/operations/tax.js +1 -1
  87. package/dist/models/schemas.d.ts +4453 -6950
  88. package/dist/models/schemas.js +1 -73
  89. package/dist/models/types.d.ts +381 -566
  90. package/dist/models/types.js +1 -1
  91. package/dist/sdk/addons.d.ts +60 -1
  92. package/dist/sdk/addons.js +63 -1
  93. package/dist/sdk/apps.d.ts +25 -1
  94. package/dist/sdk/apps.js +28 -1
  95. package/dist/sdk/billing.d.ts +57 -1
  96. package/dist/sdk/billing.js +60 -1
  97. package/dist/sdk/customers.d.ts +194 -1
  98. package/dist/sdk/customers.js +203 -1
  99. package/dist/sdk/defaults.d.ts +10 -1
  100. package/dist/sdk/defaults.js +11 -1
  101. package/dist/sdk/entitlements.d.ts +5 -1
  102. package/dist/sdk/entitlements.js +6 -1
  103. package/dist/sdk/events.d.ts +25 -1
  104. package/dist/sdk/events.js +28 -1
  105. package/dist/sdk/features.d.ts +53 -1
  106. package/dist/sdk/features.js +56 -1
  107. package/dist/sdk/internal.d.ts +89 -0
  108. package/dist/sdk/internal.js +113 -0
  109. package/dist/sdk/llmCost.d.ts +57 -1
  110. package/dist/sdk/llmCost.js +62 -1
  111. package/dist/sdk/meters.d.ts +64 -1
  112. package/dist/sdk/meters.js +67 -1
  113. package/dist/sdk/planAddons.d.ts +46 -1
  114. package/dist/sdk/planAddons.js +49 -1
  115. package/dist/sdk/plans.d.ts +60 -1
  116. package/dist/sdk/plans.js +63 -1
  117. package/dist/sdk/sdk.d.ts +9 -10
  118. package/dist/sdk/sdk.js +11 -15
  119. package/dist/sdk/subscriptions.d.ts +72 -3
  120. package/dist/sdk/subscriptions.js +77 -5
  121. package/dist/sdk/tax.d.ts +34 -1
  122. package/dist/sdk/tax.js +37 -1
  123. package/package.json +28 -4
  124. package/dist/funcs/governance.d.ts +0 -5
  125. package/dist/funcs/governance.js +0 -34
  126. package/dist/funcs/invoices.d.ts +0 -8
  127. package/dist/funcs/invoices.js +0 -81
  128. package/dist/models/operations/governance.d.ts +0 -10
  129. package/dist/models/operations/governance.js +0 -2
  130. package/dist/models/operations/invoices.d.ts +0 -48
  131. package/dist/models/operations/invoices.js +0 -2
  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';
3
+ import { paginateCursor, paginatePages } from '../lib/paginate.js';
2
4
  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
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,59 @@ 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
+ * Update credit grant external settlement status
210
+ *
211
+ * Update the payment settlement status of an externally funded credit grant.
212
+ *
213
+ * Use this endpoint to synchronize the payment state of an external payment with
214
+ * the system so that revenue recognition and credit availability work as expected.
215
+ *
216
+ * POST /openmeter/customers/{customerId}/credits/grants/{creditGrantId}/settlement/external
217
+ */
93
218
  async updateExternalSettlement(request, options) {
94
219
  return unwrap(await updateCreditGrantExternalSettlement(this._client, request, options));
95
220
  }
@@ -99,6 +224,13 @@ export class CustomersCreditsBalance {
99
224
  constructor(_client) {
100
225
  this._client = _client;
101
226
  }
227
+ /**
228
+ * Get a customer's credit balance
229
+ *
230
+ * Get a credit balance.
231
+ *
232
+ * GET /openmeter/customers/{customerId}/credits/balance
233
+ */
102
234
  async get(request, options) {
103
235
  return unwrap(await getCustomerCreditBalance(this._client, request, options));
104
236
  }
@@ -108,6 +240,18 @@ export class CustomersCreditsAdjustments {
108
240
  constructor(_client) {
109
241
  this._client = _client;
110
242
  }
243
+ /**
244
+ * Create a credit adjustment
245
+ *
246
+ * A credit adjustment can be used to make manual adjustments to a customer's
247
+ * credit balance.
248
+ *
249
+ * Supported use-cases:
250
+ *
251
+ * - Usage correction
252
+ *
253
+ * POST /openmeter/customers/{customerId}/credits/adjustments
254
+ */
111
255
  async create(request, options) {
112
256
  return unwrap(await createCreditAdjustment(this._client, request, options));
113
257
  }
@@ -117,20 +261,78 @@ export class CustomersCreditsTransactions {
117
261
  constructor(_client) {
118
262
  this._client = _client;
119
263
  }
264
+ /**
265
+ * List credit transactions
266
+ *
267
+ * List credit transactions for a customer.
268
+ *
269
+ * Returns an immutable, chronological record of credit movements: funded credits
270
+ * and consumed credits. Transactions are returned in reverse chronological order
271
+ * by default.
272
+ *
273
+ * GET /openmeter/customers/{customerId}/credits/transactions
274
+ */
120
275
  async list(request, options) {
121
276
  return unwrap(await listCreditTransactions(this._client, request, options));
122
277
  }
278
+ /**
279
+ * List credit transactions
280
+ *
281
+ * List credit transactions for a customer.
282
+ *
283
+ * Returns an immutable, chronological record of credit movements: funded credits
284
+ * and consumed credits. Transactions are returned in reverse chronological order
285
+ * by default.
286
+ *
287
+ * Iterates every item across all pages, fetching more as the returned iterable is consumed.
288
+ *
289
+ * GET /openmeter/customers/{customerId}/credits/transactions
290
+ */
291
+ listAll(request, options) {
292
+ return paginateCursor((req, opts) => listCreditTransactions(this._client, req, opts), request, options);
293
+ }
123
294
  }
124
295
  export class CustomersCharges {
125
296
  _client;
126
297
  constructor(_client) {
127
298
  this._client = _client;
128
299
  }
300
+ /**
301
+ * List customer charges
302
+ *
303
+ * List customer charges.
304
+ *
305
+ * Returns the customer's charges that are represented as either flat fee or
306
+ * usage-based charges.
307
+ *
308
+ * GET /openmeter/customers/{customerId}/charges
309
+ */
129
310
  async list(request, options) {
130
311
  return unwrap(await listCustomerCharges(this._client, request, options));
131
312
  }
313
+ /**
314
+ * List customer charges
315
+ *
316
+ * List customer charges.
317
+ *
318
+ * Returns the customer's charges that are represented as either flat fee or
319
+ * usage-based charges.
320
+ *
321
+ * Iterates every item across all pages, fetching more as the returned iterable is consumed.
322
+ *
323
+ * GET /openmeter/customers/{customerId}/charges
324
+ */
325
+ listAll(request, options) {
326
+ return paginatePages((req, opts) => listCustomerCharges(this._client, req, opts), request, options);
327
+ }
328
+ /**
329
+ * Create customer charge
330
+ *
331
+ * Create customer charge.
332
+ *
333
+ * POST /openmeter/customers/{customerId}/charges
334
+ */
132
335
  async create(request, options) {
133
336
  return unwrap(await createCustomerCharges(this._client, request, options));
134
337
  }
135
338
  }
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
@@ -0,0 +1,89 @@
1
+ import { type Client } from '../core.js';
2
+ import { type RequestOptions } from '../lib/types.js';
3
+ import type { CreateSubscriptionAddonRequest, CreateSubscriptionAddonResponse } from '../models/operations/subscriptions.js';
4
+ import type { ListCurrenciesRequest, ListCurrenciesResponse, CreateCustomCurrencyRequest, CreateCustomCurrencyResponse, ListCostBasesRequest, ListCostBasesResponse, CreateCostBasisRequest, CreateCostBasisResponse } from '../models/operations/currencies.js';
5
+ import type { CostBasis, Currency } from '../models/types.js';
6
+ /**
7
+ * Operations marked internal in the API definition. They are not part of
8
+ * the customer surface: they may require additional permissions, and they
9
+ * can change or be removed without notice or semver consideration.
10
+ */
11
+ export declare class Internal {
12
+ private readonly _client;
13
+ constructor(_client: Client);
14
+ private _subscriptions?;
15
+ get subscriptions(): InternalSubscriptions;
16
+ private _currencies?;
17
+ get currencies(): InternalCurrencies;
18
+ }
19
+ export declare class InternalSubscriptions {
20
+ private readonly _client;
21
+ constructor(_client: Client);
22
+ /**
23
+ * Create a new subscription add-on
24
+ *
25
+ * Add add-on to a subscription.
26
+ *
27
+ * POST /openmeter/subscriptions/{subscriptionId}/addons
28
+ */
29
+ createAddon(request: CreateSubscriptionAddonRequest, options?: RequestOptions): Promise<CreateSubscriptionAddonResponse>;
30
+ }
31
+ export declare class InternalCurrencies {
32
+ private readonly _client;
33
+ constructor(_client: Client);
34
+ /**
35
+ * List currencies
36
+ *
37
+ * List currencies supported by the billing system.
38
+ *
39
+ * GET /openmeter/currencies
40
+ */
41
+ list(request?: ListCurrenciesRequest, options?: RequestOptions): Promise<ListCurrenciesResponse>;
42
+ /**
43
+ * List currencies
44
+ *
45
+ * List currencies supported by the billing system.
46
+ *
47
+ * Iterates every item across all pages, fetching more as the returned iterable is consumed.
48
+ *
49
+ * GET /openmeter/currencies
50
+ */
51
+ listAll(request?: ListCurrenciesRequest, options?: RequestOptions): AsyncIterable<Currency>;
52
+ /**
53
+ * Create custom currency
54
+ *
55
+ * Create a custom currency. This operation allows defining your own custom
56
+ * currency for billing purposes.
57
+ *
58
+ * POST /openmeter/currencies/custom
59
+ */
60
+ createCustomCurrency(request: CreateCustomCurrencyRequest, options?: RequestOptions): Promise<CreateCustomCurrencyResponse>;
61
+ /**
62
+ * List cost bases
63
+ *
64
+ * List cost bases for a currency. For custom currencies, there can be multiple
65
+ * cost bases with different `effective_from` dates.
66
+ *
67
+ * GET /openmeter/currencies/custom/{currencyId}/cost-bases
68
+ */
69
+ listCostBases(request: ListCostBasesRequest, options?: RequestOptions): Promise<ListCostBasesResponse>;
70
+ /**
71
+ * List cost bases
72
+ *
73
+ * List cost bases for a currency. For custom currencies, there can be multiple
74
+ * cost bases with different `effective_from` dates.
75
+ *
76
+ * Iterates every item across all pages, fetching more as the returned iterable is consumed.
77
+ *
78
+ * GET /openmeter/currencies/custom/{currencyId}/cost-bases
79
+ */
80
+ listCostBasesAll(request: ListCostBasesRequest, options?: RequestOptions): AsyncIterable<CostBasis>;
81
+ /**
82
+ * Create cost basis
83
+ *
84
+ * Create a cost basis for a currency.
85
+ *
86
+ * POST /openmeter/currencies/custom/{currencyId}/cost-bases
87
+ */
88
+ createCostBasis(request: CreateCostBasisRequest, options?: RequestOptions): Promise<CreateCostBasisResponse>;
89
+ }