@openmeter/client 1.0.0-beta-19a1f6bdbcd5 → 1.0.0-beta-d512c81f78a3

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.
@@ -1,7 +1,7 @@
1
1
  import { type Client } from '../core.js';
2
2
  import { type RequestOptions } from '../lib/types.js';
3
- import type { CreateCustomerRequest, CreateCustomerResponse, GetCustomerRequest, GetCustomerResponse, ListCustomersRequest, ListCustomersResponse, UpsertCustomerRequest, UpsertCustomerResponse, DeleteCustomerRequest, DeleteCustomerResponse, GetCustomerBillingRequest, GetCustomerBillingResponse, UpdateCustomerBillingRequest, UpdateCustomerBillingResponse, UpdateCustomerBillingAppDataRequest, UpdateCustomerBillingAppDataResponse, CreateCustomerStripeCheckoutSessionRequest, CreateCustomerStripeCheckoutSessionResponse, CreateCustomerStripePortalSessionRequest, CreateCustomerStripePortalSessionResponse, CreateCreditGrantRequest, CreateCreditGrantResponse, GetCreditGrantRequest, GetCreditGrantResponse, ListCreditGrantsRequest, ListCreditGrantsResponse, GetCustomerCreditBalanceRequest, GetCustomerCreditBalanceResponse, CreateCreditAdjustmentRequest, CreateCreditAdjustmentResponse, UpdateCreditGrantExternalSettlementRequest, UpdateCreditGrantExternalSettlementResponse, ListCreditTransactionsRequest, ListCreditTransactionsResponse, ListCustomerChargesRequest, ListCustomerChargesResponse, CreateCustomerChargesRequest, CreateCustomerChargesResponse } from '../models/operations/customers.js';
4
- import type { Charge, CreditGrant, CreditTransaction, Customer } from '../models/types.js';
3
+ import type { CreateCustomerRequest, CreateCustomerResponse, GetCustomerRequest, GetCustomerResponse, ListCustomersRequest, ListCustomersResponse, UpsertCustomerRequest, UpsertCustomerResponse, DeleteCustomerRequest, DeleteCustomerResponse, GetCustomerBillingRequest, GetCustomerBillingResponse, UpdateCustomerBillingRequest, UpdateCustomerBillingResponse, UpdateCustomerBillingAppDataRequest, UpdateCustomerBillingAppDataResponse, CreateCustomerStripeCheckoutSessionRequest, CreateCustomerStripeCheckoutSessionResponse, CreateCustomerStripePortalSessionRequest, CreateCustomerStripePortalSessionResponse, CreateCreditGrantRequest, CreateCreditGrantResponse, GetCreditGrantRequest, GetCreditGrantResponse, ListCreditGrantsRequest, ListCreditGrantsResponse, GetCustomerCreditBalanceRequest, GetCustomerCreditBalanceResponse, CreateCreditAdjustmentRequest, CreateCreditAdjustmentResponse, UpdateCreditGrantExternalSettlementRequest, UpdateCreditGrantExternalSettlementResponse, ListCreditTransactionsRequest, ListCreditTransactionsResponse } from '../models/operations/customers.js';
4
+ import type { CreditGrant, CreditTransaction, Customer } from '../models/types.js';
5
5
  export declare class Customers {
6
6
  private readonly _client;
7
7
  constructor(_client: Client);
@@ -47,8 +47,6 @@ export declare class Customers {
47
47
  get billing(): CustomersBilling;
48
48
  private _credits?;
49
49
  get credits(): CustomersCredits;
50
- private _charges?;
51
- get charges(): CustomersCharges;
52
50
  }
53
51
  export declare class CustomersBilling {
54
52
  private readonly _client;
@@ -224,39 +222,3 @@ export declare class CustomersCreditsTransactions {
224
222
  */
225
223
  listAll(request: ListCreditTransactionsRequest, options?: RequestOptions): AsyncIterable<CreditTransaction>;
226
224
  }
227
- export declare class CustomersCharges {
228
- private readonly _client;
229
- constructor(_client: Client);
230
- /**
231
- * List customer charges
232
- *
233
- * List customer charges.
234
- *
235
- * Returns the customer's charges that are represented as either flat fee or
236
- * usage-based charges.
237
- *
238
- * GET /openmeter/customers/{customerId}/charges
239
- */
240
- list(request: ListCustomerChargesRequest, options?: RequestOptions): Promise<ListCustomerChargesResponse>;
241
- /**
242
- * List customer charges
243
- *
244
- * List customer charges.
245
- *
246
- * Returns the customer's charges that are represented as either flat fee or
247
- * usage-based charges.
248
- *
249
- * Iterates every item across all pages, fetching more as the returned iterable is consumed.
250
- *
251
- * GET /openmeter/customers/{customerId}/charges
252
- */
253
- listAll(request: ListCustomerChargesRequest, options?: RequestOptions): AsyncIterable<Charge>;
254
- /**
255
- * Create customer charge
256
- *
257
- * Create customer charge.
258
- *
259
- * POST /openmeter/customers/{customerId}/charges
260
- */
261
- create(request: CreateCustomerChargesRequest, options?: RequestOptions): Promise<CreateCustomerChargesResponse>;
262
- }
@@ -1,7 +1,7 @@
1
1
  // Code generated by @openmeter/typespec-typescript. DO NOT EDIT.
2
2
  import { unwrap } from '../lib/types.js';
3
3
  import { paginateCursor, paginatePages } from '../lib/paginate.js';
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';
4
+ import { createCustomer, getCustomer, listCustomers, upsertCustomer, deleteCustomer, getCustomerBilling, updateCustomerBilling, updateCustomerBillingAppData, createCustomerStripeCheckoutSession, createCustomerStripePortalSession, createCreditGrant, getCreditGrant, listCreditGrants, getCustomerCreditBalance, createCreditAdjustment, updateCreditGrantExternalSettlement, listCreditTransactions, } from '../funcs/customers.js';
5
5
  export class Customers {
6
6
  _client;
7
7
  constructor(_client) {
@@ -65,10 +65,6 @@ export class Customers {
65
65
  get credits() {
66
66
  return (this._credits ??= new CustomersCredits(this._client));
67
67
  }
68
- _charges;
69
- get charges() {
70
- return (this._charges ??= new CustomersCharges(this._client));
71
- }
72
68
  }
73
69
  export class CustomersBilling {
74
70
  _client;
@@ -292,47 +288,3 @@ export class CustomersCreditsTransactions {
292
288
  return paginateCursor((req, opts) => listCreditTransactions(this._client, req, opts), request, options);
293
289
  }
294
290
  }
295
- export class CustomersCharges {
296
- _client;
297
- constructor(_client) {
298
- this._client = _client;
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
- */
310
- async list(request, options) {
311
- return unwrap(await listCustomerCharges(this._client, request, options));
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
- */
335
- async create(request, options) {
336
- return unwrap(await createCustomerCharges(this._client, request, options));
337
- }
338
- }
@@ -1,13 +1,13 @@
1
1
  import { type Client } from '../core.js';
2
2
  import { type RequestOptions } from '../lib/types.js';
3
- import type { VoidCreditGrantRequest, VoidCreditGrantResponse } from '../models/operations/customers.js';
3
+ import type { VoidCreditGrantRequest, VoidCreditGrantResponse, ListCustomerChargesRequest, ListCustomerChargesResponse, CreateCustomerChargesRequest, CreateCustomerChargesResponse } from '../models/operations/customers.js';
4
4
  import type { CreateSubscriptionAddonRequest, CreateSubscriptionAddonResponse } from '../models/operations/subscriptions.js';
5
5
  import type { UninstallAppRequest, UninstallAppResponse, UpdateAppRequest, UpdateAppResponse, ListAppCatalogRequest, ListAppCatalogResponse, GetAppCatalogItemRequest, GetAppCatalogItemResponse, InstallAppRequest, InstallAppResponse } from '../models/operations/apps.js';
6
6
  import type { ListInvoicesRequest, ListInvoicesResponse, GetInvoiceRequest, GetInvoiceResponse, UpdateInvoiceRequest, UpdateInvoiceResponse, DeleteInvoiceRequest, DeleteInvoiceResponse, AdvanceInvoiceRequest, AdvanceInvoiceResponse, ApproveInvoiceRequest, ApproveInvoiceResponse, RetryInvoiceRequest, RetryInvoiceResponse, SnapshotQuantitiesInvoiceRequest, SnapshotQuantitiesInvoiceResponse } from '../models/operations/invoices.js';
7
7
  import type { ListCurrenciesRequest, ListCurrenciesResponse, CreateCustomCurrencyRequest, CreateCustomCurrencyResponse, GetCustomCurrencyRequest, GetCustomCurrencyResponse, ListCostBasesRequest, ListCostBasesResponse, CreateCostBasisRequest, CreateCostBasisResponse } from '../models/operations/currencies.js';
8
8
  import type { ListPlanAddonsRequest, ListPlanAddonsResponse } from '../models/operations/planAddons.js';
9
9
  import type { QueryEntitlementAccessRequest, QueryEntitlementAccessResponse } from '../models/operations/entitlementAccess.js';
10
- import type { AppCatalogItem, CostBasis, Currency, Invoice, PlanAddon } from '../models/types.js';
10
+ import type { AppCatalogItem, Charge, CostBasis, Currency, Invoice, PlanAddon } from '../models/types.js';
11
11
  /**
12
12
  * Operations marked internal in the API definition. They are not part of
13
13
  * the customer surface: they may require additional permissions, and they
@@ -36,6 +36,8 @@ export declare class InternalCustomers {
36
36
  constructor(_client: Client);
37
37
  private _credits?;
38
38
  get credits(): InternalCustomersCredits;
39
+ private _charges?;
40
+ get charges(): InternalCustomersCharges;
39
41
  }
40
42
  export declare class InternalCustomersCredits {
41
43
  private readonly _client;
@@ -63,6 +65,42 @@ export declare class InternalCustomersCreditsGrants {
63
65
  */
64
66
  void(request: VoidCreditGrantRequest, options?: RequestOptions): Promise<VoidCreditGrantResponse>;
65
67
  }
68
+ export declare class InternalCustomersCharges {
69
+ private readonly _client;
70
+ constructor(_client: Client);
71
+ /**
72
+ * List customer charges
73
+ *
74
+ * List customer charges.
75
+ *
76
+ * Returns the customer's charges that are represented as either flat fee or
77
+ * usage-based charges.
78
+ *
79
+ * GET /openmeter/customers/{customerId}/charges
80
+ */
81
+ list(request: ListCustomerChargesRequest, options?: RequestOptions): Promise<ListCustomerChargesResponse>;
82
+ /**
83
+ * List customer charges
84
+ *
85
+ * List customer charges.
86
+ *
87
+ * Returns the customer's charges that are represented as either flat fee or
88
+ * usage-based charges.
89
+ *
90
+ * Iterates every item across all pages, fetching more as the returned iterable is consumed.
91
+ *
92
+ * GET /openmeter/customers/{customerId}/charges
93
+ */
94
+ listAll(request: ListCustomerChargesRequest, options?: RequestOptions): AsyncIterable<Charge>;
95
+ /**
96
+ * Create customer charge
97
+ *
98
+ * Create customer charge.
99
+ *
100
+ * POST /openmeter/customers/{customerId}/charges
101
+ */
102
+ create(request: CreateCustomerChargesRequest, options?: RequestOptions): Promise<CreateCustomerChargesResponse>;
103
+ }
66
104
  export declare class InternalSubscriptions {
67
105
  private readonly _client;
68
106
  constructor(_client: Client);
@@ -1,7 +1,7 @@
1
1
  // Code generated by @openmeter/typespec-typescript. DO NOT EDIT.
2
2
  import { unwrap } from '../lib/types.js';
3
3
  import { paginatePages } from '../lib/paginate.js';
4
- import { voidCreditGrant } from '../funcs/customers.js';
4
+ import { voidCreditGrant, listCustomerCharges, createCustomerCharges, } from '../funcs/customers.js';
5
5
  import { createSubscriptionAddon } from '../funcs/subscriptions.js';
6
6
  import { uninstallApp, updateApp, listAppCatalog, getAppCatalogItem, installApp, } from '../funcs/apps.js';
7
7
  import { listInvoices, getInvoice, updateInvoice, deleteInvoice, advanceInvoice, approveInvoice, retryInvoice, snapshotQuantitiesInvoice, } from '../funcs/invoices.js';
@@ -56,6 +56,10 @@ export class InternalCustomers {
56
56
  get credits() {
57
57
  return (this._credits ??= new InternalCustomersCredits(this._client));
58
58
  }
59
+ _charges;
60
+ get charges() {
61
+ return (this._charges ??= new InternalCustomersCharges(this._client));
62
+ }
59
63
  }
60
64
  export class InternalCustomersCredits {
61
65
  _client;
@@ -91,6 +95,50 @@ export class InternalCustomersCreditsGrants {
91
95
  return unwrap(await voidCreditGrant(this._client, request, options));
92
96
  }
93
97
  }
98
+ export class InternalCustomersCharges {
99
+ _client;
100
+ constructor(_client) {
101
+ this._client = _client;
102
+ }
103
+ /**
104
+ * List customer charges
105
+ *
106
+ * List customer charges.
107
+ *
108
+ * Returns the customer's charges that are represented as either flat fee or
109
+ * usage-based charges.
110
+ *
111
+ * GET /openmeter/customers/{customerId}/charges
112
+ */
113
+ async list(request, options) {
114
+ return unwrap(await listCustomerCharges(this._client, request, options));
115
+ }
116
+ /**
117
+ * List customer charges
118
+ *
119
+ * List customer charges.
120
+ *
121
+ * Returns the customer's charges that are represented as either flat fee or
122
+ * usage-based charges.
123
+ *
124
+ * Iterates every item across all pages, fetching more as the returned iterable is consumed.
125
+ *
126
+ * GET /openmeter/customers/{customerId}/charges
127
+ */
128
+ listAll(request, options) {
129
+ return paginatePages((req, opts) => listCustomerCharges(this._client, req, opts), request, options);
130
+ }
131
+ /**
132
+ * Create customer charge
133
+ *
134
+ * Create customer charge.
135
+ *
136
+ * POST /openmeter/customers/{customerId}/charges
137
+ */
138
+ async create(request, options) {
139
+ return unwrap(await createCustomerCharges(this._client, request, options));
140
+ }
141
+ }
94
142
  export class InternalSubscriptions {
95
143
  _client;
96
144
  constructor(_client) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@openmeter/client",
3
- "version": "1.0.0-beta-19a1f6bdbcd5",
3
+ "version": "1.0.0-beta-d512c81f78a3",
4
4
  "description": "Official TypeScript SDK for the OpenMeter API — usage metering and billing",
5
5
  "keywords": [
6
6
  "openmeter",