@openmeter/client 1.0.0-beta.229 → 1.0.0-beta.230
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 +49 -30
- package/dist/funcs/addons.js +111 -28
- package/dist/funcs/apps.js +37 -8
- package/dist/funcs/billing.js +79 -16
- package/dist/funcs/currencies.js +82 -22
- package/dist/funcs/customers.d.ts +3 -1
- package/dist/funcs/customers.js +390 -91
- package/dist/funcs/defaults.js +24 -4
- package/dist/funcs/entitlements.js +19 -5
- package/dist/funcs/events.js +26 -8
- package/dist/funcs/features.js +99 -27
- package/dist/funcs/governance.js +27 -9
- package/dist/funcs/index.d.ts +1 -0
- package/dist/funcs/index.js +1 -0
- package/dist/funcs/invoices.d.ts +8 -0
- package/dist/funcs/invoices.js +81 -0
- package/dist/funcs/llmCost.js +77 -23
- package/dist/funcs/meters.d.ts +2 -1
- package/dist/funcs/meters.js +118 -27
- package/dist/funcs/planAddons.js +103 -28
- package/dist/funcs/plans.js +113 -24
- package/dist/funcs/subscriptions.d.ts +2 -1
- package/dist/funcs/subscriptions.js +178 -39
- package/dist/funcs/tax.js +78 -21
- package/dist/index.d.ts +5 -1
- package/dist/index.js +2 -0
- package/dist/lib/config.d.ts +9 -0
- package/dist/lib/encodings.d.ts +1 -1
- package/dist/lib/encodings.js +5 -4
- package/dist/lib/wire.d.ts +18 -0
- package/dist/lib/wire.js +312 -0
- package/dist/models/operations/addons.d.ts +17 -5
- package/dist/models/operations/apps.d.ts +2 -1
- package/dist/models/operations/billing.d.ts +5 -4
- package/dist/models/operations/currencies.d.ts +27 -9
- package/dist/models/operations/customers.d.ts +83 -32
- package/dist/models/operations/defaults.d.ts +2 -1
- package/dist/models/operations/events.d.ts +20 -4
- package/dist/models/operations/features.d.ts +24 -8
- package/dist/models/operations/governance.d.ts +3 -2
- package/dist/models/operations/invoices.d.ts +48 -0
- package/dist/models/operations/invoices.js +2 -0
- package/dist/models/operations/llmCost.d.ts +16 -4
- package/dist/models/operations/meters.d.ts +29 -8
- package/dist/models/operations/planAddons.d.ts +7 -6
- package/dist/models/operations/plans.d.ts +14 -5
- package/dist/models/operations/subscriptions.d.ts +36 -10
- package/dist/models/operations/tax.d.ts +6 -5
- package/dist/models/schemas.d.ts +27210 -3012
- package/dist/models/schemas.js +6212 -492
- package/dist/models/types.d.ts +4240 -977
- package/dist/sdk/customers.d.ts +3 -1
- package/dist/sdk/customers.js +7 -1
- package/dist/sdk/invoices.d.ts +12 -0
- package/dist/sdk/invoices.js +21 -0
- package/dist/sdk/meters.d.ts +2 -1
- package/dist/sdk/meters.js +4 -1
- package/dist/sdk/sdk.d.ts +3 -0
- package/dist/sdk/sdk.js +5 -0
- package/dist/sdk/subscriptions.d.ts +2 -1
- package/dist/sdk/subscriptions.js +4 -1
- package/package.json +4 -3
package/dist/funcs/meters.js
CHANGED
|
@@ -1,49 +1,140 @@
|
|
|
1
1
|
import { http } from '../core.js';
|
|
2
2
|
import { request } from '../lib/request.js';
|
|
3
|
-
import {
|
|
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';
|
|
4
6
|
export function createMeter(client, req, options) {
|
|
5
|
-
return request(() =>
|
|
6
|
-
|
|
7
|
-
.
|
|
7
|
+
return request(() => {
|
|
8
|
+
const body = toWire(req, schemas.createMeterBody);
|
|
9
|
+
if (client._options.validate) {
|
|
10
|
+
assertValid(schemas.createMeterBodyWire, body);
|
|
11
|
+
}
|
|
12
|
+
return http(client)
|
|
13
|
+
.post('openmeter/meters', { ...options, json: body })
|
|
14
|
+
.json()
|
|
15
|
+
.then((data) => {
|
|
16
|
+
if (client._options.validate) {
|
|
17
|
+
assertValid(schemas.createMeterResponseWire, data);
|
|
18
|
+
}
|
|
19
|
+
return fromWire(data, schemas.createMeterResponse);
|
|
20
|
+
});
|
|
21
|
+
});
|
|
8
22
|
}
|
|
9
23
|
export function getMeter(client, req, options) {
|
|
10
|
-
|
|
11
|
-
|
|
24
|
+
return request(() => {
|
|
25
|
+
const path = `openmeter/meters/${(() => {
|
|
26
|
+
if (req.meterId === undefined) {
|
|
27
|
+
throw new Error('missing path parameter: meterId');
|
|
28
|
+
}
|
|
29
|
+
return encodeURIComponent(String(req.meterId));
|
|
30
|
+
})()}`;
|
|
31
|
+
return http(client)
|
|
32
|
+
.get(path, options)
|
|
33
|
+
.json()
|
|
34
|
+
.then((data) => {
|
|
35
|
+
if (client._options.validate) {
|
|
36
|
+
assertValid(schemas.getMeterResponseWire, data);
|
|
37
|
+
}
|
|
38
|
+
return fromWire(data, schemas.getMeterResponse);
|
|
39
|
+
});
|
|
12
40
|
});
|
|
13
|
-
return request(() => http(client).get(path, options).json());
|
|
14
41
|
}
|
|
15
42
|
export function listMeters(client, req = {}, options) {
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
43
|
+
return request(() => {
|
|
44
|
+
const query = toWire({
|
|
45
|
+
page: req.page,
|
|
46
|
+
sort: encodeSort(req.sort, toSnakeCase),
|
|
47
|
+
filter: req.filter,
|
|
48
|
+
}, schemas.listMetersQueryParams);
|
|
49
|
+
if (client._options.validate) {
|
|
50
|
+
assertValid(schemas.listMetersQueryParamsWire, query);
|
|
51
|
+
}
|
|
52
|
+
const searchParams = toURLSearchParams(query);
|
|
53
|
+
return http(client)
|
|
54
|
+
.get('openmeter/meters', { ...options, searchParams })
|
|
55
|
+
.json()
|
|
56
|
+
.then((data) => {
|
|
57
|
+
if (client._options.validate) {
|
|
58
|
+
assertValid(schemas.listMetersResponseWire, data);
|
|
59
|
+
}
|
|
60
|
+
return fromWire(data, schemas.listMetersResponse);
|
|
61
|
+
});
|
|
20
62
|
});
|
|
21
|
-
return request(() => http(client)
|
|
22
|
-
.get('openmeter/meters', { ...options, searchParams })
|
|
23
|
-
.json());
|
|
24
63
|
}
|
|
25
64
|
export function updateMeter(client, req, options) {
|
|
26
|
-
|
|
27
|
-
|
|
65
|
+
return request(() => {
|
|
66
|
+
const path = `openmeter/meters/${(() => {
|
|
67
|
+
if (req.meterId === undefined) {
|
|
68
|
+
throw new Error('missing path parameter: meterId');
|
|
69
|
+
}
|
|
70
|
+
return encodeURIComponent(String(req.meterId));
|
|
71
|
+
})()}`;
|
|
72
|
+
const body = toWire(req.body, schemas.updateMeterBody);
|
|
73
|
+
if (client._options.validate) {
|
|
74
|
+
assertValid(schemas.updateMeterBodyWire, body);
|
|
75
|
+
}
|
|
76
|
+
return http(client)
|
|
77
|
+
.put(path, { ...options, json: body })
|
|
78
|
+
.json()
|
|
79
|
+
.then((data) => {
|
|
80
|
+
if (client._options.validate) {
|
|
81
|
+
assertValid(schemas.updateMeterResponseWire, data);
|
|
82
|
+
}
|
|
83
|
+
return fromWire(data, schemas.updateMeterResponse);
|
|
84
|
+
});
|
|
28
85
|
});
|
|
29
|
-
return request(() => http(client)
|
|
30
|
-
.put(path, { ...options, json: req.body })
|
|
31
|
-
.json());
|
|
32
86
|
}
|
|
33
87
|
export function deleteMeter(client, req, options) {
|
|
34
|
-
const path = encodePath('openmeter/meters/{meterId}', {
|
|
35
|
-
meterId: req.meterId,
|
|
36
|
-
});
|
|
37
88
|
return request(async () => {
|
|
89
|
+
const path = `openmeter/meters/${(() => {
|
|
90
|
+
if (req.meterId === undefined) {
|
|
91
|
+
throw new Error('missing path parameter: meterId');
|
|
92
|
+
}
|
|
93
|
+
return encodeURIComponent(String(req.meterId));
|
|
94
|
+
})()}`;
|
|
38
95
|
await http(client).delete(path, options);
|
|
39
96
|
});
|
|
40
97
|
}
|
|
41
98
|
export function queryMeter(client, req, options) {
|
|
42
|
-
|
|
43
|
-
|
|
99
|
+
return request(() => {
|
|
100
|
+
const path = `openmeter/meters/${(() => {
|
|
101
|
+
if (req.meterId === undefined) {
|
|
102
|
+
throw new Error('missing path parameter: meterId');
|
|
103
|
+
}
|
|
104
|
+
return encodeURIComponent(String(req.meterId));
|
|
105
|
+
})()}/query`;
|
|
106
|
+
const body = toWire(req.body, schemas.queryMeterBody);
|
|
107
|
+
if (client._options.validate) {
|
|
108
|
+
assertValid(schemas.queryMeterBodyWire, body);
|
|
109
|
+
}
|
|
110
|
+
return http(client)
|
|
111
|
+
.post(path, { ...options, json: body })
|
|
112
|
+
.json()
|
|
113
|
+
.then((data) => {
|
|
114
|
+
if (client._options.validate) {
|
|
115
|
+
assertValid(schemas.queryMeterResponseWire, data);
|
|
116
|
+
}
|
|
117
|
+
return fromWire(data, schemas.queryMeterResponse);
|
|
118
|
+
});
|
|
119
|
+
});
|
|
120
|
+
}
|
|
121
|
+
export function queryMeterCsv(client, req, options) {
|
|
122
|
+
const headers = new Headers(options?.headers);
|
|
123
|
+
headers.set('accept', 'text/csv');
|
|
124
|
+
return request(() => {
|
|
125
|
+
const path = `openmeter/meters/${(() => {
|
|
126
|
+
if (req.meterId === undefined) {
|
|
127
|
+
throw new Error('missing path parameter: meterId');
|
|
128
|
+
}
|
|
129
|
+
return encodeURIComponent(String(req.meterId));
|
|
130
|
+
})()}/query`;
|
|
131
|
+
const body = toWire(req.body, schemas.queryMeterCsvBody);
|
|
132
|
+
if (client._options.validate) {
|
|
133
|
+
assertValid(schemas.queryMeterCsvBodyWire, body);
|
|
134
|
+
}
|
|
135
|
+
return http(client)
|
|
136
|
+
.post(path, { ...options, json: body, headers })
|
|
137
|
+
.text();
|
|
44
138
|
});
|
|
45
|
-
return request(() => http(client)
|
|
46
|
-
.post(path, { ...options, json: req.body })
|
|
47
|
-
.json());
|
|
48
139
|
}
|
|
49
140
|
//# sourceMappingURL=meters.js.map
|
package/dist/funcs/planAddons.js
CHANGED
|
@@ -1,47 +1,122 @@
|
|
|
1
1
|
import { http } from '../core.js';
|
|
2
2
|
import { request } from '../lib/request.js';
|
|
3
|
-
import {
|
|
3
|
+
import { toURLSearchParams } from '../lib/encodings.js';
|
|
4
|
+
import { toWire, fromWire, assertValid } from '../lib/wire.js';
|
|
5
|
+
import * as schemas from '../models/schemas.js';
|
|
4
6
|
export function listPlanAddons(client, req, options) {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
+
return request(() => {
|
|
8
|
+
const path = `openmeter/plans/${(() => {
|
|
9
|
+
if (req.planId === undefined) {
|
|
10
|
+
throw new Error('missing path parameter: planId');
|
|
11
|
+
}
|
|
12
|
+
return encodeURIComponent(String(req.planId));
|
|
13
|
+
})()}/addons`;
|
|
14
|
+
const query = toWire({
|
|
15
|
+
page: req.page,
|
|
16
|
+
}, schemas.listPlanAddonsQueryParams);
|
|
17
|
+
if (client._options.validate) {
|
|
18
|
+
assertValid(schemas.listPlanAddonsQueryParamsWire, query);
|
|
19
|
+
}
|
|
20
|
+
const searchParams = toURLSearchParams(query);
|
|
21
|
+
return http(client)
|
|
22
|
+
.get(path, { ...options, searchParams })
|
|
23
|
+
.json()
|
|
24
|
+
.then((data) => {
|
|
25
|
+
if (client._options.validate) {
|
|
26
|
+
assertValid(schemas.listPlanAddonsResponseWire, data);
|
|
27
|
+
}
|
|
28
|
+
return fromWire(data, schemas.listPlanAddonsResponse);
|
|
29
|
+
});
|
|
7
30
|
});
|
|
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
31
|
}
|
|
15
32
|
export function createPlanAddon(client, req, options) {
|
|
16
|
-
|
|
17
|
-
|
|
33
|
+
return request(() => {
|
|
34
|
+
const path = `openmeter/plans/${(() => {
|
|
35
|
+
if (req.planId === undefined) {
|
|
36
|
+
throw new Error('missing path parameter: planId');
|
|
37
|
+
}
|
|
38
|
+
return encodeURIComponent(String(req.planId));
|
|
39
|
+
})()}/addons`;
|
|
40
|
+
const body = toWire(req.body, schemas.createPlanAddonBody);
|
|
41
|
+
if (client._options.validate) {
|
|
42
|
+
assertValid(schemas.createPlanAddonBodyWire, body);
|
|
43
|
+
}
|
|
44
|
+
return http(client)
|
|
45
|
+
.post(path, { ...options, json: body })
|
|
46
|
+
.json()
|
|
47
|
+
.then((data) => {
|
|
48
|
+
if (client._options.validate) {
|
|
49
|
+
assertValid(schemas.createPlanAddonResponseWire, data);
|
|
50
|
+
}
|
|
51
|
+
return fromWire(data, schemas.createPlanAddonResponse);
|
|
52
|
+
});
|
|
18
53
|
});
|
|
19
|
-
return request(() => http(client)
|
|
20
|
-
.post(path, { ...options, json: req.body })
|
|
21
|
-
.json());
|
|
22
54
|
}
|
|
23
55
|
export function getPlanAddon(client, req, options) {
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
56
|
+
return request(() => {
|
|
57
|
+
const path = `openmeter/plans/${(() => {
|
|
58
|
+
if (req.planId === undefined) {
|
|
59
|
+
throw new Error('missing path parameter: planId');
|
|
60
|
+
}
|
|
61
|
+
return encodeURIComponent(String(req.planId));
|
|
62
|
+
})()}/addons/${(() => {
|
|
63
|
+
if (req.planAddonId === undefined) {
|
|
64
|
+
throw new Error('missing path parameter: planAddonId');
|
|
65
|
+
}
|
|
66
|
+
return encodeURIComponent(String(req.planAddonId));
|
|
67
|
+
})()}`;
|
|
68
|
+
return http(client)
|
|
69
|
+
.get(path, options)
|
|
70
|
+
.json()
|
|
71
|
+
.then((data) => {
|
|
72
|
+
if (client._options.validate) {
|
|
73
|
+
assertValid(schemas.getPlanAddonResponseWire, data);
|
|
74
|
+
}
|
|
75
|
+
return fromWire(data, schemas.getPlanAddonResponse);
|
|
76
|
+
});
|
|
27
77
|
});
|
|
28
|
-
return request(() => http(client).get(path, options).json());
|
|
29
78
|
}
|
|
30
79
|
export function updatePlanAddon(client, req, options) {
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
80
|
+
return request(() => {
|
|
81
|
+
const path = `openmeter/plans/${(() => {
|
|
82
|
+
if (req.planId === undefined) {
|
|
83
|
+
throw new Error('missing path parameter: planId');
|
|
84
|
+
}
|
|
85
|
+
return encodeURIComponent(String(req.planId));
|
|
86
|
+
})()}/addons/${(() => {
|
|
87
|
+
if (req.planAddonId === undefined) {
|
|
88
|
+
throw new Error('missing path parameter: planAddonId');
|
|
89
|
+
}
|
|
90
|
+
return encodeURIComponent(String(req.planAddonId));
|
|
91
|
+
})()}`;
|
|
92
|
+
const body = toWire(req.body, schemas.updatePlanAddonBody);
|
|
93
|
+
if (client._options.validate) {
|
|
94
|
+
assertValid(schemas.updatePlanAddonBodyWire, body);
|
|
95
|
+
}
|
|
96
|
+
return http(client)
|
|
97
|
+
.put(path, { ...options, json: body })
|
|
98
|
+
.json()
|
|
99
|
+
.then((data) => {
|
|
100
|
+
if (client._options.validate) {
|
|
101
|
+
assertValid(schemas.updatePlanAddonResponseWire, data);
|
|
102
|
+
}
|
|
103
|
+
return fromWire(data, schemas.updatePlanAddonResponse);
|
|
104
|
+
});
|
|
34
105
|
});
|
|
35
|
-
return request(() => http(client)
|
|
36
|
-
.put(path, { ...options, json: req.body })
|
|
37
|
-
.json());
|
|
38
106
|
}
|
|
39
107
|
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
108
|
return request(async () => {
|
|
109
|
+
const path = `openmeter/plans/${(() => {
|
|
110
|
+
if (req.planId === undefined) {
|
|
111
|
+
throw new Error('missing path parameter: planId');
|
|
112
|
+
}
|
|
113
|
+
return encodeURIComponent(String(req.planId));
|
|
114
|
+
})()}/addons/${(() => {
|
|
115
|
+
if (req.planAddonId === undefined) {
|
|
116
|
+
throw new Error('missing path parameter: planAddonId');
|
|
117
|
+
}
|
|
118
|
+
return encodeURIComponent(String(req.planAddonId));
|
|
119
|
+
})()}`;
|
|
45
120
|
await http(client).delete(path, options);
|
|
46
121
|
});
|
|
47
122
|
}
|
package/dist/funcs/plans.js
CHANGED
|
@@ -1,47 +1,136 @@
|
|
|
1
1
|
import { http } from '../core.js';
|
|
2
2
|
import { request } from '../lib/request.js';
|
|
3
|
-
import {
|
|
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';
|
|
4
6
|
export function listPlans(client, req = {}, options) {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
7
|
+
return request(() => {
|
|
8
|
+
const query = toWire({
|
|
9
|
+
page: req.page,
|
|
10
|
+
sort: encodeSort(req.sort, toSnakeCase),
|
|
11
|
+
filter: req.filter,
|
|
12
|
+
}, schemas.listPlansQueryParams);
|
|
13
|
+
if (client._options.validate) {
|
|
14
|
+
assertValid(schemas.listPlansQueryParamsWire, query);
|
|
15
|
+
}
|
|
16
|
+
const searchParams = toURLSearchParams(query);
|
|
17
|
+
return http(client)
|
|
18
|
+
.get('openmeter/plans', { ...options, searchParams })
|
|
19
|
+
.json()
|
|
20
|
+
.then((data) => {
|
|
21
|
+
if (client._options.validate) {
|
|
22
|
+
assertValid(schemas.listPlansResponseWire, data);
|
|
23
|
+
}
|
|
24
|
+
return fromWire(data, schemas.listPlansResponse);
|
|
25
|
+
});
|
|
9
26
|
});
|
|
10
|
-
return request(() => http(client)
|
|
11
|
-
.get('openmeter/plans', { ...options, searchParams })
|
|
12
|
-
.json());
|
|
13
27
|
}
|
|
14
28
|
export function createPlan(client, req, options) {
|
|
15
|
-
return request(() =>
|
|
16
|
-
|
|
17
|
-
.
|
|
29
|
+
return request(() => {
|
|
30
|
+
const body = toWire(req, schemas.createPlanBody);
|
|
31
|
+
if (client._options.validate) {
|
|
32
|
+
assertValid(schemas.createPlanBodyWire, body);
|
|
33
|
+
}
|
|
34
|
+
return http(client)
|
|
35
|
+
.post('openmeter/plans', { ...options, json: body })
|
|
36
|
+
.json()
|
|
37
|
+
.then((data) => {
|
|
38
|
+
if (client._options.validate) {
|
|
39
|
+
assertValid(schemas.createPlanResponseWire, data);
|
|
40
|
+
}
|
|
41
|
+
return fromWire(data, schemas.createPlanResponse);
|
|
42
|
+
});
|
|
43
|
+
});
|
|
18
44
|
}
|
|
19
45
|
export function updatePlan(client, req, options) {
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
46
|
+
return request(() => {
|
|
47
|
+
const path = `openmeter/plans/${(() => {
|
|
48
|
+
if (req.planId === undefined) {
|
|
49
|
+
throw new Error('missing path parameter: planId');
|
|
50
|
+
}
|
|
51
|
+
return encodeURIComponent(String(req.planId));
|
|
52
|
+
})()}`;
|
|
53
|
+
const body = toWire(req.body, schemas.updatePlanBody);
|
|
54
|
+
if (client._options.validate) {
|
|
55
|
+
assertValid(schemas.updatePlanBodyWire, body);
|
|
56
|
+
}
|
|
57
|
+
return http(client)
|
|
58
|
+
.put(path, { ...options, json: body })
|
|
59
|
+
.json()
|
|
60
|
+
.then((data) => {
|
|
61
|
+
if (client._options.validate) {
|
|
62
|
+
assertValid(schemas.updatePlanResponseWire, data);
|
|
63
|
+
}
|
|
64
|
+
return fromWire(data, schemas.updatePlanResponse);
|
|
65
|
+
});
|
|
66
|
+
});
|
|
24
67
|
}
|
|
25
68
|
export function getPlan(client, req, options) {
|
|
26
|
-
|
|
27
|
-
|
|
69
|
+
return request(() => {
|
|
70
|
+
const path = `openmeter/plans/${(() => {
|
|
71
|
+
if (req.planId === undefined) {
|
|
72
|
+
throw new Error('missing path parameter: planId');
|
|
73
|
+
}
|
|
74
|
+
return encodeURIComponent(String(req.planId));
|
|
75
|
+
})()}`;
|
|
76
|
+
return http(client)
|
|
77
|
+
.get(path, options)
|
|
78
|
+
.json()
|
|
79
|
+
.then((data) => {
|
|
80
|
+
if (client._options.validate) {
|
|
81
|
+
assertValid(schemas.getPlanResponseWire, data);
|
|
82
|
+
}
|
|
83
|
+
return fromWire(data, schemas.getPlanResponse);
|
|
84
|
+
});
|
|
85
|
+
});
|
|
28
86
|
}
|
|
29
87
|
export function deletePlan(client, req, options) {
|
|
30
|
-
const path = encodePath('openmeter/plans/{planId}', { planId: req.planId });
|
|
31
88
|
return request(async () => {
|
|
89
|
+
const path = `openmeter/plans/${(() => {
|
|
90
|
+
if (req.planId === undefined) {
|
|
91
|
+
throw new Error('missing path parameter: planId');
|
|
92
|
+
}
|
|
93
|
+
return encodeURIComponent(String(req.planId));
|
|
94
|
+
})()}`;
|
|
32
95
|
await http(client).delete(path, options);
|
|
33
96
|
});
|
|
34
97
|
}
|
|
35
98
|
export function archivePlan(client, req, options) {
|
|
36
|
-
|
|
37
|
-
|
|
99
|
+
return request(() => {
|
|
100
|
+
const path = `openmeter/plans/${(() => {
|
|
101
|
+
if (req.planId === undefined) {
|
|
102
|
+
throw new Error('missing path parameter: planId');
|
|
103
|
+
}
|
|
104
|
+
return encodeURIComponent(String(req.planId));
|
|
105
|
+
})()}/archive`;
|
|
106
|
+
return http(client)
|
|
107
|
+
.post(path, options)
|
|
108
|
+
.json()
|
|
109
|
+
.then((data) => {
|
|
110
|
+
if (client._options.validate) {
|
|
111
|
+
assertValid(schemas.archivePlanResponseWire, data);
|
|
112
|
+
}
|
|
113
|
+
return fromWire(data, schemas.archivePlanResponse);
|
|
114
|
+
});
|
|
38
115
|
});
|
|
39
|
-
return request(() => http(client).post(path, options).json());
|
|
40
116
|
}
|
|
41
117
|
export function publishPlan(client, req, options) {
|
|
42
|
-
|
|
43
|
-
|
|
118
|
+
return request(() => {
|
|
119
|
+
const path = `openmeter/plans/${(() => {
|
|
120
|
+
if (req.planId === undefined) {
|
|
121
|
+
throw new Error('missing path parameter: planId');
|
|
122
|
+
}
|
|
123
|
+
return encodeURIComponent(String(req.planId));
|
|
124
|
+
})()}/publish`;
|
|
125
|
+
return http(client)
|
|
126
|
+
.post(path, options)
|
|
127
|
+
.json()
|
|
128
|
+
.then((data) => {
|
|
129
|
+
if (client._options.validate) {
|
|
130
|
+
assertValid(schemas.publishPlanResponseWire, data);
|
|
131
|
+
}
|
|
132
|
+
return fromWire(data, schemas.publishPlanResponse);
|
|
133
|
+
});
|
|
44
134
|
});
|
|
45
|
-
return request(() => http(client).post(path, options).json());
|
|
46
135
|
}
|
|
47
136
|
//# sourceMappingURL=plans.js.map
|
|
@@ -1,12 +1,13 @@
|
|
|
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
4
|
export declare function createSubscription(client: Client, req: CreateSubscriptionRequest, options?: RequestOptions): Promise<Result<CreateSubscriptionResponse>>;
|
|
5
5
|
export declare function listSubscriptions(client: Client, req?: ListSubscriptionsRequest, options?: RequestOptions): Promise<Result<ListSubscriptionsResponse>>;
|
|
6
6
|
export declare function getSubscription(client: Client, req: GetSubscriptionRequest, options?: RequestOptions): Promise<Result<GetSubscriptionResponse>>;
|
|
7
7
|
export declare function cancelSubscription(client: Client, req: CancelSubscriptionRequest, options?: RequestOptions): Promise<Result<CancelSubscriptionResponse>>;
|
|
8
8
|
export declare function unscheduleCancelation(client: Client, req: UnscheduleCancelationRequest, options?: RequestOptions): Promise<Result<UnscheduleCancelationResponse>>;
|
|
9
9
|
export declare function changeSubscription(client: Client, req: ChangeSubscriptionRequest, options?: RequestOptions): Promise<Result<ChangeSubscriptionResponse>>;
|
|
10
|
+
export declare function createSubscriptionAddon(client: Client, req: CreateSubscriptionAddonRequest, options?: RequestOptions): Promise<Result<CreateSubscriptionAddonResponse>>;
|
|
10
11
|
export declare function listSubscriptionAddons(client: Client, req: ListSubscriptionAddonsRequest, options?: RequestOptions): Promise<Result<ListSubscriptionAddonsResponse>>;
|
|
11
12
|
export declare function getSubscriptionAddon(client: Client, req: GetSubscriptionAddonRequest, options?: RequestOptions): Promise<Result<GetSubscriptionAddonResponse>>;
|
|
12
13
|
//# sourceMappingURL=subscriptions.d.ts.map
|