@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/planAddons.js
CHANGED
|
@@ -1,48 +1,158 @@
|
|
|
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 } from '../lib/encodings.js';
|
|
5
|
+
import { toWire, fromWire, assertValid } from '../lib/wire.js';
|
|
6
|
+
import * as schemas from '../models/schemas.js';
|
|
7
|
+
/**
|
|
8
|
+
* List add-ons for plan
|
|
9
|
+
*
|
|
10
|
+
* List add-ons associated with a plan.
|
|
11
|
+
*
|
|
12
|
+
* GET /openmeter/plans/{planId}/addons
|
|
13
|
+
*/
|
|
4
14
|
export function listPlanAddons(client, req, options) {
|
|
5
|
-
|
|
6
|
-
|
|
15
|
+
return request(() => {
|
|
16
|
+
const path = `openmeter/plans/${(() => {
|
|
17
|
+
if (req.planId === undefined) {
|
|
18
|
+
throw new Error('missing path parameter: planId');
|
|
19
|
+
}
|
|
20
|
+
return encodeURIComponent(String(req.planId));
|
|
21
|
+
})()}/addons`;
|
|
22
|
+
const query = toWire({
|
|
23
|
+
page: req.page,
|
|
24
|
+
}, schemas.listPlanAddonsQueryParams);
|
|
25
|
+
if (client._options.validate) {
|
|
26
|
+
assertValid(schemas.listPlanAddonsQueryParamsWire, query);
|
|
27
|
+
}
|
|
28
|
+
const searchParams = toURLSearchParams(query);
|
|
29
|
+
return http(client)
|
|
30
|
+
.get(path, { ...options, searchParams })
|
|
31
|
+
.json()
|
|
32
|
+
.then((data) => {
|
|
33
|
+
if (client._options.validate) {
|
|
34
|
+
assertValid(schemas.listPlanAddonsResponseWire, data);
|
|
35
|
+
}
|
|
36
|
+
return fromWire(data, schemas.listPlanAddonsResponse);
|
|
37
|
+
});
|
|
7
38
|
});
|
|
8
|
-
const path = encodePath('openmeter/plans/{planId}/addons', {
|
|
9
|
-
planId: req.planId,
|
|
10
|
-
});
|
|
11
|
-
return request(() => http(client)
|
|
12
|
-
.get(path, { ...options, searchParams })
|
|
13
|
-
.json());
|
|
14
39
|
}
|
|
40
|
+
/**
|
|
41
|
+
* Add add-on to plan
|
|
42
|
+
*
|
|
43
|
+
* Add an add-on to a plan.
|
|
44
|
+
*
|
|
45
|
+
* POST /openmeter/plans/{planId}/addons
|
|
46
|
+
*/
|
|
15
47
|
export function createPlanAddon(client, req, options) {
|
|
16
|
-
|
|
17
|
-
|
|
48
|
+
return request(() => {
|
|
49
|
+
const path = `openmeter/plans/${(() => {
|
|
50
|
+
if (req.planId === undefined) {
|
|
51
|
+
throw new Error('missing path parameter: planId');
|
|
52
|
+
}
|
|
53
|
+
return encodeURIComponent(String(req.planId));
|
|
54
|
+
})()}/addons`;
|
|
55
|
+
const body = toWire(req.body, schemas.createPlanAddonBody);
|
|
56
|
+
if (client._options.validate) {
|
|
57
|
+
assertValid(schemas.createPlanAddonBodyWire, body);
|
|
58
|
+
}
|
|
59
|
+
return http(client)
|
|
60
|
+
.post(path, { ...options, json: body })
|
|
61
|
+
.json()
|
|
62
|
+
.then((data) => {
|
|
63
|
+
if (client._options.validate) {
|
|
64
|
+
assertValid(schemas.createPlanAddonResponseWire, data);
|
|
65
|
+
}
|
|
66
|
+
return fromWire(data, schemas.createPlanAddonResponse);
|
|
67
|
+
});
|
|
18
68
|
});
|
|
19
|
-
return request(() => http(client)
|
|
20
|
-
.post(path, { ...options, json: req.body })
|
|
21
|
-
.json());
|
|
22
69
|
}
|
|
70
|
+
/**
|
|
71
|
+
* Get add-on association for plan
|
|
72
|
+
*
|
|
73
|
+
* Get an add-on association for a plan.
|
|
74
|
+
*
|
|
75
|
+
* GET /openmeter/plans/{planId}/addons/{planAddonId}
|
|
76
|
+
*/
|
|
23
77
|
export function getPlanAddon(client, req, options) {
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
78
|
+
return request(() => {
|
|
79
|
+
const path = `openmeter/plans/${(() => {
|
|
80
|
+
if (req.planId === undefined) {
|
|
81
|
+
throw new Error('missing path parameter: planId');
|
|
82
|
+
}
|
|
83
|
+
return encodeURIComponent(String(req.planId));
|
|
84
|
+
})()}/addons/${(() => {
|
|
85
|
+
if (req.planAddonId === undefined) {
|
|
86
|
+
throw new Error('missing path parameter: planAddonId');
|
|
87
|
+
}
|
|
88
|
+
return encodeURIComponent(String(req.planAddonId));
|
|
89
|
+
})()}`;
|
|
90
|
+
return http(client)
|
|
91
|
+
.get(path, options)
|
|
92
|
+
.json()
|
|
93
|
+
.then((data) => {
|
|
94
|
+
if (client._options.validate) {
|
|
95
|
+
assertValid(schemas.getPlanAddonResponseWire, data);
|
|
96
|
+
}
|
|
97
|
+
return fromWire(data, schemas.getPlanAddonResponse);
|
|
98
|
+
});
|
|
27
99
|
});
|
|
28
|
-
return request(() => http(client).get(path, options).json());
|
|
29
100
|
}
|
|
101
|
+
/**
|
|
102
|
+
* Update add-on association for plan
|
|
103
|
+
*
|
|
104
|
+
* Update an add-on association for a plan.
|
|
105
|
+
*
|
|
106
|
+
* PUT /openmeter/plans/{planId}/addons/{planAddonId}
|
|
107
|
+
*/
|
|
30
108
|
export function updatePlanAddon(client, req, options) {
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
109
|
+
return request(() => {
|
|
110
|
+
const path = `openmeter/plans/${(() => {
|
|
111
|
+
if (req.planId === undefined) {
|
|
112
|
+
throw new Error('missing path parameter: planId');
|
|
113
|
+
}
|
|
114
|
+
return encodeURIComponent(String(req.planId));
|
|
115
|
+
})()}/addons/${(() => {
|
|
116
|
+
if (req.planAddonId === undefined) {
|
|
117
|
+
throw new Error('missing path parameter: planAddonId');
|
|
118
|
+
}
|
|
119
|
+
return encodeURIComponent(String(req.planAddonId));
|
|
120
|
+
})()}`;
|
|
121
|
+
const body = toWire(req.body, schemas.updatePlanAddonBody);
|
|
122
|
+
if (client._options.validate) {
|
|
123
|
+
assertValid(schemas.updatePlanAddonBodyWire, body);
|
|
124
|
+
}
|
|
125
|
+
return http(client)
|
|
126
|
+
.put(path, { ...options, json: body })
|
|
127
|
+
.json()
|
|
128
|
+
.then((data) => {
|
|
129
|
+
if (client._options.validate) {
|
|
130
|
+
assertValid(schemas.updatePlanAddonResponseWire, data);
|
|
131
|
+
}
|
|
132
|
+
return fromWire(data, schemas.updatePlanAddonResponse);
|
|
133
|
+
});
|
|
34
134
|
});
|
|
35
|
-
return request(() => http(client)
|
|
36
|
-
.put(path, { ...options, json: req.body })
|
|
37
|
-
.json());
|
|
38
135
|
}
|
|
136
|
+
/**
|
|
137
|
+
* Remove add-on from plan
|
|
138
|
+
*
|
|
139
|
+
* Remove an add-on from a plan.
|
|
140
|
+
*
|
|
141
|
+
* DELETE /openmeter/plans/{planId}/addons/{planAddonId}
|
|
142
|
+
*/
|
|
39
143
|
export function deletePlanAddon(client, req, options) {
|
|
40
|
-
const path = encodePath('openmeter/plans/{planId}/addons/{planAddonId}', {
|
|
41
|
-
planId: req.planId,
|
|
42
|
-
planAddonId: req.planAddonId,
|
|
43
|
-
});
|
|
44
144
|
return request(async () => {
|
|
145
|
+
const path = `openmeter/plans/${(() => {
|
|
146
|
+
if (req.planId === undefined) {
|
|
147
|
+
throw new Error('missing path parameter: planId');
|
|
148
|
+
}
|
|
149
|
+
return encodeURIComponent(String(req.planId));
|
|
150
|
+
})()}/addons/${(() => {
|
|
151
|
+
if (req.planAddonId === undefined) {
|
|
152
|
+
throw new Error('missing path parameter: planAddonId');
|
|
153
|
+
}
|
|
154
|
+
return encodeURIComponent(String(req.planAddonId));
|
|
155
|
+
})()}`;
|
|
45
156
|
await http(client).delete(path, options);
|
|
46
157
|
});
|
|
47
158
|
}
|
|
48
|
-
//# sourceMappingURL=planAddons.js.map
|
package/dist/funcs/plans.d.ts
CHANGED
|
@@ -1,11 +1,59 @@
|
|
|
1
1
|
import { type Client } from '../core.js';
|
|
2
2
|
import { type Result, type RequestOptions } from '../lib/types.js';
|
|
3
3
|
import type { ListPlansRequest, ListPlansResponse, CreatePlanRequest, CreatePlanResponse, UpdatePlanRequest, UpdatePlanResponse, GetPlanRequest, GetPlanResponse, DeletePlanRequest, DeletePlanResponse, ArchivePlanRequest, ArchivePlanResponse, PublishPlanRequest, PublishPlanResponse } from '../models/operations/plans.js';
|
|
4
|
+
/**
|
|
5
|
+
* List plans
|
|
6
|
+
*
|
|
7
|
+
* List all plans.
|
|
8
|
+
*
|
|
9
|
+
* GET /openmeter/plans
|
|
10
|
+
*/
|
|
4
11
|
export declare function listPlans(client: Client, req?: ListPlansRequest, options?: RequestOptions): Promise<Result<ListPlansResponse>>;
|
|
12
|
+
/**
|
|
13
|
+
* Create plan
|
|
14
|
+
*
|
|
15
|
+
* Create a new plan.
|
|
16
|
+
*
|
|
17
|
+
* POST /openmeter/plans
|
|
18
|
+
*/
|
|
5
19
|
export declare function createPlan(client: Client, req: CreatePlanRequest, options?: RequestOptions): Promise<Result<CreatePlanResponse>>;
|
|
20
|
+
/**
|
|
21
|
+
* Update plan
|
|
22
|
+
*
|
|
23
|
+
* Update a plan by id.
|
|
24
|
+
*
|
|
25
|
+
* PUT /openmeter/plans/{planId}
|
|
26
|
+
*/
|
|
6
27
|
export declare function updatePlan(client: Client, req: UpdatePlanRequest, options?: RequestOptions): Promise<Result<UpdatePlanResponse>>;
|
|
28
|
+
/**
|
|
29
|
+
* Get plan
|
|
30
|
+
*
|
|
31
|
+
* Get a plan by id.
|
|
32
|
+
*
|
|
33
|
+
* GET /openmeter/plans/{planId}
|
|
34
|
+
*/
|
|
7
35
|
export declare function getPlan(client: Client, req: GetPlanRequest, options?: RequestOptions): Promise<Result<GetPlanResponse>>;
|
|
36
|
+
/**
|
|
37
|
+
* Delete plan
|
|
38
|
+
*
|
|
39
|
+
* Delete a plan by id.
|
|
40
|
+
*
|
|
41
|
+
* DELETE /openmeter/plans/{planId}
|
|
42
|
+
*/
|
|
8
43
|
export declare function deletePlan(client: Client, req: DeletePlanRequest, options?: RequestOptions): Promise<Result<DeletePlanResponse>>;
|
|
44
|
+
/**
|
|
45
|
+
* Archive plan version
|
|
46
|
+
*
|
|
47
|
+
* Archive a plan version.
|
|
48
|
+
*
|
|
49
|
+
* POST /openmeter/plans/{planId}/archive
|
|
50
|
+
*/
|
|
9
51
|
export declare function archivePlan(client: Client, req: ArchivePlanRequest, options?: RequestOptions): Promise<Result<ArchivePlanResponse>>;
|
|
52
|
+
/**
|
|
53
|
+
* Publish plan version
|
|
54
|
+
*
|
|
55
|
+
* Publish a plan version.
|
|
56
|
+
*
|
|
57
|
+
* POST /openmeter/plans/{planId}/publish
|
|
58
|
+
*/
|
|
10
59
|
export declare function publishPlan(client: Client, req: PublishPlanRequest, options?: RequestOptions): Promise<Result<PublishPlanResponse>>;
|
|
11
|
-
//# sourceMappingURL=plans.d.ts.map
|
package/dist/funcs/plans.js
CHANGED
|
@@ -1,47 +1,185 @@
|
|
|
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 plans
|
|
9
|
+
*
|
|
10
|
+
* List all plans.
|
|
11
|
+
*
|
|
12
|
+
* GET /openmeter/plans
|
|
13
|
+
*/
|
|
4
14
|
export function listPlans(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.listPlansQueryParams);
|
|
21
|
+
if (client._options.validate) {
|
|
22
|
+
assertValid(schemas.listPlansQueryParamsWire, query);
|
|
23
|
+
}
|
|
24
|
+
const searchParams = toURLSearchParams(query);
|
|
25
|
+
return http(client)
|
|
26
|
+
.get('openmeter/plans', { ...options, searchParams })
|
|
27
|
+
.json()
|
|
28
|
+
.then((data) => {
|
|
29
|
+
if (client._options.validate) {
|
|
30
|
+
assertValid(schemas.listPlansResponseWire, data);
|
|
31
|
+
}
|
|
32
|
+
return fromWire(data, schemas.listPlansResponse);
|
|
33
|
+
});
|
|
9
34
|
});
|
|
10
|
-
return request(() => http(client)
|
|
11
|
-
.get('openmeter/plans', { ...options, searchParams })
|
|
12
|
-
.json());
|
|
13
35
|
}
|
|
36
|
+
/**
|
|
37
|
+
* Create plan
|
|
38
|
+
*
|
|
39
|
+
* Create a new plan.
|
|
40
|
+
*
|
|
41
|
+
* POST /openmeter/plans
|
|
42
|
+
*/
|
|
14
43
|
export function createPlan(client, req, options) {
|
|
15
|
-
return request(() =>
|
|
16
|
-
|
|
17
|
-
.
|
|
44
|
+
return request(() => {
|
|
45
|
+
const body = toWire(req, schemas.createPlanBody);
|
|
46
|
+
if (client._options.validate) {
|
|
47
|
+
assertValid(schemas.createPlanBodyWire, body);
|
|
48
|
+
}
|
|
49
|
+
return http(client)
|
|
50
|
+
.post('openmeter/plans', { ...options, json: body })
|
|
51
|
+
.json()
|
|
52
|
+
.then((data) => {
|
|
53
|
+
if (client._options.validate) {
|
|
54
|
+
assertValid(schemas.createPlanResponseWire, data);
|
|
55
|
+
}
|
|
56
|
+
return fromWire(data, schemas.createPlanResponse);
|
|
57
|
+
});
|
|
58
|
+
});
|
|
18
59
|
}
|
|
60
|
+
/**
|
|
61
|
+
* Update plan
|
|
62
|
+
*
|
|
63
|
+
* Update a plan by id.
|
|
64
|
+
*
|
|
65
|
+
* PUT /openmeter/plans/{planId}
|
|
66
|
+
*/
|
|
19
67
|
export function updatePlan(client, req, options) {
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
68
|
+
return request(() => {
|
|
69
|
+
const path = `openmeter/plans/${(() => {
|
|
70
|
+
if (req.planId === undefined) {
|
|
71
|
+
throw new Error('missing path parameter: planId');
|
|
72
|
+
}
|
|
73
|
+
return encodeURIComponent(String(req.planId));
|
|
74
|
+
})()}`;
|
|
75
|
+
const body = toWire(req.body, schemas.updatePlanBody);
|
|
76
|
+
if (client._options.validate) {
|
|
77
|
+
assertValid(schemas.updatePlanBodyWire, body);
|
|
78
|
+
}
|
|
79
|
+
return http(client)
|
|
80
|
+
.put(path, { ...options, json: body })
|
|
81
|
+
.json()
|
|
82
|
+
.then((data) => {
|
|
83
|
+
if (client._options.validate) {
|
|
84
|
+
assertValid(schemas.updatePlanResponseWire, data);
|
|
85
|
+
}
|
|
86
|
+
return fromWire(data, schemas.updatePlanResponse);
|
|
87
|
+
});
|
|
88
|
+
});
|
|
24
89
|
}
|
|
90
|
+
/**
|
|
91
|
+
* Get plan
|
|
92
|
+
*
|
|
93
|
+
* Get a plan by id.
|
|
94
|
+
*
|
|
95
|
+
* GET /openmeter/plans/{planId}
|
|
96
|
+
*/
|
|
25
97
|
export function getPlan(client, req, options) {
|
|
26
|
-
|
|
27
|
-
|
|
98
|
+
return request(() => {
|
|
99
|
+
const path = `openmeter/plans/${(() => {
|
|
100
|
+
if (req.planId === undefined) {
|
|
101
|
+
throw new Error('missing path parameter: planId');
|
|
102
|
+
}
|
|
103
|
+
return encodeURIComponent(String(req.planId));
|
|
104
|
+
})()}`;
|
|
105
|
+
return http(client)
|
|
106
|
+
.get(path, options)
|
|
107
|
+
.json()
|
|
108
|
+
.then((data) => {
|
|
109
|
+
if (client._options.validate) {
|
|
110
|
+
assertValid(schemas.getPlanResponseWire, data);
|
|
111
|
+
}
|
|
112
|
+
return fromWire(data, schemas.getPlanResponse);
|
|
113
|
+
});
|
|
114
|
+
});
|
|
28
115
|
}
|
|
116
|
+
/**
|
|
117
|
+
* Delete plan
|
|
118
|
+
*
|
|
119
|
+
* Delete a plan by id.
|
|
120
|
+
*
|
|
121
|
+
* DELETE /openmeter/plans/{planId}
|
|
122
|
+
*/
|
|
29
123
|
export function deletePlan(client, req, options) {
|
|
30
|
-
const path = encodePath('openmeter/plans/{planId}', { planId: req.planId });
|
|
31
124
|
return request(async () => {
|
|
125
|
+
const path = `openmeter/plans/${(() => {
|
|
126
|
+
if (req.planId === undefined) {
|
|
127
|
+
throw new Error('missing path parameter: planId');
|
|
128
|
+
}
|
|
129
|
+
return encodeURIComponent(String(req.planId));
|
|
130
|
+
})()}`;
|
|
32
131
|
await http(client).delete(path, options);
|
|
33
132
|
});
|
|
34
133
|
}
|
|
134
|
+
/**
|
|
135
|
+
* Archive plan version
|
|
136
|
+
*
|
|
137
|
+
* Archive a plan version.
|
|
138
|
+
*
|
|
139
|
+
* POST /openmeter/plans/{planId}/archive
|
|
140
|
+
*/
|
|
35
141
|
export function archivePlan(client, req, options) {
|
|
36
|
-
|
|
37
|
-
|
|
142
|
+
return request(() => {
|
|
143
|
+
const path = `openmeter/plans/${(() => {
|
|
144
|
+
if (req.planId === undefined) {
|
|
145
|
+
throw new Error('missing path parameter: planId');
|
|
146
|
+
}
|
|
147
|
+
return encodeURIComponent(String(req.planId));
|
|
148
|
+
})()}/archive`;
|
|
149
|
+
return http(client)
|
|
150
|
+
.post(path, options)
|
|
151
|
+
.json()
|
|
152
|
+
.then((data) => {
|
|
153
|
+
if (client._options.validate) {
|
|
154
|
+
assertValid(schemas.archivePlanResponseWire, data);
|
|
155
|
+
}
|
|
156
|
+
return fromWire(data, schemas.archivePlanResponse);
|
|
157
|
+
});
|
|
38
158
|
});
|
|
39
|
-
return request(() => http(client).post(path, options).json());
|
|
40
159
|
}
|
|
160
|
+
/**
|
|
161
|
+
* Publish plan version
|
|
162
|
+
*
|
|
163
|
+
* Publish a plan version.
|
|
164
|
+
*
|
|
165
|
+
* POST /openmeter/plans/{planId}/publish
|
|
166
|
+
*/
|
|
41
167
|
export function publishPlan(client, req, options) {
|
|
42
|
-
|
|
43
|
-
|
|
168
|
+
return request(() => {
|
|
169
|
+
const path = `openmeter/plans/${(() => {
|
|
170
|
+
if (req.planId === undefined) {
|
|
171
|
+
throw new Error('missing path parameter: planId');
|
|
172
|
+
}
|
|
173
|
+
return encodeURIComponent(String(req.planId));
|
|
174
|
+
})()}/publish`;
|
|
175
|
+
return http(client)
|
|
176
|
+
.post(path, options)
|
|
177
|
+
.json()
|
|
178
|
+
.then((data) => {
|
|
179
|
+
if (client._options.validate) {
|
|
180
|
+
assertValid(schemas.publishPlanResponseWire, data);
|
|
181
|
+
}
|
|
182
|
+
return fromWire(data, schemas.publishPlanResponse);
|
|
183
|
+
});
|
|
44
184
|
});
|
|
45
|
-
return request(() => http(client).post(path, options).json());
|
|
46
185
|
}
|
|
47
|
-
//# sourceMappingURL=plans.js.map
|
|
@@ -1,12 +1,71 @@
|
|
|
1
1
|
import { type Client } from '../core.js';
|
|
2
2
|
import { type Result, type RequestOptions } from '../lib/types.js';
|
|
3
|
-
import type { CreateSubscriptionRequest, CreateSubscriptionResponse, ListSubscriptionsRequest, ListSubscriptionsResponse, GetSubscriptionRequest, GetSubscriptionResponse, CancelSubscriptionRequest, CancelSubscriptionResponse, UnscheduleCancelationRequest, UnscheduleCancelationResponse, ChangeSubscriptionRequest, ChangeSubscriptionResponse, ListSubscriptionAddonsRequest, ListSubscriptionAddonsResponse, GetSubscriptionAddonRequest, GetSubscriptionAddonResponse } from '../models/operations/subscriptions.js';
|
|
3
|
+
import type { CreateSubscriptionRequest, CreateSubscriptionResponse, ListSubscriptionsRequest, ListSubscriptionsResponse, GetSubscriptionRequest, GetSubscriptionResponse, CancelSubscriptionRequest, CancelSubscriptionResponse, UnscheduleCancelationRequest, UnscheduleCancelationResponse, ChangeSubscriptionRequest, ChangeSubscriptionResponse, CreateSubscriptionAddonRequest, CreateSubscriptionAddonResponse, ListSubscriptionAddonsRequest, ListSubscriptionAddonsResponse, GetSubscriptionAddonRequest, GetSubscriptionAddonResponse } from '../models/operations/subscriptions.js';
|
|
4
|
+
/**
|
|
5
|
+
* Create subscription
|
|
6
|
+
*
|
|
7
|
+
* POST /openmeter/subscriptions
|
|
8
|
+
*/
|
|
4
9
|
export declare function createSubscription(client: Client, req: CreateSubscriptionRequest, options?: RequestOptions): Promise<Result<CreateSubscriptionResponse>>;
|
|
10
|
+
/**
|
|
11
|
+
* List subscriptions
|
|
12
|
+
*
|
|
13
|
+
* GET /openmeter/subscriptions
|
|
14
|
+
*/
|
|
5
15
|
export declare function listSubscriptions(client: Client, req?: ListSubscriptionsRequest, options?: RequestOptions): Promise<Result<ListSubscriptionsResponse>>;
|
|
16
|
+
/**
|
|
17
|
+
* Get subscription
|
|
18
|
+
*
|
|
19
|
+
* GET /openmeter/subscriptions/{subscriptionId}
|
|
20
|
+
*/
|
|
6
21
|
export declare function getSubscription(client: Client, req: GetSubscriptionRequest, options?: RequestOptions): Promise<Result<GetSubscriptionResponse>>;
|
|
22
|
+
/**
|
|
23
|
+
* Cancel subscription
|
|
24
|
+
*
|
|
25
|
+
* Cancels the subscription. Will result in a scheduling conflict if there are
|
|
26
|
+
* other subscriptions scheduled to start after the cancelation time.
|
|
27
|
+
*
|
|
28
|
+
* POST /openmeter/subscriptions/{subscriptionId}/cancel
|
|
29
|
+
*/
|
|
7
30
|
export declare function cancelSubscription(client: Client, req: CancelSubscriptionRequest, options?: RequestOptions): Promise<Result<CancelSubscriptionResponse>>;
|
|
31
|
+
/**
|
|
32
|
+
* Unschedule subscription cancelation
|
|
33
|
+
*
|
|
34
|
+
* Unschedules the subscription cancelation.
|
|
35
|
+
*
|
|
36
|
+
* POST /openmeter/subscriptions/{subscriptionId}/unschedule-cancelation
|
|
37
|
+
*/
|
|
8
38
|
export declare function unscheduleCancelation(client: Client, req: UnscheduleCancelationRequest, options?: RequestOptions): Promise<Result<UnscheduleCancelationResponse>>;
|
|
39
|
+
/**
|
|
40
|
+
* Change subscription
|
|
41
|
+
*
|
|
42
|
+
* Closes a running subscription and starts a new one according to the
|
|
43
|
+
* specification. Can be used for upgrades, downgrades, and plan changes.
|
|
44
|
+
*
|
|
45
|
+
* POST /openmeter/subscriptions/{subscriptionId}/change
|
|
46
|
+
*/
|
|
9
47
|
export declare function changeSubscription(client: Client, req: ChangeSubscriptionRequest, options?: RequestOptions): Promise<Result<ChangeSubscriptionResponse>>;
|
|
48
|
+
/**
|
|
49
|
+
* Create a new subscription add-on
|
|
50
|
+
*
|
|
51
|
+
* Add add-on to a subscription.
|
|
52
|
+
*
|
|
53
|
+
* POST /openmeter/subscriptions/{subscriptionId}/addons
|
|
54
|
+
*/
|
|
55
|
+
export declare function createSubscriptionAddon(client: Client, req: CreateSubscriptionAddonRequest, options?: RequestOptions): Promise<Result<CreateSubscriptionAddonResponse>>;
|
|
56
|
+
/**
|
|
57
|
+
* List subscription addons
|
|
58
|
+
*
|
|
59
|
+
* List the add-ons of a subscription.
|
|
60
|
+
*
|
|
61
|
+
* GET /openmeter/subscriptions/{subscriptionId}/addons
|
|
62
|
+
*/
|
|
10
63
|
export declare function listSubscriptionAddons(client: Client, req: ListSubscriptionAddonsRequest, options?: RequestOptions): Promise<Result<ListSubscriptionAddonsResponse>>;
|
|
64
|
+
/**
|
|
65
|
+
* Get add-on association for subscription
|
|
66
|
+
*
|
|
67
|
+
* Get an add-on association for a subscription.
|
|
68
|
+
*
|
|
69
|
+
* GET /openmeter/subscriptions/{subscriptionId}/addons/{subscriptionAddonId}
|
|
70
|
+
*/
|
|
11
71
|
export declare function getSubscriptionAddon(client: Client, req: GetSubscriptionAddonRequest, options?: RequestOptions): Promise<Result<GetSubscriptionAddonResponse>>;
|
|
12
|
-
//# sourceMappingURL=subscriptions.d.ts.map
|