@openmeter/client 1.0.0-beta.232 → 1.0.0-beta.234
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 +112 -43
- package/dist/funcs/apps.js +7 -2
- package/dist/funcs/billing.js +7 -2
- package/dist/funcs/charges.d.ts +14 -0
- package/dist/funcs/charges.js +42 -0
- package/dist/funcs/customers.d.ts +112 -1
- package/dist/funcs/customers.js +430 -0
- package/dist/funcs/{governance.d.ts → entitlementAccess.d.ts} +4 -4
- package/dist/funcs/{governance.js → entitlementAccess.js} +10 -10
- package/dist/funcs/entitlements.d.ts +46 -1
- package/dist/funcs/entitlements.js +213 -1
- package/dist/funcs/grants.d.ts +24 -0
- package/dist/funcs/grants.js +78 -0
- package/dist/funcs/index.d.ts +4 -1
- package/dist/funcs/index.js +4 -1
- package/dist/funcs/notifications.d.ts +43 -0
- package/dist/funcs/notifications.js +163 -0
- package/dist/funcs/planAddons.js +7 -2
- package/dist/funcs/subscriptions.d.ts +60 -1
- package/dist/funcs/subscriptions.js +204 -0
- package/dist/index.d.ts +6 -2
- package/dist/index.js +1 -0
- package/dist/lib/version.d.ts +1 -1
- package/dist/lib/version.js +1 -1
- package/dist/lib/wire.js +62 -6
- package/dist/models/operations/apps.d.ts +17 -1
- package/dist/models/operations/billing.d.ts +19 -1
- package/dist/models/operations/charges.d.ts +54 -0
- package/dist/models/operations/customers.d.ts +127 -5
- package/dist/models/operations/entitlementAccess.d.ts +9 -0
- package/dist/models/operations/entitlementAccess.js +2 -0
- package/dist/models/operations/entitlements.d.ts +73 -1
- package/dist/models/operations/grants.d.ts +43 -0
- package/dist/models/operations/grants.js +2 -0
- package/dist/models/operations/notifications.d.ts +46 -0
- package/dist/models/operations/notifications.js +2 -0
- package/dist/models/operations/planAddons.d.ts +14 -1
- package/dist/models/operations/subscriptions.d.ts +27 -3
- package/dist/models/schemas.d.ts +51330 -23237
- package/dist/models/schemas.js +4837 -1735
- package/dist/models/types.d.ts +4758 -1592
- package/dist/sdk/apps.d.ts +2 -44
- package/dist/sdk/apps.js +1 -53
- package/dist/sdk/customers.d.ts +2 -56
- package/dist/sdk/customers.js +1 -67
- package/dist/sdk/internal.d.ts +491 -28
- package/dist/sdk/internal.js +607 -30
- package/dist/sdk/invoices.d.ts +112 -0
- package/dist/sdk/invoices.js +115 -0
- package/dist/sdk/notifications.d.ts +58 -0
- package/dist/sdk/notifications.js +72 -0
- package/dist/sdk/planAddons.d.ts +1 -20
- package/dist/sdk/planAddons.js +1 -24
- package/dist/sdk/sdk.d.ts +3 -0
- package/dist/sdk/sdk.js +5 -0
- package/dist/sdk/subscriptions.d.ts +12 -1
- package/dist/sdk/subscriptions.js +14 -1
- package/package.json +1 -1
- package/dist/models/operations/governance.d.ts +0 -9
- /package/dist/models/operations/{governance.js → charges.js} +0 -0
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
// Code generated by @openmeter/typespec-typescript. DO NOT EDIT.
|
|
2
2
|
import { http } from '../core.js';
|
|
3
3
|
import { request } from '../lib/request.js';
|
|
4
|
-
import {
|
|
4
|
+
import { toURLSearchParams, encodeSort } from '../lib/encodings.js';
|
|
5
|
+
import { toWire, toPathWire, fromWire, assertValid, toSnakeCase, } from '../lib/wire.js';
|
|
5
6
|
import * as schemas from '../models/schemas.js';
|
|
6
7
|
/**
|
|
7
8
|
* List customer entitlement access
|
|
@@ -36,3 +37,214 @@ export function listCustomerEntitlementAccess(client, req, options) {
|
|
|
36
37
|
});
|
|
37
38
|
});
|
|
38
39
|
}
|
|
40
|
+
/**
|
|
41
|
+
* Get customer entitlement access
|
|
42
|
+
*
|
|
43
|
+
* Get the customer's access to a single feature.
|
|
44
|
+
*
|
|
45
|
+
* GET /openmeter/customers/{customerId}/entitlement-access/features/{featureKey}
|
|
46
|
+
*/
|
|
47
|
+
export function getCustomerEntitlementAccess(client, req, options) {
|
|
48
|
+
return request(() => {
|
|
49
|
+
const pathParamsInput = {
|
|
50
|
+
customerId: req.customerId,
|
|
51
|
+
featureKey: req.featureKey,
|
|
52
|
+
};
|
|
53
|
+
const pathParams = client._options.validate
|
|
54
|
+
? toPathWire(pathParamsInput, schemas.getCustomerEntitlementAccessPathParams)
|
|
55
|
+
: pathParamsInput;
|
|
56
|
+
if (client._options.validate) {
|
|
57
|
+
assertValid(schemas.getCustomerEntitlementAccessPathParamsWire, pathParams);
|
|
58
|
+
}
|
|
59
|
+
const path = `openmeter/customers/${(() => {
|
|
60
|
+
if (pathParams.customerId === undefined) {
|
|
61
|
+
throw new Error('missing path parameter: customerId');
|
|
62
|
+
}
|
|
63
|
+
return encodeURIComponent(String(pathParams.customerId));
|
|
64
|
+
})()}/entitlement-access/features/${(() => {
|
|
65
|
+
if (pathParams.featureKey === undefined) {
|
|
66
|
+
throw new Error('missing path parameter: featureKey');
|
|
67
|
+
}
|
|
68
|
+
return encodeURIComponent(String(pathParams.featureKey));
|
|
69
|
+
})()}`;
|
|
70
|
+
return http(client)
|
|
71
|
+
.get(path, options)
|
|
72
|
+
.json()
|
|
73
|
+
.then((data) => {
|
|
74
|
+
if (client._options.validate) {
|
|
75
|
+
assertValid(schemas.getCustomerEntitlementAccessResponseWire, data);
|
|
76
|
+
}
|
|
77
|
+
return fromWire(data, schemas.getCustomerEntitlementAccessResponse);
|
|
78
|
+
});
|
|
79
|
+
});
|
|
80
|
+
}
|
|
81
|
+
/**
|
|
82
|
+
* Get customer entitlement value by feature key
|
|
83
|
+
*
|
|
84
|
+
* Get the customer's entitlement value for a feature at a point in time. Without
|
|
85
|
+
* an active entitlement, the result denies access and omits the type.
|
|
86
|
+
*
|
|
87
|
+
* GET /openmeter/customers/{customerId}/entitlement-access/features/{featureKey}/value
|
|
88
|
+
*/
|
|
89
|
+
export function getCustomerEntitlementValueByFeatureKey(client, req, options) {
|
|
90
|
+
return request(() => {
|
|
91
|
+
const pathParamsInput = {
|
|
92
|
+
customerId: req.customerId,
|
|
93
|
+
featureKey: req.featureKey,
|
|
94
|
+
};
|
|
95
|
+
const pathParams = client._options.validate
|
|
96
|
+
? toPathWire(pathParamsInput, schemas.getCustomerEntitlementValueByFeatureKeyPathParams)
|
|
97
|
+
: pathParamsInput;
|
|
98
|
+
if (client._options.validate) {
|
|
99
|
+
assertValid(schemas.getCustomerEntitlementValueByFeatureKeyPathParamsWire, pathParams);
|
|
100
|
+
}
|
|
101
|
+
const path = `openmeter/customers/${(() => {
|
|
102
|
+
if (pathParams.customerId === undefined) {
|
|
103
|
+
throw new Error('missing path parameter: customerId');
|
|
104
|
+
}
|
|
105
|
+
return encodeURIComponent(String(pathParams.customerId));
|
|
106
|
+
})()}/entitlement-access/features/${(() => {
|
|
107
|
+
if (pathParams.featureKey === undefined) {
|
|
108
|
+
throw new Error('missing path parameter: featureKey');
|
|
109
|
+
}
|
|
110
|
+
return encodeURIComponent(String(pathParams.featureKey));
|
|
111
|
+
})()}/value`;
|
|
112
|
+
const query = toWire({
|
|
113
|
+
expand: req.expand,
|
|
114
|
+
at: req.at,
|
|
115
|
+
}, schemas.getCustomerEntitlementValueByFeatureKeyQueryParams);
|
|
116
|
+
if (client._options.validate) {
|
|
117
|
+
assertValid(schemas.getCustomerEntitlementValueByFeatureKeyQueryParamsWire, query);
|
|
118
|
+
}
|
|
119
|
+
const searchParams = toURLSearchParams(query);
|
|
120
|
+
return http(client)
|
|
121
|
+
.get(path, { ...options, searchParams })
|
|
122
|
+
.json()
|
|
123
|
+
.then((data) => {
|
|
124
|
+
if (client._options.validate) {
|
|
125
|
+
assertValid(schemas.getCustomerEntitlementValueByFeatureKeyResponseWire, data);
|
|
126
|
+
}
|
|
127
|
+
return fromWire(data, schemas.getCustomerEntitlementValueByFeatureKeyResponse);
|
|
128
|
+
});
|
|
129
|
+
});
|
|
130
|
+
}
|
|
131
|
+
/**
|
|
132
|
+
* List entitlements
|
|
133
|
+
*
|
|
134
|
+
* List the active entitlements of all customers. Intended for administrative use.
|
|
135
|
+
* To list the entitlements of a single customer, use the customer entitlements
|
|
136
|
+
* endpoints; to check entitlement access, use the entitlement access endpoints.
|
|
137
|
+
*
|
|
138
|
+
* GET /openmeter/entitlements
|
|
139
|
+
*/
|
|
140
|
+
export function listEntitlements(client, req = {}, options) {
|
|
141
|
+
return request(() => {
|
|
142
|
+
if (client._options.validate && req.sort !== undefined) {
|
|
143
|
+
assertValid(schemas.listEntitlementsQueryParams.shape.sort, req.sort);
|
|
144
|
+
}
|
|
145
|
+
const query = toWire({
|
|
146
|
+
page: req.page,
|
|
147
|
+
sort: encodeSort(req.sort, toSnakeCase),
|
|
148
|
+
filter: req.filter,
|
|
149
|
+
}, schemas.listEntitlementsQueryParams);
|
|
150
|
+
if (client._options.validate) {
|
|
151
|
+
assertValid(schemas.listEntitlementsQueryParamsWire, query);
|
|
152
|
+
}
|
|
153
|
+
const searchParams = toURLSearchParams(query);
|
|
154
|
+
return http(client)
|
|
155
|
+
.get('openmeter/entitlements', { ...options, searchParams })
|
|
156
|
+
.json()
|
|
157
|
+
.then((data) => {
|
|
158
|
+
if (client._options.validate) {
|
|
159
|
+
assertValid(schemas.listEntitlementsResponseWire, data);
|
|
160
|
+
}
|
|
161
|
+
return fromWire(data, schemas.listEntitlementsResponse);
|
|
162
|
+
});
|
|
163
|
+
});
|
|
164
|
+
}
|
|
165
|
+
/**
|
|
166
|
+
* Get entitlement
|
|
167
|
+
*
|
|
168
|
+
* Get an entitlement by ID. To check entitlement access, use the entitlement
|
|
169
|
+
* access endpoints instead.
|
|
170
|
+
*
|
|
171
|
+
* GET /openmeter/entitlements/{entitlementId}
|
|
172
|
+
*/
|
|
173
|
+
export function getEntitlement(client, req, options) {
|
|
174
|
+
return request(() => {
|
|
175
|
+
const pathParamsInput = {
|
|
176
|
+
entitlementId: req.entitlementId,
|
|
177
|
+
};
|
|
178
|
+
const pathParams = client._options.validate
|
|
179
|
+
? toPathWire(pathParamsInput, schemas.getEntitlementPathParams)
|
|
180
|
+
: pathParamsInput;
|
|
181
|
+
if (client._options.validate) {
|
|
182
|
+
assertValid(schemas.getEntitlementPathParamsWire, pathParams);
|
|
183
|
+
}
|
|
184
|
+
const path = `openmeter/entitlements/${(() => {
|
|
185
|
+
if (pathParams.entitlementId === undefined) {
|
|
186
|
+
throw new Error('missing path parameter: entitlementId');
|
|
187
|
+
}
|
|
188
|
+
return encodeURIComponent(String(pathParams.entitlementId));
|
|
189
|
+
})()}`;
|
|
190
|
+
return http(client)
|
|
191
|
+
.get(path, options)
|
|
192
|
+
.json()
|
|
193
|
+
.then((data) => {
|
|
194
|
+
if (client._options.validate) {
|
|
195
|
+
assertValid(schemas.getEntitlementResponseWire, data);
|
|
196
|
+
}
|
|
197
|
+
return fromWire(data, schemas.getEntitlementResponse);
|
|
198
|
+
});
|
|
199
|
+
});
|
|
200
|
+
}
|
|
201
|
+
/**
|
|
202
|
+
* Get customer entitlement value
|
|
203
|
+
*
|
|
204
|
+
* Get the customer's access through a single entitlement, optionally evaluated at
|
|
205
|
+
* a point in time.
|
|
206
|
+
*
|
|
207
|
+
* GET /openmeter/customers/{customerId}/entitlements/{entitlementId}/value
|
|
208
|
+
*/
|
|
209
|
+
export function getCustomerEntitlementValue(client, req, options) {
|
|
210
|
+
return request(() => {
|
|
211
|
+
const pathParamsInput = {
|
|
212
|
+
customerId: req.customerId,
|
|
213
|
+
entitlementId: req.entitlementId,
|
|
214
|
+
};
|
|
215
|
+
const pathParams = client._options.validate
|
|
216
|
+
? toPathWire(pathParamsInput, schemas.getCustomerEntitlementValuePathParams)
|
|
217
|
+
: pathParamsInput;
|
|
218
|
+
if (client._options.validate) {
|
|
219
|
+
assertValid(schemas.getCustomerEntitlementValuePathParamsWire, pathParams);
|
|
220
|
+
}
|
|
221
|
+
const path = `openmeter/customers/${(() => {
|
|
222
|
+
if (pathParams.customerId === undefined) {
|
|
223
|
+
throw new Error('missing path parameter: customerId');
|
|
224
|
+
}
|
|
225
|
+
return encodeURIComponent(String(pathParams.customerId));
|
|
226
|
+
})()}/entitlements/${(() => {
|
|
227
|
+
if (pathParams.entitlementId === undefined) {
|
|
228
|
+
throw new Error('missing path parameter: entitlementId');
|
|
229
|
+
}
|
|
230
|
+
return encodeURIComponent(String(pathParams.entitlementId));
|
|
231
|
+
})()}/value`;
|
|
232
|
+
const query = toWire({
|
|
233
|
+
expand: req.expand,
|
|
234
|
+
at: req.at,
|
|
235
|
+
}, schemas.getCustomerEntitlementValueQueryParams);
|
|
236
|
+
if (client._options.validate) {
|
|
237
|
+
assertValid(schemas.getCustomerEntitlementValueQueryParamsWire, query);
|
|
238
|
+
}
|
|
239
|
+
const searchParams = toURLSearchParams(query);
|
|
240
|
+
return http(client)
|
|
241
|
+
.get(path, { ...options, searchParams })
|
|
242
|
+
.json()
|
|
243
|
+
.then((data) => {
|
|
244
|
+
if (client._options.validate) {
|
|
245
|
+
assertValid(schemas.getCustomerEntitlementValueResponseWire, data);
|
|
246
|
+
}
|
|
247
|
+
return fromWire(data, schemas.getCustomerEntitlementValueResponse);
|
|
248
|
+
});
|
|
249
|
+
});
|
|
250
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { type Client } from '../core.js';
|
|
2
|
+
import { type Result, type RequestOptions } from '../lib/types.js';
|
|
3
|
+
import type { ListGrantsRequest, ListGrantsResponse, VoidGrantRequest, VoidGrantResponse } from '../models/operations/grants.js';
|
|
4
|
+
/**
|
|
5
|
+
* List grants
|
|
6
|
+
*
|
|
7
|
+
* List the grants of all customers and entitlements. To list the grants of a
|
|
8
|
+
* single entitlement, use the customer entitlement grants endpoint.
|
|
9
|
+
*
|
|
10
|
+
* Deleted grants are excluded unless `include_deleted` is set. Voided and expired
|
|
11
|
+
* grants are always included, as they are part of the balance history.
|
|
12
|
+
*
|
|
13
|
+
* GET /openmeter/grants
|
|
14
|
+
*/
|
|
15
|
+
export declare function listGrants(client: Client, req?: ListGrantsRequest, options?: RequestOptions): Promise<Result<ListGrantsResponse>>;
|
|
16
|
+
/**
|
|
17
|
+
* Void grant
|
|
18
|
+
*
|
|
19
|
+
* Void a grant so it no longer adds to the balance. Usage already deducted from
|
|
20
|
+
* the grant is kept.
|
|
21
|
+
*
|
|
22
|
+
* DELETE /openmeter/grants/{grantId}
|
|
23
|
+
*/
|
|
24
|
+
export declare function voidGrant(client: Client, req: VoidGrantRequest, options?: RequestOptions): Promise<Result<VoidGrantResponse>>;
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
// Code generated by @openmeter/typespec-typescript. DO NOT EDIT.
|
|
2
|
+
import { http } from '../core.js';
|
|
3
|
+
import { request } from '../lib/request.js';
|
|
4
|
+
import { toURLSearchParams, encodeSort } from '../lib/encodings.js';
|
|
5
|
+
import { toWire, toPathWire, fromWire, assertValid, toSnakeCase, } from '../lib/wire.js';
|
|
6
|
+
import * as schemas from '../models/schemas.js';
|
|
7
|
+
/**
|
|
8
|
+
* List grants
|
|
9
|
+
*
|
|
10
|
+
* List the grants of all customers and entitlements. To list the grants of a
|
|
11
|
+
* single entitlement, use the customer entitlement grants endpoint.
|
|
12
|
+
*
|
|
13
|
+
* Deleted grants are excluded unless `include_deleted` is set. Voided and expired
|
|
14
|
+
* grants are always included, as they are part of the balance history.
|
|
15
|
+
*
|
|
16
|
+
* GET /openmeter/grants
|
|
17
|
+
*/
|
|
18
|
+
export function listGrants(client, req = {}, options) {
|
|
19
|
+
return request(() => {
|
|
20
|
+
if (client._options.validate && req.sort !== undefined) {
|
|
21
|
+
assertValid(schemas.listGrantsQueryParams.shape.sort, req.sort);
|
|
22
|
+
}
|
|
23
|
+
const query = toWire({
|
|
24
|
+
page: req.page,
|
|
25
|
+
sort: encodeSort(req.sort, toSnakeCase),
|
|
26
|
+
filter: req.filter,
|
|
27
|
+
includeDeleted: req.includeDeleted,
|
|
28
|
+
}, schemas.listGrantsQueryParams);
|
|
29
|
+
if (client._options.validate) {
|
|
30
|
+
assertValid(schemas.listGrantsQueryParamsWire, query);
|
|
31
|
+
}
|
|
32
|
+
const searchParams = toURLSearchParams(query);
|
|
33
|
+
return http(client)
|
|
34
|
+
.get('openmeter/grants', { ...options, searchParams })
|
|
35
|
+
.json()
|
|
36
|
+
.then((data) => {
|
|
37
|
+
if (client._options.validate) {
|
|
38
|
+
assertValid(schemas.listGrantsResponseWire, data);
|
|
39
|
+
}
|
|
40
|
+
return fromWire(data, schemas.listGrantsResponse);
|
|
41
|
+
});
|
|
42
|
+
});
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* Void grant
|
|
46
|
+
*
|
|
47
|
+
* Void a grant so it no longer adds to the balance. Usage already deducted from
|
|
48
|
+
* the grant is kept.
|
|
49
|
+
*
|
|
50
|
+
* DELETE /openmeter/grants/{grantId}
|
|
51
|
+
*/
|
|
52
|
+
export function voidGrant(client, req, options) {
|
|
53
|
+
return request(async () => {
|
|
54
|
+
const pathParamsInput = {
|
|
55
|
+
grantId: req.grantId,
|
|
56
|
+
};
|
|
57
|
+
const pathParams = client._options.validate
|
|
58
|
+
? toPathWire(pathParamsInput, schemas.voidGrantPathParams)
|
|
59
|
+
: pathParamsInput;
|
|
60
|
+
if (client._options.validate) {
|
|
61
|
+
assertValid(schemas.voidGrantPathParamsWire, pathParams);
|
|
62
|
+
}
|
|
63
|
+
const path = `openmeter/grants/${(() => {
|
|
64
|
+
if (pathParams.grantId === undefined) {
|
|
65
|
+
throw new Error('missing path parameter: grantId');
|
|
66
|
+
}
|
|
67
|
+
return encodeURIComponent(String(pathParams.grantId));
|
|
68
|
+
})()}`;
|
|
69
|
+
const query = toWire({
|
|
70
|
+
voidedAt: req.voidedAt,
|
|
71
|
+
}, schemas.voidGrantQueryParams);
|
|
72
|
+
if (client._options.validate) {
|
|
73
|
+
assertValid(schemas.voidGrantQueryParamsWire, query);
|
|
74
|
+
}
|
|
75
|
+
const searchParams = toURLSearchParams(query);
|
|
76
|
+
await http(client).delete(path, { ...options, searchParams });
|
|
77
|
+
});
|
|
78
|
+
}
|
package/dist/funcs/index.d.ts
CHANGED
|
@@ -2,10 +2,12 @@ export * from './events.js';
|
|
|
2
2
|
export * from './meters.js';
|
|
3
3
|
export * from './customers.js';
|
|
4
4
|
export * from './entitlements.js';
|
|
5
|
+
export * from './grants.js';
|
|
5
6
|
export * from './subscriptions.js';
|
|
6
7
|
export * from './apps.js';
|
|
7
8
|
export * from './billing.js';
|
|
8
9
|
export * from './invoices.js';
|
|
10
|
+
export * from './charges.js';
|
|
9
11
|
export * from './tax.js';
|
|
10
12
|
export * from './currencies.js';
|
|
11
13
|
export * from './features.js';
|
|
@@ -14,4 +16,5 @@ export * from './plans.js';
|
|
|
14
16
|
export * from './addons.js';
|
|
15
17
|
export * from './planAddons.js';
|
|
16
18
|
export * from './defaults.js';
|
|
17
|
-
export * from './
|
|
19
|
+
export * from './entitlementAccess.js';
|
|
20
|
+
export * from './notifications.js';
|
package/dist/funcs/index.js
CHANGED
|
@@ -3,10 +3,12 @@ export * from './events.js';
|
|
|
3
3
|
export * from './meters.js';
|
|
4
4
|
export * from './customers.js';
|
|
5
5
|
export * from './entitlements.js';
|
|
6
|
+
export * from './grants.js';
|
|
6
7
|
export * from './subscriptions.js';
|
|
7
8
|
export * from './apps.js';
|
|
8
9
|
export * from './billing.js';
|
|
9
10
|
export * from './invoices.js';
|
|
11
|
+
export * from './charges.js';
|
|
10
12
|
export * from './tax.js';
|
|
11
13
|
export * from './currencies.js';
|
|
12
14
|
export * from './features.js';
|
|
@@ -15,4 +17,5 @@ export * from './plans.js';
|
|
|
15
17
|
export * from './addons.js';
|
|
16
18
|
export * from './planAddons.js';
|
|
17
19
|
export * from './defaults.js';
|
|
18
|
-
export * from './
|
|
20
|
+
export * from './entitlementAccess.js';
|
|
21
|
+
export * from './notifications.js';
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { type Client } from '../core.js';
|
|
2
|
+
import { type Result, type RequestOptions } from '../lib/types.js';
|
|
3
|
+
import type { ListNotificationChannelsRequest, ListNotificationChannelsResponse, CreateNotificationChannelRequest, CreateNotificationChannelResponse, GetNotificationChannelRequest, GetNotificationChannelResponse, UpdateNotificationChannelRequest, UpdateNotificationChannelResponse, DeleteNotificationChannelRequest, DeleteNotificationChannelResponse } from '../models/operations/notifications.js';
|
|
4
|
+
/**
|
|
5
|
+
* List notification channels
|
|
6
|
+
*
|
|
7
|
+
* List all notification channels.
|
|
8
|
+
*
|
|
9
|
+
* GET /openmeter/notification/channels
|
|
10
|
+
*/
|
|
11
|
+
export declare function listNotificationChannels(client: Client, req?: ListNotificationChannelsRequest, options?: RequestOptions): Promise<Result<ListNotificationChannelsResponse>>;
|
|
12
|
+
/**
|
|
13
|
+
* Create notification channel
|
|
14
|
+
*
|
|
15
|
+
* Create a notification channel.
|
|
16
|
+
*
|
|
17
|
+
* POST /openmeter/notification/channels
|
|
18
|
+
*/
|
|
19
|
+
export declare function createNotificationChannel(client: Client, req: CreateNotificationChannelRequest, options?: RequestOptions): Promise<Result<CreateNotificationChannelResponse>>;
|
|
20
|
+
/**
|
|
21
|
+
* Get notification channel
|
|
22
|
+
*
|
|
23
|
+
* Get a notification channel by id.
|
|
24
|
+
*
|
|
25
|
+
* GET /openmeter/notification/channels/{notificationChannelId}
|
|
26
|
+
*/
|
|
27
|
+
export declare function getNotificationChannel(client: Client, req: GetNotificationChannelRequest, options?: RequestOptions): Promise<Result<GetNotificationChannelResponse>>;
|
|
28
|
+
/**
|
|
29
|
+
* Update notification channel
|
|
30
|
+
*
|
|
31
|
+
* Update a notification channel by id.
|
|
32
|
+
*
|
|
33
|
+
* PUT /openmeter/notification/channels/{notificationChannelId}
|
|
34
|
+
*/
|
|
35
|
+
export declare function updateNotificationChannel(client: Client, req: UpdateNotificationChannelRequest, options?: RequestOptions): Promise<Result<UpdateNotificationChannelResponse>>;
|
|
36
|
+
/**
|
|
37
|
+
* Delete notification channel
|
|
38
|
+
*
|
|
39
|
+
* Delete a notification channel by id.
|
|
40
|
+
*
|
|
41
|
+
* DELETE /openmeter/notification/channels/{notificationChannelId}
|
|
42
|
+
*/
|
|
43
|
+
export declare function deleteNotificationChannel(client: Client, req: DeleteNotificationChannelRequest, options?: RequestOptions): Promise<Result<DeleteNotificationChannelResponse>>;
|
|
@@ -0,0 +1,163 @@
|
|
|
1
|
+
// Code generated by @openmeter/typespec-typescript. DO NOT EDIT.
|
|
2
|
+
import { http } from '../core.js';
|
|
3
|
+
import { request } from '../lib/request.js';
|
|
4
|
+
import { toURLSearchParams, encodeSort } from '../lib/encodings.js';
|
|
5
|
+
import { toWire, toPathWire, fromWire, assertValid, toSnakeCase, } from '../lib/wire.js';
|
|
6
|
+
import * as schemas from '../models/schemas.js';
|
|
7
|
+
/**
|
|
8
|
+
* List notification channels
|
|
9
|
+
*
|
|
10
|
+
* List all notification channels.
|
|
11
|
+
*
|
|
12
|
+
* GET /openmeter/notification/channels
|
|
13
|
+
*/
|
|
14
|
+
export function listNotificationChannels(client, req = {}, options) {
|
|
15
|
+
return request(() => {
|
|
16
|
+
if (client._options.validate && req.sort !== undefined) {
|
|
17
|
+
assertValid(schemas.listNotificationChannelsQueryParams.shape.sort, req.sort);
|
|
18
|
+
}
|
|
19
|
+
const query = toWire({
|
|
20
|
+
page: req.page,
|
|
21
|
+
sort: encodeSort(req.sort, toSnakeCase),
|
|
22
|
+
filter: req.filter,
|
|
23
|
+
}, schemas.listNotificationChannelsQueryParams);
|
|
24
|
+
if (client._options.validate) {
|
|
25
|
+
assertValid(schemas.listNotificationChannelsQueryParamsWire, query);
|
|
26
|
+
}
|
|
27
|
+
const searchParams = toURLSearchParams(query);
|
|
28
|
+
return http(client)
|
|
29
|
+
.get('openmeter/notification/channels', { ...options, searchParams })
|
|
30
|
+
.json()
|
|
31
|
+
.then((data) => {
|
|
32
|
+
if (client._options.validate) {
|
|
33
|
+
assertValid(schemas.listNotificationChannelsResponseWire, data);
|
|
34
|
+
}
|
|
35
|
+
return fromWire(data, schemas.listNotificationChannelsResponse);
|
|
36
|
+
});
|
|
37
|
+
});
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* Create notification channel
|
|
41
|
+
*
|
|
42
|
+
* Create a notification channel.
|
|
43
|
+
*
|
|
44
|
+
* POST /openmeter/notification/channels
|
|
45
|
+
*/
|
|
46
|
+
export function createNotificationChannel(client, req, options) {
|
|
47
|
+
return request(() => {
|
|
48
|
+
const body = toWire(req, schemas.createNotificationChannelBody);
|
|
49
|
+
if (client._options.validate) {
|
|
50
|
+
assertValid(schemas.createNotificationChannelBodyWire, body);
|
|
51
|
+
}
|
|
52
|
+
return http(client)
|
|
53
|
+
.post('openmeter/notification/channels', { ...options, json: body })
|
|
54
|
+
.json()
|
|
55
|
+
.then((data) => {
|
|
56
|
+
if (client._options.validate) {
|
|
57
|
+
assertValid(schemas.createNotificationChannelResponseWire, data);
|
|
58
|
+
}
|
|
59
|
+
return fromWire(data, schemas.createNotificationChannelResponse);
|
|
60
|
+
});
|
|
61
|
+
});
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* Get notification channel
|
|
65
|
+
*
|
|
66
|
+
* Get a notification channel by id.
|
|
67
|
+
*
|
|
68
|
+
* GET /openmeter/notification/channels/{notificationChannelId}
|
|
69
|
+
*/
|
|
70
|
+
export function getNotificationChannel(client, req, options) {
|
|
71
|
+
return request(() => {
|
|
72
|
+
const pathParamsInput = {
|
|
73
|
+
notificationChannelId: req.notificationChannelId,
|
|
74
|
+
};
|
|
75
|
+
const pathParams = client._options.validate
|
|
76
|
+
? toPathWire(pathParamsInput, schemas.getNotificationChannelPathParams)
|
|
77
|
+
: pathParamsInput;
|
|
78
|
+
if (client._options.validate) {
|
|
79
|
+
assertValid(schemas.getNotificationChannelPathParamsWire, pathParams);
|
|
80
|
+
}
|
|
81
|
+
const path = `openmeter/notification/channels/${(() => {
|
|
82
|
+
if (pathParams.notificationChannelId === undefined) {
|
|
83
|
+
throw new Error('missing path parameter: notificationChannelId');
|
|
84
|
+
}
|
|
85
|
+
return encodeURIComponent(String(pathParams.notificationChannelId));
|
|
86
|
+
})()}`;
|
|
87
|
+
return http(client)
|
|
88
|
+
.get(path, options)
|
|
89
|
+
.json()
|
|
90
|
+
.then((data) => {
|
|
91
|
+
if (client._options.validate) {
|
|
92
|
+
assertValid(schemas.getNotificationChannelResponseWire, data);
|
|
93
|
+
}
|
|
94
|
+
return fromWire(data, schemas.getNotificationChannelResponse);
|
|
95
|
+
});
|
|
96
|
+
});
|
|
97
|
+
}
|
|
98
|
+
/**
|
|
99
|
+
* Update notification channel
|
|
100
|
+
*
|
|
101
|
+
* Update a notification channel by id.
|
|
102
|
+
*
|
|
103
|
+
* PUT /openmeter/notification/channels/{notificationChannelId}
|
|
104
|
+
*/
|
|
105
|
+
export function updateNotificationChannel(client, req, options) {
|
|
106
|
+
return request(() => {
|
|
107
|
+
const pathParamsInput = {
|
|
108
|
+
notificationChannelId: req.notificationChannelId,
|
|
109
|
+
};
|
|
110
|
+
const pathParams = client._options.validate
|
|
111
|
+
? toPathWire(pathParamsInput, schemas.updateNotificationChannelPathParams)
|
|
112
|
+
: pathParamsInput;
|
|
113
|
+
if (client._options.validate) {
|
|
114
|
+
assertValid(schemas.updateNotificationChannelPathParamsWire, pathParams);
|
|
115
|
+
}
|
|
116
|
+
const path = `openmeter/notification/channels/${(() => {
|
|
117
|
+
if (pathParams.notificationChannelId === undefined) {
|
|
118
|
+
throw new Error('missing path parameter: notificationChannelId');
|
|
119
|
+
}
|
|
120
|
+
return encodeURIComponent(String(pathParams.notificationChannelId));
|
|
121
|
+
})()}`;
|
|
122
|
+
const body = toWire(req.body, schemas.updateNotificationChannelBody);
|
|
123
|
+
if (client._options.validate) {
|
|
124
|
+
assertValid(schemas.updateNotificationChannelBodyWire, body);
|
|
125
|
+
}
|
|
126
|
+
return http(client)
|
|
127
|
+
.put(path, { ...options, json: body })
|
|
128
|
+
.json()
|
|
129
|
+
.then((data) => {
|
|
130
|
+
if (client._options.validate) {
|
|
131
|
+
assertValid(schemas.updateNotificationChannelResponseWire, data);
|
|
132
|
+
}
|
|
133
|
+
return fromWire(data, schemas.updateNotificationChannelResponse);
|
|
134
|
+
});
|
|
135
|
+
});
|
|
136
|
+
}
|
|
137
|
+
/**
|
|
138
|
+
* Delete notification channel
|
|
139
|
+
*
|
|
140
|
+
* Delete a notification channel by id.
|
|
141
|
+
*
|
|
142
|
+
* DELETE /openmeter/notification/channels/{notificationChannelId}
|
|
143
|
+
*/
|
|
144
|
+
export function deleteNotificationChannel(client, req, options) {
|
|
145
|
+
return request(async () => {
|
|
146
|
+
const pathParamsInput = {
|
|
147
|
+
notificationChannelId: req.notificationChannelId,
|
|
148
|
+
};
|
|
149
|
+
const pathParams = client._options.validate
|
|
150
|
+
? toPathWire(pathParamsInput, schemas.deleteNotificationChannelPathParams)
|
|
151
|
+
: pathParamsInput;
|
|
152
|
+
if (client._options.validate) {
|
|
153
|
+
assertValid(schemas.deleteNotificationChannelPathParamsWire, pathParams);
|
|
154
|
+
}
|
|
155
|
+
const path = `openmeter/notification/channels/${(() => {
|
|
156
|
+
if (pathParams.notificationChannelId === undefined) {
|
|
157
|
+
throw new Error('missing path parameter: notificationChannelId');
|
|
158
|
+
}
|
|
159
|
+
return encodeURIComponent(String(pathParams.notificationChannelId));
|
|
160
|
+
})()}`;
|
|
161
|
+
await http(client).delete(path, options);
|
|
162
|
+
});
|
|
163
|
+
}
|
package/dist/funcs/planAddons.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
// Code generated by @openmeter/typespec-typescript. DO NOT EDIT.
|
|
2
2
|
import { http } from '../core.js';
|
|
3
3
|
import { request } from '../lib/request.js';
|
|
4
|
-
import { toURLSearchParams } from '../lib/encodings.js';
|
|
5
|
-
import { toWire, toPathWire, fromWire, assertValid } from '../lib/wire.js';
|
|
4
|
+
import { toURLSearchParams, encodeSort } from '../lib/encodings.js';
|
|
5
|
+
import { toWire, toPathWire, fromWire, assertValid, toSnakeCase, } from '../lib/wire.js';
|
|
6
6
|
import * as schemas from '../models/schemas.js';
|
|
7
7
|
/**
|
|
8
8
|
* List add-ons for plan
|
|
@@ -28,8 +28,13 @@ export function listPlanAddons(client, req, options) {
|
|
|
28
28
|
}
|
|
29
29
|
return encodeURIComponent(String(pathParams.planId));
|
|
30
30
|
})()}/addons`;
|
|
31
|
+
if (client._options.validate && req.sort !== undefined) {
|
|
32
|
+
assertValid(schemas.listPlanAddonsQueryParams.shape.sort, req.sort);
|
|
33
|
+
}
|
|
31
34
|
const query = toWire({
|
|
32
35
|
page: req.page,
|
|
36
|
+
sort: encodeSort(req.sort, toSnakeCase),
|
|
37
|
+
filter: req.filter,
|
|
33
38
|
}, schemas.listPlanAddonsQueryParams);
|
|
34
39
|
if (client._options.validate) {
|
|
35
40
|
assertValid(schemas.listPlanAddonsQueryParamsWire, query);
|