@openmeter/client 1.0.0-beta-3087f852a0e8 → 1.0.0-beta-14ec9d225214
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/README.md +7 -0
- package/dist/funcs/charges.d.ts +14 -0
- package/dist/funcs/charges.js +42 -0
- package/dist/funcs/index.d.ts +1 -0
- package/dist/funcs/index.js +1 -0
- package/dist/index.d.ts +2 -1
- package/dist/lib/version.d.ts +1 -1
- package/dist/lib/version.js +1 -1
- package/dist/models/operations/charges.d.ts +54 -0
- package/dist/models/operations/charges.js +2 -0
- package/dist/models/operations/customers.d.ts +2 -2
- package/dist/models/schemas.d.ts +5245 -2364
- package/dist/models/schemas.js +73 -4
- package/dist/models/types.d.ts +27 -1
- package/dist/sdk/internal.d.ts +31 -0
- package/dist/sdk/internal.js +39 -0
- package/package.json +1 -1
package/dist/models/schemas.js
CHANGED
|
@@ -2882,7 +2882,7 @@ export const listEventsParamsFilter = z
|
|
|
2882
2882
|
storedAt: dateTimeFieldFilter.optional(),
|
|
2883
2883
|
})
|
|
2884
2884
|
.describe('Filter options for listing ingested events.');
|
|
2885
|
-
export const
|
|
2885
|
+
export const listCustomerChargesParamsFilter = z
|
|
2886
2886
|
.object({
|
|
2887
2887
|
status: stringFieldFilterExact.optional(),
|
|
2888
2888
|
featureId: ulidFieldFilter.optional(),
|
|
@@ -2900,6 +2900,16 @@ export const listInvoicesParamsFilter = z
|
|
|
2900
2900
|
createdAt: dateTimeFieldFilter.optional(),
|
|
2901
2901
|
})
|
|
2902
2902
|
.describe('Filter options for listing invoices.');
|
|
2903
|
+
export const listChargesParamsFilter = z
|
|
2904
|
+
.object({
|
|
2905
|
+
status: stringFieldFilterExact.optional(),
|
|
2906
|
+
featureId: ulidFieldFilter.optional(),
|
|
2907
|
+
featureKey: stringFieldFilterExact.optional(),
|
|
2908
|
+
servicePeriodFrom: dateTimeFieldFilter.optional(),
|
|
2909
|
+
servicePeriodTo: dateTimeFieldFilter.optional(),
|
|
2910
|
+
customerId: ulidFieldFilter.optional(),
|
|
2911
|
+
})
|
|
2912
|
+
.describe('Filter options for listing charges across customers.');
|
|
2903
2913
|
export const resourceFilters = z
|
|
2904
2914
|
.object({
|
|
2905
2915
|
name: stringFieldFilter.optional(),
|
|
@@ -5290,7 +5300,7 @@ export const listCustomerChargesQueryParams = z.object({
|
|
|
5290
5300
|
.optional()
|
|
5291
5301
|
.describe('Determines which page of the collection to retrieve.'),
|
|
5292
5302
|
sort: sortQuery.optional(),
|
|
5293
|
-
filter:
|
|
5303
|
+
filter: listCustomerChargesParamsFilter.optional(),
|
|
5294
5304
|
expand: z
|
|
5295
5305
|
.array(chargesExpand)
|
|
5296
5306
|
.optional()
|
|
@@ -5527,6 +5537,29 @@ export const snapshotQuantitiesInvoicePathParams = z.object({
|
|
|
5527
5537
|
invoiceId: ulid,
|
|
5528
5538
|
});
|
|
5529
5539
|
export const snapshotQuantitiesInvoiceResponse = invoice;
|
|
5540
|
+
export const listChargesQueryParams = z.object({
|
|
5541
|
+
page: z
|
|
5542
|
+
.object({
|
|
5543
|
+
size: z.coerce
|
|
5544
|
+
.number()
|
|
5545
|
+
.int()
|
|
5546
|
+
.optional()
|
|
5547
|
+
.describe('The number of items to include per page.'),
|
|
5548
|
+
number: z.coerce.number().int().optional().describe('The page number.'),
|
|
5549
|
+
})
|
|
5550
|
+
.optional()
|
|
5551
|
+
.describe('Determines which page of the collection to retrieve.'),
|
|
5552
|
+
sort: sortQuery.optional(),
|
|
5553
|
+
filter: listChargesParamsFilter.optional(),
|
|
5554
|
+
expand: z
|
|
5555
|
+
.array(chargesExpand)
|
|
5556
|
+
.optional()
|
|
5557
|
+
.describe("Expand full objects for referenced entities. Supported values are: - `real_time_usage`: Expand the charge's real-time usage; it sets the `usage` and the `totals.realtime` fields. - `customer`: Expand the charge's customer to the complete entity. - `feature`: Expand the charge's feature to the complete entity. - `subscription`: Expand the charge's subscription to the complete entity. - `realization.invoice`: Expand each realization's invoice to the complete entity. - `realization.totals`: Expand each realization run's `totals`. - `realization.detailed_lines`: Expand each realization run's `detailed_lines`."),
|
|
5558
|
+
});
|
|
5559
|
+
export const listChargesResponse = z.object({
|
|
5560
|
+
data: z.array(charge),
|
|
5561
|
+
meta: paginatedMeta,
|
|
5562
|
+
});
|
|
5530
5563
|
export const createTaxCodeBody = createTaxCodeRequest;
|
|
5531
5564
|
export const createTaxCodeResponse = taxCode;
|
|
5532
5565
|
export const getTaxCodePathParams = z.object({
|
|
@@ -8688,7 +8721,7 @@ export const listEventsParamsFilterWire = z
|
|
|
8688
8721
|
stored_at: dateTimeFieldFilterWire.optional(),
|
|
8689
8722
|
})
|
|
8690
8723
|
.describe('Filter options for listing ingested events.');
|
|
8691
|
-
export const
|
|
8724
|
+
export const listCustomerChargesParamsFilterWire = z
|
|
8692
8725
|
.strictObject({
|
|
8693
8726
|
status: stringFieldFilterExactWire.optional(),
|
|
8694
8727
|
feature_id: ulidFieldFilterWire.optional(),
|
|
@@ -8706,6 +8739,16 @@ export const listInvoicesParamsFilterWire = z
|
|
|
8706
8739
|
created_at: dateTimeFieldFilterWire.optional(),
|
|
8707
8740
|
})
|
|
8708
8741
|
.describe('Filter options for listing invoices.');
|
|
8742
|
+
export const listChargesParamsFilterWire = z
|
|
8743
|
+
.strictObject({
|
|
8744
|
+
status: stringFieldFilterExactWire.optional(),
|
|
8745
|
+
feature_id: ulidFieldFilterWire.optional(),
|
|
8746
|
+
feature_key: stringFieldFilterExactWire.optional(),
|
|
8747
|
+
service_period_from: dateTimeFieldFilterWire.optional(),
|
|
8748
|
+
service_period_to: dateTimeFieldFilterWire.optional(),
|
|
8749
|
+
customer_id: ulidFieldFilterWire.optional(),
|
|
8750
|
+
})
|
|
8751
|
+
.describe('Filter options for listing charges across customers.');
|
|
8709
8752
|
export const resourceFiltersWire = z
|
|
8710
8753
|
.strictObject({
|
|
8711
8754
|
name: stringFieldFilterWire.optional(),
|
|
@@ -11106,7 +11149,7 @@ export const listCustomerChargesQueryParamsWire = z.object({
|
|
|
11106
11149
|
.string()
|
|
11107
11150
|
.optional()
|
|
11108
11151
|
.describe('Sort charges returned in the response. Supported sort attributes are: - `id` - `created_at` - `service_period.from` - `billing_period.from`'),
|
|
11109
|
-
filter:
|
|
11152
|
+
filter: listCustomerChargesParamsFilterWire.optional(),
|
|
11110
11153
|
expand: z
|
|
11111
11154
|
.array(chargesExpandWire)
|
|
11112
11155
|
.optional()
|
|
@@ -11358,6 +11401,32 @@ export const snapshotQuantitiesInvoicePathParamsWire = z.object({
|
|
|
11358
11401
|
invoiceId: ulidWire,
|
|
11359
11402
|
});
|
|
11360
11403
|
export const snapshotQuantitiesInvoiceResponseWire = invoiceWire;
|
|
11404
|
+
export const listChargesQueryParamsWire = z.object({
|
|
11405
|
+
page: z
|
|
11406
|
+
.strictObject({
|
|
11407
|
+
size: z.coerce
|
|
11408
|
+
.number()
|
|
11409
|
+
.int()
|
|
11410
|
+
.optional()
|
|
11411
|
+
.describe('The number of items to include per page.'),
|
|
11412
|
+
number: z.coerce.number().int().optional().describe('The page number.'),
|
|
11413
|
+
})
|
|
11414
|
+
.optional()
|
|
11415
|
+
.describe('Determines which page of the collection to retrieve.'),
|
|
11416
|
+
sort: z
|
|
11417
|
+
.string()
|
|
11418
|
+
.optional()
|
|
11419
|
+
.describe('Sort charges returned in the response. Supported sort attributes are: - `id` - `created_at` - `service_period.from` - `billing_period.from`'),
|
|
11420
|
+
filter: listChargesParamsFilterWire.optional(),
|
|
11421
|
+
expand: z
|
|
11422
|
+
.array(chargesExpandWire)
|
|
11423
|
+
.optional()
|
|
11424
|
+
.describe("Expand full objects for referenced entities. Supported values are: - `real_time_usage`: Expand the charge's real-time usage; it sets the `usage` and the `totals.realtime` fields. - `customer`: Expand the charge's customer to the complete entity. - `feature`: Expand the charge's feature to the complete entity. - `subscription`: Expand the charge's subscription to the complete entity. - `realization.invoice`: Expand each realization's invoice to the complete entity. - `realization.totals`: Expand each realization run's `totals`. - `realization.detailed_lines`: Expand each realization run's `detailed_lines`."),
|
|
11425
|
+
});
|
|
11426
|
+
export const listChargesResponseWire = z.strictObject({
|
|
11427
|
+
data: z.array(chargeWire),
|
|
11428
|
+
meta: paginatedMetaWire,
|
|
11429
|
+
});
|
|
11361
11430
|
export const createTaxCodeBodyWire = createTaxCodeRequestWire;
|
|
11362
11431
|
export const createTaxCodeResponseWire = taxCodeWire;
|
|
11363
11432
|
export const getTaxCodePathParamsWire = z.object({
|
package/dist/models/types.d.ts
CHANGED
|
@@ -2748,7 +2748,7 @@ export interface ListEventsParamsFilter {
|
|
|
2748
2748
|
storedAt?: DateTimeFieldFilter;
|
|
2749
2749
|
}
|
|
2750
2750
|
/** Filter options for listing charges. */
|
|
2751
|
-
export interface
|
|
2751
|
+
export interface ListCustomerChargesParamsFilter {
|
|
2752
2752
|
/**
|
|
2753
2753
|
* Filter charges by status.
|
|
2754
2754
|
*
|
|
@@ -2784,6 +2784,32 @@ export interface ListInvoicesParamsFilter {
|
|
|
2784
2784
|
/** Filter by invoice creation time. */
|
|
2785
2785
|
createdAt?: DateTimeFieldFilter;
|
|
2786
2786
|
}
|
|
2787
|
+
/** Filter options for listing charges across customers. */
|
|
2788
|
+
export interface ListChargesParamsFilter {
|
|
2789
|
+
/**
|
|
2790
|
+
* Filter charges by status.
|
|
2791
|
+
*
|
|
2792
|
+
* Supported statuses are:
|
|
2793
|
+
*
|
|
2794
|
+
* - `created`
|
|
2795
|
+
* - `active`
|
|
2796
|
+
* - `final`
|
|
2797
|
+
* - `deleted`
|
|
2798
|
+
*
|
|
2799
|
+
* If omitted, all statuses are returned except for `deleted`.
|
|
2800
|
+
*/
|
|
2801
|
+
status?: StringFieldFilterExact;
|
|
2802
|
+
/** Filter charges by the ID of their associated feature. */
|
|
2803
|
+
featureId?: UlidFieldFilter;
|
|
2804
|
+
/** Filter charges by the key of their associated feature. */
|
|
2805
|
+
featureKey?: StringFieldFilterExact;
|
|
2806
|
+
/** Filter charges by the start of their service period. */
|
|
2807
|
+
servicePeriodFrom?: DateTimeFieldFilter;
|
|
2808
|
+
/** Filter charges by the end of their service period. */
|
|
2809
|
+
servicePeriodTo?: DateTimeFieldFilter;
|
|
2810
|
+
/** Filter charges by the ID of their customer. */
|
|
2811
|
+
customerId?: UlidFieldFilter;
|
|
2812
|
+
}
|
|
2787
2813
|
/** Resource filters. */
|
|
2788
2814
|
export interface ResourceFilters {
|
|
2789
2815
|
name?: StringFieldFilter;
|
package/dist/sdk/internal.d.ts
CHANGED
|
@@ -3,6 +3,7 @@ import { type RequestOptions } from '../lib/types.js';
|
|
|
3
3
|
import type { VoidCreditGrantRequest, VoidCreditGrantResponse, ListCustomerChargesRequest, ListCustomerChargesResponse, CreateCustomerChargesRequest, CreateCustomerChargesResponse } from '../models/operations/customers.js';
|
|
4
4
|
import type { ListAppsRequest, ListAppsResponse, UninstallAppRequest, UninstallAppResponse, UpdateAppRequest, UpdateAppResponse, ListAppCatalogRequest, ListAppCatalogResponse, GetAppCatalogItemRequest, GetAppCatalogItemResponse, InstallAppRequest, InstallAppResponse } from '../models/operations/apps.js';
|
|
5
5
|
import type { ListInvoicesRequest, ListInvoicesResponse, GetInvoiceRequest, GetInvoiceResponse, UpdateInvoiceRequest, UpdateInvoiceResponse, DeleteInvoiceRequest, DeleteInvoiceResponse, AdvanceInvoiceRequest, AdvanceInvoiceResponse, ApproveInvoiceRequest, ApproveInvoiceResponse, RetryInvoiceRequest, RetryInvoiceResponse, SnapshotQuantitiesInvoiceRequest, SnapshotQuantitiesInvoiceResponse } from '../models/operations/invoices.js';
|
|
6
|
+
import type { ListChargesRequest, ListChargesResponse } from '../models/operations/charges.js';
|
|
6
7
|
import type { ListCurrenciesRequest, ListCurrenciesResponse, CreateCustomCurrencyRequest, CreateCustomCurrencyResponse, GetCustomCurrencyRequest, GetCustomCurrencyResponse, ListCostBasesRequest, ListCostBasesResponse, CreateCostBasisRequest, CreateCostBasisResponse } from '../models/operations/currencies.js';
|
|
7
8
|
import type { ListPlanAddonsRequest, ListPlanAddonsResponse } from '../models/operations/planAddons.js';
|
|
8
9
|
import type { QueryEntitlementAccessRequest, QueryEntitlementAccessResponse } from '../models/operations/entitlementAccess.js';
|
|
@@ -21,6 +22,8 @@ export declare class Internal {
|
|
|
21
22
|
get apps(): InternalApps;
|
|
22
23
|
private _invoices?;
|
|
23
24
|
get invoices(): InternalInvoices;
|
|
25
|
+
private _charges?;
|
|
26
|
+
get charges(): InternalCharges;
|
|
24
27
|
private _currencies?;
|
|
25
28
|
get currencies(): InternalCurrencies;
|
|
26
29
|
private _planAddons?;
|
|
@@ -293,6 +296,34 @@ export declare class InternalInvoices {
|
|
|
293
296
|
*/
|
|
294
297
|
snapshotQuantities(request: SnapshotQuantitiesInvoiceRequest, options?: RequestOptions): Promise<SnapshotQuantitiesInvoiceResponse>;
|
|
295
298
|
}
|
|
299
|
+
export declare class InternalCharges {
|
|
300
|
+
private readonly _client;
|
|
301
|
+
constructor(_client: Client);
|
|
302
|
+
/**
|
|
303
|
+
* List charges
|
|
304
|
+
*
|
|
305
|
+
* List charges.
|
|
306
|
+
*
|
|
307
|
+
* Returns the charges of every customer that are represented as either flat fee or
|
|
308
|
+
* usage-based charges.
|
|
309
|
+
*
|
|
310
|
+
* GET /openmeter/charges
|
|
311
|
+
*/
|
|
312
|
+
list(request?: ListChargesRequest, options?: RequestOptions): Promise<ListChargesResponse>;
|
|
313
|
+
/**
|
|
314
|
+
* List charges
|
|
315
|
+
*
|
|
316
|
+
* List charges.
|
|
317
|
+
*
|
|
318
|
+
* Returns the charges of every customer 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/charges
|
|
324
|
+
*/
|
|
325
|
+
listAll(request?: ListChargesRequest, options?: RequestOptions): AsyncIterable<Charge>;
|
|
326
|
+
}
|
|
296
327
|
export declare class InternalCurrencies {
|
|
297
328
|
private readonly _client;
|
|
298
329
|
constructor(_client: Client);
|
package/dist/sdk/internal.js
CHANGED
|
@@ -4,6 +4,7 @@ import { paginatePages } from '../lib/paginate.js';
|
|
|
4
4
|
import { voidCreditGrant, listCustomerCharges, createCustomerCharges, } from '../funcs/customers.js';
|
|
5
5
|
import { listApps, uninstallApp, updateApp, listAppCatalog, getAppCatalogItem, installApp, } from '../funcs/apps.js';
|
|
6
6
|
import { listInvoices, getInvoice, updateInvoice, deleteInvoice, advanceInvoice, approveInvoice, retryInvoice, snapshotQuantitiesInvoice, } from '../funcs/invoices.js';
|
|
7
|
+
import { listCharges } from '../funcs/charges.js';
|
|
7
8
|
import { listCurrencies, createCustomCurrency, getCustomCurrency, listCostBases, createCostBasis, } from '../funcs/currencies.js';
|
|
8
9
|
import { listPlanAddons } from '../funcs/planAddons.js';
|
|
9
10
|
import { queryEntitlementAccess } from '../funcs/entitlementAccess.js';
|
|
@@ -29,6 +30,10 @@ export class Internal {
|
|
|
29
30
|
get invoices() {
|
|
30
31
|
return (this._invoices ??= new InternalInvoices(this._client));
|
|
31
32
|
}
|
|
33
|
+
_charges;
|
|
34
|
+
get charges() {
|
|
35
|
+
return (this._charges ??= new InternalCharges(this._client));
|
|
36
|
+
}
|
|
32
37
|
_currencies;
|
|
33
38
|
get currencies() {
|
|
34
39
|
return (this._currencies ??= new InternalCurrencies(this._client));
|
|
@@ -367,6 +372,40 @@ export class InternalInvoices {
|
|
|
367
372
|
return unwrap(await snapshotQuantitiesInvoice(this._client, request, options));
|
|
368
373
|
}
|
|
369
374
|
}
|
|
375
|
+
export class InternalCharges {
|
|
376
|
+
_client;
|
|
377
|
+
constructor(_client) {
|
|
378
|
+
this._client = _client;
|
|
379
|
+
}
|
|
380
|
+
/**
|
|
381
|
+
* List charges
|
|
382
|
+
*
|
|
383
|
+
* List charges.
|
|
384
|
+
*
|
|
385
|
+
* Returns the charges of every customer that are represented as either flat fee or
|
|
386
|
+
* usage-based charges.
|
|
387
|
+
*
|
|
388
|
+
* GET /openmeter/charges
|
|
389
|
+
*/
|
|
390
|
+
async list(request, options) {
|
|
391
|
+
return unwrap(await listCharges(this._client, request, options));
|
|
392
|
+
}
|
|
393
|
+
/**
|
|
394
|
+
* List charges
|
|
395
|
+
*
|
|
396
|
+
* List charges.
|
|
397
|
+
*
|
|
398
|
+
* Returns the charges of every customer that are represented as either flat fee or
|
|
399
|
+
* usage-based charges.
|
|
400
|
+
*
|
|
401
|
+
* Iterates every item across all pages, fetching more as the returned iterable is consumed.
|
|
402
|
+
*
|
|
403
|
+
* GET /openmeter/charges
|
|
404
|
+
*/
|
|
405
|
+
listAll(request, options) {
|
|
406
|
+
return paginatePages((req, opts) => listCharges(this._client, req, opts), request ?? {}, options);
|
|
407
|
+
}
|
|
408
|
+
}
|
|
370
409
|
export class InternalCurrencies {
|
|
371
410
|
_client;
|
|
372
411
|
constructor(_client) {
|