@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.
- package/LICENSE +202 -0
- package/README.md +316 -55
- package/dist/core.d.ts +0 -1
- package/dist/core.js +8 -1
- package/dist/funcs/addons.d.ts +49 -1
- package/dist/funcs/addons.js +50 -1
- package/dist/funcs/apps.d.ts +14 -1
- package/dist/funcs/apps.js +15 -1
- package/dist/funcs/billing.d.ts +46 -1
- package/dist/funcs/billing.js +47 -1
- package/dist/funcs/currencies.d.ts +30 -1
- package/dist/funcs/currencies.js +31 -1
- package/dist/funcs/customers.d.ts +148 -1
- package/dist/funcs/customers.js +149 -1
- package/dist/funcs/defaults.d.ts +10 -1
- package/dist/funcs/defaults.js +11 -1
- package/dist/funcs/entitlements.d.ts +5 -1
- package/dist/funcs/entitlements.js +6 -1
- package/dist/funcs/events.d.ts +14 -1
- package/dist/funcs/events.js +15 -1
- package/dist/funcs/features.d.ts +42 -1
- package/dist/funcs/features.js +43 -1
- package/dist/funcs/index.d.ts +0 -3
- package/dist/funcs/index.js +1 -3
- package/dist/funcs/llmCost.d.ts +36 -1
- package/dist/funcs/llmCost.js +37 -1
- package/dist/funcs/meters.d.ts +53 -1
- package/dist/funcs/meters.js +54 -1
- package/dist/funcs/planAddons.d.ts +35 -1
- package/dist/funcs/planAddons.js +36 -1
- package/dist/funcs/plans.d.ts +49 -1
- package/dist/funcs/plans.js +50 -1
- package/dist/funcs/subscriptions.d.ts +59 -1
- package/dist/funcs/subscriptions.js +60 -1
- package/dist/funcs/tax.d.ts +25 -1
- package/dist/funcs/tax.js +26 -1
- package/dist/index.d.ts +4 -8
- package/dist/index.js +4 -5
- package/dist/lib/config.d.ts +0 -1
- package/dist/lib/config.js +1 -1
- package/dist/lib/encodings.d.ts +0 -1
- package/dist/lib/encodings.js +1 -1
- package/dist/lib/paginate.d.ts +56 -0
- package/dist/lib/paginate.js +60 -0
- package/dist/lib/request.d.ts +0 -1
- package/dist/lib/request.js +1 -1
- package/dist/lib/to-error.d.ts +0 -1
- package/dist/lib/to-error.js +1 -1
- package/dist/lib/types.d.ts +0 -1
- package/dist/lib/types.js +1 -1
- package/dist/lib/version.d.ts +1 -0
- package/dist/lib/version.js +5 -0
- package/dist/lib/wire.d.ts +3 -1
- package/dist/lib/wire.js +93 -4
- package/dist/models/errors.d.ts +13 -2
- package/dist/models/errors.js +31 -4
- package/dist/models/operations/addons.d.ts +0 -1
- package/dist/models/operations/addons.js +1 -1
- package/dist/models/operations/apps.d.ts +2 -5
- package/dist/models/operations/apps.js +1 -1
- package/dist/models/operations/billing.d.ts +0 -1
- package/dist/models/operations/billing.js +1 -1
- package/dist/models/operations/currencies.d.ts +0 -1
- package/dist/models/operations/currencies.js +1 -1
- package/dist/models/operations/customers.d.ts +3 -6
- package/dist/models/operations/customers.js +1 -1
- package/dist/models/operations/defaults.d.ts +0 -1
- package/dist/models/operations/defaults.js +1 -1
- package/dist/models/operations/entitlements.d.ts +0 -1
- package/dist/models/operations/entitlements.js +1 -1
- package/dist/models/operations/events.d.ts +0 -1
- package/dist/models/operations/events.js +1 -1
- package/dist/models/operations/features.d.ts +0 -1
- package/dist/models/operations/features.js +1 -1
- package/dist/models/operations/llmCost.d.ts +0 -1
- package/dist/models/operations/llmCost.js +1 -1
- package/dist/models/operations/meters.d.ts +0 -1
- package/dist/models/operations/meters.js +1 -1
- package/dist/models/operations/planAddons.d.ts +0 -1
- package/dist/models/operations/planAddons.js +1 -1
- package/dist/models/operations/plans.d.ts +0 -1
- package/dist/models/operations/plans.js +1 -1
- package/dist/models/operations/subscriptions.d.ts +0 -1
- package/dist/models/operations/subscriptions.js +1 -1
- package/dist/models/operations/tax.d.ts +0 -1
- package/dist/models/operations/tax.js +1 -1
- package/dist/models/schemas.d.ts +4453 -6950
- package/dist/models/schemas.js +1 -73
- package/dist/models/types.d.ts +381 -566
- package/dist/models/types.js +1 -1
- package/dist/sdk/addons.d.ts +60 -1
- package/dist/sdk/addons.js +63 -1
- package/dist/sdk/apps.d.ts +25 -1
- package/dist/sdk/apps.js +28 -1
- package/dist/sdk/billing.d.ts +57 -1
- package/dist/sdk/billing.js +60 -1
- package/dist/sdk/customers.d.ts +194 -1
- package/dist/sdk/customers.js +203 -1
- package/dist/sdk/defaults.d.ts +10 -1
- package/dist/sdk/defaults.js +11 -1
- package/dist/sdk/entitlements.d.ts +5 -1
- package/dist/sdk/entitlements.js +6 -1
- package/dist/sdk/events.d.ts +25 -1
- package/dist/sdk/events.js +28 -1
- package/dist/sdk/features.d.ts +53 -1
- package/dist/sdk/features.js +56 -1
- package/dist/sdk/internal.d.ts +89 -0
- package/dist/sdk/internal.js +113 -0
- package/dist/sdk/llmCost.d.ts +57 -1
- package/dist/sdk/llmCost.js +62 -1
- package/dist/sdk/meters.d.ts +64 -1
- package/dist/sdk/meters.js +67 -1
- package/dist/sdk/planAddons.d.ts +46 -1
- package/dist/sdk/planAddons.js +49 -1
- package/dist/sdk/plans.d.ts +60 -1
- package/dist/sdk/plans.js +63 -1
- package/dist/sdk/sdk.d.ts +9 -10
- package/dist/sdk/sdk.js +11 -15
- package/dist/sdk/subscriptions.d.ts +72 -3
- package/dist/sdk/subscriptions.js +77 -5
- package/dist/sdk/tax.d.ts +34 -1
- package/dist/sdk/tax.js +37 -1
- package/package.json +28 -4
- package/dist/funcs/governance.d.ts +0 -5
- package/dist/funcs/governance.js +0 -34
- package/dist/funcs/invoices.d.ts +0 -8
- package/dist/funcs/invoices.js +0 -81
- package/dist/models/operations/governance.d.ts +0 -10
- package/dist/models/operations/governance.js +0 -2
- package/dist/models/operations/invoices.d.ts +0 -48
- package/dist/models/operations/invoices.js +0 -2
- package/dist/sdk/currencies.d.ts +0 -12
- package/dist/sdk/currencies.js +0 -21
- package/dist/sdk/governance.d.ts +0 -9
- package/dist/sdk/governance.js +0 -12
- package/dist/sdk/invoices.d.ts +0 -12
- package/dist/sdk/invoices.js +0 -21
package/dist/funcs/invoices.js
DELETED
|
@@ -1,81 +0,0 @@
|
|
|
1
|
-
import { http } from '../core.js';
|
|
2
|
-
import { request } from '../lib/request.js';
|
|
3
|
-
import { toURLSearchParams, encodeSort } from '../lib/encodings.js';
|
|
4
|
-
import { toWire, fromWire, assertValid, toSnakeCase } from '../lib/wire.js';
|
|
5
|
-
import * as schemas from '../models/schemas.js';
|
|
6
|
-
export function listInvoices(client, req = {}, options) {
|
|
7
|
-
return request(() => {
|
|
8
|
-
const query = toWire({
|
|
9
|
-
page: req.page,
|
|
10
|
-
sort: encodeSort(req.sort, toSnakeCase),
|
|
11
|
-
filter: req.filter,
|
|
12
|
-
}, schemas.listInvoicesQueryParams);
|
|
13
|
-
if (client._options.validate) {
|
|
14
|
-
assertValid(schemas.listInvoicesQueryParamsWire, query);
|
|
15
|
-
}
|
|
16
|
-
const searchParams = toURLSearchParams(query);
|
|
17
|
-
return http(client)
|
|
18
|
-
.get('openmeter/billing/invoices', { ...options, searchParams })
|
|
19
|
-
.json()
|
|
20
|
-
.then((data) => {
|
|
21
|
-
if (client._options.validate) {
|
|
22
|
-
assertValid(schemas.listInvoicesResponseWire, data);
|
|
23
|
-
}
|
|
24
|
-
return fromWire(data, schemas.listInvoicesResponse);
|
|
25
|
-
});
|
|
26
|
-
});
|
|
27
|
-
}
|
|
28
|
-
export function getInvoice(client, req, options) {
|
|
29
|
-
return request(() => {
|
|
30
|
-
const path = `openmeter/billing/invoices/${(() => {
|
|
31
|
-
if (req.invoiceId === undefined) {
|
|
32
|
-
throw new Error('missing path parameter: invoiceId');
|
|
33
|
-
}
|
|
34
|
-
return encodeURIComponent(String(req.invoiceId));
|
|
35
|
-
})()}`;
|
|
36
|
-
return http(client)
|
|
37
|
-
.get(path, options)
|
|
38
|
-
.json()
|
|
39
|
-
.then((data) => {
|
|
40
|
-
if (client._options.validate) {
|
|
41
|
-
assertValid(schemas.getInvoiceResponseWire, data);
|
|
42
|
-
}
|
|
43
|
-
return fromWire(data, schemas.getInvoiceResponse);
|
|
44
|
-
});
|
|
45
|
-
});
|
|
46
|
-
}
|
|
47
|
-
export function updateInvoice(client, req, options) {
|
|
48
|
-
return request(() => {
|
|
49
|
-
const path = `openmeter/billing/invoices/${(() => {
|
|
50
|
-
if (req.invoiceId === undefined) {
|
|
51
|
-
throw new Error('missing path parameter: invoiceId');
|
|
52
|
-
}
|
|
53
|
-
return encodeURIComponent(String(req.invoiceId));
|
|
54
|
-
})()}`;
|
|
55
|
-
const body = toWire(req.body, schemas.updateInvoiceBody);
|
|
56
|
-
if (client._options.validate) {
|
|
57
|
-
assertValid(schemas.updateInvoiceBodyWire, body);
|
|
58
|
-
}
|
|
59
|
-
return http(client)
|
|
60
|
-
.put(path, { ...options, json: body })
|
|
61
|
-
.json()
|
|
62
|
-
.then((data) => {
|
|
63
|
-
if (client._options.validate) {
|
|
64
|
-
assertValid(schemas.updateInvoiceResponseWire, data);
|
|
65
|
-
}
|
|
66
|
-
return fromWire(data, schemas.updateInvoiceResponse);
|
|
67
|
-
});
|
|
68
|
-
});
|
|
69
|
-
}
|
|
70
|
-
export function deleteInvoice(client, req, options) {
|
|
71
|
-
return request(async () => {
|
|
72
|
-
const path = `openmeter/billing/invoices/${(() => {
|
|
73
|
-
if (req.invoiceId === undefined) {
|
|
74
|
-
throw new Error('missing path parameter: invoiceId');
|
|
75
|
-
}
|
|
76
|
-
return encodeURIComponent(String(req.invoiceId));
|
|
77
|
-
})()}`;
|
|
78
|
-
await http(client).delete(path, options);
|
|
79
|
-
});
|
|
80
|
-
}
|
|
81
|
-
//# sourceMappingURL=invoices.js.map
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import type { AcceptDateStrings } from '../../lib/wire.js';
|
|
2
|
-
import type { CursorPaginationQueryPage, GovernanceQueryRequestInput, GovernanceQueryResponse } from '../types.js';
|
|
3
|
-
export interface QueryGovernanceAccessQuery {
|
|
4
|
-
page?: CursorPaginationQueryPage;
|
|
5
|
-
}
|
|
6
|
-
export type QueryGovernanceAccessRequest = AcceptDateStrings<{
|
|
7
|
-
body: GovernanceQueryRequestInput;
|
|
8
|
-
} & QueryGovernanceAccessQuery>;
|
|
9
|
-
export type QueryGovernanceAccessResponse = GovernanceQueryResponse;
|
|
10
|
-
//# sourceMappingURL=governance.d.ts.map
|
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
import { z } from 'zod';
|
|
2
|
-
import * as schemas from '../schemas.js';
|
|
3
|
-
import type { AcceptDateStrings } from '../../lib/wire.js';
|
|
4
|
-
import type { InvoicePagePaginatedResponse, ListInvoicesParamsFilter, SortQueryInput, UpdateInvoiceStandardRequestInput } from '../types.js';
|
|
5
|
-
export interface ListInvoicesQuery {
|
|
6
|
-
/** Determines which page of the collection to retrieve. */
|
|
7
|
-
page?: {
|
|
8
|
-
size?: number;
|
|
9
|
-
number?: number;
|
|
10
|
-
};
|
|
11
|
-
/**
|
|
12
|
-
* Sort invoices returned in the response. Supported sort attributes:
|
|
13
|
-
*
|
|
14
|
-
* - `issued_at`
|
|
15
|
-
* - `created_at` (default)
|
|
16
|
-
* - `service_period_start`
|
|
17
|
-
*
|
|
18
|
-
* The `asc` suffix is optional as the default sort order is ascending. The `desc`
|
|
19
|
-
* suffix is used to specify a descending order.
|
|
20
|
-
*/
|
|
21
|
-
sort?: SortQueryInput;
|
|
22
|
-
/**
|
|
23
|
-
* Filter invoices returned in the response.
|
|
24
|
-
*
|
|
25
|
-
* Examples:
|
|
26
|
-
*
|
|
27
|
-
* - `filter[status][oeq]=draft,issued`
|
|
28
|
-
* - `filter[customer_id]=01KPDB8K...`
|
|
29
|
-
* - `filter[issued_at][gte]=2024-01-01T00:00:00Z`
|
|
30
|
-
*/
|
|
31
|
-
filter?: ListInvoicesParamsFilter;
|
|
32
|
-
}
|
|
33
|
-
export type ListInvoicesRequest = AcceptDateStrings<ListInvoicesQuery>;
|
|
34
|
-
export type ListInvoicesResponse = InvoicePagePaginatedResponse;
|
|
35
|
-
export type GetInvoiceRequest = {
|
|
36
|
-
invoiceId: string;
|
|
37
|
-
};
|
|
38
|
-
export type GetInvoiceResponse = z.output<typeof schemas.getInvoiceResponse>;
|
|
39
|
-
export type UpdateInvoiceRequest = AcceptDateStrings<{
|
|
40
|
-
invoiceId: string;
|
|
41
|
-
body: UpdateInvoiceStandardRequestInput;
|
|
42
|
-
}>;
|
|
43
|
-
export type UpdateInvoiceResponse = z.output<typeof schemas.updateInvoiceResponse>;
|
|
44
|
-
export type DeleteInvoiceRequest = {
|
|
45
|
-
invoiceId: string;
|
|
46
|
-
};
|
|
47
|
-
export type DeleteInvoiceResponse = void;
|
|
48
|
-
//# sourceMappingURL=invoices.d.ts.map
|
package/dist/sdk/currencies.d.ts
DELETED
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { type Client } from '../core.js';
|
|
2
|
-
import { type RequestOptions } from '../lib/types.js';
|
|
3
|
-
import type { ListCurrenciesRequest, ListCurrenciesResponse, CreateCustomCurrencyRequest, CreateCustomCurrencyResponse, ListCostBasesRequest, ListCostBasesResponse, CreateCostBasisRequest, CreateCostBasisResponse } from '../models/operations/currencies.js';
|
|
4
|
-
export declare class Currencies {
|
|
5
|
-
private readonly _client;
|
|
6
|
-
constructor(_client: Client);
|
|
7
|
-
list(request?: ListCurrenciesRequest, options?: RequestOptions): Promise<ListCurrenciesResponse>;
|
|
8
|
-
createCustomCurrency(request: CreateCustomCurrencyRequest, options?: RequestOptions): Promise<CreateCustomCurrencyResponse>;
|
|
9
|
-
listCostBases(request: ListCostBasesRequest, options?: RequestOptions): Promise<ListCostBasesResponse>;
|
|
10
|
-
createCostBasis(request: CreateCostBasisRequest, options?: RequestOptions): Promise<CreateCostBasisResponse>;
|
|
11
|
-
}
|
|
12
|
-
//# sourceMappingURL=currencies.d.ts.map
|
package/dist/sdk/currencies.js
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import { unwrap } from '../lib/types.js';
|
|
2
|
-
import { listCurrencies, createCustomCurrency, listCostBases, createCostBasis, } from '../funcs/currencies.js';
|
|
3
|
-
export class Currencies {
|
|
4
|
-
_client;
|
|
5
|
-
constructor(_client) {
|
|
6
|
-
this._client = _client;
|
|
7
|
-
}
|
|
8
|
-
async list(request, options) {
|
|
9
|
-
return unwrap(await listCurrencies(this._client, request, options));
|
|
10
|
-
}
|
|
11
|
-
async createCustomCurrency(request, options) {
|
|
12
|
-
return unwrap(await createCustomCurrency(this._client, request, options));
|
|
13
|
-
}
|
|
14
|
-
async listCostBases(request, options) {
|
|
15
|
-
return unwrap(await listCostBases(this._client, request, options));
|
|
16
|
-
}
|
|
17
|
-
async createCostBasis(request, options) {
|
|
18
|
-
return unwrap(await createCostBasis(this._client, request, options));
|
|
19
|
-
}
|
|
20
|
-
}
|
|
21
|
-
//# sourceMappingURL=currencies.js.map
|
package/dist/sdk/governance.d.ts
DELETED
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { type Client } from '../core.js';
|
|
2
|
-
import { type RequestOptions } from '../lib/types.js';
|
|
3
|
-
import type { QueryGovernanceAccessRequest, QueryGovernanceAccessResponse } from '../models/operations/governance.js';
|
|
4
|
-
export declare class Governance {
|
|
5
|
-
private readonly _client;
|
|
6
|
-
constructor(_client: Client);
|
|
7
|
-
queryAccess(request: QueryGovernanceAccessRequest, options?: RequestOptions): Promise<QueryGovernanceAccessResponse>;
|
|
8
|
-
}
|
|
9
|
-
//# sourceMappingURL=governance.d.ts.map
|
package/dist/sdk/governance.js
DELETED
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { unwrap } from '../lib/types.js';
|
|
2
|
-
import { queryGovernanceAccess } from '../funcs/governance.js';
|
|
3
|
-
export class Governance {
|
|
4
|
-
_client;
|
|
5
|
-
constructor(_client) {
|
|
6
|
-
this._client = _client;
|
|
7
|
-
}
|
|
8
|
-
async queryAccess(request, options) {
|
|
9
|
-
return unwrap(await queryGovernanceAccess(this._client, request, options));
|
|
10
|
-
}
|
|
11
|
-
}
|
|
12
|
-
//# sourceMappingURL=governance.js.map
|
package/dist/sdk/invoices.d.ts
DELETED
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { type Client } from '../core.js';
|
|
2
|
-
import { type RequestOptions } from '../lib/types.js';
|
|
3
|
-
import type { ListInvoicesRequest, ListInvoicesResponse, GetInvoiceRequest, GetInvoiceResponse, UpdateInvoiceRequest, UpdateInvoiceResponse, DeleteInvoiceRequest, DeleteInvoiceResponse } from '../models/operations/invoices.js';
|
|
4
|
-
export declare class Invoices {
|
|
5
|
-
private readonly _client;
|
|
6
|
-
constructor(_client: Client);
|
|
7
|
-
list(request?: ListInvoicesRequest, options?: RequestOptions): Promise<ListInvoicesResponse>;
|
|
8
|
-
get(request: GetInvoiceRequest, options?: RequestOptions): Promise<GetInvoiceResponse>;
|
|
9
|
-
update(request: UpdateInvoiceRequest, options?: RequestOptions): Promise<UpdateInvoiceResponse>;
|
|
10
|
-
delete(request: DeleteInvoiceRequest, options?: RequestOptions): Promise<DeleteInvoiceResponse>;
|
|
11
|
-
}
|
|
12
|
-
//# sourceMappingURL=invoices.d.ts.map
|
package/dist/sdk/invoices.js
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import { unwrap } from '../lib/types.js';
|
|
2
|
-
import { listInvoices, getInvoice, updateInvoice, deleteInvoice, } from '../funcs/invoices.js';
|
|
3
|
-
export class Invoices {
|
|
4
|
-
_client;
|
|
5
|
-
constructor(_client) {
|
|
6
|
-
this._client = _client;
|
|
7
|
-
}
|
|
8
|
-
async list(request, options) {
|
|
9
|
-
return unwrap(await listInvoices(this._client, request, options));
|
|
10
|
-
}
|
|
11
|
-
async get(request, options) {
|
|
12
|
-
return unwrap(await getInvoice(this._client, request, options));
|
|
13
|
-
}
|
|
14
|
-
async update(request, options) {
|
|
15
|
-
return unwrap(await updateInvoice(this._client, request, options));
|
|
16
|
-
}
|
|
17
|
-
async delete(request, options) {
|
|
18
|
-
return unwrap(await deleteInvoice(this._client, request, options));
|
|
19
|
-
}
|
|
20
|
-
}
|
|
21
|
-
//# sourceMappingURL=invoices.js.map
|