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