@openmeter/sdk 1.0.0-beta.9 → 1.0.0-beta.91
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 +62 -50
- package/dist/cjs/clients/client.cjs +117 -0
- package/dist/cjs/clients/client.d.cts +40 -0
- package/dist/cjs/clients/client.js.map +1 -0
- package/dist/cjs/clients/event.cjs +71 -0
- package/dist/cjs/clients/event.d.cts +79 -0
- package/dist/cjs/clients/event.js.map +1 -0
- package/dist/cjs/clients/meter.cjs +69 -0
- package/dist/cjs/clients/meter.d.cts +75 -0
- package/dist/cjs/clients/meter.js.map +1 -0
- package/dist/cjs/clients/portal.cjs +41 -0
- package/dist/cjs/clients/portal.d.cts +22 -0
- package/dist/cjs/clients/portal.js.map +1 -0
- package/dist/cjs/clients/subject.cjs +60 -0
- package/dist/cjs/clients/subject.d.cts +27 -0
- package/dist/cjs/clients/subject.js.map +1 -0
- package/dist/cjs/index.cjs +24 -0
- package/dist/cjs/index.d.cts +15 -0
- package/dist/cjs/index.js.map +1 -0
- package/dist/cjs/schemas/openapi.cjs +7 -0
- package/dist/cjs/schemas/openapi.d.cts +2022 -0
- package/dist/cjs/schemas/openapi.js.map +1 -0
- package/dist/cjs/test/agent.cjs +266 -0
- package/dist/cjs/test/agent.d.cts +2 -0
- package/dist/cjs/test/agent.js.map +1 -0
- package/dist/cjs/test/mocks.cjs +44 -0
- package/dist/cjs/test/mocks.d.cts +14 -0
- package/dist/cjs/test/mocks.js.map +1 -0
- package/dist/cjs/tsconfig.2fd2513a.tsbuildinfo +1 -0
- package/dist/cjs/tsconfig.ba4a040a.tsbuildinfo +1 -0
- package/dist/clients/client.d.ts +1 -1
- package/dist/clients/client.js +9 -1
- package/dist/clients/client.js.map +1 -0
- package/dist/clients/event.d.ts +5 -5
- package/dist/clients/event.js +29 -18
- package/dist/clients/event.js.map +1 -0
- package/dist/clients/meter.d.ts +9 -37
- package/dist/clients/meter.js +1 -15
- package/dist/clients/meter.js.map +1 -0
- package/dist/clients/portal.d.ts +22 -0
- package/dist/clients/portal.js +37 -0
- package/dist/clients/portal.js.map +1 -0
- package/dist/clients/subject.d.ts +27 -0
- package/dist/clients/subject.js +56 -0
- package/dist/clients/subject.js.map +1 -0
- package/dist/index.d.ts +6 -3
- package/dist/index.js +8 -2
- package/dist/index.js.map +1 -0
- package/dist/schemas/openapi.d.ts +1729 -246
- package/dist/schemas/openapi.js +1 -0
- package/dist/schemas/openapi.js.map +1 -0
- package/dist/test/agent.js +108 -29
- package/dist/test/agent.js.map +1 -0
- package/dist/test/mocks.d.ts +2 -0
- package/dist/test/mocks.js +9 -0
- package/dist/test/mocks.js.map +1 -0
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +43 -33
- package/dist/next.d.ts +0 -15
- package/dist/next.js +0 -46
- package/index.ts +0 -24
- package/next.ts +0 -76
|
@@ -4,55 +4,320 @@
|
|
|
4
4
|
*/
|
|
5
5
|
export interface paths {
|
|
6
6
|
'/api/v1/events': {
|
|
7
|
-
/**
|
|
7
|
+
/**
|
|
8
|
+
* List ingested events
|
|
9
|
+
* @description List ingested events within a time range.
|
|
10
|
+
*/
|
|
8
11
|
get: operations['listEvents'];
|
|
9
|
-
/**
|
|
12
|
+
/**
|
|
13
|
+
* Ingest events
|
|
14
|
+
* @description Ingests an event or batch of events following the CloudEvents specification.
|
|
15
|
+
*/
|
|
10
16
|
post: operations['ingestEvents'];
|
|
11
17
|
};
|
|
12
18
|
'/api/v1/meters': {
|
|
13
|
-
/**
|
|
19
|
+
/**
|
|
20
|
+
* List meters
|
|
21
|
+
* @description List meters.
|
|
22
|
+
*/
|
|
14
23
|
get: operations['listMeters'];
|
|
15
|
-
/**
|
|
24
|
+
/**
|
|
25
|
+
* ☁ Create meter
|
|
26
|
+
* @description *Available in OpenMeter Cloud.*
|
|
27
|
+
* *In the open-source version, meters are created in the configuration file.*
|
|
28
|
+
*
|
|
29
|
+
* Create a meter.
|
|
30
|
+
*/
|
|
16
31
|
post: operations['createMeter'];
|
|
17
32
|
};
|
|
18
33
|
'/api/v1/meters/{meterIdOrSlug}': {
|
|
19
|
-
/**
|
|
34
|
+
/**
|
|
35
|
+
* Get meter
|
|
36
|
+
* @description Get meter by ID or slug
|
|
37
|
+
*/
|
|
20
38
|
get: operations['getMeter'];
|
|
21
|
-
/** @description Delete meter by slug */
|
|
22
|
-
delete: operations['deleteMeter'];
|
|
23
|
-
};
|
|
24
|
-
'/api/v1/meters/{meterIdOrSlug}/values': {
|
|
25
39
|
/**
|
|
26
|
-
*
|
|
27
|
-
* @description
|
|
28
|
-
*
|
|
40
|
+
* ☁ Delete meter
|
|
41
|
+
* @description *Available in OpenMeter Cloud.*
|
|
42
|
+
*
|
|
43
|
+
* Delete a meter by ID or slug.
|
|
29
44
|
*/
|
|
30
|
-
|
|
45
|
+
delete: operations['deleteMeter'];
|
|
31
46
|
};
|
|
32
47
|
'/api/v1/meters/{meterIdOrSlug}/query': {
|
|
33
|
-
/**
|
|
48
|
+
/**
|
|
49
|
+
* Query meter
|
|
50
|
+
* @description Query meter for usage.
|
|
51
|
+
*/
|
|
34
52
|
get: operations['queryMeter'];
|
|
35
53
|
};
|
|
36
54
|
'/api/v1/meters/{meterIdOrSlug}/subjects': {
|
|
37
|
-
/**
|
|
55
|
+
/**
|
|
56
|
+
* List meter subjects
|
|
57
|
+
* @description List subjects for a meter.
|
|
58
|
+
*/
|
|
38
59
|
get: operations['listMeterSubjects'];
|
|
39
60
|
};
|
|
40
|
-
'/api/v1/
|
|
41
|
-
/**
|
|
42
|
-
|
|
61
|
+
'/api/v1/portal/tokens': {
|
|
62
|
+
/**
|
|
63
|
+
* ☁ List portal tokens
|
|
64
|
+
* @description *Available in OpenMeter Cloud.*
|
|
65
|
+
*
|
|
66
|
+
* List consumer portal tokens.
|
|
67
|
+
*/
|
|
68
|
+
get: operations['listPortalTokens'];
|
|
69
|
+
/**
|
|
70
|
+
* Create portal token
|
|
71
|
+
* @description Create a consumer portal token.
|
|
72
|
+
*/
|
|
73
|
+
post: operations['createPortalToken'];
|
|
74
|
+
};
|
|
75
|
+
'/api/v1/portal/tokens/invalidate': {
|
|
76
|
+
/**
|
|
77
|
+
* ☁ Invalidate portal tokens
|
|
78
|
+
* @description *Available in OpenMeter Cloud.*
|
|
79
|
+
*
|
|
80
|
+
* Invalidates consumer portal tokens by ID or subject.
|
|
81
|
+
*/
|
|
82
|
+
post: operations['invalidatePortalTokens'];
|
|
83
|
+
};
|
|
84
|
+
'/api/v1/subjects': {
|
|
85
|
+
/**
|
|
86
|
+
* ☁ List subjects
|
|
87
|
+
* @description *Available in OpenMeter Cloud.*
|
|
88
|
+
*
|
|
89
|
+
* List subjects.
|
|
90
|
+
*/
|
|
91
|
+
get: operations['listSubjects'];
|
|
92
|
+
/**
|
|
93
|
+
* ☁ Upsert subject
|
|
94
|
+
* @description *Available in OpenMeter Cloud.*
|
|
95
|
+
*
|
|
96
|
+
* Upserts a subject. Creates or updates subject.
|
|
97
|
+
* If the subject doesn't exist, it will be created.
|
|
98
|
+
* If the subject exists, it will be partially updated with the provided fields.
|
|
99
|
+
*/
|
|
100
|
+
post: operations['upsertSubject'];
|
|
101
|
+
};
|
|
102
|
+
'/api/v1/subjects/{subjectIdOrKey}': {
|
|
103
|
+
/**
|
|
104
|
+
* ☁ Get subject
|
|
105
|
+
* @description *Available in OpenMeter Cloud.*
|
|
106
|
+
*
|
|
107
|
+
* Get subject by ID or key.
|
|
108
|
+
*/
|
|
109
|
+
get: operations['getSubject'];
|
|
110
|
+
/**
|
|
111
|
+
* ☁ Delete subject
|
|
112
|
+
* @description *Available in OpenMeter Cloud.*
|
|
113
|
+
*
|
|
114
|
+
* Delete a subject by ID or key.
|
|
115
|
+
*/
|
|
116
|
+
delete: operations['deleteSubject'];
|
|
117
|
+
};
|
|
118
|
+
'/api/v1/portal/meters/{meterSlug}/query': {
|
|
119
|
+
/**
|
|
120
|
+
* Query portal meter
|
|
121
|
+
* @description Query meter for consumer portal. This endpoint is publicly exposable to consumers.
|
|
122
|
+
*/
|
|
123
|
+
get: operations['queryPortalMeter'];
|
|
124
|
+
};
|
|
125
|
+
'/api/v1/entitlements': {
|
|
126
|
+
/**
|
|
127
|
+
* List entitlements
|
|
128
|
+
* @description List entitlements.
|
|
129
|
+
*/
|
|
130
|
+
get: operations['listEntitlements'];
|
|
131
|
+
};
|
|
132
|
+
'/api/v1/features': {
|
|
133
|
+
/**
|
|
134
|
+
* List features
|
|
135
|
+
* @description List features.
|
|
136
|
+
*/
|
|
137
|
+
get: operations['listFeatures'];
|
|
138
|
+
/**
|
|
139
|
+
* Create feature
|
|
140
|
+
* @description Creates a feature.
|
|
141
|
+
*/
|
|
142
|
+
post: operations['createFeature'];
|
|
143
|
+
};
|
|
144
|
+
'/api/v1/features/{featureId}': {
|
|
145
|
+
/**
|
|
146
|
+
* Get feature
|
|
147
|
+
* @description Get feature by id.
|
|
148
|
+
*/
|
|
149
|
+
get: operations['getFeature'];
|
|
150
|
+
/**
|
|
151
|
+
* Delete feature
|
|
152
|
+
* @description Delete a feature by key.
|
|
153
|
+
*/
|
|
154
|
+
delete: operations['deleteFeature'];
|
|
155
|
+
};
|
|
156
|
+
'/api/v1/grants': {
|
|
157
|
+
/**
|
|
158
|
+
* List grants
|
|
159
|
+
* @description List all grants.
|
|
160
|
+
*/
|
|
161
|
+
get: operations['listGrants'];
|
|
162
|
+
};
|
|
163
|
+
'/api/v1/grants/{grantId}': {
|
|
164
|
+
/**
|
|
165
|
+
* Delete a grant
|
|
166
|
+
* @description Void (delete) a grant. A grant can only be deleted if it hasn't been used.
|
|
167
|
+
*/
|
|
168
|
+
delete: operations['voidGrant'];
|
|
169
|
+
};
|
|
170
|
+
'/api/v1/subjects/{subjectIdOrKey}/entitlements': {
|
|
171
|
+
/**
|
|
172
|
+
* List entitlements
|
|
173
|
+
* @description List all entitlements for a subject.
|
|
174
|
+
*/
|
|
175
|
+
get: operations['listSubjectEntitlements'];
|
|
176
|
+
/**
|
|
177
|
+
* Create entitlement
|
|
178
|
+
* @description Create an entitlement for a subject.
|
|
179
|
+
*/
|
|
180
|
+
post: operations['createEntitlement'];
|
|
181
|
+
};
|
|
182
|
+
'/api/v1/subjects/{subjectIdOrKey}/entitlements/{entitlementId}': {
|
|
183
|
+
/**
|
|
184
|
+
* Get entitlement
|
|
185
|
+
* @description Get entitlement by id.
|
|
186
|
+
*/
|
|
187
|
+
get: operations['getEntitlement'];
|
|
188
|
+
/**
|
|
189
|
+
* Delete entitlement
|
|
190
|
+
* @description Delete an entitlement by id.
|
|
191
|
+
*/
|
|
192
|
+
delete: operations['deleteEntitlement'];
|
|
193
|
+
};
|
|
194
|
+
'/api/v1/subjects/{subjectIdOrKey}/entitlements/{entitlementId}/grants': {
|
|
195
|
+
/**
|
|
196
|
+
* List grants for an entitlement
|
|
197
|
+
* @description List all grants for an entitlement.
|
|
198
|
+
*/
|
|
199
|
+
get: operations['listEntitlementGrants'];
|
|
200
|
+
/**
|
|
201
|
+
* Create grant
|
|
202
|
+
* @description Create a grant for an entitlement.
|
|
203
|
+
*/
|
|
204
|
+
post: operations['createGrant'];
|
|
205
|
+
};
|
|
206
|
+
'/api/v1/subjects/{subjectIdOrKey}/entitlements/{entitlementIdOrFeatureKey}/value': {
|
|
207
|
+
/**
|
|
208
|
+
* Get the balance of a specific entitlement.
|
|
209
|
+
* @description Get the balance of a specific entitlement.
|
|
210
|
+
*/
|
|
211
|
+
get: operations['getEntitlementValue'];
|
|
212
|
+
};
|
|
213
|
+
'/api/v1/subjects/{subjectIdOrKey}/entitlements/{entitlementId}/history': {
|
|
214
|
+
/**
|
|
215
|
+
* Get the balance history of a specific entitlement.
|
|
216
|
+
* @description Get the balance history of a specific entitlement.
|
|
217
|
+
*
|
|
218
|
+
* The windows are inclusive at their start and exclusive at their end.
|
|
219
|
+
* The last window may be smaller than the window size and is inclusive at both ends.
|
|
220
|
+
*/
|
|
221
|
+
get: operations['getEntitlementHistory'];
|
|
222
|
+
};
|
|
223
|
+
'/api/v1/subjects/{subjectIdOrKey}/entitlements/{entitlementId}/reset': {
|
|
224
|
+
/**
|
|
225
|
+
* Reset entitlement
|
|
226
|
+
* @description Reset the entitlement usage and start a new period. Grants that can be are rolled over.
|
|
227
|
+
*/
|
|
228
|
+
post: operations['resetEntitlementUsage'];
|
|
43
229
|
};
|
|
44
230
|
}
|
|
45
231
|
export type webhooks = Record<string, never>;
|
|
46
232
|
export interface components {
|
|
47
233
|
schemas: {
|
|
48
234
|
/**
|
|
49
|
-
* @description
|
|
235
|
+
* @description Metadata fields for a resource.
|
|
236
|
+
* These fields are automatically populated by the system for the entities we manage.
|
|
237
|
+
*/
|
|
238
|
+
SharedMetaFields: {
|
|
239
|
+
/**
|
|
240
|
+
* @description Readonly unique ULID identifier.
|
|
241
|
+
*
|
|
242
|
+
* @example 01ARZ3NDEKTSV4RRFFQ69G5FAV
|
|
243
|
+
*/
|
|
244
|
+
id: string;
|
|
245
|
+
/**
|
|
246
|
+
* Format: date-time
|
|
247
|
+
* @description The date and time the resource was created.
|
|
248
|
+
* @example 2023-01-01T00:00:00Z
|
|
249
|
+
*/
|
|
250
|
+
createdAt: string;
|
|
251
|
+
/**
|
|
252
|
+
* Format: date-time
|
|
253
|
+
* @description The date and time the resource was last updated.
|
|
254
|
+
* @example 2023-01-01T00:00:00Z
|
|
255
|
+
*/
|
|
256
|
+
updatedAt: string;
|
|
257
|
+
/**
|
|
258
|
+
* Format: date-time
|
|
259
|
+
* @description The date and time the resource was deleted.
|
|
260
|
+
* @example null
|
|
261
|
+
*/
|
|
262
|
+
deletedAt: string | null;
|
|
263
|
+
};
|
|
264
|
+
/**
|
|
265
|
+
* @description Conflict
|
|
266
|
+
* @example {
|
|
267
|
+
* "type": "about:blank",
|
|
268
|
+
* "title": "Conflict",
|
|
269
|
+
* "status": 409,
|
|
270
|
+
* "detail": "ledger (default.01HXVNDJR532E8GTBVSC2XK5D4) already exitst for subject subject-1",
|
|
271
|
+
* "instance": "urn:request:local/JMOlctsKV8-000001",
|
|
272
|
+
* "conflictingEntityId": "01HXVNDJR532E8GTBVSC2XK5D4"
|
|
273
|
+
* }
|
|
274
|
+
*/
|
|
275
|
+
ConflictProblem: {
|
|
276
|
+
/**
|
|
277
|
+
* Format: uri
|
|
278
|
+
* @description Type contains a URI that identifies the problem type.
|
|
279
|
+
* @example urn:problem-type:bad-request
|
|
280
|
+
*/
|
|
281
|
+
type: string;
|
|
282
|
+
/**
|
|
283
|
+
* @description A a short, human-readable summary of the problem type.
|
|
284
|
+
* @example Bad Request
|
|
285
|
+
*/
|
|
286
|
+
title: string;
|
|
287
|
+
/**
|
|
288
|
+
* Format: int32
|
|
289
|
+
* @description The HTTP status code generated by the origin server for this occurrence of the problem.
|
|
290
|
+
* @example 400
|
|
291
|
+
*/
|
|
292
|
+
status: number;
|
|
293
|
+
/**
|
|
294
|
+
* @description A human-readable explanation specific to this occurrence of the problem.
|
|
295
|
+
* @example body must be a JSON object
|
|
296
|
+
*/
|
|
297
|
+
detail: string;
|
|
298
|
+
/**
|
|
299
|
+
* Format: uri
|
|
300
|
+
* @description A URI reference that identifies the specific occurrence of the problem.
|
|
301
|
+
* @example urn:request:local/JMOlctsKV8-000001
|
|
302
|
+
*/
|
|
303
|
+
instance?: string;
|
|
304
|
+
extensions?: {
|
|
305
|
+
/**
|
|
306
|
+
* @description The id of the conflicting entity.
|
|
307
|
+
* @example 01ARZ3NDEKTSV4RRFFQ69G5FAV
|
|
308
|
+
*/
|
|
309
|
+
conflictingEntityId: string;
|
|
310
|
+
};
|
|
311
|
+
[key: string]: unknown;
|
|
312
|
+
};
|
|
313
|
+
/**
|
|
314
|
+
* @description A Problem Details object (RFC 7807).
|
|
315
|
+
* Additional properties specific to the problem type may be present.
|
|
50
316
|
* @example {
|
|
51
317
|
* "type": "urn:problem-type:bad-request",
|
|
52
318
|
* "title": "Bad Request",
|
|
53
319
|
* "status": 400,
|
|
54
|
-
* "detail": "
|
|
55
|
-
* "instance": "urn:request:local/JMOlctsKV8-000001"
|
|
320
|
+
* "detail": "body must be a JSON object"
|
|
56
321
|
* }
|
|
57
322
|
*/
|
|
58
323
|
Problem: {
|
|
@@ -75,7 +340,7 @@ export interface components {
|
|
|
75
340
|
status: number;
|
|
76
341
|
/**
|
|
77
342
|
* @description A human-readable explanation specific to this occurrence of the problem.
|
|
78
|
-
* @example
|
|
343
|
+
* @example body must be a JSON object
|
|
79
344
|
*/
|
|
80
345
|
detail: string;
|
|
81
346
|
/**
|
|
@@ -86,7 +351,22 @@ export interface components {
|
|
|
86
351
|
instance?: string;
|
|
87
352
|
[key: string]: unknown;
|
|
88
353
|
};
|
|
89
|
-
/**
|
|
354
|
+
/**
|
|
355
|
+
* @description CloudEvents Specification JSON Schema
|
|
356
|
+
* @example {
|
|
357
|
+
* "id": "5c10fade-1c9e-4d6c-8275-c52c36731d3c",
|
|
358
|
+
* "source": "service-name",
|
|
359
|
+
* "specversion": "1.0",
|
|
360
|
+
* "type": "prompt",
|
|
361
|
+
* "subject": "customer-id",
|
|
362
|
+
* "time": "2023-01-01T01:01:01.001Z",
|
|
363
|
+
* "data": {
|
|
364
|
+
* "tokens": "1234",
|
|
365
|
+
* "model": "gpt-4-turbo",
|
|
366
|
+
* "type": "input"
|
|
367
|
+
* }
|
|
368
|
+
* }
|
|
369
|
+
*/
|
|
90
370
|
Event: {
|
|
91
371
|
/**
|
|
92
372
|
* @description Identifies the event.
|
|
@@ -96,7 +376,7 @@ export interface components {
|
|
|
96
376
|
/**
|
|
97
377
|
* Format: uri-reference
|
|
98
378
|
* @description Identifies the context in which an event happened.
|
|
99
|
-
* @example
|
|
379
|
+
* @example service-name
|
|
100
380
|
*/
|
|
101
381
|
source: string;
|
|
102
382
|
/**
|
|
@@ -106,7 +386,7 @@ export interface components {
|
|
|
106
386
|
specversion: string;
|
|
107
387
|
/**
|
|
108
388
|
* @description Describes the type of event related to the originating occurrence.
|
|
109
|
-
* @example
|
|
389
|
+
* @example prompt
|
|
110
390
|
*/
|
|
111
391
|
type: string;
|
|
112
392
|
/**
|
|
@@ -122,7 +402,7 @@ export interface components {
|
|
|
122
402
|
dataschema?: string | null;
|
|
123
403
|
/**
|
|
124
404
|
* @description Describes the subject of the event in the context of the event producer (identified by source).
|
|
125
|
-
* @example
|
|
405
|
+
* @example customer-id
|
|
126
406
|
*/
|
|
127
407
|
subject: string;
|
|
128
408
|
/**
|
|
@@ -134,405 +414,1608 @@ export interface components {
|
|
|
134
414
|
/**
|
|
135
415
|
* @description The event payload.
|
|
136
416
|
* @example {
|
|
137
|
-
* "
|
|
138
|
-
* "
|
|
417
|
+
* "tokens": "1234",
|
|
418
|
+
* "model": "gpt-4-turbo"
|
|
139
419
|
* }
|
|
140
420
|
*/
|
|
141
421
|
data?: {
|
|
142
422
|
[key: string]: unknown;
|
|
143
423
|
};
|
|
144
424
|
};
|
|
145
|
-
|
|
425
|
+
/**
|
|
426
|
+
* @description An ingested event with optional validation error.
|
|
427
|
+
* @example {
|
|
428
|
+
* "event": {
|
|
429
|
+
* "id": "5c10fade-1c9e-4d6c-8275-c52c36731d3d",
|
|
430
|
+
* "source": "service-name",
|
|
431
|
+
* "specversion": "1.0",
|
|
432
|
+
* "type": "prompt",
|
|
433
|
+
* "subject": "customer-id",
|
|
434
|
+
* "time": "2023-01-01T01:01:01.001Z",
|
|
435
|
+
* "data": {
|
|
436
|
+
* "tokens": "1234",
|
|
437
|
+
* "model": "gpt-4-turbo"
|
|
438
|
+
* }
|
|
439
|
+
* },
|
|
440
|
+
* "validationError": "meter not found for event"
|
|
441
|
+
* }
|
|
442
|
+
*/
|
|
443
|
+
IngestedEvent: {
|
|
444
|
+
event: components['schemas']['Event'];
|
|
445
|
+
/** @example invalid event */
|
|
446
|
+
validationError?: string;
|
|
447
|
+
};
|
|
448
|
+
/**
|
|
449
|
+
* @description A feature is a feature or service offered to a customer.
|
|
450
|
+
* For example: CPU-Hours, Tokens, API Calls, etc.
|
|
451
|
+
*/
|
|
452
|
+
FeatureCreateInputs: {
|
|
146
453
|
/**
|
|
147
|
-
* @description
|
|
148
|
-
*
|
|
454
|
+
* @description The unique key of the feature to reference it from your application.
|
|
455
|
+
*
|
|
456
|
+
* @example gpt4_tokens
|
|
149
457
|
*/
|
|
150
|
-
|
|
458
|
+
key: string;
|
|
151
459
|
/**
|
|
152
|
-
* @description
|
|
153
|
-
*
|
|
460
|
+
* @description The name of the feature.
|
|
461
|
+
*
|
|
462
|
+
* @example AI Tokens
|
|
154
463
|
*/
|
|
155
|
-
|
|
464
|
+
name: string;
|
|
465
|
+
/** @description Additional metadata for the feature. */
|
|
466
|
+
metadata?: {
|
|
467
|
+
[key: string]: string;
|
|
468
|
+
};
|
|
156
469
|
/**
|
|
157
|
-
* @description
|
|
158
|
-
*
|
|
470
|
+
* @description The meter that the feature is associated with and decreases grants by usage.
|
|
471
|
+
* If present, the usage of the feature can be metered.
|
|
472
|
+
*
|
|
473
|
+
* @example tokens_total
|
|
159
474
|
*/
|
|
160
|
-
|
|
161
|
-
aggregation: components['schemas']['MeterAggregation'];
|
|
475
|
+
meterSlug?: string;
|
|
162
476
|
/**
|
|
163
|
-
* @description
|
|
164
|
-
*
|
|
477
|
+
* @description Optional meter group by filters. Useful if the meter scope is broader than what feature tracks.
|
|
478
|
+
*
|
|
479
|
+
* @example {
|
|
480
|
+
* "model": "gpt-4"
|
|
481
|
+
* }
|
|
165
482
|
*/
|
|
166
|
-
|
|
483
|
+
meterGroupByFilters?: {
|
|
484
|
+
[key: string]: string;
|
|
485
|
+
};
|
|
486
|
+
};
|
|
487
|
+
/**
|
|
488
|
+
* @description A feature is a feature or service offered to a customer.
|
|
489
|
+
* For example: CPU-Hours, Tokens, API Calls, etc.
|
|
490
|
+
*/
|
|
491
|
+
Feature: {
|
|
167
492
|
/**
|
|
168
|
-
*
|
|
169
|
-
* @
|
|
493
|
+
* Format: date-time
|
|
494
|
+
* @description If the feature is archived, it will not be used for grants or usage.
|
|
495
|
+
*
|
|
496
|
+
* @example 2023-01-01T00:00:00Z
|
|
170
497
|
*/
|
|
171
|
-
|
|
498
|
+
archivedAt?: string;
|
|
499
|
+
} & components['schemas']['FeatureCreateInputs'] & components['schemas']['SharedMetaFields'];
|
|
500
|
+
EntitlementCreateSharedFields: {
|
|
501
|
+
/**
|
|
502
|
+
* @description The feature the subject is entitled to use
|
|
503
|
+
*
|
|
504
|
+
* @example 01ARZ3NDEKTSV4RRFFQ69G5FAV
|
|
505
|
+
*/
|
|
506
|
+
featureId: string;
|
|
507
|
+
/** @description Additional metadata for the feature. */
|
|
508
|
+
metadata?: {
|
|
509
|
+
[key: string]: string;
|
|
510
|
+
};
|
|
511
|
+
usagePeriod?: components['schemas']['RecurringPeriod'];
|
|
512
|
+
};
|
|
513
|
+
EntitlementSharedFields: components['schemas']['SharedMetaFields'] & components['schemas']['EntitlementCreateSharedFields'] & {
|
|
514
|
+
/**
|
|
515
|
+
* @description The identifier key unique to the subject
|
|
516
|
+
* @example customer-1
|
|
517
|
+
*/
|
|
518
|
+
subjectKey: string;
|
|
519
|
+
usagePeriod?: components['schemas']['RecurringPeriod'];
|
|
520
|
+
};
|
|
521
|
+
EntitlementMeteredCreateInputs: components['schemas']['EntitlementCreateSharedFields'] & {
|
|
522
|
+
/**
|
|
523
|
+
* @example metered
|
|
524
|
+
* @enum {string}
|
|
525
|
+
*/
|
|
526
|
+
type: 'metered';
|
|
527
|
+
/**
|
|
528
|
+
* @description If unlimited=true the subject can use the feature an unlimited amount.
|
|
529
|
+
*
|
|
530
|
+
* @default false
|
|
531
|
+
*/
|
|
532
|
+
isUnlimited?: boolean;
|
|
533
|
+
usagePeriod: components['schemas']['RecurringPeriod'];
|
|
534
|
+
/** @description You can issue usage automatically after reset. This usage is not rolled over. */
|
|
535
|
+
issueAfterReset?: number;
|
|
536
|
+
};
|
|
537
|
+
/** @description Entitles a subject to use a feature. */
|
|
538
|
+
EntitlementMetered: components['schemas']['EntitlementMeteredCreateInputs'] & components['schemas']['EntitlementSharedFields'];
|
|
539
|
+
EntitlementStaticCreateInputs: components['schemas']['EntitlementCreateSharedFields'] & {
|
|
540
|
+
/**
|
|
541
|
+
* @example static
|
|
542
|
+
* @enum {string}
|
|
543
|
+
*/
|
|
544
|
+
type: 'static';
|
|
545
|
+
/**
|
|
546
|
+
* @description The JSON parsable config of the entitlement.
|
|
547
|
+
*
|
|
548
|
+
* @example {"key1": "value1"}
|
|
549
|
+
*/
|
|
550
|
+
config: string;
|
|
551
|
+
};
|
|
552
|
+
/** @description Entitles a subject to use a feature. */
|
|
553
|
+
EntitlementStatic: components['schemas']['EntitlementStaticCreateInputs'] & components['schemas']['EntitlementSharedFields'];
|
|
554
|
+
EntitlementBooleanCreateInputs: components['schemas']['EntitlementCreateSharedFields'] & {
|
|
555
|
+
/**
|
|
556
|
+
* @example boolean
|
|
557
|
+
* @enum {string}
|
|
558
|
+
*/
|
|
559
|
+
type: 'boolean';
|
|
560
|
+
};
|
|
561
|
+
/** @description Entitles a subject to use a feature. */
|
|
562
|
+
EntitlementBoolean: components['schemas']['EntitlementBooleanCreateInputs'] & components['schemas']['EntitlementSharedFields'];
|
|
563
|
+
Entitlement: components['schemas']['EntitlementMetered'] | components['schemas']['EntitlementStatic'] | components['schemas']['EntitlementBoolean'];
|
|
564
|
+
/**
|
|
565
|
+
* @description A segment of the grant burn down history.
|
|
566
|
+
*
|
|
567
|
+
* A given segment represents the usage of a grant in a specific period.
|
|
568
|
+
*/
|
|
569
|
+
GrantBurnDownHistorySegment: {
|
|
570
|
+
period?: components['schemas']['Period'];
|
|
571
|
+
/**
|
|
572
|
+
* Format: double
|
|
573
|
+
* @description The usage of the grant in the period.
|
|
574
|
+
*
|
|
575
|
+
* @example 100
|
|
576
|
+
*/
|
|
577
|
+
usage?: number;
|
|
578
|
+
/**
|
|
579
|
+
* Format: double
|
|
580
|
+
* @description Overuse that wasn't covered by grants.
|
|
581
|
+
*
|
|
582
|
+
* @example 25
|
|
583
|
+
*/
|
|
584
|
+
overage?: number;
|
|
585
|
+
/**
|
|
586
|
+
* Format: double
|
|
587
|
+
* @description The entitlement balance at the start of the period.
|
|
588
|
+
*
|
|
589
|
+
* @example 100
|
|
590
|
+
*/
|
|
591
|
+
balanceAtStart?: number;
|
|
172
592
|
/**
|
|
173
|
-
* @description
|
|
593
|
+
* @description The balance breakdown of each active grant at the start of the period: GrantID: Balance
|
|
594
|
+
*
|
|
174
595
|
* @example {
|
|
175
|
-
* "
|
|
176
|
-
* "path": "$.path"
|
|
596
|
+
* "01ARZ3NDEKTSV4RRFFQ69G5FAV": 100
|
|
177
597
|
* }
|
|
178
598
|
*/
|
|
179
|
-
|
|
180
|
-
[key: string]:
|
|
599
|
+
grantBalancesAtStart?: {
|
|
600
|
+
[key: string]: number;
|
|
181
601
|
};
|
|
182
|
-
|
|
602
|
+
/**
|
|
603
|
+
* Format: double
|
|
604
|
+
* @description The entitlement balance at the end of the period.
|
|
605
|
+
*
|
|
606
|
+
* @example 100
|
|
607
|
+
*/
|
|
608
|
+
balanceAtEnd?: number;
|
|
609
|
+
/**
|
|
610
|
+
* @description The balance breakdown of each active grant at the start of the period: GrantID: Balance
|
|
611
|
+
*
|
|
612
|
+
* @example {
|
|
613
|
+
* "01ARZ3NDEKTSV4RRFFQ69G5FAV": 100
|
|
614
|
+
* }
|
|
615
|
+
*/
|
|
616
|
+
grantBalancesAtEnd?: {
|
|
617
|
+
[key: string]: number;
|
|
618
|
+
};
|
|
619
|
+
/** @description Which grants were actually burnt down in the period and by what amount. */
|
|
620
|
+
grantUsages?: readonly components['schemas']['GrantUsageRecord'][];
|
|
621
|
+
};
|
|
622
|
+
GrantUsageRecord: {
|
|
623
|
+
/**
|
|
624
|
+
* @description The id of the grant.
|
|
625
|
+
*
|
|
626
|
+
* @example 01ARZ3NDEKTSV4RRFFQ69G5FAV
|
|
627
|
+
*/
|
|
628
|
+
grantId?: string;
|
|
629
|
+
/**
|
|
630
|
+
* Format: double
|
|
631
|
+
* @description The usage of the grant.
|
|
632
|
+
*
|
|
633
|
+
* @example 100
|
|
634
|
+
*/
|
|
635
|
+
usage?: number;
|
|
636
|
+
};
|
|
637
|
+
/** @description A window of balance history. */
|
|
638
|
+
BalanceHistoryWindow: {
|
|
639
|
+
period?: components['schemas']['Period'];
|
|
640
|
+
/**
|
|
641
|
+
* Format: double
|
|
642
|
+
* @description The total usage of the feature in the period.
|
|
643
|
+
*
|
|
644
|
+
* @example 100
|
|
645
|
+
*/
|
|
646
|
+
usage?: number;
|
|
647
|
+
/**
|
|
648
|
+
* Format: double
|
|
649
|
+
* @description The entitlement balance at the start of the period.
|
|
650
|
+
*
|
|
651
|
+
* @example 100
|
|
652
|
+
*/
|
|
653
|
+
balanceAtStart?: number;
|
|
654
|
+
};
|
|
655
|
+
/** @description The windowed balance history. */
|
|
656
|
+
WindowedBalanceHistory: {
|
|
657
|
+
/**
|
|
658
|
+
* @description The windowed balance history.
|
|
659
|
+
* Only returns rows for windows where there was usage.
|
|
660
|
+
*/
|
|
661
|
+
windowedHistory?: components['schemas']['BalanceHistoryWindow'][];
|
|
662
|
+
/** @description The grant burn down history in the period. */
|
|
663
|
+
burndownHistory?: components['schemas']['GrantBurnDownHistorySegment'][];
|
|
664
|
+
};
|
|
665
|
+
/** @description A time period */
|
|
666
|
+
Period: {
|
|
667
|
+
/**
|
|
668
|
+
* Format: date-time
|
|
669
|
+
* @description Period start time where the amount was applied. If applicable.
|
|
670
|
+
*
|
|
671
|
+
* @example 2023-01-01T00:00:00Z
|
|
672
|
+
*/
|
|
673
|
+
from: string;
|
|
674
|
+
/**
|
|
675
|
+
* Format: date-time
|
|
676
|
+
* @description Period end time where the amount was applied. If applicable.
|
|
677
|
+
*
|
|
678
|
+
* @example 2023-01-01T00:00:00Z
|
|
679
|
+
*/
|
|
680
|
+
to: string;
|
|
183
681
|
};
|
|
184
682
|
/**
|
|
185
|
-
* @description
|
|
683
|
+
* @description List of pre-defined periods that can be used for recurring & scheduling.
|
|
684
|
+
*
|
|
685
|
+
* DAILY: Every day
|
|
686
|
+
* # MONDAY: Every Monday
|
|
687
|
+
* # TUESDAY: Every Tuesday
|
|
688
|
+
* # WEDNESDAY: Every Wednesday
|
|
689
|
+
* # THURSDAY: Every Thursday
|
|
690
|
+
* # FRIDAY: Every Friday
|
|
691
|
+
* # SATURDAY: Every Saturday
|
|
692
|
+
* # SUNDAY: Every Sunday
|
|
693
|
+
* WEEKLY: Every week
|
|
694
|
+
* MONTHLY: Every month
|
|
695
|
+
* YEARLY: Every year
|
|
696
|
+
* BILLING: Every billing cycle
|
|
697
|
+
*
|
|
186
698
|
* @enum {string}
|
|
187
699
|
*/
|
|
188
|
-
|
|
189
|
-
/** @
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
/**
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
windowEnd: string;
|
|
198
|
-
value: number;
|
|
199
|
-
groupBy?: {
|
|
200
|
-
[key: string]: string;
|
|
201
|
-
} | null;
|
|
700
|
+
RecurringPeriodEnum: 'DAILY' | 'WEEKLY' | 'MONTHLY' | 'YEARLY' | 'BILLING';
|
|
701
|
+
/** @description Recurring period of an entitlement. */
|
|
702
|
+
RecurringPeriod: {
|
|
703
|
+
interval: components['schemas']['RecurringPeriodEnum'];
|
|
704
|
+
/**
|
|
705
|
+
* Format: date-time
|
|
706
|
+
* @description An arbitrary anchor to base the recurring period on.
|
|
707
|
+
*/
|
|
708
|
+
anchor: string;
|
|
202
709
|
};
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
/**
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
710
|
+
/** @description Grants are used to increase balance of specific subjects. */
|
|
711
|
+
EntitlementGrantCreateInput: {
|
|
712
|
+
/**
|
|
713
|
+
* Format: double
|
|
714
|
+
* @description The amount to grant. Should be a positive number.
|
|
715
|
+
*
|
|
716
|
+
* @example 100
|
|
717
|
+
*/
|
|
718
|
+
amount: number;
|
|
719
|
+
/**
|
|
720
|
+
* @description The priority of the grant. Grants with higher priority are applied first.
|
|
721
|
+
* Priority is a positive decimal numbers. With lower numbers indicating higher importance.
|
|
722
|
+
* For example, a priority of 1 is more urgent than a priority of 2.
|
|
723
|
+
* When there are several grants available for the same subject, the system selects the grant with the highest priority.
|
|
724
|
+
* In cases where grants share the same priority level, the grant closest to its expiration will be used first.
|
|
725
|
+
* In the case of two grants have identical priorities and expiration dates, the system will use the grant that was created first.
|
|
726
|
+
*
|
|
727
|
+
* @default 1
|
|
728
|
+
* @example 1
|
|
729
|
+
*/
|
|
730
|
+
priority?: number;
|
|
731
|
+
/**
|
|
732
|
+
* Format: date-time
|
|
733
|
+
* @description The effective time. Provided value will be ceiled to metering windowSize (minute).
|
|
734
|
+
*
|
|
735
|
+
* @example 2023-01-01T00:00:00Z
|
|
736
|
+
*/
|
|
737
|
+
effectiveAt: string;
|
|
738
|
+
expiration: components['schemas']['ExpirationPeriod'];
|
|
739
|
+
/**
|
|
740
|
+
* Format: double
|
|
741
|
+
* @description The maximum amount of the grant that can be rolled over. Defaults to 0.
|
|
742
|
+
*
|
|
743
|
+
* - maxAmount = {original_amount} -> rollover original amount
|
|
744
|
+
* - maxAmount = 0 -> no rollover
|
|
745
|
+
* - maxAmount = 90 -> rollover 90 max
|
|
746
|
+
*
|
|
747
|
+
* If it's larger than 0 then the grant's balance will be the MAX(maxRollover, balance) + amount.
|
|
748
|
+
*
|
|
749
|
+
* @default 0
|
|
750
|
+
* @example 100
|
|
751
|
+
*/
|
|
752
|
+
maxRolloverAmount?: number;
|
|
753
|
+
/**
|
|
754
|
+
* @example {
|
|
755
|
+
* "stripePaymentId": "pi_4OrAkhLvyihio9p51h9iiFnB"
|
|
756
|
+
* }
|
|
757
|
+
*/
|
|
758
|
+
metadata?: {
|
|
212
759
|
[key: string]: string;
|
|
213
|
-
}
|
|
760
|
+
};
|
|
761
|
+
recurrence?: components['schemas']['RecurringPeriod'];
|
|
214
762
|
};
|
|
215
|
-
|
|
216
|
-
Namespace: {
|
|
763
|
+
EntitlementGrant: components['schemas']['EntitlementGrantCreateInput'] & components['schemas']['SharedMetaFields'] & {
|
|
217
764
|
/**
|
|
218
|
-
* @description
|
|
219
|
-
*
|
|
765
|
+
* @description The unique entitlement ULID that the grant is associated with.
|
|
766
|
+
*
|
|
767
|
+
* @example 01ARZ3NDEKTSV4RRFFQ69G5FAV
|
|
220
768
|
*/
|
|
221
|
-
|
|
769
|
+
entitlementId: string;
|
|
770
|
+
/**
|
|
771
|
+
* @description The subject that is granted the entitlement.
|
|
772
|
+
*
|
|
773
|
+
* @example customer-id
|
|
774
|
+
*/
|
|
775
|
+
subjectKey: string;
|
|
776
|
+
/**
|
|
777
|
+
* Format: date-time
|
|
778
|
+
* @description The next time the grant will recurr.
|
|
779
|
+
*
|
|
780
|
+
* @example 2023-01-01T00:00:00Z
|
|
781
|
+
*/
|
|
782
|
+
nextRecurrence?: string;
|
|
783
|
+
/**
|
|
784
|
+
* Format: date-time
|
|
785
|
+
* @description The expiration date of the grant.
|
|
786
|
+
*
|
|
787
|
+
* @example 2023-01-01T00:00:00Z
|
|
788
|
+
*/
|
|
789
|
+
expiresAt?: string;
|
|
790
|
+
/**
|
|
791
|
+
* Format: date-time
|
|
792
|
+
* @description The date and time the grant was voided (cannot be used after that).
|
|
793
|
+
*/
|
|
794
|
+
voidedAt?: string;
|
|
795
|
+
};
|
|
796
|
+
EntitlementValue: {
|
|
797
|
+
/**
|
|
798
|
+
* @description Whether the subject has access to the feature.
|
|
799
|
+
* @example true
|
|
800
|
+
*/
|
|
801
|
+
hasAccess: boolean;
|
|
802
|
+
/**
|
|
803
|
+
* Format: double
|
|
804
|
+
* @description The balance of a metered entitlement.
|
|
805
|
+
* @example 100
|
|
806
|
+
*/
|
|
807
|
+
balance?: number;
|
|
808
|
+
/**
|
|
809
|
+
* Format: double
|
|
810
|
+
* @description Total usage of the feature in the period. Includes overages.
|
|
811
|
+
* @example 50
|
|
812
|
+
*/
|
|
813
|
+
usage?: number;
|
|
814
|
+
/**
|
|
815
|
+
* Format: double
|
|
816
|
+
* @description The overage of a metered entitlement.
|
|
817
|
+
* @example 0
|
|
818
|
+
*/
|
|
819
|
+
overage?: number;
|
|
820
|
+
/**
|
|
821
|
+
* @description The JSON parseable configuration value of a static entitlement.
|
|
822
|
+
* @example {"key1": "value1"}
|
|
823
|
+
*/
|
|
824
|
+
config?: string;
|
|
825
|
+
};
|
|
826
|
+
/** @description Expiration period of a grant. */
|
|
827
|
+
ExpirationPeriod: {
|
|
828
|
+
/**
|
|
829
|
+
* @description The expiration period duration like month.
|
|
830
|
+
*
|
|
831
|
+
* @enum {string}
|
|
832
|
+
*/
|
|
833
|
+
duration: 'HOUR' | 'DAY' | 'WEEK' | 'MONTH' | 'YEAR';
|
|
834
|
+
/**
|
|
835
|
+
* @description The expiration period count like 12 months.
|
|
836
|
+
*
|
|
837
|
+
* @example 12
|
|
838
|
+
*/
|
|
839
|
+
count: number;
|
|
840
|
+
};
|
|
841
|
+
/**
|
|
842
|
+
* @description A meter is a configuration that defines how to match and aggregate events.
|
|
843
|
+
* @example {
|
|
844
|
+
* "slug": "tokens_total",
|
|
845
|
+
* "description": "AI token usage",
|
|
846
|
+
* "aggregation": "SUM",
|
|
847
|
+
* "windowSize": "MINUTE",
|
|
848
|
+
* "eventType": "prompt",
|
|
849
|
+
* "valueProperty": "$.tokens",
|
|
850
|
+
* "groupBy": {
|
|
851
|
+
* "model": "$.model",
|
|
852
|
+
* "type": "$.type"
|
|
853
|
+
* }
|
|
854
|
+
* }
|
|
855
|
+
*/
|
|
856
|
+
Meter: {
|
|
857
|
+
/**
|
|
858
|
+
* @description A unique identifier for the meter.
|
|
859
|
+
* @example 01G65Z755AFWAKHE12NY0CQ9FH
|
|
860
|
+
*/
|
|
861
|
+
id?: string;
|
|
862
|
+
/**
|
|
863
|
+
* @description A unique, human-readable identifier for the meter. Must consist only alphanumeric and underscore characters.
|
|
864
|
+
* @example tokens_total
|
|
865
|
+
*/
|
|
866
|
+
slug: string;
|
|
867
|
+
/**
|
|
868
|
+
* @description A description of the meter.
|
|
869
|
+
* @example AI Token Usage
|
|
870
|
+
*/
|
|
871
|
+
description?: string | null;
|
|
872
|
+
aggregation: components['schemas']['MeterAggregation'];
|
|
873
|
+
windowSize: components['schemas']['WindowSize'];
|
|
874
|
+
/**
|
|
875
|
+
* @description The event type to aggregate.
|
|
876
|
+
* @example prompt
|
|
877
|
+
*/
|
|
878
|
+
eventType: string;
|
|
879
|
+
/**
|
|
880
|
+
* @description JSONPath expression to extract the value from the ingested event's data property.
|
|
881
|
+
* The ingested value for SUM, AVG, MIN, and MAX aggregations is a number or a string that can be parsed to a number.
|
|
882
|
+
* For UNIQUE_COUNT aggregation, the ingested value must be a string. For COUNT aggregation the valueProperty is ignored.
|
|
883
|
+
*
|
|
884
|
+
* @example $.tokens
|
|
885
|
+
*/
|
|
886
|
+
valueProperty?: string;
|
|
887
|
+
/**
|
|
888
|
+
* @description Named JSONPath expressions to extract the group by values from the event data. Keys must be unique and consist only alphanumeric and underscore characters.
|
|
889
|
+
* @example {
|
|
890
|
+
* "model": "$.model",
|
|
891
|
+
* "type": "$.type"
|
|
892
|
+
* }
|
|
893
|
+
*/
|
|
894
|
+
groupBy?: {
|
|
895
|
+
[key: string]: string;
|
|
896
|
+
};
|
|
897
|
+
};
|
|
898
|
+
/**
|
|
899
|
+
* @description The aggregation type to use for the meter.
|
|
900
|
+
* @example SUM
|
|
901
|
+
* @enum {string}
|
|
902
|
+
*/
|
|
903
|
+
MeterAggregation: 'SUM' | 'COUNT' | 'UNIQUE_COUNT' | 'AVG' | 'MIN' | 'MAX';
|
|
904
|
+
/**
|
|
905
|
+
* @description Aggregation window size.
|
|
906
|
+
* @example MINUTE
|
|
907
|
+
* @enum {string}
|
|
908
|
+
*/
|
|
909
|
+
WindowSize: 'MINUTE' | 'HOUR' | 'DAY';
|
|
910
|
+
/**
|
|
911
|
+
* @description The result of a meter query.
|
|
912
|
+
* @example {
|
|
913
|
+
* "from": "2023-01-01T00:00:00Z",
|
|
914
|
+
* "to": "2023-01-02T00:00:00Z",
|
|
915
|
+
* "windowSize": "MINUTE",
|
|
916
|
+
* "data": [
|
|
917
|
+
* {
|
|
918
|
+
* "value": 12,
|
|
919
|
+
* "windowStart": "2023-01-01T00:00:00Z",
|
|
920
|
+
* "windowEnd": "2023-01-02T00:00:00Z",
|
|
921
|
+
* "subject": "customer-id",
|
|
922
|
+
* "groupBy": {
|
|
923
|
+
* "model": "gpt-4-turbo",
|
|
924
|
+
* "type": "prompt"
|
|
925
|
+
* }
|
|
926
|
+
* }
|
|
927
|
+
* ]
|
|
928
|
+
* }
|
|
929
|
+
*/
|
|
930
|
+
MeterQueryResult: {
|
|
931
|
+
/**
|
|
932
|
+
* Format: date-time
|
|
933
|
+
* @example 2023-01-01T00:00:00Z
|
|
934
|
+
*/
|
|
935
|
+
from?: string;
|
|
936
|
+
/**
|
|
937
|
+
* Format: date-time
|
|
938
|
+
* @example 2023-01-02T00:00:00Z
|
|
939
|
+
*/
|
|
940
|
+
to?: string;
|
|
941
|
+
windowSize?: components['schemas']['WindowSize'];
|
|
942
|
+
/**
|
|
943
|
+
* @example [
|
|
944
|
+
* {
|
|
945
|
+
* "value": 12,
|
|
946
|
+
* "windowStart": "2023-01-01T00:00:00Z",
|
|
947
|
+
* "windowEnd": "2023-01-02T00:00:00Z",
|
|
948
|
+
* "subject": "customer-id",
|
|
949
|
+
* "groupBy": {
|
|
950
|
+
* "model": "gpt-4-turbo",
|
|
951
|
+
* "type": "prompt"
|
|
952
|
+
* }
|
|
953
|
+
* }
|
|
954
|
+
* ]
|
|
955
|
+
*/
|
|
956
|
+
data: components['schemas']['MeterQueryRow'][];
|
|
957
|
+
};
|
|
958
|
+
/**
|
|
959
|
+
* @description A row in the result of a meter query.
|
|
960
|
+
* @example {
|
|
961
|
+
* "value": 12,
|
|
962
|
+
* "windowStart": "2023-01-01T00:00:00Z",
|
|
963
|
+
* "windowEnd": "2023-01-02T00:00:00Z",
|
|
964
|
+
* "subject": "customer-id",
|
|
965
|
+
* "groupBy": {
|
|
966
|
+
* "model": "gpt-4-turbo",
|
|
967
|
+
* "type": "prompt"
|
|
968
|
+
* }
|
|
969
|
+
* }
|
|
970
|
+
*/
|
|
971
|
+
MeterQueryRow: {
|
|
972
|
+
/** @example 12 */
|
|
973
|
+
value: number;
|
|
974
|
+
/**
|
|
975
|
+
* Format: date-time
|
|
976
|
+
* @example 2023-01-01T00:00:00Z
|
|
977
|
+
*/
|
|
978
|
+
windowStart: string;
|
|
979
|
+
/**
|
|
980
|
+
* Format: date-time
|
|
981
|
+
* @example 2023-01-02T00:00:00Z
|
|
982
|
+
*/
|
|
983
|
+
windowEnd: string;
|
|
984
|
+
/**
|
|
985
|
+
* @description The subject of the meter value.
|
|
986
|
+
* @example customer-id
|
|
987
|
+
*/
|
|
988
|
+
subject?: string | null;
|
|
989
|
+
/**
|
|
990
|
+
* @example {
|
|
991
|
+
* "model": "gpt-4-turbo",
|
|
992
|
+
* "type": "prompt"
|
|
993
|
+
* }
|
|
994
|
+
*/
|
|
995
|
+
groupBy?: {
|
|
996
|
+
[key: string]: string;
|
|
997
|
+
} | null;
|
|
998
|
+
};
|
|
999
|
+
/**
|
|
1000
|
+
* @description A consumer portal token.
|
|
1001
|
+
* @example {
|
|
1002
|
+
* "id": "01G65Z755AFWAKHE12NY0CQ9FH",
|
|
1003
|
+
* "subject": "customer-id",
|
|
1004
|
+
* "expiresAt": "2023-01-02T00:00:00Z",
|
|
1005
|
+
* "expired": false,
|
|
1006
|
+
* "createdAt": "2023-01-01T00:00:00Z",
|
|
1007
|
+
* "token": "om_portal_IAnD3PpWW2A2Wr8m9jfzeHlGX8xmCXwG.y5q4S-AWqFu6qjfaFz0zQq4Ez28RsnyVwJffX5qxMvo",
|
|
1008
|
+
* "allowedMeterSlugs": [
|
|
1009
|
+
* "tokens_total"
|
|
1010
|
+
* ]
|
|
1011
|
+
* }
|
|
1012
|
+
*/
|
|
1013
|
+
PortalToken: {
|
|
1014
|
+
/** @example 01G65Z755AFWAKHE12NY0CQ9FH */
|
|
1015
|
+
id?: string;
|
|
1016
|
+
/** @example customer-id */
|
|
1017
|
+
subject: string;
|
|
1018
|
+
/**
|
|
1019
|
+
* Format: date-time
|
|
1020
|
+
* @example 2023-01-02T00:00:00Z
|
|
1021
|
+
*/
|
|
1022
|
+
expiresAt?: string;
|
|
1023
|
+
expired?: boolean;
|
|
1024
|
+
/**
|
|
1025
|
+
* Format: date-time
|
|
1026
|
+
* @example 2023-01-01T00:00:00Z
|
|
1027
|
+
*/
|
|
1028
|
+
createdAt?: string;
|
|
1029
|
+
/**
|
|
1030
|
+
* @description The token is only returned at creation.
|
|
1031
|
+
* @example om_portal_IAnD3PpWW2A2Wr8m9jfzeHlGX8xmCXwG.y5q4S-AWqFu6qjfaFz0zQq4Ez28RsnyVwJffX5qxMvo
|
|
1032
|
+
*/
|
|
1033
|
+
token?: string;
|
|
1034
|
+
/**
|
|
1035
|
+
* @description Optional, if defined only the specified meters will be allowed
|
|
1036
|
+
* @example [
|
|
1037
|
+
* "tokens_total"
|
|
1038
|
+
* ]
|
|
1039
|
+
*/
|
|
1040
|
+
allowedMeterSlugs?: string[];
|
|
1041
|
+
};
|
|
1042
|
+
/**
|
|
1043
|
+
* @description A subject is a unique identifier for a user or entity.
|
|
1044
|
+
* @example {
|
|
1045
|
+
* "id": "01G65Z755AFWAKHE12NY0CQ9FH",
|
|
1046
|
+
* "key": "customer-id",
|
|
1047
|
+
* "displayName": "Customer Name",
|
|
1048
|
+
* "metadata": {
|
|
1049
|
+
* "hubspotId": "123456"
|
|
1050
|
+
* },
|
|
1051
|
+
* "currentPeriodStart": "2023-01-01T00:00:00Z",
|
|
1052
|
+
* "currentPeriodEnd": "2023-02-01T00:00:00Z",
|
|
1053
|
+
* "stripeCustomerId": "cus_JMOlctsKV8"
|
|
1054
|
+
* }
|
|
1055
|
+
*/
|
|
1056
|
+
Subject: {
|
|
1057
|
+
/** @example 01G65Z755AFWAKHE12NY0CQ9FH */
|
|
1058
|
+
id?: string;
|
|
1059
|
+
/** @example customer-id */
|
|
1060
|
+
key: string;
|
|
1061
|
+
/** @example Customer Name */
|
|
1062
|
+
displayName?: string | null;
|
|
1063
|
+
/**
|
|
1064
|
+
* @example {
|
|
1065
|
+
* "hubspotId": "123456"
|
|
1066
|
+
* }
|
|
1067
|
+
*/
|
|
1068
|
+
metadata?: {
|
|
1069
|
+
[key: string]: unknown;
|
|
1070
|
+
} | null;
|
|
1071
|
+
/**
|
|
1072
|
+
* Format: date-time
|
|
1073
|
+
* @example 2023-01-01T00:00:00Z
|
|
1074
|
+
*/
|
|
1075
|
+
currentPeriodStart?: string | null;
|
|
1076
|
+
/**
|
|
1077
|
+
* Format: date-time
|
|
1078
|
+
* @example 2023-02-01T00:00:00Z
|
|
1079
|
+
*/
|
|
1080
|
+
currentPeriodEnd?: string | null;
|
|
1081
|
+
/** @example cus_JMOlctsKV8 */
|
|
1082
|
+
stripeCustomerId?: string | null;
|
|
1083
|
+
};
|
|
1084
|
+
/**
|
|
1085
|
+
* @description A unique identifier.
|
|
1086
|
+
* @example tokens_total
|
|
1087
|
+
*/
|
|
1088
|
+
IdOrSlug: string;
|
|
1089
|
+
};
|
|
1090
|
+
responses: {
|
|
1091
|
+
/** @description Ledger Exists */
|
|
1092
|
+
ConflictProblemResponse: {
|
|
1093
|
+
content: {
|
|
1094
|
+
'application/problem+json': components['schemas']['ConflictProblem'];
|
|
1095
|
+
};
|
|
1096
|
+
};
|
|
1097
|
+
/** @description Bad Request */
|
|
1098
|
+
BadRequestProblemResponse: {
|
|
1099
|
+
content: {
|
|
1100
|
+
'application/problem+json': components['schemas']['Problem'];
|
|
1101
|
+
};
|
|
1102
|
+
};
|
|
1103
|
+
/** @description Unauthorized */
|
|
1104
|
+
UnauthorizedProblemResponse: {
|
|
1105
|
+
content: {
|
|
1106
|
+
'application/problem+json': components['schemas']['Problem'];
|
|
1107
|
+
};
|
|
1108
|
+
};
|
|
1109
|
+
/** @description Not Found */
|
|
1110
|
+
NotFoundProblemResponse: {
|
|
1111
|
+
content: {
|
|
1112
|
+
'application/problem+json': components['schemas']['Problem'];
|
|
1113
|
+
};
|
|
1114
|
+
};
|
|
1115
|
+
/** @description Not Implemented */
|
|
1116
|
+
NotImplementedProblemResponse: {
|
|
1117
|
+
content: {
|
|
1118
|
+
'application/problem+json': components['schemas']['Problem'];
|
|
1119
|
+
};
|
|
1120
|
+
};
|
|
1121
|
+
/** @description Unexpected error */
|
|
1122
|
+
UnexpectedProblemResponse: {
|
|
1123
|
+
content: {
|
|
1124
|
+
'application/problem+json': components['schemas']['Problem'];
|
|
1125
|
+
};
|
|
1126
|
+
};
|
|
1127
|
+
};
|
|
1128
|
+
parameters: {
|
|
1129
|
+
/** @description A unique identifier for the meter. */
|
|
1130
|
+
meterIdOrSlug: components['schemas']['IdOrSlug'];
|
|
1131
|
+
/** @description A unique identifier for a subject. */
|
|
1132
|
+
subjectIdOrKey: string;
|
|
1133
|
+
/** @description A unique ULID identifier for a feature. */
|
|
1134
|
+
featureId: string;
|
|
1135
|
+
/** @description A unique identifier for a grant. */
|
|
1136
|
+
grantId: string;
|
|
1137
|
+
/** @description A unique ULID for an entitlement. */
|
|
1138
|
+
entitlementId: string;
|
|
1139
|
+
/** @description The id of the entitlement or the key of the feature. */
|
|
1140
|
+
entitlementIdOrFeatureKey: string;
|
|
1141
|
+
/** @description Include deleted entries. */
|
|
1142
|
+
includeDeleted?: boolean;
|
|
1143
|
+
/** @description Number of entries to return */
|
|
1144
|
+
queryLimit?: number;
|
|
1145
|
+
/** @description Number of entries to skip */
|
|
1146
|
+
queryOffset?: number;
|
|
1147
|
+
/**
|
|
1148
|
+
* @description Start date-time in RFC 3339 format.
|
|
1149
|
+
* Inclusive.
|
|
1150
|
+
*/
|
|
1151
|
+
queryFrom?: string;
|
|
1152
|
+
/**
|
|
1153
|
+
* @description End date-time in RFC 3339 format.
|
|
1154
|
+
* Inclusive.
|
|
1155
|
+
*/
|
|
1156
|
+
queryTo?: string;
|
|
1157
|
+
/** @description If not specified, a single usage aggregate will be returned for the entirety of the specified period for each subject and group. */
|
|
1158
|
+
queryWindowSize?: components['schemas']['WindowSize'];
|
|
1159
|
+
/**
|
|
1160
|
+
* @description The value is the name of the time zone as defined in the IANA Time Zone Database (http://www.iana.org/time-zones).
|
|
1161
|
+
* If not specified, the UTC timezone will be used.
|
|
1162
|
+
*/
|
|
1163
|
+
queryWindowTimeZone?: string;
|
|
1164
|
+
/**
|
|
1165
|
+
* @description Filtering by multiple subjects.
|
|
1166
|
+
*
|
|
1167
|
+
* Usage: ?subject=customer-1&subject=customer-2
|
|
1168
|
+
*/
|
|
1169
|
+
queryFilterSubject?: string[];
|
|
1170
|
+
queryFilterGroupBy?: {
|
|
1171
|
+
[key: string]: string;
|
|
1172
|
+
};
|
|
1173
|
+
/**
|
|
1174
|
+
* @description If not specified a single aggregate will be returned for each subject and time window.
|
|
1175
|
+
* `subject` is a reserved group by value.
|
|
1176
|
+
*/
|
|
1177
|
+
queryGroupBy?: string[];
|
|
1178
|
+
};
|
|
1179
|
+
requestBodies: never;
|
|
1180
|
+
headers: never;
|
|
1181
|
+
pathItems: never;
|
|
1182
|
+
}
|
|
1183
|
+
export type $defs = Record<string, never>;
|
|
1184
|
+
export type external = Record<string, never>;
|
|
1185
|
+
export interface operations {
|
|
1186
|
+
/**
|
|
1187
|
+
* List ingested events
|
|
1188
|
+
* @description List ingested events within a time range.
|
|
1189
|
+
*/
|
|
1190
|
+
listEvents: {
|
|
1191
|
+
parameters: {
|
|
1192
|
+
query?: {
|
|
1193
|
+
from?: components['parameters']['queryFrom'];
|
|
1194
|
+
to?: components['parameters']['queryTo'];
|
|
1195
|
+
/** @description Number of events to return */
|
|
1196
|
+
limit?: number;
|
|
1197
|
+
};
|
|
1198
|
+
};
|
|
1199
|
+
responses: {
|
|
1200
|
+
/** @description List of events for debugging. */
|
|
1201
|
+
200: {
|
|
1202
|
+
content: {
|
|
1203
|
+
'application/json': components['schemas']['IngestedEvent'][];
|
|
1204
|
+
};
|
|
1205
|
+
};
|
|
1206
|
+
400: components['responses']['BadRequestProblemResponse'];
|
|
1207
|
+
401: components['responses']['UnauthorizedProblemResponse'];
|
|
1208
|
+
default: components['responses']['UnexpectedProblemResponse'];
|
|
1209
|
+
};
|
|
1210
|
+
};
|
|
1211
|
+
/**
|
|
1212
|
+
* Ingest events
|
|
1213
|
+
* @description Ingests an event or batch of events following the CloudEvents specification.
|
|
1214
|
+
*/
|
|
1215
|
+
ingestEvents: {
|
|
1216
|
+
/**
|
|
1217
|
+
* @description The event or batch of events to ingest.
|
|
1218
|
+
* The request body must be a CloudEvents JSON object or an array of CloudEvents JSON objects.
|
|
1219
|
+
* The CloudEvents JSON object must adhere to the CloudEvents Specification JSON Schema.
|
|
1220
|
+
*/
|
|
1221
|
+
requestBody: {
|
|
1222
|
+
content: {
|
|
1223
|
+
'application/cloudevents+json': components['schemas']['Event'];
|
|
1224
|
+
'application/cloudevents-batch+json': components['schemas']['Event'][];
|
|
1225
|
+
};
|
|
1226
|
+
};
|
|
1227
|
+
responses: {
|
|
1228
|
+
/** @description Successfully ingested. */
|
|
1229
|
+
204: {
|
|
1230
|
+
content: never;
|
|
1231
|
+
};
|
|
1232
|
+
400: components['responses']['BadRequestProblemResponse'];
|
|
1233
|
+
401: components['responses']['UnauthorizedProblemResponse'];
|
|
1234
|
+
default: components['responses']['UnexpectedProblemResponse'];
|
|
1235
|
+
};
|
|
1236
|
+
};
|
|
1237
|
+
/**
|
|
1238
|
+
* List meters
|
|
1239
|
+
* @description List meters.
|
|
1240
|
+
*/
|
|
1241
|
+
listMeters: {
|
|
1242
|
+
responses: {
|
|
1243
|
+
/** @description List of meters. */
|
|
1244
|
+
200: {
|
|
1245
|
+
content: {
|
|
1246
|
+
'application/json': components['schemas']['Meter'][];
|
|
1247
|
+
};
|
|
1248
|
+
};
|
|
1249
|
+
401: components['responses']['UnauthorizedProblemResponse'];
|
|
1250
|
+
default: components['responses']['UnexpectedProblemResponse'];
|
|
1251
|
+
};
|
|
1252
|
+
};
|
|
1253
|
+
/**
|
|
1254
|
+
* ☁ Create meter
|
|
1255
|
+
* @description *Available in OpenMeter Cloud.*
|
|
1256
|
+
* *In the open-source version, meters are created in the configuration file.*
|
|
1257
|
+
*
|
|
1258
|
+
* Create a meter.
|
|
1259
|
+
*/
|
|
1260
|
+
createMeter: {
|
|
1261
|
+
/** @description The meter to create. */
|
|
1262
|
+
requestBody: {
|
|
1263
|
+
content: {
|
|
1264
|
+
'application/json': components['schemas']['Meter'];
|
|
1265
|
+
};
|
|
1266
|
+
};
|
|
1267
|
+
responses: {
|
|
1268
|
+
/** @description Created. */
|
|
1269
|
+
201: {
|
|
1270
|
+
content: {
|
|
1271
|
+
'application/json': components['schemas']['Meter'];
|
|
1272
|
+
};
|
|
1273
|
+
};
|
|
1274
|
+
400: components['responses']['BadRequestProblemResponse'];
|
|
1275
|
+
401: components['responses']['UnauthorizedProblemResponse'];
|
|
1276
|
+
501: components['responses']['NotImplementedProblemResponse'];
|
|
1277
|
+
default: components['responses']['UnexpectedProblemResponse'];
|
|
1278
|
+
};
|
|
1279
|
+
};
|
|
1280
|
+
/**
|
|
1281
|
+
* Get meter
|
|
1282
|
+
* @description Get meter by ID or slug
|
|
1283
|
+
*/
|
|
1284
|
+
getMeter: {
|
|
1285
|
+
parameters: {
|
|
1286
|
+
path: {
|
|
1287
|
+
meterIdOrSlug: components['parameters']['meterIdOrSlug'];
|
|
1288
|
+
};
|
|
1289
|
+
};
|
|
1290
|
+
responses: {
|
|
1291
|
+
/** @description Meter found. */
|
|
1292
|
+
200: {
|
|
1293
|
+
content: {
|
|
1294
|
+
'application/json': components['schemas']['Meter'];
|
|
1295
|
+
};
|
|
1296
|
+
};
|
|
1297
|
+
404: components['responses']['NotFoundProblemResponse'];
|
|
1298
|
+
default: components['responses']['UnexpectedProblemResponse'];
|
|
1299
|
+
};
|
|
1300
|
+
};
|
|
1301
|
+
/**
|
|
1302
|
+
* ☁ Delete meter
|
|
1303
|
+
* @description *Available in OpenMeter Cloud.*
|
|
1304
|
+
*
|
|
1305
|
+
* Delete a meter by ID or slug.
|
|
1306
|
+
*/
|
|
1307
|
+
deleteMeter: {
|
|
1308
|
+
parameters: {
|
|
1309
|
+
path: {
|
|
1310
|
+
meterIdOrSlug: components['parameters']['meterIdOrSlug'];
|
|
1311
|
+
};
|
|
1312
|
+
};
|
|
1313
|
+
responses: {
|
|
1314
|
+
/** @description Meter deleted. */
|
|
1315
|
+
204: {
|
|
1316
|
+
content: never;
|
|
1317
|
+
};
|
|
1318
|
+
404: components['responses']['NotFoundProblemResponse'];
|
|
1319
|
+
501: components['responses']['NotImplementedProblemResponse'];
|
|
1320
|
+
default: components['responses']['UnexpectedProblemResponse'];
|
|
1321
|
+
};
|
|
1322
|
+
};
|
|
1323
|
+
/**
|
|
1324
|
+
* Query meter
|
|
1325
|
+
* @description Query meter for usage.
|
|
1326
|
+
*/
|
|
1327
|
+
queryMeter: {
|
|
1328
|
+
parameters: {
|
|
1329
|
+
query?: {
|
|
1330
|
+
from?: components['parameters']['queryFrom'];
|
|
1331
|
+
to?: components['parameters']['queryTo'];
|
|
1332
|
+
windowSize?: components['parameters']['queryWindowSize'];
|
|
1333
|
+
windowTimeZone?: components['parameters']['queryWindowTimeZone'];
|
|
1334
|
+
subject?: components['parameters']['queryFilterSubject'];
|
|
1335
|
+
filterGroupBy?: components['parameters']['queryFilterGroupBy'];
|
|
1336
|
+
groupBy?: components['parameters']['queryGroupBy'];
|
|
1337
|
+
};
|
|
1338
|
+
path: {
|
|
1339
|
+
meterIdOrSlug: components['parameters']['meterIdOrSlug'];
|
|
1340
|
+
};
|
|
1341
|
+
};
|
|
1342
|
+
responses: {
|
|
1343
|
+
/** @description Usage data. */
|
|
1344
|
+
200: {
|
|
1345
|
+
content: {
|
|
1346
|
+
'application/json': components['schemas']['MeterQueryResult'];
|
|
1347
|
+
'text/csv': string;
|
|
1348
|
+
};
|
|
1349
|
+
};
|
|
1350
|
+
400: components['responses']['BadRequestProblemResponse'];
|
|
1351
|
+
401: components['responses']['UnauthorizedProblemResponse'];
|
|
1352
|
+
default: components['responses']['UnexpectedProblemResponse'];
|
|
1353
|
+
};
|
|
1354
|
+
};
|
|
1355
|
+
/**
|
|
1356
|
+
* List meter subjects
|
|
1357
|
+
* @description List subjects for a meter.
|
|
1358
|
+
*/
|
|
1359
|
+
listMeterSubjects: {
|
|
1360
|
+
parameters: {
|
|
1361
|
+
path: {
|
|
1362
|
+
meterIdOrSlug: components['parameters']['meterIdOrSlug'];
|
|
1363
|
+
};
|
|
1364
|
+
};
|
|
1365
|
+
responses: {
|
|
1366
|
+
/** @description List of subjects. */
|
|
1367
|
+
200: {
|
|
1368
|
+
content: {
|
|
1369
|
+
'application/json': string[];
|
|
1370
|
+
};
|
|
1371
|
+
};
|
|
1372
|
+
400: components['responses']['BadRequestProblemResponse'];
|
|
1373
|
+
default: components['responses']['UnexpectedProblemResponse'];
|
|
1374
|
+
};
|
|
1375
|
+
};
|
|
1376
|
+
/**
|
|
1377
|
+
* ☁ List portal tokens
|
|
1378
|
+
* @description *Available in OpenMeter Cloud.*
|
|
1379
|
+
*
|
|
1380
|
+
* List consumer portal tokens.
|
|
1381
|
+
*/
|
|
1382
|
+
listPortalTokens: {
|
|
1383
|
+
parameters: {
|
|
1384
|
+
query?: {
|
|
1385
|
+
/** @description Number of portal tokens to return. Default is 25. */
|
|
1386
|
+
limit?: number;
|
|
1387
|
+
};
|
|
1388
|
+
};
|
|
1389
|
+
responses: {
|
|
1390
|
+
/** @description List of portal tokens. */
|
|
1391
|
+
200: {
|
|
1392
|
+
content: {
|
|
1393
|
+
'application/json': components['schemas']['PortalToken'][];
|
|
1394
|
+
};
|
|
1395
|
+
};
|
|
1396
|
+
400: components['responses']['BadRequestProblemResponse'];
|
|
1397
|
+
401: components['responses']['UnauthorizedProblemResponse'];
|
|
1398
|
+
501: components['responses']['NotImplementedProblemResponse'];
|
|
1399
|
+
default: components['responses']['UnexpectedProblemResponse'];
|
|
1400
|
+
};
|
|
1401
|
+
};
|
|
1402
|
+
/**
|
|
1403
|
+
* Create portal token
|
|
1404
|
+
* @description Create a consumer portal token.
|
|
1405
|
+
*/
|
|
1406
|
+
createPortalToken: {
|
|
1407
|
+
/** @description The portal token to create. */
|
|
1408
|
+
requestBody: {
|
|
1409
|
+
content: {
|
|
1410
|
+
/**
|
|
1411
|
+
* @example {
|
|
1412
|
+
* "subject": "customer-id",
|
|
1413
|
+
* "allowedMeterSlugs": [
|
|
1414
|
+
* "tokens_total"
|
|
1415
|
+
* ]
|
|
1416
|
+
* }
|
|
1417
|
+
*/
|
|
1418
|
+
'application/json': components['schemas']['PortalToken'];
|
|
1419
|
+
};
|
|
1420
|
+
};
|
|
1421
|
+
responses: {
|
|
1422
|
+
/** @description Created. */
|
|
1423
|
+
200: {
|
|
1424
|
+
content: {
|
|
1425
|
+
'application/json': components['schemas']['PortalToken'];
|
|
1426
|
+
};
|
|
1427
|
+
};
|
|
1428
|
+
400: components['responses']['BadRequestProblemResponse'];
|
|
1429
|
+
401: components['responses']['UnauthorizedProblemResponse'];
|
|
1430
|
+
default: components['responses']['UnexpectedProblemResponse'];
|
|
1431
|
+
};
|
|
1432
|
+
};
|
|
1433
|
+
/**
|
|
1434
|
+
* ☁ Invalidate portal tokens
|
|
1435
|
+
* @description *Available in OpenMeter Cloud.*
|
|
1436
|
+
*
|
|
1437
|
+
* Invalidates consumer portal tokens by ID or subject.
|
|
1438
|
+
*/
|
|
1439
|
+
invalidatePortalTokens: {
|
|
1440
|
+
/** @description If no id or subject is specified, all tokens will be invalidated. */
|
|
1441
|
+
requestBody: {
|
|
1442
|
+
content: {
|
|
1443
|
+
'application/json': {
|
|
1444
|
+
/** @description Invalidate a portal token by ID. */
|
|
1445
|
+
id?: string;
|
|
1446
|
+
/** @description Invalidate all portal tokens for a subject. */
|
|
1447
|
+
subject?: string;
|
|
1448
|
+
};
|
|
1449
|
+
};
|
|
1450
|
+
};
|
|
1451
|
+
responses: {
|
|
1452
|
+
/** @description Portal tokens invalidated. */
|
|
1453
|
+
204: {
|
|
1454
|
+
content: never;
|
|
1455
|
+
};
|
|
1456
|
+
400: components['responses']['BadRequestProblemResponse'];
|
|
1457
|
+
401: components['responses']['UnauthorizedProblemResponse'];
|
|
1458
|
+
501: components['responses']['NotImplementedProblemResponse'];
|
|
1459
|
+
default: components['responses']['UnexpectedProblemResponse'];
|
|
1460
|
+
};
|
|
1461
|
+
};
|
|
1462
|
+
/**
|
|
1463
|
+
* ☁ List subjects
|
|
1464
|
+
* @description *Available in OpenMeter Cloud.*
|
|
1465
|
+
*
|
|
1466
|
+
* List subjects.
|
|
1467
|
+
*/
|
|
1468
|
+
listSubjects: {
|
|
1469
|
+
responses: {
|
|
1470
|
+
/** @description List of subjects. */
|
|
1471
|
+
200: {
|
|
1472
|
+
content: {
|
|
1473
|
+
'application/json': components['schemas']['Subject'][];
|
|
1474
|
+
};
|
|
1475
|
+
};
|
|
1476
|
+
401: components['responses']['UnauthorizedProblemResponse'];
|
|
1477
|
+
default: components['responses']['UnexpectedProblemResponse'];
|
|
222
1478
|
};
|
|
223
1479
|
};
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
1480
|
+
/**
|
|
1481
|
+
* ☁ Upsert subject
|
|
1482
|
+
* @description *Available in OpenMeter Cloud.*
|
|
1483
|
+
*
|
|
1484
|
+
* Upserts a subject. Creates or updates subject.
|
|
1485
|
+
* If the subject doesn't exist, it will be created.
|
|
1486
|
+
* If the subject exists, it will be partially updated with the provided fields.
|
|
1487
|
+
*/
|
|
1488
|
+
upsertSubject: {
|
|
1489
|
+
/** @description The subject to upsert. */
|
|
1490
|
+
requestBody: {
|
|
227
1491
|
content: {
|
|
228
|
-
'application/
|
|
1492
|
+
'application/json': components['schemas']['Subject'][];
|
|
229
1493
|
};
|
|
230
1494
|
};
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
1495
|
+
responses: {
|
|
1496
|
+
/** @description Subject upserted. */
|
|
1497
|
+
200: {
|
|
1498
|
+
content: {
|
|
1499
|
+
'application/json': components['schemas']['Subject'][];
|
|
1500
|
+
};
|
|
235
1501
|
};
|
|
1502
|
+
400: components['responses']['BadRequestProblemResponse'];
|
|
1503
|
+
401: components['responses']['UnauthorizedProblemResponse'];
|
|
1504
|
+
501: components['responses']['NotImplementedProblemResponse'];
|
|
1505
|
+
default: components['responses']['UnexpectedProblemResponse'];
|
|
236
1506
|
};
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
1507
|
+
};
|
|
1508
|
+
/**
|
|
1509
|
+
* ☁ Get subject
|
|
1510
|
+
* @description *Available in OpenMeter Cloud.*
|
|
1511
|
+
*
|
|
1512
|
+
* Get subject by ID or key.
|
|
1513
|
+
*/
|
|
1514
|
+
getSubject: {
|
|
1515
|
+
parameters: {
|
|
1516
|
+
path: {
|
|
1517
|
+
subjectIdOrKey: components['parameters']['subjectIdOrKey'];
|
|
241
1518
|
};
|
|
242
1519
|
};
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
1520
|
+
responses: {
|
|
1521
|
+
/** @description Subject found. */
|
|
1522
|
+
200: {
|
|
1523
|
+
content: {
|
|
1524
|
+
'application/json': components['schemas']['Subject'];
|
|
1525
|
+
};
|
|
247
1526
|
};
|
|
1527
|
+
401: components['responses']['UnauthorizedProblemResponse'];
|
|
1528
|
+
404: components['responses']['NotFoundProblemResponse'];
|
|
1529
|
+
default: components['responses']['UnexpectedProblemResponse'];
|
|
248
1530
|
};
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
1531
|
+
};
|
|
1532
|
+
/**
|
|
1533
|
+
* ☁ Delete subject
|
|
1534
|
+
* @description *Available in OpenMeter Cloud.*
|
|
1535
|
+
*
|
|
1536
|
+
* Delete a subject by ID or key.
|
|
1537
|
+
*/
|
|
1538
|
+
deleteSubject: {
|
|
1539
|
+
parameters: {
|
|
1540
|
+
path: {
|
|
1541
|
+
subjectIdOrKey: components['parameters']['subjectIdOrKey'];
|
|
253
1542
|
};
|
|
254
1543
|
};
|
|
1544
|
+
responses: {
|
|
1545
|
+
/** @description Subject deleted. */
|
|
1546
|
+
204: {
|
|
1547
|
+
content: never;
|
|
1548
|
+
};
|
|
1549
|
+
400: components['responses']['BadRequestProblemResponse'];
|
|
1550
|
+
401: components['responses']['UnauthorizedProblemResponse'];
|
|
1551
|
+
404: components['responses']['NotFoundProblemResponse'];
|
|
1552
|
+
501: components['responses']['NotImplementedProblemResponse'];
|
|
1553
|
+
default: components['responses']['UnexpectedProblemResponse'];
|
|
1554
|
+
};
|
|
255
1555
|
};
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
};
|
|
262
|
-
requestBodies: never;
|
|
263
|
-
headers: never;
|
|
264
|
-
pathItems: never;
|
|
265
|
-
}
|
|
266
|
-
export type $defs = Record<string, never>;
|
|
267
|
-
export type external = Record<string, never>;
|
|
268
|
-
export interface operations {
|
|
269
|
-
/** @description Retrieve latest raw events. */
|
|
270
|
-
listEvents: {
|
|
1556
|
+
/**
|
|
1557
|
+
* Query portal meter
|
|
1558
|
+
* @description Query meter for consumer portal. This endpoint is publicly exposable to consumers.
|
|
1559
|
+
*/
|
|
1560
|
+
queryPortalMeter: {
|
|
271
1561
|
parameters: {
|
|
272
1562
|
query?: {
|
|
273
|
-
|
|
274
|
-
|
|
1563
|
+
from?: components['parameters']['queryFrom'];
|
|
1564
|
+
to?: components['parameters']['queryTo'];
|
|
1565
|
+
windowSize?: components['parameters']['queryWindowSize'];
|
|
1566
|
+
windowTimeZone?: components['parameters']['queryWindowTimeZone'];
|
|
1567
|
+
filterGroupBy?: components['parameters']['queryFilterGroupBy'];
|
|
1568
|
+
groupBy?: components['parameters']['queryGroupBy'];
|
|
275
1569
|
};
|
|
276
|
-
|
|
277
|
-
|
|
1570
|
+
path: {
|
|
1571
|
+
/** @description A unique identifier for the meter. */
|
|
1572
|
+
meterSlug: string;
|
|
278
1573
|
};
|
|
279
1574
|
};
|
|
280
1575
|
responses: {
|
|
281
|
-
/** @description
|
|
1576
|
+
/** @description Usage data. */
|
|
282
1577
|
200: {
|
|
283
1578
|
content: {
|
|
284
|
-
'application/json': components['schemas']['
|
|
1579
|
+
'application/json': components['schemas']['MeterQueryResult'];
|
|
1580
|
+
'text/csv': string;
|
|
285
1581
|
};
|
|
286
1582
|
};
|
|
287
1583
|
400: components['responses']['BadRequestProblemResponse'];
|
|
1584
|
+
401: components['responses']['UnauthorizedProblemResponse'];
|
|
288
1585
|
default: components['responses']['UnexpectedProblemResponse'];
|
|
289
1586
|
};
|
|
290
1587
|
};
|
|
291
|
-
/**
|
|
292
|
-
|
|
1588
|
+
/**
|
|
1589
|
+
* List entitlements
|
|
1590
|
+
* @description List entitlements.
|
|
1591
|
+
*/
|
|
1592
|
+
listEntitlements: {
|
|
1593
|
+
parameters: {
|
|
1594
|
+
query?: {
|
|
1595
|
+
limit?: components['parameters']['queryLimit'];
|
|
1596
|
+
offset?: components['parameters']['queryOffset'];
|
|
1597
|
+
/** @description Order by field */
|
|
1598
|
+
orderBy?: 'createdAt' | 'updatedAt';
|
|
1599
|
+
};
|
|
1600
|
+
};
|
|
1601
|
+
responses: {
|
|
1602
|
+
/** @description List of entitlements. */
|
|
1603
|
+
200: {
|
|
1604
|
+
content: {
|
|
1605
|
+
'application/json': components['schemas']['Entitlement'][];
|
|
1606
|
+
};
|
|
1607
|
+
};
|
|
1608
|
+
401: components['responses']['UnauthorizedProblemResponse'];
|
|
1609
|
+
default: components['responses']['UnexpectedProblemResponse'];
|
|
1610
|
+
};
|
|
1611
|
+
};
|
|
1612
|
+
/**
|
|
1613
|
+
* List features
|
|
1614
|
+
* @description List features.
|
|
1615
|
+
*/
|
|
1616
|
+
listFeatures: {
|
|
293
1617
|
parameters: {
|
|
294
|
-
|
|
295
|
-
|
|
1618
|
+
query?: {
|
|
1619
|
+
limit?: components['parameters']['queryLimit'];
|
|
1620
|
+
offset?: components['parameters']['queryOffset'];
|
|
1621
|
+
/** @description Order by field */
|
|
1622
|
+
orderBy?: 'id' | 'createdAt' | 'updatedAt';
|
|
1623
|
+
/** @description Include archived features. */
|
|
1624
|
+
includeArchived?: boolean;
|
|
1625
|
+
};
|
|
1626
|
+
};
|
|
1627
|
+
responses: {
|
|
1628
|
+
/** @description List of features. */
|
|
1629
|
+
200: {
|
|
1630
|
+
content: {
|
|
1631
|
+
'application/json': components['schemas']['Feature'][];
|
|
1632
|
+
};
|
|
296
1633
|
};
|
|
1634
|
+
401: components['responses']['UnauthorizedProblemResponse'];
|
|
1635
|
+
default: components['responses']['UnexpectedProblemResponse'];
|
|
297
1636
|
};
|
|
1637
|
+
};
|
|
1638
|
+
/**
|
|
1639
|
+
* Create feature
|
|
1640
|
+
* @description Creates a feature.
|
|
1641
|
+
*/
|
|
1642
|
+
createFeature: {
|
|
1643
|
+
/** @description The feature to create. */
|
|
298
1644
|
requestBody: {
|
|
299
1645
|
content: {
|
|
300
|
-
'application/
|
|
301
|
-
|
|
1646
|
+
'application/json': components['schemas']['FeatureCreateInputs'];
|
|
1647
|
+
};
|
|
1648
|
+
};
|
|
1649
|
+
responses: {
|
|
1650
|
+
/** @description Feature created. */
|
|
1651
|
+
201: {
|
|
1652
|
+
content: {
|
|
1653
|
+
'application/json': components['schemas']['Feature'];
|
|
1654
|
+
};
|
|
1655
|
+
};
|
|
1656
|
+
400: components['responses']['BadRequestProblemResponse'];
|
|
1657
|
+
401: components['responses']['UnauthorizedProblemResponse'];
|
|
1658
|
+
501: components['responses']['NotImplementedProblemResponse'];
|
|
1659
|
+
default: components['responses']['UnexpectedProblemResponse'];
|
|
1660
|
+
};
|
|
1661
|
+
};
|
|
1662
|
+
/**
|
|
1663
|
+
* Get feature
|
|
1664
|
+
* @description Get feature by id.
|
|
1665
|
+
*/
|
|
1666
|
+
getFeature: {
|
|
1667
|
+
parameters: {
|
|
1668
|
+
path: {
|
|
1669
|
+
featureId: components['parameters']['featureId'];
|
|
1670
|
+
};
|
|
1671
|
+
};
|
|
1672
|
+
responses: {
|
|
1673
|
+
/** @description Feature found. */
|
|
1674
|
+
200: {
|
|
1675
|
+
content: {
|
|
1676
|
+
'application/json': components['schemas']['Feature'];
|
|
1677
|
+
};
|
|
1678
|
+
};
|
|
1679
|
+
401: components['responses']['UnauthorizedProblemResponse'];
|
|
1680
|
+
404: components['responses']['NotFoundProblemResponse'];
|
|
1681
|
+
default: components['responses']['UnexpectedProblemResponse'];
|
|
1682
|
+
};
|
|
1683
|
+
};
|
|
1684
|
+
/**
|
|
1685
|
+
* Delete feature
|
|
1686
|
+
* @description Delete a feature by key.
|
|
1687
|
+
*/
|
|
1688
|
+
deleteFeature: {
|
|
1689
|
+
parameters: {
|
|
1690
|
+
path: {
|
|
1691
|
+
featureId: components['parameters']['featureId'];
|
|
1692
|
+
};
|
|
1693
|
+
};
|
|
1694
|
+
responses: {
|
|
1695
|
+
/** @description Feature deleted. */
|
|
1696
|
+
204: {
|
|
1697
|
+
content: never;
|
|
1698
|
+
};
|
|
1699
|
+
401: components['responses']['UnauthorizedProblemResponse'];
|
|
1700
|
+
404: components['responses']['NotFoundProblemResponse'];
|
|
1701
|
+
default: components['responses']['UnexpectedProblemResponse'];
|
|
1702
|
+
};
|
|
1703
|
+
};
|
|
1704
|
+
/**
|
|
1705
|
+
* List grants
|
|
1706
|
+
* @description List all grants.
|
|
1707
|
+
*/
|
|
1708
|
+
listGrants: {
|
|
1709
|
+
parameters: {
|
|
1710
|
+
query?: {
|
|
1711
|
+
limit?: components['parameters']['queryLimit'];
|
|
1712
|
+
offset?: components['parameters']['queryOffset'];
|
|
1713
|
+
/** @description Order by field */
|
|
1714
|
+
orderBy?: 'id' | 'createdAt' | 'updatedAt';
|
|
1715
|
+
includeDeleted?: components['parameters']['includeDeleted'];
|
|
1716
|
+
};
|
|
1717
|
+
};
|
|
1718
|
+
responses: {
|
|
1719
|
+
/** @description List of grants. */
|
|
1720
|
+
200: {
|
|
1721
|
+
content: {
|
|
1722
|
+
'application/json': components['schemas']['EntitlementGrant'][];
|
|
1723
|
+
};
|
|
1724
|
+
};
|
|
1725
|
+
401: components['responses']['UnauthorizedProblemResponse'];
|
|
1726
|
+
default: components['responses']['UnexpectedProblemResponse'];
|
|
1727
|
+
};
|
|
1728
|
+
};
|
|
1729
|
+
/**
|
|
1730
|
+
* Delete a grant
|
|
1731
|
+
* @description Void (delete) a grant. A grant can only be deleted if it hasn't been used.
|
|
1732
|
+
*/
|
|
1733
|
+
voidGrant: {
|
|
1734
|
+
parameters: {
|
|
1735
|
+
path: {
|
|
1736
|
+
grantId: components['parameters']['grantId'];
|
|
302
1737
|
};
|
|
303
1738
|
};
|
|
304
1739
|
responses: {
|
|
305
|
-
/** @description
|
|
1740
|
+
/** @description Grant has been voided. */
|
|
306
1741
|
204: {
|
|
307
1742
|
content: never;
|
|
308
1743
|
};
|
|
309
1744
|
400: components['responses']['BadRequestProblemResponse'];
|
|
1745
|
+
401: components['responses']['UnauthorizedProblemResponse'];
|
|
1746
|
+
404: components['responses']['NotFoundProblemResponse'];
|
|
1747
|
+
409: components['responses']['ConflictProblemResponse'];
|
|
310
1748
|
default: components['responses']['UnexpectedProblemResponse'];
|
|
311
1749
|
};
|
|
312
1750
|
};
|
|
313
|
-
/**
|
|
314
|
-
|
|
1751
|
+
/**
|
|
1752
|
+
* List entitlements
|
|
1753
|
+
* @description List all entitlements for a subject.
|
|
1754
|
+
*/
|
|
1755
|
+
listSubjectEntitlements: {
|
|
315
1756
|
parameters: {
|
|
316
|
-
|
|
317
|
-
|
|
1757
|
+
query?: {
|
|
1758
|
+
includeDeleted?: components['parameters']['includeDeleted'];
|
|
1759
|
+
};
|
|
1760
|
+
path: {
|
|
1761
|
+
subjectIdOrKey: components['parameters']['subjectIdOrKey'];
|
|
318
1762
|
};
|
|
319
1763
|
};
|
|
320
1764
|
responses: {
|
|
321
|
-
/** @description
|
|
1765
|
+
/** @description List of entitlements. */
|
|
322
1766
|
200: {
|
|
323
1767
|
content: {
|
|
324
|
-
'application/json': components['schemas']['
|
|
1768
|
+
'application/json': components['schemas']['Entitlement'][];
|
|
325
1769
|
};
|
|
326
1770
|
};
|
|
1771
|
+
401: components['responses']['UnauthorizedProblemResponse'];
|
|
327
1772
|
default: components['responses']['UnexpectedProblemResponse'];
|
|
328
1773
|
};
|
|
329
1774
|
};
|
|
330
|
-
/**
|
|
331
|
-
|
|
1775
|
+
/**
|
|
1776
|
+
* Create entitlement
|
|
1777
|
+
* @description Create an entitlement for a subject.
|
|
1778
|
+
*/
|
|
1779
|
+
createEntitlement: {
|
|
332
1780
|
parameters: {
|
|
333
|
-
|
|
334
|
-
|
|
1781
|
+
path: {
|
|
1782
|
+
subjectIdOrKey: components['parameters']['subjectIdOrKey'];
|
|
335
1783
|
};
|
|
336
1784
|
};
|
|
1785
|
+
/** @description The entitlement to create. */
|
|
337
1786
|
requestBody: {
|
|
338
1787
|
content: {
|
|
339
|
-
'application/json': components['schemas']['
|
|
1788
|
+
'application/json': components['schemas']['EntitlementMeteredCreateInputs'] | components['schemas']['EntitlementStaticCreateInputs'] | components['schemas']['EntitlementBooleanCreateInputs'];
|
|
340
1789
|
};
|
|
341
1790
|
};
|
|
342
1791
|
responses: {
|
|
343
|
-
/** @description
|
|
1792
|
+
/** @description Entitlement created. */
|
|
344
1793
|
201: {
|
|
345
1794
|
content: {
|
|
346
|
-
'application/json': components['schemas']['
|
|
1795
|
+
'application/json': components['schemas']['Entitlement'];
|
|
347
1796
|
};
|
|
348
1797
|
};
|
|
349
1798
|
400: components['responses']['BadRequestProblemResponse'];
|
|
1799
|
+
401: components['responses']['UnauthorizedProblemResponse'];
|
|
1800
|
+
409: components['responses']['ConflictProblemResponse'];
|
|
350
1801
|
501: components['responses']['NotImplementedProblemResponse'];
|
|
351
1802
|
default: components['responses']['UnexpectedProblemResponse'];
|
|
352
1803
|
};
|
|
353
1804
|
};
|
|
354
|
-
/**
|
|
355
|
-
|
|
1805
|
+
/**
|
|
1806
|
+
* Get entitlement
|
|
1807
|
+
* @description Get entitlement by id.
|
|
1808
|
+
*/
|
|
1809
|
+
getEntitlement: {
|
|
356
1810
|
parameters: {
|
|
357
|
-
header?: {
|
|
358
|
-
'OM-Namespace'?: components['parameters']['namespaceParam'];
|
|
359
|
-
};
|
|
360
1811
|
path: {
|
|
361
|
-
|
|
1812
|
+
subjectIdOrKey: components['parameters']['subjectIdOrKey'];
|
|
1813
|
+
entitlementId: components['parameters']['entitlementId'];
|
|
362
1814
|
};
|
|
363
1815
|
};
|
|
364
1816
|
responses: {
|
|
365
|
-
/** @description
|
|
1817
|
+
/** @description Entitlement found. */
|
|
366
1818
|
200: {
|
|
367
1819
|
content: {
|
|
368
|
-
'application/json':
|
|
1820
|
+
'application/json': {
|
|
1821
|
+
type: 'json';
|
|
1822
|
+
} & Omit<components['schemas']['Entitlement'], 'type'> & {
|
|
1823
|
+
/**
|
|
1824
|
+
* Format: date-time
|
|
1825
|
+
* @description The last time usage was reset.
|
|
1826
|
+
* @example 2023-01-01T00:00:00Z
|
|
1827
|
+
*/
|
|
1828
|
+
lastReset?: string;
|
|
1829
|
+
};
|
|
369
1830
|
};
|
|
370
1831
|
};
|
|
1832
|
+
401: components['responses']['UnauthorizedProblemResponse'];
|
|
371
1833
|
404: components['responses']['NotFoundProblemResponse'];
|
|
372
1834
|
default: components['responses']['UnexpectedProblemResponse'];
|
|
373
1835
|
};
|
|
374
1836
|
};
|
|
375
|
-
/**
|
|
376
|
-
|
|
1837
|
+
/**
|
|
1838
|
+
* Delete entitlement
|
|
1839
|
+
* @description Delete an entitlement by id.
|
|
1840
|
+
*/
|
|
1841
|
+
deleteEntitlement: {
|
|
377
1842
|
parameters: {
|
|
378
|
-
header?: {
|
|
379
|
-
'OM-Namespace'?: components['parameters']['namespaceParam'];
|
|
380
|
-
};
|
|
381
1843
|
path: {
|
|
382
|
-
|
|
1844
|
+
subjectIdOrKey: components['parameters']['subjectIdOrKey'];
|
|
1845
|
+
entitlementId: components['parameters']['entitlementId'];
|
|
383
1846
|
};
|
|
384
1847
|
};
|
|
385
1848
|
responses: {
|
|
386
|
-
/** @description
|
|
1849
|
+
/** @description Entitlement deleted. */
|
|
387
1850
|
204: {
|
|
388
1851
|
content: never;
|
|
389
1852
|
};
|
|
1853
|
+
401: components['responses']['UnauthorizedProblemResponse'];
|
|
390
1854
|
404: components['responses']['NotFoundProblemResponse'];
|
|
391
|
-
501: components['responses']['NotImplementedProblemResponse'];
|
|
392
1855
|
default: components['responses']['UnexpectedProblemResponse'];
|
|
393
1856
|
};
|
|
394
1857
|
};
|
|
395
1858
|
/**
|
|
396
|
-
*
|
|
397
|
-
* @description
|
|
398
|
-
* Deprecated: use /api/v1/meters/{meter}/query instead.
|
|
1859
|
+
* List grants for an entitlement
|
|
1860
|
+
* @description List all grants for an entitlement.
|
|
399
1861
|
*/
|
|
400
|
-
|
|
1862
|
+
listEntitlementGrants: {
|
|
401
1863
|
parameters: {
|
|
402
1864
|
query?: {
|
|
403
|
-
|
|
404
|
-
/**
|
|
405
|
-
|
|
406
|
-
* Must be aligned with the window size.
|
|
407
|
-
* Inclusive.
|
|
408
|
-
*/
|
|
409
|
-
from?: string;
|
|
410
|
-
/**
|
|
411
|
-
* @description End date-time in RFC 3339 format in UTC timezone.
|
|
412
|
-
* Must be aligned with the window size.
|
|
413
|
-
* Inclusive.
|
|
414
|
-
*/
|
|
415
|
-
to?: string;
|
|
416
|
-
/** @description If not specified, a single usage aggregate will be returned for the entirety of the specified period for each subject and group. */
|
|
417
|
-
windowSize?: components['schemas']['WindowSize'];
|
|
418
|
-
/**
|
|
419
|
-
* @description If not specified, OpenMeter will use the default aggregation type.
|
|
420
|
-
* As OpenMeter stores aggregates defined by meter config, passing a different aggregate can lead to inaccurate results.
|
|
421
|
-
* For example getting the MIN of SUMs.
|
|
422
|
-
*/
|
|
423
|
-
aggregation?: components['schemas']['MeterAggregation'];
|
|
424
|
-
/** @description If not specified a single aggregate will be returned for each subject and time window. */
|
|
425
|
-
groupBy?: string;
|
|
426
|
-
};
|
|
427
|
-
header?: {
|
|
428
|
-
'OM-Namespace'?: components['parameters']['namespaceParam'];
|
|
1865
|
+
includeDeleted?: components['parameters']['includeDeleted'];
|
|
1866
|
+
/** @description Order by field */
|
|
1867
|
+
orderBy?: 'id' | 'createdAt' | 'updatedAt';
|
|
429
1868
|
};
|
|
430
1869
|
path: {
|
|
431
|
-
|
|
1870
|
+
subjectIdOrKey: components['parameters']['subjectIdOrKey'];
|
|
1871
|
+
entitlementId: components['parameters']['entitlementId'];
|
|
432
1872
|
};
|
|
433
1873
|
};
|
|
434
1874
|
responses: {
|
|
435
|
-
/** @description
|
|
1875
|
+
/** @description List of grants. */
|
|
436
1876
|
200: {
|
|
437
1877
|
content: {
|
|
438
|
-
'application/json':
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
1878
|
+
'application/json': components['schemas']['EntitlementGrant'][];
|
|
1879
|
+
};
|
|
1880
|
+
};
|
|
1881
|
+
401: components['responses']['UnauthorizedProblemResponse'];
|
|
1882
|
+
default: components['responses']['UnexpectedProblemResponse'];
|
|
1883
|
+
};
|
|
1884
|
+
};
|
|
1885
|
+
/**
|
|
1886
|
+
* Create grant
|
|
1887
|
+
* @description Create a grant for an entitlement.
|
|
1888
|
+
*/
|
|
1889
|
+
createGrant: {
|
|
1890
|
+
parameters: {
|
|
1891
|
+
path: {
|
|
1892
|
+
subjectIdOrKey: components['parameters']['subjectIdOrKey'];
|
|
1893
|
+
entitlementId: components['parameters']['entitlementId'];
|
|
1894
|
+
};
|
|
1895
|
+
};
|
|
1896
|
+
/** @description The grant to create. */
|
|
1897
|
+
requestBody: {
|
|
1898
|
+
content: {
|
|
1899
|
+
'application/json': components['schemas']['EntitlementGrantCreateInput'];
|
|
1900
|
+
};
|
|
1901
|
+
};
|
|
1902
|
+
responses: {
|
|
1903
|
+
/** @description Grant created. */
|
|
1904
|
+
201: {
|
|
1905
|
+
content: {
|
|
1906
|
+
'application/json': components['schemas']['EntitlementGrant'];
|
|
442
1907
|
};
|
|
443
1908
|
};
|
|
444
1909
|
400: components['responses']['BadRequestProblemResponse'];
|
|
1910
|
+
401: components['responses']['UnauthorizedProblemResponse'];
|
|
1911
|
+
501: components['responses']['NotImplementedProblemResponse'];
|
|
445
1912
|
default: components['responses']['UnexpectedProblemResponse'];
|
|
446
1913
|
};
|
|
447
1914
|
};
|
|
448
|
-
/**
|
|
449
|
-
|
|
1915
|
+
/**
|
|
1916
|
+
* Get the balance of a specific entitlement.
|
|
1917
|
+
* @description Get the balance of a specific entitlement.
|
|
1918
|
+
*/
|
|
1919
|
+
getEntitlementValue: {
|
|
450
1920
|
parameters: {
|
|
451
1921
|
query?: {
|
|
452
|
-
/**
|
|
453
|
-
|
|
454
|
-
* Must be aligned with the window size.
|
|
455
|
-
* Inclusive.
|
|
456
|
-
*/
|
|
457
|
-
from?: string;
|
|
458
|
-
/**
|
|
459
|
-
* @description End date-time in RFC 3339 format in UTC timezone.
|
|
460
|
-
* Must be aligned with the window size.
|
|
461
|
-
* Inclusive.
|
|
462
|
-
*/
|
|
463
|
-
to?: string;
|
|
464
|
-
/** @description If not specified, a single usage aggregate will be returned for the entirety of the specified period for each subject and group. */
|
|
465
|
-
windowSize?: components['schemas']['WindowSize'];
|
|
466
|
-
/**
|
|
467
|
-
* @deprecated
|
|
468
|
-
* @description If not specified, OpenMeter will use the default aggregation type.
|
|
469
|
-
* As OpenMeter stores aggregates defined by meter config, passing a different aggregate can lead to inaccurate results.
|
|
470
|
-
* For example getting the MIN of SUMs.
|
|
471
|
-
*/
|
|
472
|
-
aggregation?: components['schemas']['MeterAggregation'];
|
|
473
|
-
subject?: string[];
|
|
474
|
-
/** @description If not specified a single aggregate will be returned for each subject and time window. */
|
|
475
|
-
groupBy?: string[];
|
|
476
|
-
};
|
|
477
|
-
header?: {
|
|
478
|
-
'OM-Namespace'?: components['parameters']['namespaceParam'];
|
|
1922
|
+
/** @description Point of time to check value: date-time in RFC 3339 format. Defaults to now. */
|
|
1923
|
+
time?: string;
|
|
479
1924
|
};
|
|
480
1925
|
path: {
|
|
481
|
-
|
|
1926
|
+
subjectIdOrKey: components['parameters']['subjectIdOrKey'];
|
|
1927
|
+
entitlementIdOrFeatureKey: components['parameters']['entitlementIdOrFeatureKey'];
|
|
482
1928
|
};
|
|
483
1929
|
};
|
|
484
1930
|
responses: {
|
|
485
|
-
/** @description
|
|
1931
|
+
/** @description The entitlement value. */
|
|
486
1932
|
200: {
|
|
487
1933
|
content: {
|
|
488
|
-
'application/json':
|
|
489
|
-
/** Format: date-time */
|
|
490
|
-
from?: string;
|
|
491
|
-
/** Format: date-time */
|
|
492
|
-
to?: string;
|
|
493
|
-
windowSize?: components['schemas']['WindowSize'];
|
|
494
|
-
data: components['schemas']['MeterQueryRow'][];
|
|
495
|
-
};
|
|
496
|
-
'text/csv': string;
|
|
1934
|
+
'application/json': components['schemas']['EntitlementValue'];
|
|
497
1935
|
};
|
|
498
1936
|
};
|
|
499
1937
|
400: components['responses']['BadRequestProblemResponse'];
|
|
1938
|
+
401: components['responses']['UnauthorizedProblemResponse'];
|
|
1939
|
+
404: components['responses']['NotFoundProblemResponse'];
|
|
500
1940
|
default: components['responses']['UnexpectedProblemResponse'];
|
|
501
1941
|
};
|
|
502
1942
|
};
|
|
503
|
-
/**
|
|
504
|
-
|
|
1943
|
+
/**
|
|
1944
|
+
* Get the balance history of a specific entitlement.
|
|
1945
|
+
* @description Get the balance history of a specific entitlement.
|
|
1946
|
+
*
|
|
1947
|
+
* The windows are inclusive at their start and exclusive at their end.
|
|
1948
|
+
* The last window may be smaller than the window size and is inclusive at both ends.
|
|
1949
|
+
*/
|
|
1950
|
+
getEntitlementHistory: {
|
|
505
1951
|
parameters: {
|
|
506
|
-
|
|
507
|
-
|
|
1952
|
+
query: {
|
|
1953
|
+
/**
|
|
1954
|
+
* @description Start of time range to query entitlement: date-time in RFC 3339 format.
|
|
1955
|
+
* Gets truncated to the granularity of the underlying meter.
|
|
1956
|
+
*/
|
|
1957
|
+
from: string;
|
|
1958
|
+
/**
|
|
1959
|
+
* @description End of time range to query entitlement: date-time in RFC 3339 format. Defaults to now.
|
|
1960
|
+
* If not now then gets truncated to the granularity of the underlying meter.
|
|
1961
|
+
*/
|
|
1962
|
+
to?: string;
|
|
1963
|
+
/** @description Size of the time window to group the history by. Cannot be shorter than meter granularity. */
|
|
1964
|
+
windowSize: 'MINUTE' | 'HOUR' | 'DAY';
|
|
1965
|
+
windowTimeZone?: components['parameters']['queryWindowTimeZone'];
|
|
508
1966
|
};
|
|
509
1967
|
path: {
|
|
510
|
-
|
|
1968
|
+
subjectIdOrKey: components['parameters']['subjectIdOrKey'];
|
|
1969
|
+
entitlementId: components['parameters']['entitlementId'];
|
|
511
1970
|
};
|
|
512
1971
|
};
|
|
513
1972
|
responses: {
|
|
514
|
-
/** @description
|
|
1973
|
+
/** @description Entitlement balance history. If windowsize is specified then the history is grouped by the window size. */
|
|
515
1974
|
200: {
|
|
516
1975
|
content: {
|
|
517
|
-
'application/json':
|
|
1976
|
+
'application/json': components['schemas']['WindowedBalanceHistory'];
|
|
518
1977
|
};
|
|
519
1978
|
};
|
|
520
1979
|
400: components['responses']['BadRequestProblemResponse'];
|
|
1980
|
+
401: components['responses']['UnauthorizedProblemResponse'];
|
|
1981
|
+
404: components['responses']['NotFoundProblemResponse'];
|
|
521
1982
|
default: components['responses']['UnexpectedProblemResponse'];
|
|
522
1983
|
};
|
|
523
1984
|
};
|
|
524
|
-
/**
|
|
525
|
-
|
|
1985
|
+
/**
|
|
1986
|
+
* Reset entitlement
|
|
1987
|
+
* @description Reset the entitlement usage and start a new period. Grants that can be are rolled over.
|
|
1988
|
+
*/
|
|
1989
|
+
resetEntitlementUsage: {
|
|
1990
|
+
parameters: {
|
|
1991
|
+
path: {
|
|
1992
|
+
subjectIdOrKey: components['parameters']['subjectIdOrKey'];
|
|
1993
|
+
entitlementId: components['parameters']['entitlementId'];
|
|
1994
|
+
};
|
|
1995
|
+
};
|
|
526
1996
|
requestBody: {
|
|
527
1997
|
content: {
|
|
528
|
-
'application/json':
|
|
1998
|
+
'application/json': {
|
|
1999
|
+
/**
|
|
2000
|
+
* Format: date-time
|
|
2001
|
+
* @description The time at which the reset takes effect, defaults to now.
|
|
2002
|
+
* The reset cannot be in the future.
|
|
2003
|
+
* The provided value is truncated to the granularity of the underlying meter.
|
|
2004
|
+
*
|
|
2005
|
+
* @example 2023-01-01T00:00:00Z
|
|
2006
|
+
*/
|
|
2007
|
+
effectiveAt?: string;
|
|
2008
|
+
};
|
|
529
2009
|
};
|
|
530
2010
|
};
|
|
531
2011
|
responses: {
|
|
532
|
-
/** @description
|
|
533
|
-
|
|
2012
|
+
/** @description Entitlement reset. */
|
|
2013
|
+
204: {
|
|
534
2014
|
content: never;
|
|
535
2015
|
};
|
|
2016
|
+
400: components['responses']['BadRequestProblemResponse'];
|
|
2017
|
+
401: components['responses']['UnauthorizedProblemResponse'];
|
|
2018
|
+
404: components['responses']['NotFoundProblemResponse'];
|
|
536
2019
|
default: components['responses']['UnexpectedProblemResponse'];
|
|
537
2020
|
};
|
|
538
2021
|
};
|