@openmeter/client 1.0.0-beta.229 → 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.
- package/LICENSE +202 -0
- package/README.md +364 -66
- 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 +161 -29
- package/dist/funcs/apps.d.ts +14 -1
- package/dist/funcs/apps.js +52 -9
- package/dist/funcs/billing.d.ts +46 -1
- package/dist/funcs/billing.js +126 -17
- package/dist/funcs/currencies.d.ts +30 -1
- package/dist/funcs/currencies.js +113 -23
- package/dist/funcs/customers.d.ts +167 -2
- package/dist/funcs/customers.js +580 -90
- package/dist/funcs/defaults.d.ts +10 -1
- package/dist/funcs/defaults.js +35 -5
- package/dist/funcs/entitlements.d.ts +5 -1
- package/dist/funcs/entitlements.js +25 -6
- package/dist/funcs/events.d.ts +14 -1
- package/dist/funcs/events.js +41 -9
- package/dist/funcs/features.d.ts +42 -1
- package/dist/funcs/features.js +142 -28
- package/dist/funcs/governance.d.ts +14 -1
- package/dist/funcs/governance.js +42 -10
- package/dist/funcs/index.d.ts +1 -1
- package/dist/funcs/index.js +2 -1
- package/dist/funcs/invoices.d.ts +51 -0
- package/dist/funcs/invoices.js +125 -0
- package/dist/funcs/llmCost.d.ts +36 -1
- package/dist/funcs/llmCost.js +114 -24
- package/dist/funcs/meters.d.ts +55 -2
- package/dist/funcs/meters.js +172 -28
- package/dist/funcs/planAddons.d.ts +35 -1
- package/dist/funcs/planAddons.js +139 -29
- package/dist/funcs/plans.d.ts +49 -1
- package/dist/funcs/plans.js +163 -25
- package/dist/funcs/subscriptions.d.ts +61 -2
- package/dist/funcs/subscriptions.js +238 -40
- package/dist/funcs/tax.d.ts +25 -1
- package/dist/funcs/tax.js +104 -22
- package/dist/index.d.ts +6 -4
- package/dist/index.js +4 -3
- package/dist/lib/config.d.ts +9 -1
- package/dist/lib/config.js +1 -1
- package/dist/lib/encodings.d.ts +1 -2
- package/dist/lib/encodings.js +6 -5
- 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 +20 -0
- package/dist/lib/wire.js +401 -0
- package/dist/models/errors.d.ts +13 -2
- package/dist/models/errors.js +31 -4
- package/dist/models/operations/addons.d.ts +17 -6
- package/dist/models/operations/addons.js +1 -1
- package/dist/models/operations/apps.d.ts +4 -6
- package/dist/models/operations/apps.js +1 -1
- package/dist/models/operations/billing.d.ts +5 -5
- package/dist/models/operations/billing.js +1 -1
- package/dist/models/operations/currencies.d.ts +27 -10
- package/dist/models/operations/currencies.js +1 -1
- package/dist/models/operations/customers.d.ts +87 -33
- package/dist/models/operations/customers.js +1 -1
- package/dist/models/operations/defaults.d.ts +2 -2
- 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 +20 -5
- package/dist/models/operations/events.js +1 -1
- package/dist/models/operations/features.d.ts +24 -9
- package/dist/models/operations/features.js +1 -1
- package/dist/models/operations/governance.d.ts +3 -3
- package/dist/models/operations/governance.js +1 -1
- package/dist/models/operations/invoices.d.ts +45 -0
- package/dist/models/operations/invoices.js +2 -0
- package/dist/models/operations/llmCost.d.ts +16 -5
- package/dist/models/operations/llmCost.js +1 -1
- package/dist/models/operations/meters.d.ts +29 -9
- package/dist/models/operations/meters.js +1 -1
- package/dist/models/operations/planAddons.d.ts +7 -7
- package/dist/models/operations/planAddons.js +1 -1
- package/dist/models/operations/plans.d.ts +14 -6
- package/dist/models/operations/plans.js +1 -1
- package/dist/models/operations/subscriptions.d.ts +36 -11
- package/dist/models/operations/subscriptions.js +1 -1
- package/dist/models/operations/tax.d.ts +6 -6
- package/dist/models/operations/tax.js +1 -1
- package/dist/models/schemas.d.ts +27484 -3125
- package/dist/models/schemas.js +6247 -495
- package/dist/models/types.d.ts +4548 -1398
- 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 +213 -2
- package/dist/sdk/customers.js +228 -2
- 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 +180 -0
- package/dist/sdk/internal.js +224 -0
- package/dist/sdk/llmCost.d.ts +57 -1
- package/dist/sdk/llmCost.js +62 -1
- package/dist/sdk/meters.d.ts +66 -2
- package/dist/sdk/meters.js +71 -2
- 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 -7
- package/dist/sdk/sdk.js +11 -10
- package/dist/sdk/subscriptions.d.ts +71 -1
- package/dist/sdk/subscriptions.js +76 -1
- package/dist/sdk/tax.d.ts +34 -1
- package/dist/sdk/tax.js +37 -1
- package/package.json +31 -6
- 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/funcs/defaults.d.ts
CHANGED
|
@@ -1,6 +1,15 @@
|
|
|
1
1
|
import { type Client } from '../core.js';
|
|
2
2
|
import { type Result, type RequestOptions } from '../lib/types.js';
|
|
3
3
|
import type { GetOrganizationDefaultTaxCodesRequest, GetOrganizationDefaultTaxCodesResponse, UpdateOrganizationDefaultTaxCodesRequest, UpdateOrganizationDefaultTaxCodesResponse } from '../models/operations/defaults.js';
|
|
4
|
+
/**
|
|
5
|
+
* Get organization default tax codes
|
|
6
|
+
*
|
|
7
|
+
* GET /openmeter/defaults/tax-codes
|
|
8
|
+
*/
|
|
4
9
|
export declare function getOrganizationDefaultTaxCodes(client: Client, req: GetOrganizationDefaultTaxCodesRequest, options?: RequestOptions): Promise<Result<GetOrganizationDefaultTaxCodesResponse>>;
|
|
10
|
+
/**
|
|
11
|
+
* Update organization default tax codes
|
|
12
|
+
*
|
|
13
|
+
* PUT /openmeter/defaults/tax-codes
|
|
14
|
+
*/
|
|
5
15
|
export declare function updateOrganizationDefaultTaxCodes(client: Client, req: UpdateOrganizationDefaultTaxCodesRequest, options?: RequestOptions): Promise<Result<UpdateOrganizationDefaultTaxCodesResponse>>;
|
|
6
|
-
//# sourceMappingURL=defaults.d.ts.map
|
package/dist/funcs/defaults.js
CHANGED
|
@@ -1,13 +1,43 @@
|
|
|
1
|
+
// Code generated by @openmeter/typespec-typescript. DO NOT EDIT.
|
|
1
2
|
import { http } from '../core.js';
|
|
2
3
|
import { request } from '../lib/request.js';
|
|
4
|
+
import { toWire, fromWire, assertValid } from '../lib/wire.js';
|
|
5
|
+
import * as schemas from '../models/schemas.js';
|
|
6
|
+
/**
|
|
7
|
+
* Get organization default tax codes
|
|
8
|
+
*
|
|
9
|
+
* GET /openmeter/defaults/tax-codes
|
|
10
|
+
*/
|
|
3
11
|
export function getOrganizationDefaultTaxCodes(client, req, options) {
|
|
4
12
|
return request(() => http(client)
|
|
5
13
|
.get('openmeter/defaults/tax-codes', options)
|
|
6
|
-
.json()
|
|
14
|
+
.json()
|
|
15
|
+
.then((data) => {
|
|
16
|
+
if (client._options.validate) {
|
|
17
|
+
assertValid(schemas.getOrganizationDefaultTaxCodesResponseWire, data);
|
|
18
|
+
}
|
|
19
|
+
return fromWire(data, schemas.getOrganizationDefaultTaxCodesResponse);
|
|
20
|
+
}));
|
|
7
21
|
}
|
|
22
|
+
/**
|
|
23
|
+
* Update organization default tax codes
|
|
24
|
+
*
|
|
25
|
+
* PUT /openmeter/defaults/tax-codes
|
|
26
|
+
*/
|
|
8
27
|
export function updateOrganizationDefaultTaxCodes(client, req, options) {
|
|
9
|
-
return request(() =>
|
|
10
|
-
|
|
11
|
-
.
|
|
28
|
+
return request(() => {
|
|
29
|
+
const body = toWire(req, schemas.updateOrganizationDefaultTaxCodesBody);
|
|
30
|
+
if (client._options.validate) {
|
|
31
|
+
assertValid(schemas.updateOrganizationDefaultTaxCodesBodyWire, body);
|
|
32
|
+
}
|
|
33
|
+
return http(client)
|
|
34
|
+
.put('openmeter/defaults/tax-codes', { ...options, json: body })
|
|
35
|
+
.json()
|
|
36
|
+
.then((data) => {
|
|
37
|
+
if (client._options.validate) {
|
|
38
|
+
assertValid(schemas.updateOrganizationDefaultTaxCodesResponseWire, data);
|
|
39
|
+
}
|
|
40
|
+
return fromWire(data, schemas.updateOrganizationDefaultTaxCodesResponse);
|
|
41
|
+
});
|
|
42
|
+
});
|
|
12
43
|
}
|
|
13
|
-
//# sourceMappingURL=defaults.js.map
|
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
import { type Client } from '../core.js';
|
|
2
2
|
import { type Result, type RequestOptions } from '../lib/types.js';
|
|
3
3
|
import type { ListCustomerEntitlementAccessRequest, ListCustomerEntitlementAccessResponse } from '../models/operations/entitlements.js';
|
|
4
|
+
/**
|
|
5
|
+
* List customer entitlement access
|
|
6
|
+
*
|
|
7
|
+
* GET /openmeter/customers/{customerId}/entitlement-access
|
|
8
|
+
*/
|
|
4
9
|
export declare function listCustomerEntitlementAccess(client: Client, req: ListCustomerEntitlementAccessRequest, options?: RequestOptions): Promise<Result<ListCustomerEntitlementAccessResponse>>;
|
|
5
|
-
//# sourceMappingURL=entitlements.d.ts.map
|
|
@@ -1,10 +1,29 @@
|
|
|
1
|
+
// Code generated by @openmeter/typespec-typescript. DO NOT EDIT.
|
|
1
2
|
import { http } from '../core.js';
|
|
2
3
|
import { request } from '../lib/request.js';
|
|
3
|
-
import {
|
|
4
|
+
import { fromWire, assertValid } from '../lib/wire.js';
|
|
5
|
+
import * as schemas from '../models/schemas.js';
|
|
6
|
+
/**
|
|
7
|
+
* List customer entitlement access
|
|
8
|
+
*
|
|
9
|
+
* GET /openmeter/customers/{customerId}/entitlement-access
|
|
10
|
+
*/
|
|
4
11
|
export function listCustomerEntitlementAccess(client, req, options) {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
12
|
+
return request(() => {
|
|
13
|
+
const path = `openmeter/customers/${(() => {
|
|
14
|
+
if (req.customerId === undefined) {
|
|
15
|
+
throw new Error('missing path parameter: customerId');
|
|
16
|
+
}
|
|
17
|
+
return encodeURIComponent(String(req.customerId));
|
|
18
|
+
})()}/entitlement-access`;
|
|
19
|
+
return http(client)
|
|
20
|
+
.get(path, options)
|
|
21
|
+
.json()
|
|
22
|
+
.then((data) => {
|
|
23
|
+
if (client._options.validate) {
|
|
24
|
+
assertValid(schemas.listCustomerEntitlementAccessResponseWire, data);
|
|
25
|
+
}
|
|
26
|
+
return fromWire(data, schemas.listCustomerEntitlementAccessResponse);
|
|
27
|
+
});
|
|
28
|
+
});
|
|
9
29
|
}
|
|
10
|
-
//# sourceMappingURL=entitlements.js.map
|
package/dist/funcs/events.d.ts
CHANGED
|
@@ -1,6 +1,19 @@
|
|
|
1
1
|
import { type Client } from '../core.js';
|
|
2
2
|
import { type Result, type RequestOptions } from '../lib/types.js';
|
|
3
3
|
import type { ListMeteringEventsRequest, ListMeteringEventsResponse, IngestMeteringEventsRequest, IngestMeteringEventsResponse } from '../models/operations/events.js';
|
|
4
|
+
/**
|
|
5
|
+
* List metering events
|
|
6
|
+
*
|
|
7
|
+
* List ingested events.
|
|
8
|
+
*
|
|
9
|
+
* GET /openmeter/events
|
|
10
|
+
*/
|
|
4
11
|
export declare function listMeteringEvents(client: Client, req?: ListMeteringEventsRequest, options?: RequestOptions): Promise<Result<ListMeteringEventsResponse>>;
|
|
12
|
+
/**
|
|
13
|
+
* Ingest metering events
|
|
14
|
+
*
|
|
15
|
+
* Ingests an event or batch of events following the CloudEvents specification.
|
|
16
|
+
*
|
|
17
|
+
* POST /openmeter/events
|
|
18
|
+
*/
|
|
5
19
|
export declare function ingestMeteringEvents(client: Client, req: IngestMeteringEventsRequest, options?: RequestOptions): Promise<Result<IngestMeteringEventsResponse>>;
|
|
6
|
-
//# sourceMappingURL=events.d.ts.map
|
package/dist/funcs/events.js
CHANGED
|
@@ -1,19 +1,51 @@
|
|
|
1
|
+
// Code generated by @openmeter/typespec-typescript. DO NOT EDIT.
|
|
1
2
|
import { http } from '../core.js';
|
|
2
3
|
import { request } from '../lib/request.js';
|
|
3
4
|
import { toURLSearchParams, encodeSort } from '../lib/encodings.js';
|
|
5
|
+
import { toWire, fromWire, assertValid, toSnakeCase } from '../lib/wire.js';
|
|
6
|
+
import * as schemas from '../models/schemas.js';
|
|
7
|
+
/**
|
|
8
|
+
* List metering events
|
|
9
|
+
*
|
|
10
|
+
* List ingested events.
|
|
11
|
+
*
|
|
12
|
+
* GET /openmeter/events
|
|
13
|
+
*/
|
|
4
14
|
export function listMeteringEvents(client, req = {}, options) {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
15
|
+
return request(() => {
|
|
16
|
+
const query = toWire({
|
|
17
|
+
page: req.page,
|
|
18
|
+
filter: req.filter,
|
|
19
|
+
sort: encodeSort(req.sort, toSnakeCase),
|
|
20
|
+
}, schemas.listMeteringEventsQueryParams);
|
|
21
|
+
if (client._options.validate) {
|
|
22
|
+
assertValid(schemas.listMeteringEventsQueryParamsWire, query);
|
|
23
|
+
}
|
|
24
|
+
const searchParams = toURLSearchParams(query);
|
|
25
|
+
return http(client)
|
|
26
|
+
.get('openmeter/events', { ...options, searchParams })
|
|
27
|
+
.json()
|
|
28
|
+
.then((data) => {
|
|
29
|
+
if (client._options.validate) {
|
|
30
|
+
assertValid(schemas.listMeteringEventsResponseWire, data);
|
|
31
|
+
}
|
|
32
|
+
return fromWire(data, schemas.listMeteringEventsResponse);
|
|
33
|
+
});
|
|
9
34
|
});
|
|
10
|
-
return request(() => http(client)
|
|
11
|
-
.get('openmeter/events', { ...options, searchParams })
|
|
12
|
-
.json());
|
|
13
35
|
}
|
|
36
|
+
/**
|
|
37
|
+
* Ingest metering events
|
|
38
|
+
*
|
|
39
|
+
* Ingests an event or batch of events following the CloudEvents specification.
|
|
40
|
+
*
|
|
41
|
+
* POST /openmeter/events
|
|
42
|
+
*/
|
|
14
43
|
export function ingestMeteringEvents(client, req, options) {
|
|
15
44
|
return request(async () => {
|
|
16
|
-
|
|
45
|
+
const body = toWire(req, schemas.ingestMeteringEventsBody);
|
|
46
|
+
if (client._options.validate) {
|
|
47
|
+
assertValid(schemas.ingestMeteringEventsBodyWire, body);
|
|
48
|
+
}
|
|
49
|
+
await http(client).post('openmeter/events', { ...options, json: body });
|
|
17
50
|
});
|
|
18
51
|
}
|
|
19
|
-
//# sourceMappingURL=events.js.map
|
package/dist/funcs/features.d.ts
CHANGED
|
@@ -1,10 +1,51 @@
|
|
|
1
1
|
import { type Client } from '../core.js';
|
|
2
2
|
import { type Result, 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
|
+
/**
|
|
5
|
+
* List features
|
|
6
|
+
*
|
|
7
|
+
* List all features.
|
|
8
|
+
*
|
|
9
|
+
* GET /openmeter/features
|
|
10
|
+
*/
|
|
4
11
|
export declare function listFeatures(client: Client, req?: ListFeaturesRequest, options?: RequestOptions): Promise<Result<ListFeaturesResponse>>;
|
|
12
|
+
/**
|
|
13
|
+
* Create feature
|
|
14
|
+
*
|
|
15
|
+
* Create a feature.
|
|
16
|
+
*
|
|
17
|
+
* POST /openmeter/features
|
|
18
|
+
*/
|
|
5
19
|
export declare function createFeature(client: Client, req: CreateFeatureRequest, options?: RequestOptions): Promise<Result<CreateFeatureResponse>>;
|
|
20
|
+
/**
|
|
21
|
+
* Get feature
|
|
22
|
+
*
|
|
23
|
+
* Get a feature by id.
|
|
24
|
+
*
|
|
25
|
+
* GET /openmeter/features/{featureId}
|
|
26
|
+
*/
|
|
6
27
|
export declare function getFeature(client: Client, req: GetFeatureRequest, options?: RequestOptions): Promise<Result<GetFeatureResponse>>;
|
|
28
|
+
/**
|
|
29
|
+
* Update feature
|
|
30
|
+
*
|
|
31
|
+
* Update a feature by id. Currently only the unit_cost field can be updated.
|
|
32
|
+
*
|
|
33
|
+
* PATCH /openmeter/features/{featureId}
|
|
34
|
+
*/
|
|
7
35
|
export declare function updateFeature(client: Client, req: UpdateFeatureRequest, options?: RequestOptions): Promise<Result<UpdateFeatureResponse>>;
|
|
36
|
+
/**
|
|
37
|
+
* Delete feature
|
|
38
|
+
*
|
|
39
|
+
* Delete a feature by id.
|
|
40
|
+
*
|
|
41
|
+
* DELETE /openmeter/features/{featureId}
|
|
42
|
+
*/
|
|
8
43
|
export declare function deleteFeature(client: Client, req: DeleteFeatureRequest, options?: RequestOptions): Promise<Result<DeleteFeatureResponse>>;
|
|
44
|
+
/**
|
|
45
|
+
* Query feature cost
|
|
46
|
+
*
|
|
47
|
+
* Query the cost of a feature.
|
|
48
|
+
*
|
|
49
|
+
* POST /openmeter/features/{featureId}/cost/query
|
|
50
|
+
*/
|
|
9
51
|
export declare function queryFeatureCost(client: Client, req: QueryFeatureCostRequest, options?: RequestOptions): Promise<Result<QueryFeatureCostResponse>>;
|
|
10
|
-
//# sourceMappingURL=features.d.ts.map
|
package/dist/funcs/features.js
CHANGED
|
@@ -1,49 +1,163 @@
|
|
|
1
|
+
// Code generated by @openmeter/typespec-typescript. DO NOT EDIT.
|
|
1
2
|
import { http } from '../core.js';
|
|
2
3
|
import { request } from '../lib/request.js';
|
|
3
|
-
import {
|
|
4
|
+
import { toURLSearchParams, encodeSort } from '../lib/encodings.js';
|
|
5
|
+
import { toWire, fromWire, assertValid, toSnakeCase } from '../lib/wire.js';
|
|
6
|
+
import * as schemas from '../models/schemas.js';
|
|
7
|
+
/**
|
|
8
|
+
* List features
|
|
9
|
+
*
|
|
10
|
+
* List all features.
|
|
11
|
+
*
|
|
12
|
+
* GET /openmeter/features
|
|
13
|
+
*/
|
|
4
14
|
export function listFeatures(client, req = {}, options) {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
15
|
+
return request(() => {
|
|
16
|
+
const query = toWire({
|
|
17
|
+
page: req.page,
|
|
18
|
+
sort: encodeSort(req.sort, toSnakeCase),
|
|
19
|
+
filter: req.filter,
|
|
20
|
+
}, schemas.listFeaturesQueryParams);
|
|
21
|
+
if (client._options.validate) {
|
|
22
|
+
assertValid(schemas.listFeaturesQueryParamsWire, query);
|
|
23
|
+
}
|
|
24
|
+
const searchParams = toURLSearchParams(query);
|
|
25
|
+
return http(client)
|
|
26
|
+
.get('openmeter/features', { ...options, searchParams })
|
|
27
|
+
.json()
|
|
28
|
+
.then((data) => {
|
|
29
|
+
if (client._options.validate) {
|
|
30
|
+
assertValid(schemas.listFeaturesResponseWire, data);
|
|
31
|
+
}
|
|
32
|
+
return fromWire(data, schemas.listFeaturesResponse);
|
|
33
|
+
});
|
|
9
34
|
});
|
|
10
|
-
return request(() => http(client)
|
|
11
|
-
.get('openmeter/features', { ...options, searchParams })
|
|
12
|
-
.json());
|
|
13
35
|
}
|
|
36
|
+
/**
|
|
37
|
+
* Create feature
|
|
38
|
+
*
|
|
39
|
+
* Create a feature.
|
|
40
|
+
*
|
|
41
|
+
* POST /openmeter/features
|
|
42
|
+
*/
|
|
14
43
|
export function createFeature(client, req, options) {
|
|
15
|
-
return request(() =>
|
|
16
|
-
|
|
17
|
-
.
|
|
44
|
+
return request(() => {
|
|
45
|
+
const body = toWire(req, schemas.createFeatureBody);
|
|
46
|
+
if (client._options.validate) {
|
|
47
|
+
assertValid(schemas.createFeatureBodyWire, body);
|
|
48
|
+
}
|
|
49
|
+
return http(client)
|
|
50
|
+
.post('openmeter/features', { ...options, json: body })
|
|
51
|
+
.json()
|
|
52
|
+
.then((data) => {
|
|
53
|
+
if (client._options.validate) {
|
|
54
|
+
assertValid(schemas.createFeatureResponseWire, data);
|
|
55
|
+
}
|
|
56
|
+
return fromWire(data, schemas.createFeatureResponse);
|
|
57
|
+
});
|
|
58
|
+
});
|
|
18
59
|
}
|
|
60
|
+
/**
|
|
61
|
+
* Get feature
|
|
62
|
+
*
|
|
63
|
+
* Get a feature by id.
|
|
64
|
+
*
|
|
65
|
+
* GET /openmeter/features/{featureId}
|
|
66
|
+
*/
|
|
19
67
|
export function getFeature(client, req, options) {
|
|
20
|
-
|
|
21
|
-
|
|
68
|
+
return request(() => {
|
|
69
|
+
const path = `openmeter/features/${(() => {
|
|
70
|
+
if (req.featureId === undefined) {
|
|
71
|
+
throw new Error('missing path parameter: featureId');
|
|
72
|
+
}
|
|
73
|
+
return encodeURIComponent(String(req.featureId));
|
|
74
|
+
})()}`;
|
|
75
|
+
return http(client)
|
|
76
|
+
.get(path, options)
|
|
77
|
+
.json()
|
|
78
|
+
.then((data) => {
|
|
79
|
+
if (client._options.validate) {
|
|
80
|
+
assertValid(schemas.getFeatureResponseWire, data);
|
|
81
|
+
}
|
|
82
|
+
return fromWire(data, schemas.getFeatureResponse);
|
|
83
|
+
});
|
|
22
84
|
});
|
|
23
|
-
return request(() => http(client).get(path, options).json());
|
|
24
85
|
}
|
|
86
|
+
/**
|
|
87
|
+
* Update feature
|
|
88
|
+
*
|
|
89
|
+
* Update a feature by id. Currently only the unit_cost field can be updated.
|
|
90
|
+
*
|
|
91
|
+
* PATCH /openmeter/features/{featureId}
|
|
92
|
+
*/
|
|
25
93
|
export function updateFeature(client, req, options) {
|
|
26
|
-
|
|
27
|
-
|
|
94
|
+
return request(() => {
|
|
95
|
+
const path = `openmeter/features/${(() => {
|
|
96
|
+
if (req.featureId === undefined) {
|
|
97
|
+
throw new Error('missing path parameter: featureId');
|
|
98
|
+
}
|
|
99
|
+
return encodeURIComponent(String(req.featureId));
|
|
100
|
+
})()}`;
|
|
101
|
+
const body = toWire(req.body, schemas.updateFeatureBody);
|
|
102
|
+
if (client._options.validate) {
|
|
103
|
+
assertValid(schemas.updateFeatureBodyWire, body);
|
|
104
|
+
}
|
|
105
|
+
return http(client)
|
|
106
|
+
.patch(path, { ...options, json: body })
|
|
107
|
+
.json()
|
|
108
|
+
.then((data) => {
|
|
109
|
+
if (client._options.validate) {
|
|
110
|
+
assertValid(schemas.updateFeatureResponseWire, data);
|
|
111
|
+
}
|
|
112
|
+
return fromWire(data, schemas.updateFeatureResponse);
|
|
113
|
+
});
|
|
28
114
|
});
|
|
29
|
-
return request(() => http(client)
|
|
30
|
-
.patch(path, { ...options, json: req.body })
|
|
31
|
-
.json());
|
|
32
115
|
}
|
|
116
|
+
/**
|
|
117
|
+
* Delete feature
|
|
118
|
+
*
|
|
119
|
+
* Delete a feature by id.
|
|
120
|
+
*
|
|
121
|
+
* DELETE /openmeter/features/{featureId}
|
|
122
|
+
*/
|
|
33
123
|
export function deleteFeature(client, req, options) {
|
|
34
|
-
const path = encodePath('openmeter/features/{featureId}', {
|
|
35
|
-
featureId: req.featureId,
|
|
36
|
-
});
|
|
37
124
|
return request(async () => {
|
|
125
|
+
const path = `openmeter/features/${(() => {
|
|
126
|
+
if (req.featureId === undefined) {
|
|
127
|
+
throw new Error('missing path parameter: featureId');
|
|
128
|
+
}
|
|
129
|
+
return encodeURIComponent(String(req.featureId));
|
|
130
|
+
})()}`;
|
|
38
131
|
await http(client).delete(path, options);
|
|
39
132
|
});
|
|
40
133
|
}
|
|
134
|
+
/**
|
|
135
|
+
* Query feature cost
|
|
136
|
+
*
|
|
137
|
+
* Query the cost of a feature.
|
|
138
|
+
*
|
|
139
|
+
* POST /openmeter/features/{featureId}/cost/query
|
|
140
|
+
*/
|
|
41
141
|
export function queryFeatureCost(client, req, options) {
|
|
42
|
-
|
|
43
|
-
|
|
142
|
+
return request(() => {
|
|
143
|
+
const path = `openmeter/features/${(() => {
|
|
144
|
+
if (req.featureId === undefined) {
|
|
145
|
+
throw new Error('missing path parameter: featureId');
|
|
146
|
+
}
|
|
147
|
+
return encodeURIComponent(String(req.featureId));
|
|
148
|
+
})()}/cost/query`;
|
|
149
|
+
const body = toWire(req.body, schemas.queryFeatureCostBody);
|
|
150
|
+
if (client._options.validate) {
|
|
151
|
+
assertValid(schemas.queryFeatureCostBodyWire, body);
|
|
152
|
+
}
|
|
153
|
+
return http(client)
|
|
154
|
+
.post(path, { ...options, json: body })
|
|
155
|
+
.json()
|
|
156
|
+
.then((data) => {
|
|
157
|
+
if (client._options.validate) {
|
|
158
|
+
assertValid(schemas.queryFeatureCostResponseWire, data);
|
|
159
|
+
}
|
|
160
|
+
return fromWire(data, schemas.queryFeatureCostResponse);
|
|
161
|
+
});
|
|
44
162
|
});
|
|
45
|
-
return request(() => http(client)
|
|
46
|
-
.post(path, { ...options, json: req.body })
|
|
47
|
-
.json());
|
|
48
163
|
}
|
|
49
|
-
//# sourceMappingURL=features.js.map
|
|
@@ -1,5 +1,18 @@
|
|
|
1
1
|
import { type Client } from '../core.js';
|
|
2
2
|
import { type Result, type RequestOptions } from '../lib/types.js';
|
|
3
3
|
import type { QueryGovernanceAccessRequest, QueryGovernanceAccessResponse } from '../models/operations/governance.js';
|
|
4
|
+
/**
|
|
5
|
+
* Query governance access
|
|
6
|
+
*
|
|
7
|
+
* Query feature access for a list of customers.
|
|
8
|
+
*
|
|
9
|
+
* The endpoint resolves each provided identifier to a customer and returns the
|
|
10
|
+
* access status for the requested features, plus optional credit balance
|
|
11
|
+
* availability.
|
|
12
|
+
*
|
|
13
|
+
* _Designed to be called on a fixed refresh interval and the query response is
|
|
14
|
+
* intended to be cached._
|
|
15
|
+
*
|
|
16
|
+
* POST /openmeter/governance/query
|
|
17
|
+
*/
|
|
4
18
|
export declare function queryGovernanceAccess(client: Client, req: QueryGovernanceAccessRequest, options?: RequestOptions): Promise<Result<QueryGovernanceAccessResponse>>;
|
|
5
|
-
//# sourceMappingURL=governance.d.ts.map
|
package/dist/funcs/governance.js
CHANGED
|
@@ -1,16 +1,48 @@
|
|
|
1
|
+
// Code generated by @openmeter/typespec-typescript. DO NOT EDIT.
|
|
1
2
|
import { http } from '../core.js';
|
|
2
3
|
import { request } from '../lib/request.js';
|
|
3
4
|
import { toURLSearchParams } from '../lib/encodings.js';
|
|
5
|
+
import { toWire, fromWire, assertValid } from '../lib/wire.js';
|
|
6
|
+
import * as schemas from '../models/schemas.js';
|
|
7
|
+
/**
|
|
8
|
+
* Query governance access
|
|
9
|
+
*
|
|
10
|
+
* Query feature access for a list of customers.
|
|
11
|
+
*
|
|
12
|
+
* The endpoint resolves each provided identifier to a customer and returns the
|
|
13
|
+
* access status for the requested features, plus optional credit balance
|
|
14
|
+
* availability.
|
|
15
|
+
*
|
|
16
|
+
* _Designed to be called on a fixed refresh interval and the query response is
|
|
17
|
+
* intended to be cached._
|
|
18
|
+
*
|
|
19
|
+
* POST /openmeter/governance/query
|
|
20
|
+
*/
|
|
4
21
|
export function queryGovernanceAccess(client, req, options) {
|
|
5
|
-
|
|
6
|
-
|
|
22
|
+
return request(() => {
|
|
23
|
+
const body = toWire(req.body, schemas.queryGovernanceAccessBody);
|
|
24
|
+
if (client._options.validate) {
|
|
25
|
+
assertValid(schemas.queryGovernanceAccessBodyWire, body);
|
|
26
|
+
}
|
|
27
|
+
const query = toWire({
|
|
28
|
+
page: req.page,
|
|
29
|
+
}, schemas.queryGovernanceAccessQueryParams);
|
|
30
|
+
if (client._options.validate) {
|
|
31
|
+
assertValid(schemas.queryGovernanceAccessQueryParamsWire, query);
|
|
32
|
+
}
|
|
33
|
+
const searchParams = toURLSearchParams(query);
|
|
34
|
+
return http(client)
|
|
35
|
+
.post('openmeter/governance/query', {
|
|
36
|
+
...options,
|
|
37
|
+
searchParams,
|
|
38
|
+
json: body,
|
|
39
|
+
})
|
|
40
|
+
.json()
|
|
41
|
+
.then((data) => {
|
|
42
|
+
if (client._options.validate) {
|
|
43
|
+
assertValid(schemas.queryGovernanceAccessResponseWire, data);
|
|
44
|
+
}
|
|
45
|
+
return fromWire(data, schemas.queryGovernanceAccessResponse);
|
|
46
|
+
});
|
|
7
47
|
});
|
|
8
|
-
return request(() => http(client)
|
|
9
|
-
.post('openmeter/governance/query', {
|
|
10
|
-
...options,
|
|
11
|
-
searchParams,
|
|
12
|
-
json: req.body,
|
|
13
|
-
})
|
|
14
|
-
.json());
|
|
15
48
|
}
|
|
16
|
-
//# sourceMappingURL=governance.js.map
|
package/dist/funcs/index.d.ts
CHANGED
|
@@ -5,6 +5,7 @@ export * from './entitlements.js';
|
|
|
5
5
|
export * from './subscriptions.js';
|
|
6
6
|
export * from './apps.js';
|
|
7
7
|
export * from './billing.js';
|
|
8
|
+
export * from './invoices.js';
|
|
8
9
|
export * from './tax.js';
|
|
9
10
|
export * from './currencies.js';
|
|
10
11
|
export * from './features.js';
|
|
@@ -14,4 +15,3 @@ export * from './addons.js';
|
|
|
14
15
|
export * from './planAddons.js';
|
|
15
16
|
export * from './defaults.js';
|
|
16
17
|
export * from './governance.js';
|
|
17
|
-
//# sourceMappingURL=index.d.ts.map
|
package/dist/funcs/index.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
// Code generated by @openmeter/typespec-typescript. DO NOT EDIT.
|
|
1
2
|
export * from './events.js';
|
|
2
3
|
export * from './meters.js';
|
|
3
4
|
export * from './customers.js';
|
|
@@ -5,6 +6,7 @@ export * from './entitlements.js';
|
|
|
5
6
|
export * from './subscriptions.js';
|
|
6
7
|
export * from './apps.js';
|
|
7
8
|
export * from './billing.js';
|
|
9
|
+
export * from './invoices.js';
|
|
8
10
|
export * from './tax.js';
|
|
9
11
|
export * from './currencies.js';
|
|
10
12
|
export * from './features.js';
|
|
@@ -14,4 +16,3 @@ export * from './addons.js';
|
|
|
14
16
|
export * from './planAddons.js';
|
|
15
17
|
export * from './defaults.js';
|
|
16
18
|
export * from './governance.js';
|
|
17
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { type Client } from '../core.js';
|
|
2
|
+
import { type Result, type RequestOptions } from '../lib/types.js';
|
|
3
|
+
import type { ListInvoicesRequest, ListInvoicesResponse, GetInvoiceRequest, GetInvoiceResponse, UpdateInvoiceRequest, UpdateInvoiceResponse, DeleteInvoiceRequest, DeleteInvoiceResponse } from '../models/operations/invoices.js';
|
|
4
|
+
/**
|
|
5
|
+
* List billing invoices
|
|
6
|
+
*
|
|
7
|
+
* List billing invoices.
|
|
8
|
+
*
|
|
9
|
+
* Returns a page of invoices. Gathering invoices are never included. Use `filter`
|
|
10
|
+
* to narrow by status, customer, dates, or service period start. Use `sort` to
|
|
11
|
+
* control ordering.
|
|
12
|
+
*
|
|
13
|
+
* GET /openmeter/billing/invoices
|
|
14
|
+
*/
|
|
15
|
+
export declare function listInvoices(client: Client, req?: ListInvoicesRequest, options?: RequestOptions): Promise<Result<ListInvoicesResponse>>;
|
|
16
|
+
/**
|
|
17
|
+
* Get a billing invoice
|
|
18
|
+
*
|
|
19
|
+
* Get a billing invoice by ID.
|
|
20
|
+
*
|
|
21
|
+
* Returns the full invoice resource including line items, status details, totals,
|
|
22
|
+
* and workflow configuration snapshot.
|
|
23
|
+
*
|
|
24
|
+
* GET /openmeter/billing/invoices/{invoiceId}
|
|
25
|
+
*/
|
|
26
|
+
export declare function getInvoice(client: Client, req: GetInvoiceRequest, options?: RequestOptions): Promise<Result<GetInvoiceResponse>>;
|
|
27
|
+
/**
|
|
28
|
+
* Update a billing invoice
|
|
29
|
+
*
|
|
30
|
+
* Update a billing invoice.
|
|
31
|
+
*
|
|
32
|
+
* Only the mutable fields of the invoice can be edited: description, labels,
|
|
33
|
+
* supplier, customer, workflow settings, and top-level lines. Top-level lines are
|
|
34
|
+
* matched by `id`; lines without an `id` are created, and existing lines omitted
|
|
35
|
+
* from `lines` are deleted. Detailed (child) lines are always computed and cannot
|
|
36
|
+
* be edited directly. Only invoices in draft status can be updated.
|
|
37
|
+
*
|
|
38
|
+
* PUT /openmeter/billing/invoices/{invoiceId}
|
|
39
|
+
*/
|
|
40
|
+
export declare function updateInvoice(client: Client, req: UpdateInvoiceRequest, options?: RequestOptions): Promise<Result<UpdateInvoiceResponse>>;
|
|
41
|
+
/**
|
|
42
|
+
* Delete a billing invoice
|
|
43
|
+
*
|
|
44
|
+
* Delete a billing invoice.
|
|
45
|
+
*
|
|
46
|
+
* Only standard invoices in draft status can be deleted. Deleting an invoice will
|
|
47
|
+
* also delete all associated line items and workflow configuration.
|
|
48
|
+
*
|
|
49
|
+
* DELETE /openmeter/billing/invoices/{invoiceId}
|
|
50
|
+
*/
|
|
51
|
+
export declare function deleteInvoice(client: Client, req: DeleteInvoiceRequest, options?: RequestOptions): Promise<Result<DeleteInvoiceResponse>>;
|