@openmeter/sdk 1.0.0-beta.9 → 1.0.0-beta.90

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