@openmeter/sdk 1.0.0-beta.13 → 1.0.0-beta.131

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 (86) hide show
  1. package/README.md +224 -46
  2. package/dist/cjs/clients/client.cjs +120 -0
  3. package/dist/cjs/clients/client.d.cts +37 -0
  4. package/dist/cjs/clients/client.js.map +1 -0
  5. package/dist/cjs/clients/entitlement.cjs +39 -0
  6. package/dist/cjs/clients/entitlement.d.cts +32 -0
  7. package/dist/cjs/clients/entitlement.js.map +1 -0
  8. package/dist/cjs/clients/event.cjs +71 -0
  9. package/dist/cjs/clients/event.d.cts +79 -0
  10. package/dist/cjs/clients/event.js.map +1 -0
  11. package/dist/cjs/clients/feature.cjs +80 -0
  12. package/dist/cjs/clients/feature.d.cts +46 -0
  13. package/dist/cjs/clients/feature.js.map +1 -0
  14. package/dist/cjs/clients/grant.cjs +41 -0
  15. package/dist/cjs/clients/grant.d.cts +24 -0
  16. package/dist/cjs/clients/grant.js.map +1 -0
  17. package/dist/cjs/clients/meter.cjs +83 -0
  18. package/dist/cjs/clients/meter.d.cts +79 -0
  19. package/dist/cjs/clients/meter.js.map +1 -0
  20. package/dist/cjs/clients/pagination.cjs +3 -0
  21. package/dist/cjs/clients/pagination.d.cts +6 -0
  22. package/dist/cjs/clients/pagination.js.map +1 -0
  23. package/dist/cjs/clients/portal.cjs +41 -0
  24. package/dist/cjs/clients/portal.d.cts +22 -0
  25. package/dist/cjs/clients/portal.js.map +1 -0
  26. package/dist/cjs/clients/subject.cjs +242 -0
  27. package/dist/cjs/clients/subject.d.cts +125 -0
  28. package/dist/cjs/clients/subject.js.map +1 -0
  29. package/dist/cjs/index.cjs +33 -0
  30. package/dist/cjs/index.d.cts +21 -0
  31. package/dist/cjs/index.js.map +1 -0
  32. package/dist/cjs/schemas/openapi.cjs +7 -0
  33. package/dist/cjs/schemas/openapi.d.cts +3032 -0
  34. package/dist/cjs/schemas/openapi.js.map +1 -0
  35. package/dist/cjs/test/agent.cjs +485 -0
  36. package/dist/cjs/test/agent.d.cts +2 -0
  37. package/dist/cjs/test/agent.js.map +1 -0
  38. package/dist/cjs/test/mocks.cjs +153 -0
  39. package/dist/cjs/test/mocks.d.cts +25 -0
  40. package/dist/cjs/test/mocks.js.map +1 -0
  41. package/dist/cjs/tsconfig.229eb452.tsbuildinfo +1 -0
  42. package/dist/cjs/tsconfig.b2052a4e.tsbuildinfo +1 -0
  43. package/dist/clients/client.d.ts +1 -4
  44. package/dist/clients/client.js +12 -1
  45. package/dist/clients/client.js.map +1 -0
  46. package/dist/clients/entitlement.d.ts +32 -0
  47. package/dist/clients/entitlement.js +35 -0
  48. package/dist/clients/entitlement.js.map +1 -0
  49. package/dist/clients/event.d.ts +5 -5
  50. package/dist/clients/event.js +29 -18
  51. package/dist/clients/event.js.map +1 -0
  52. package/dist/clients/feature.d.ts +46 -0
  53. package/dist/clients/feature.js +76 -0
  54. package/dist/clients/feature.js.map +1 -0
  55. package/dist/clients/grant.d.ts +24 -0
  56. package/dist/clients/grant.js +37 -0
  57. package/dist/clients/grant.js.map +1 -0
  58. package/dist/clients/meter.d.ts +13 -30
  59. package/dist/clients/meter.js +15 -0
  60. package/dist/clients/meter.js.map +1 -0
  61. package/dist/clients/pagination.d.ts +6 -0
  62. package/dist/clients/pagination.js +2 -0
  63. package/dist/clients/pagination.js.map +1 -0
  64. package/dist/clients/portal.d.ts +22 -0
  65. package/dist/clients/portal.js +37 -0
  66. package/dist/clients/portal.js.map +1 -0
  67. package/dist/clients/subject.d.ts +125 -0
  68. package/dist/clients/subject.js +238 -0
  69. package/dist/clients/subject.js.map +1 -0
  70. package/dist/index.d.ts +11 -2
  71. package/dist/index.js +16 -1
  72. package/dist/index.js.map +1 -0
  73. package/dist/schemas/openapi.d.ts +2790 -164
  74. package/dist/schemas/openapi.js +1 -0
  75. package/dist/schemas/openapi.js.map +1 -0
  76. package/dist/test/agent.js +327 -29
  77. package/dist/test/agent.js.map +1 -0
  78. package/dist/test/mocks.d.ts +13 -0
  79. package/dist/test/mocks.js +118 -0
  80. package/dist/test/mocks.js.map +1 -0
  81. package/dist/tsconfig.tsbuildinfo +1 -1
  82. package/package.json +40 -30
  83. package/dist/next.d.ts +0 -15
  84. package/dist/next.js +0 -46
  85. package/index.ts +0 -19
  86. package/next.ts +0 -76
@@ -2,45 +2,447 @@
2
2
  * This file was auto-generated by openapi-typescript.
3
3
  * Do not make direct changes to the file.
4
4
  */
5
+ /** OneOf type helpers */
6
+ type Without<T, U> = {
7
+ [P in Exclude<keyof T, keyof U>]?: never;
8
+ };
9
+ type XOR<T, U> = T | U extends object ? (Without<T, U> & U) | (Without<U, T> & T) : T | U;
10
+ type OneOf<T extends any[]> = T extends [infer Only] ? Only : T extends [infer A, infer B, ...infer Rest] ? OneOf<[XOR<A, B>, ...Rest]> : never;
5
11
  export interface paths {
6
12
  '/api/v1/events': {
7
- /** @description Retrieve latest raw events. */
13
+ /**
14
+ * List ingested events
15
+ * @description List ingested events within a time range.
16
+ */
8
17
  get: operations['listEvents'];
9
- /** @description Ingest events */
18
+ /**
19
+ * Ingest events
20
+ * @description Ingests an event or batch of events following the CloudEvents specification.
21
+ */
10
22
  post: operations['ingestEvents'];
11
23
  };
12
24
  '/api/v1/meters': {
13
- /** @description List meters */
25
+ /**
26
+ * List meters
27
+ * @description List meters.
28
+ */
14
29
  get: operations['listMeters'];
15
- /** @description Create meter */
30
+ /**
31
+ * ☁ Create meter
32
+ * @description *Available in OpenMeter Cloud.*
33
+ * *In the open-source version, meters are created in the configuration file.*
34
+ *
35
+ * Create a meter.
36
+ */
16
37
  post: operations['createMeter'];
17
38
  };
18
39
  '/api/v1/meters/{meterIdOrSlug}': {
19
- /** @description Get meter by slugs */
40
+ /**
41
+ * Get meter
42
+ * @description Get meter by ID or slug
43
+ */
20
44
  get: operations['getMeter'];
21
- /** @description Delete meter by slug */
45
+ /**
46
+ * ☁ Delete meter
47
+ * @description *Available in OpenMeter Cloud.*
48
+ *
49
+ * Delete a meter by ID or slug.
50
+ */
22
51
  delete: operations['deleteMeter'];
23
52
  };
24
53
  '/api/v1/meters/{meterIdOrSlug}/query': {
25
- /** @description Query meter */
54
+ /**
55
+ * Query meter
56
+ * @description Query meter for usage.
57
+ */
26
58
  get: operations['queryMeter'];
27
59
  };
28
60
  '/api/v1/meters/{meterIdOrSlug}/subjects': {
29
- /** @description List meter subjects */
61
+ /**
62
+ * List meter subjects
63
+ * @description List subjects for a meter.
64
+ */
30
65
  get: operations['listMeterSubjects'];
31
66
  };
67
+ '/api/v1/portal/tokens': {
68
+ /**
69
+ * ☁ List portal tokens
70
+ * @description *Available in OpenMeter Cloud.*
71
+ *
72
+ * List consumer portal tokens.
73
+ */
74
+ get: operations['listPortalTokens'];
75
+ /**
76
+ * Create portal token
77
+ * @description Create a consumer portal token.
78
+ */
79
+ post: operations['createPortalToken'];
80
+ };
81
+ '/api/v1/portal/tokens/invalidate': {
82
+ /**
83
+ * ☁ Invalidate portal tokens
84
+ * @description *Available in OpenMeter Cloud.*
85
+ *
86
+ * Invalidates consumer portal tokens by ID or subject.
87
+ */
88
+ post: operations['invalidatePortalTokens'];
89
+ };
90
+ '/api/v1/subjects': {
91
+ /**
92
+ * ☁ List subjects
93
+ * @description *Available in OpenMeter Cloud.*
94
+ *
95
+ * List subjects.
96
+ */
97
+ get: operations['listSubjects'];
98
+ /**
99
+ * ☁ Upsert subject
100
+ * @description *Available in OpenMeter Cloud.*
101
+ *
102
+ * Upserts a subject. Creates or updates subject.
103
+ * If the subject doesn't exist, it will be created.
104
+ * If the subject exists, it will be partially updated with the provided fields.
105
+ */
106
+ post: operations['upsertSubject'];
107
+ };
108
+ '/api/v1/subjects/{subjectIdOrKey}': {
109
+ /**
110
+ * ☁ Get subject
111
+ * @description *Available in OpenMeter Cloud.*
112
+ *
113
+ * Get subject by ID or key.
114
+ */
115
+ get: operations['getSubject'];
116
+ /**
117
+ * ☁ Delete subject
118
+ * @description *Available in OpenMeter Cloud.*
119
+ *
120
+ * Delete a subject by ID or key.
121
+ */
122
+ delete: operations['deleteSubject'];
123
+ };
124
+ '/api/v1/portal/meters/{meterSlug}/query': {
125
+ /**
126
+ * Query portal meter
127
+ * @description Query meter for consumer portal. This endpoint is publicly exposable to consumers.
128
+ */
129
+ get: operations['queryPortalMeter'];
130
+ };
131
+ '/api/v1/entitlements': {
132
+ /**
133
+ * List entitlements
134
+ * @description List all entitlements regardless of subject. This endpoint is intended for administrative purposes.
135
+ * If page is provided that takes precedence and the paginated response is returned.
136
+ */
137
+ get: operations['listEntitlements'];
138
+ };
139
+ '/api/v1/entitlements/{entitlementId}': {
140
+ /**
141
+ * Get an entitlement
142
+ * @description Get entitlement by id.
143
+ */
144
+ get: operations['getEntitlementById'];
145
+ };
146
+ '/api/v1/features': {
147
+ /**
148
+ * List features
149
+ * @description List all features. If page is provided that takes precedence and the paginated response is returned.
150
+ */
151
+ get: operations['listFeatures'];
152
+ /**
153
+ * Create a feature
154
+ * @description Features are either metered or static. A feature is metered if meterSlug is provided at creation.
155
+ * For metered features you can pass additional filters that will be applied when calculating feature usage, based on the meter's groupBy fields. Only meters with SUM and COUNT aggregation are supported for features.
156
+ *
157
+ * Features cannot be updated later, only archived.
158
+ */
159
+ post: operations['createFeature'];
160
+ };
161
+ '/api/v1/features/{featureId}': {
162
+ /**
163
+ * Get feature
164
+ * @description Get a feature by id.
165
+ */
166
+ get: operations['getFeature'];
167
+ /**
168
+ * Archive a feature
169
+ * @description Once a feature is archived it cannot be unarchived. If a feature is archived, new entitlements cannot be created for it, but archiving the feature does not affect existing entitlements. This means, if you want to create a new feature with the same key, and then create entitlements for it, the previous entitlements have to be deleted first on a per subject basis.
170
+ */
171
+ delete: operations['deleteFeature'];
172
+ };
173
+ '/api/v1/grants': {
174
+ /**
175
+ * List grants
176
+ * @description List all grants for all the subjects and entitlements. This endpoint is intended for administrative purposes only. To fetch the grants of a specific entitlement please use the /api/v1/subjects/{subjectKeyOrID}/entitlements/{entitlementOrFeatureID}/grants endpoint.
177
+ *
178
+ * If page is provided that takes precedence and the paginated response is returned.
179
+ */
180
+ get: operations['listGrants'];
181
+ };
182
+ '/api/v1/grants/{grantId}': {
183
+ /**
184
+ * Void a grant
185
+ * @description Voiding a grant means it is no longer valid, it doesn't take part in further balance calculations. Voiding a grant does not retroactively take effect, meaning any usage that has already been attributed to the grant will remain, but future usage cannot be burnt down from the grant.
186
+ *
187
+ * For example, if you have a single grant for your metered entitlement with an initial amount of 100, and so far 60 usage has been metered, the grant (and the entitlement itself) would have a balance of 40. If you then void that grant, balance becomes 0, but the 60 previous usage will not be affected.
188
+ */
189
+ delete: operations['voidGrant'];
190
+ };
191
+ '/api/v1/subjects/{subjectIdOrKey}/entitlements': {
192
+ /**
193
+ * List entitlements of a subject
194
+ * @description List all entitlements for a subject. For checking entitlement access, use the /value endpoint instead.
195
+ */
196
+ get: operations['listSubjectEntitlements'];
197
+ /**
198
+ * Create an entitlement
199
+ * @description OpenMeter has three types of entitlements: metered, boolean, and static. The type property determines the type of entitlement. The underlying feature has to be compatible with the entitlement type specified in the request (e.g., a metered entitlement needs a feature associated with a meter).
200
+ *
201
+ * - Boolean entitlements define static feature access, e.g. "Can use SSO authentication".
202
+ * - Static entitlements let you pass along a configuration while granting access, e.g. "Using this feature with X Y settings" (passed in the config).
203
+ * - Metered entitlements have many use cases, from setting up usage-based access to implementing complex credit systems. Example: The customer can use 10000 AI tokens during the usage period of the entitlement.
204
+ *
205
+ * A given subject can only have one active (non-deleted) entitlement per featureKey. If you try to create a new entitlement for a featureKey that already has an active entitlement, the request will fail with a 409 error.
206
+ *
207
+ * Once an entitlement is created you cannot modify it, only delete it.
208
+ */
209
+ post: operations['createEntitlement'];
210
+ };
211
+ '/api/v1/subjects/{subjectIdOrKey}/entitlements/{entitlementId}': {
212
+ /**
213
+ * Get an entitlement
214
+ * @description Get entitlement by id. For checking entitlement access, use the /value endpoint instead.
215
+ */
216
+ get: operations['getEntitlement'];
217
+ /**
218
+ * Delete an entitlement
219
+ * @description Deleting an entitlement revokes access to the associated feature. As a single subject can only have one entitlement per featureKey, when "migrating" features you have to delete the old entitlements as well.
220
+ * As access and status checks can be historical queries, deleting an entitlement populates the deletedAt timestamp. When queried for a time before that, the entitlement is still considered active, you cannot have retroactive changes to access, which is important for, among other things, auditing.
221
+ */
222
+ delete: operations['deleteEntitlement'];
223
+ };
224
+ '/api/v1/subjects/{subjectIdOrKey}/entitlements/{entitlementIdOrFeatureKey}/grants': {
225
+ /**
226
+ * List grants for an entitlement
227
+ * @description List all grants issued for an entitlement. The entitlement can be defined either by its id or featureKey.
228
+ */
229
+ get: operations['listEntitlementGrants'];
230
+ /**
231
+ * Create a grant
232
+ * @description Grants define a behavior of granting usage for a metered entitlement. They can have complicated recurrence and rollover rules, thanks to which you can define a wide range of access patterns with a single grant, in most cases you don't have to periodically create new grants. You can only issue grants for active metered entitlements.
233
+ *
234
+ * A grant defines a given amount of usage that can be consumed for the entitlement. The grant is in effect between its effective date and its expiration date. Specifying both is mandatory for new grants.
235
+ *
236
+ * Grants have a priority setting that determines their order of use. Lower numbers have higher priority, with 0 being the highest priority.
237
+ *
238
+ * Grants can have a recurrence setting intended to automate the manual reissuing of grants. For example, a daily recurrence is equal to reissuing that same grant every day (ignoring rollover settings).
239
+ *
240
+ * Rollover settings define what happens to the remaining balance of a grant at a reset. Balance_After_Reset = MIN(MaxRolloverAmount, MAX(Balance_Before_Reset, MinRolloverAmount))
241
+ *
242
+ * Grants cannot be changed once created, only deleted. This is to ensure that balance is deterministic regardless of when it is queried.
243
+ */
244
+ post: operations['createGrant'];
245
+ };
246
+ '/api/v1/subjects/{subjectIdOrKey}/entitlements/{entitlementIdOrFeatureKey}/value': {
247
+ /**
248
+ * Get the current value and access of an entitlement
249
+ * @description This endpoint should be used for access checks and enforcement. All entitlement types share the hasAccess property in their value response, but multiple other properties are returned based on the entitlement type.
250
+ *
251
+ * For convenience reasons, /value works with both entitlementId and featureKey.
252
+ */
253
+ get: operations['getEntitlementValue'];
254
+ };
255
+ '/api/v1/subjects/{subjectIdOrKey}/entitlements/{entitlementId}/history': {
256
+ /**
257
+ * Get the balance history of a specific entitlement.
258
+ * @description Returns historical balance and usage data for the entitlement. The queried history can span accross multiple reset events.
259
+ *
260
+ * BurndownHistory returns a continous history of segments, where the segments are seperated by events that changed either the grant burndown priority or the usage period.
261
+ *
262
+ * WindowedHistory returns windowed usage data for the period enriched with balance information and the list of grants that were being burnt down in that window.
263
+ */
264
+ get: operations['getEntitlementHistory'];
265
+ };
266
+ '/api/v1/subjects/{subjectIdOrKey}/entitlements/{entitlementId}/reset': {
267
+ /**
268
+ * Reset an entitlement
269
+ * @description Reset marks the start of a new usage period for the entitlement and initiates grant rollover. At the start of a period usage is zerod out and grants are rolled over based on their rollover settings. It would typically be synced with the subjects billing period to enforce usage based on their subscription.
270
+ *
271
+ * Usage is automatically reset for metered entitlements based on their usage period, but this endpoint allows to manually reset it at any time. When doing so the period anchor of the entitlement can be changed if needed.
272
+ */
273
+ post: operations['resetEntitlementUsage'];
274
+ };
275
+ '/api/v1/debug/metrics': {
276
+ /**
277
+ * Get event metrics
278
+ * @description Returns debug metrics like the number of ingested events since mindnight UTC.
279
+ * The OpenMetrics Counter(s) reset every day at midnight UTC.
280
+ */
281
+ get: operations['getDebugMetrics'];
282
+ };
283
+ '/api/v1/notification/channels': {
284
+ /**
285
+ * List notification channels
286
+ * @description List all notification channels.
287
+ */
288
+ get: operations['listNotificationChannels'];
289
+ /**
290
+ * Create a notification channel
291
+ * @description Create a new notification channel.
292
+ */
293
+ post: operations['createNotificationChannel'];
294
+ };
295
+ '/api/v1/notification/channels/{channelId}': {
296
+ /**
297
+ * Get notification channel
298
+ * @description Get a notification channel by id.
299
+ */
300
+ get: operations['getNotificationChannel'];
301
+ /**
302
+ * Update notification channel
303
+ * @description Update a notification channel by id.
304
+ */
305
+ put: operations['updateNotificationChannel'];
306
+ /**
307
+ * Delete a notification channel
308
+ * @description Delete notification channel by id.
309
+ */
310
+ delete: operations['deleteNotificationChannel'];
311
+ };
312
+ '/api/v1/notification/rules': {
313
+ /**
314
+ * List notification rules
315
+ * @description List all notification rules.
316
+ */
317
+ get: operations['listNotificationRules'];
318
+ /**
319
+ * Create a notification rule
320
+ * @description Create a new notification rule.
321
+ */
322
+ post: operations['createNotificationRule'];
323
+ };
324
+ '/api/v1/notification/rules/{ruleId}': {
325
+ /**
326
+ * Get notification rule
327
+ * @description Get a notification rule by id.
328
+ */
329
+ get: operations['getNotificationRule'];
330
+ /**
331
+ * Update a notification rule
332
+ * @description Update a notification rule by id.
333
+ */
334
+ put: operations['updateNotificationRule'];
335
+ /**
336
+ * Delete a notification rule
337
+ * @description Delete notification rule by id.
338
+ */
339
+ delete: operations['deleteNotificationRule'];
340
+ };
341
+ '/api/v1/notification/events': {
342
+ /**
343
+ * List notification evens
344
+ * @description List all notification events.
345
+ */
346
+ get: operations['listNotificationEvents'];
347
+ };
348
+ '/api/v1/notification/events/{eventId}': {
349
+ /**
350
+ * Get notification event
351
+ * @description Get a notification event by id.
352
+ */
353
+ get: operations['getNotificationEvent'];
354
+ };
32
355
  }
33
356
  export type webhooks = Record<string, never>;
34
357
  export interface components {
35
358
  schemas: {
36
359
  /**
37
- * @description A Problem Details object (RFC 7807)
360
+ * @description Metadata fields for all resources.
361
+ * These fields are automatically populated by the system for managed entities. Their use and meaning is uniform across all resources.
362
+ */
363
+ SharedMetaFields: {
364
+ /**
365
+ * @description Readonly unique ULID identifier.
366
+ *
367
+ * @example 01ARZ3NDEKTSV4RRFFQ69G5FAV
368
+ */
369
+ id: string;
370
+ /**
371
+ * Format: date-time
372
+ * @description The date and time the resource was created.
373
+ * @example 2023-01-01T00:00:00Z
374
+ */
375
+ createdAt: string;
376
+ /**
377
+ * Format: date-time
378
+ * @description The date and time the resource was last updated. The initial value is the same as createdAt.
379
+ * @example 2023-01-01T00:00:00Z
380
+ */
381
+ updatedAt: string;
382
+ /**
383
+ * Format: date-time
384
+ * @description The date and time the resource was deleted.
385
+ * @example 2023-01-01T00:00:00Z
386
+ */
387
+ deletedAt?: string;
388
+ };
389
+ /**
390
+ * @description Conflict
391
+ * @example {
392
+ * "type": "about:blank",
393
+ * "title": "Conflict",
394
+ * "status": 409,
395
+ * "detail": "ledger (default.01HXVNDJR532E8GTBVSC2XK5D4) already exitst for subject subject-1",
396
+ * "instance": "urn:request:local/JMOlctsKV8-000001",
397
+ * "conflictingEntityId": "01HXVNDJR532E8GTBVSC2XK5D4"
398
+ * }
399
+ */
400
+ ConflictProblem: {
401
+ /**
402
+ * Format: uri
403
+ * @description Type contains a URI that identifies the problem type.
404
+ * @example urn:problem-type:bad-request
405
+ */
406
+ type: string;
407
+ /**
408
+ * @description A a short, human-readable summary of the problem type.
409
+ * @example Bad Request
410
+ */
411
+ title: string;
412
+ /**
413
+ * Format: int32
414
+ * @description The HTTP status code generated by the origin server for this occurrence of the problem.
415
+ * @example 400
416
+ */
417
+ status: number;
418
+ /**
419
+ * @description A human-readable explanation specific to this occurrence of the problem.
420
+ * @example body must be a JSON object
421
+ */
422
+ detail: string;
423
+ /**
424
+ * Format: uri
425
+ * @description A URI reference that identifies the specific occurrence of the problem.
426
+ * @example urn:request:local/JMOlctsKV8-000001
427
+ */
428
+ instance?: string;
429
+ extensions?: {
430
+ /**
431
+ * @description The id of the conflicting entity.
432
+ * @example 01ARZ3NDEKTSV4RRFFQ69G5FAV
433
+ */
434
+ conflictingEntityId: string;
435
+ };
436
+ [key: string]: unknown;
437
+ };
438
+ /**
439
+ * @description A Problem Details object (RFC 7807).
440
+ * Additional properties specific to the problem type may be present.
38
441
  * @example {
39
442
  * "type": "urn:problem-type:bad-request",
40
443
  * "title": "Bad Request",
41
444
  * "status": 400,
42
- * "detail": "header Content-Type has unexpected value \"application/xml\"",
43
- * "instance": "urn:request:local/JMOlctsKV8-000001"
445
+ * "detail": "body must be a JSON object"
44
446
  * }
45
447
  */
46
448
  Problem: {
@@ -63,7 +465,7 @@ export interface components {
63
465
  status: number;
64
466
  /**
65
467
  * @description A human-readable explanation specific to this occurrence of the problem.
66
- * @example header Content-Type has unexpected value \"application/xml\"
468
+ * @example body must be a JSON object
67
469
  */
68
470
  detail: string;
69
471
  /**
@@ -74,7 +476,22 @@ export interface components {
74
476
  instance?: string;
75
477
  [key: string]: unknown;
76
478
  };
77
- /** @description CloudEvents Specification JSON Schema */
479
+ /**
480
+ * @description CloudEvents Specification JSON Schema
481
+ * @example {
482
+ * "id": "5c10fade-1c9e-4d6c-8275-c52c36731d3c",
483
+ * "source": "service-name",
484
+ * "specversion": "1.0",
485
+ * "type": "prompt",
486
+ * "subject": "customer-id",
487
+ * "time": "2023-01-01T01:01:01.001Z",
488
+ * "data": {
489
+ * "tokens": "1234",
490
+ * "model": "gpt-4-turbo",
491
+ * "type": "input"
492
+ * }
493
+ * }
494
+ */
78
495
  Event: {
79
496
  /**
80
497
  * @description Identifies the event.
@@ -84,7 +501,7 @@ export interface components {
84
501
  /**
85
502
  * Format: uri-reference
86
503
  * @description Identifies the context in which an event happened.
87
- * @example services/service-0
504
+ * @example service-name
88
505
  */
89
506
  source: string;
90
507
  /**
@@ -94,7 +511,7 @@ export interface components {
94
511
  specversion: string;
95
512
  /**
96
513
  * @description Describes the type of event related to the originating occurrence.
97
- * @example api_request
514
+ * @example prompt
98
515
  */
99
516
  type: string;
100
517
  /**
@@ -110,7 +527,7 @@ export interface components {
110
527
  dataschema?: string | null;
111
528
  /**
112
529
  * @description Describes the subject of the event in the context of the event producer (identified by source).
113
- * @example customer_id
530
+ * @example customer-id
114
531
  */
115
532
  subject: string;
116
533
  /**
@@ -122,285 +539,2494 @@ export interface components {
122
539
  /**
123
540
  * @description The event payload.
124
541
  * @example {
125
- * "duration_ms": "12",
126
- * "path": "/hello"
542
+ * "tokens": "1234",
543
+ * "model": "gpt-4-turbo"
127
544
  * }
128
545
  */
129
546
  data?: {
130
547
  [key: string]: unknown;
131
548
  };
132
549
  };
133
- Meter: {
134
- /**
135
- * @description A unique identifier for the meter.
136
- * @example 01G65Z755AFWAKHE12NY0CQ9FH
137
- */
138
- id?: string;
139
- /**
140
- * @description A unique identifier for the meter.
141
- * @example my_meter
142
- */
143
- slug: string;
550
+ /**
551
+ * @description An ingested event with optional validation error.
552
+ * @example {
553
+ * "event": {
554
+ * "id": "5c10fade-1c9e-4d6c-8275-c52c36731d3d",
555
+ * "source": "service-name",
556
+ * "specversion": "1.0",
557
+ * "type": "prompt",
558
+ * "subject": "customer-id",
559
+ * "time": "2023-01-01T01:01:01.001Z",
560
+ * "data": {
561
+ * "tokens": "1234",
562
+ * "model": "gpt-4-turbo"
563
+ * }
564
+ * },
565
+ * "validationError": "meter not found for event"
566
+ * }
567
+ */
568
+ IngestedEvent: {
569
+ event: components['schemas']['Event'];
570
+ /** @example invalid event */
571
+ validationError?: string;
572
+ };
573
+ /**
574
+ * @description A feature is a feature or service offered to a customer.
575
+ * For example: CPU-Hours, Tokens, API Calls, etc.
576
+ */
577
+ FeatureCreateInputs: {
144
578
  /**
145
- * @description A description of the meter.
146
- * @example My Meter Description
579
+ * @description The key is an immutable unique identifier of the feature used throughout the API, for example when interacting with a subject's entitlements. The key has to be unique across all active features, but archived features can share the same key. The key should consist of lowercase alphanumeric characters and dashes.
580
+ *
581
+ * @example gpt4_tokens
147
582
  */
148
- description?: string | null;
149
- aggregation: components['schemas']['MeterAggregation'];
583
+ key: string;
150
584
  /**
151
- * @description The event type to aggregate.
152
- * @example api_request
585
+ * @description The name of the feature.
586
+ *
587
+ * @example AI Tokens
153
588
  */
154
- eventType: string;
589
+ name: string;
590
+ /** @description Additional metadata for the feature, useful for syncing with external systems and annotating custom fields. */
591
+ metadata?: {
592
+ [key: string]: string;
593
+ };
155
594
  /**
156
- * @description JSONPath expression to extract the value from the event data.
157
- * @example $.duration_ms
595
+ * @description The meter that the feature is associated with and and based on which usage is calculated.
596
+ * The meter selected must have SUM or COUNT aggregation.
597
+ *
598
+ * @example tokens_total
158
599
  */
159
- valueProperty?: string;
600
+ meterSlug?: string;
160
601
  /**
161
- * @description Named JSONPath expressions to extract the group by values from the event data.
602
+ * @description Optional meter group by filters. Useful if the meter scope is broader than what feature tracks. Example scenario would be a meter tracking all token use with groupBy fields for the model, then the feature could filter for model=gpt-4.
603
+ *
162
604
  * @example {
163
- * "method": "$.method",
164
- * "path": "$.path"
605
+ * "model": "gpt-4"
165
606
  * }
166
607
  */
167
- groupBy?: {
608
+ meterGroupByFilters?: {
168
609
  [key: string]: string;
169
610
  };
170
- windowSize: components['schemas']['WindowSize'];
171
611
  };
172
612
  /**
173
- * @description The aggregation type to use for the meter.
174
- * @enum {string}
613
+ * @description A feature is a feature or service offered to a customer.
614
+ * For example: CPU-Hours, Tokens, API Calls, etc.
175
615
  */
176
- MeterAggregation: 'SUM' | 'COUNT' | 'AVG' | 'MIN' | 'MAX';
177
- /** @enum {string} */
178
- WindowSize: 'MINUTE' | 'HOUR' | 'DAY';
179
- MeterQueryRow: {
180
- value: number;
181
- /** Format: date-time */
182
- windowStart: string;
183
- /** Format: date-time */
184
- windowEnd: string;
185
- /** @description The subject of the meter value. */
186
- subject?: string | null;
187
- groupBy?: {
188
- [key: string]: string;
189
- } | null;
616
+ Feature: {
617
+ /**
618
+ * Format: date-time
619
+ * @description If the feature is archived, no new entitlements can be created for it.
620
+ *
621
+ * @example 2023-01-01T00:00:00Z
622
+ */
623
+ archivedAt?: string;
624
+ } & components['schemas']['FeatureCreateInputs'] & components['schemas']['SharedMetaFields'];
625
+ ListFeatureResponse: OneOf<[
626
+ components['schemas']['Feature'][],
627
+ {
628
+ /**
629
+ * @description Total number of features.
630
+ * @example 500
631
+ */
632
+ totalCount: number;
633
+ /**
634
+ * @description Current page number.
635
+ * @example 1
636
+ */
637
+ page: number;
638
+ /**
639
+ * @description Number of features per page.
640
+ * @example 100
641
+ */
642
+ pageSize: number;
643
+ /** @description List of features. */
644
+ items: components['schemas']['Feature'][];
645
+ }
646
+ ]>;
647
+ /** @description Limited representation of a feature resource which includes only its unique identifiers (id, key). */
648
+ FeatureMeta: {
649
+ /**
650
+ * @description A unique identifier for the notification rule.
651
+ * @example 01J2KNP1YTXQRXHTDJ4KPR7PZ0
652
+ */
653
+ id: string;
654
+ /**
655
+ * @description The key is an immutable unique identifier of the feature used throughout the API,
656
+ * for example when interacting with a subject's entitlements.
657
+ *
658
+ * @example gpt4_tokens
659
+ */
660
+ key: string;
190
661
  };
191
- IdOrSlug: string;
192
- };
193
- responses: {
194
- /** @description Bad Request */
195
- BadRequestProblemResponse: {
196
- content: {
197
- 'application/problem+json': components['schemas']['Problem'];
662
+ EntitlementCreateSharedFields: {
663
+ /**
664
+ * @description The feature the subject is entitled to use.
665
+ * Either featureKey or featureId is required.
666
+ *
667
+ * @example example-feature-key
668
+ */
669
+ featureKey?: string;
670
+ /**
671
+ * @description The feature the subject is entitled to use.
672
+ * Either featureKey or featureId is required.
673
+ *
674
+ * @example 01ARZ3NDEKTSV4RRFFQ69G5FAV
675
+ */
676
+ featureId?: string;
677
+ /** @description Additional metadata for the feature. */
678
+ metadata?: {
679
+ [key: string]: string;
198
680
  };
681
+ usagePeriod?: components['schemas']['RecurringPeriodCreateInput'];
199
682
  };
200
- /** @description Method not allowed, feature not supported */
201
- MethodNotAllowedProblemResponse: {
202
- content: {
203
- 'application/problem+json': components['schemas']['Problem'];
204
- };
683
+ EntitlementSharedFields: components['schemas']['SharedMetaFields'] & components['schemas']['EntitlementCreateSharedFields'] & {
684
+ /**
685
+ * @description The feature the subject is entitled to use.
686
+ * Either featureKey or featureId is required.
687
+ *
688
+ * @example example-feature-key
689
+ */
690
+ featureKey: string;
691
+ /**
692
+ * @description The feature the subject is entitled to use.
693
+ * Either featureKey or featureId is required.
694
+ *
695
+ * @example 01ARZ3NDEKTSV4RRFFQ69G5FAV
696
+ */
697
+ featureId: string;
698
+ /**
699
+ * @description The identifier key unique to the subject
700
+ * @example customer-1
701
+ */
702
+ subjectKey: string;
703
+ usagePeriod?: components['schemas']['RecurringPeriod'];
704
+ currentUsagePeriod?: components['schemas']['Period'];
205
705
  };
206
- /** @description Not Found */
207
- NotFoundProblemResponse: {
208
- content: {
209
- 'application/problem+json': components['schemas']['Problem'];
210
- };
706
+ /** @enum {string} */
707
+ MeasureUsageFromEnum: 'CURRENT_PERIOD_START' | 'NOW';
708
+ /** Format: date-time */
709
+ MeasureUsageFromTime: string;
710
+ /**
711
+ * @description The time from which usage is measured, defaults to the entitlement creation time.
712
+ * The provided value is truncated to the granularity of the underlying meter.
713
+ */
714
+ MeasureUsageFrom: components['schemas']['MeasureUsageFromEnum'] | components['schemas']['MeasureUsageFromTime'];
715
+ EntitlementMeteredCreateInputs: components['schemas']['EntitlementCreateSharedFields'] & {
716
+ /**
717
+ * @example metered
718
+ * @enum {string}
719
+ */
720
+ type: 'metered';
721
+ /**
722
+ * @description If softLimit=true the subject can use the feature even if the entitlement is exhausted, hasAccess will always be true.
723
+ *
724
+ * @default false
725
+ */
726
+ isSoftLimit?: boolean;
727
+ /**
728
+ * @description Deprecated, ignored by the backend. Please use isSoftLimit instead; this field will be removed in the future.
729
+ *
730
+ * @default false
731
+ */
732
+ isUnlimited?: boolean;
733
+ usagePeriod: components['schemas']['RecurringPeriodCreateInput'];
734
+ measureUsageFrom?: components['schemas']['MeasureUsageFrom'];
735
+ /**
736
+ * Format: double
737
+ * @description You can grant usage automatically alongside the entitlement, the example scenario would be creating a starting balance. If an amount is specified here, a grant will be created alongside the entitlement with the specified amount.
738
+ * That grant will have it's rollover settings configured in a way that after each reset operation, the balance will return the original amount specified here.
739
+ *
740
+ * Manually creating such a grant would mean having the "amount", "minRolloverAmount", and "maxRolloverAmount" fields all be the same.
741
+ */
742
+ issueAfterReset?: number;
743
+ /**
744
+ * @description Defines the grant priority for the default grant. If provided, issueAfterReset must have a value.
745
+ *
746
+ * @default 1
747
+ * @example 1
748
+ */
749
+ issueAfterResetPriority?: number;
211
750
  };
212
- /** @description Not Implemented */
751
+ EntitlementCreateInputs: components['schemas']['EntitlementMeteredCreateInputs'] | components['schemas']['EntitlementStaticCreateInputs'] | components['schemas']['EntitlementBooleanCreateInputs'];
752
+ /** @description Metered entitlements are useful for many different use cases, from setting up usage based access to implementing complex credit systems. Access is determined based on feature usage using a balance calculation (the "usage allowance" provided by the issued grants is "burnt down" by the usage). */
753
+ EntitlementMetered: components['schemas']['EntitlementMeteredCreateInputs'] & components['schemas']['EntitlementMeteredCalculatedFields'] & components['schemas']['EntitlementSharedFields'];
754
+ /** @description Calculated fields for a metered entitlement. */
755
+ EntitlementMeteredCalculatedFields: {
756
+ /**
757
+ * Format: date-time
758
+ * @description The last time a reset happened.
759
+ *
760
+ * @example 2023-01-01T00:00:00Z
761
+ */
762
+ lastReset: string;
763
+ currentUsagePeriod: components['schemas']['Period'];
764
+ /**
765
+ * Format: date-time
766
+ * @description The time from which usage is measured. If not specified on creation, defaults to the entitlement creation time.
767
+ */
768
+ measureUsageFrom: string;
769
+ };
770
+ EntitlementStaticCreateInputs: components['schemas']['EntitlementCreateSharedFields'] & {
771
+ /**
772
+ * @example static
773
+ * @enum {string}
774
+ */
775
+ type: 'static';
776
+ /**
777
+ * @description The JSON parsable config of the entitlement. This value is also returned when checking entitlement access and it is useful for configuring fine-grained access settings to the feature, implemented in your own system. Has to be an object.
778
+ *
779
+ * @example {"key1": "value1"}
780
+ */
781
+ config: string;
782
+ };
783
+ /** @description Entitles a subject to use a feature. */
784
+ EntitlementStatic: components['schemas']['EntitlementStaticCreateInputs'] & components['schemas']['EntitlementSharedFields'];
785
+ EntitlementBooleanCreateInputs: components['schemas']['EntitlementCreateSharedFields'] & {
786
+ /**
787
+ * @example boolean
788
+ * @enum {string}
789
+ */
790
+ type: 'boolean';
791
+ };
792
+ /** @description Entitles a subject to use a feature. */
793
+ EntitlementBoolean: components['schemas']['EntitlementBooleanCreateInputs'] & components['schemas']['EntitlementSharedFields'];
794
+ Entitlement: components['schemas']['EntitlementMetered'] | components['schemas']['EntitlementStatic'] | components['schemas']['EntitlementBoolean'];
795
+ ListEntitlementResponse: OneOf<[
796
+ components['schemas']['Entitlement'][],
797
+ {
798
+ /**
799
+ * @description Total number of entitlements.
800
+ * @example 500
801
+ */
802
+ totalCount: number;
803
+ /**
804
+ * @description Current page number.
805
+ * @example 1
806
+ */
807
+ page: number;
808
+ /**
809
+ * @description Number of entitlements per page.
810
+ * @example 100
811
+ */
812
+ pageSize: number;
813
+ /** @description List of entitlements. */
814
+ items: components['schemas']['Entitlement'][];
815
+ }
816
+ ]>;
817
+ /**
818
+ * @description A segment of the grant burn down history.
819
+ *
820
+ * A given segment represents the usage of a grant between events that changed either the grant burn down priority order or the usag period.
821
+ */
822
+ GrantBurnDownHistorySegment: {
823
+ period?: components['schemas']['Period'];
824
+ /**
825
+ * Format: double
826
+ * @description The usage of the grant in the period.
827
+ *
828
+ * @example 100
829
+ */
830
+ usage?: number;
831
+ /**
832
+ * Format: double
833
+ * @description Overuse that wasn't covered by grants.
834
+ *
835
+ * @example 25
836
+ */
837
+ overage?: number;
838
+ /**
839
+ * Format: double
840
+ * @description The entitlement balance at the start of the period.
841
+ *
842
+ * @example 100
843
+ */
844
+ balanceAtStart?: number;
845
+ /**
846
+ * @description The balance breakdown of each active grant at the start of the period: GrantID: Balance
847
+ *
848
+ * @example {
849
+ * "01ARZ3NDEKTSV4RRFFQ69G5FAV": 100
850
+ * }
851
+ */
852
+ grantBalancesAtStart?: {
853
+ [key: string]: number;
854
+ };
855
+ /**
856
+ * Format: double
857
+ * @description The entitlement balance at the end of the period.
858
+ *
859
+ * @example 100
860
+ */
861
+ balanceAtEnd?: number;
862
+ /**
863
+ * @description The balance breakdown of each active grant at the start of the period: GrantID: Balance
864
+ *
865
+ * @example {
866
+ * "01ARZ3NDEKTSV4RRFFQ69G5FAV": 100
867
+ * }
868
+ */
869
+ grantBalancesAtEnd?: {
870
+ [key: string]: number;
871
+ };
872
+ /** @description Which grants were actually burnt down in the period and by what amount. */
873
+ grantUsages?: readonly components['schemas']['GrantUsageRecord'][];
874
+ };
875
+ GrantUsageRecord: {
876
+ /**
877
+ * @description The id of the grant.
878
+ *
879
+ * @example 01ARZ3NDEKTSV4RRFFQ69G5FAV
880
+ */
881
+ grantId?: string;
882
+ /**
883
+ * Format: double
884
+ * @description The usage of the grant.
885
+ *
886
+ * @example 100
887
+ */
888
+ usage?: number;
889
+ };
890
+ /** @description Windowed usage and balance information. */
891
+ BalanceHistoryWindow: {
892
+ period?: components['schemas']['Period'];
893
+ /**
894
+ * Format: double
895
+ * @description The total usage of the feature in the period.
896
+ *
897
+ * @example 100
898
+ */
899
+ usage?: number;
900
+ /**
901
+ * Format: double
902
+ * @description The entitlement balance at the start of the period.
903
+ *
904
+ * @example 100
905
+ */
906
+ balanceAtStart?: number;
907
+ };
908
+ /** @description The windowed balance history. */
909
+ WindowedBalanceHistory: {
910
+ /**
911
+ * @description The windowed balance history.
912
+ * - It only returns rows for windows where there was usage.
913
+ * - The windows are inclusive at their start and exclusive at their end.
914
+ * - The last window may be smaller than the window size and is inclusive at both ends.
915
+ */
916
+ windowedHistory?: components['schemas']['BalanceHistoryWindow'][];
917
+ /** @description Grant burndown history. */
918
+ burndownHistory?: components['schemas']['GrantBurnDownHistorySegment'][];
919
+ };
920
+ /** @description A time period */
921
+ Period: {
922
+ /**
923
+ * Format: date-time
924
+ * @description Period start time where the amount was applied. If applicable.
925
+ *
926
+ * @example 2023-01-01T00:00:00Z
927
+ */
928
+ from: string;
929
+ /**
930
+ * Format: date-time
931
+ * @description Period end time where the amount was applied. If applicable.
932
+ *
933
+ * @example 2023-01-01T00:00:00Z
934
+ */
935
+ to: string;
936
+ };
937
+ /**
938
+ * @description List of pre-defined periods that can be used for recurring & scheduling.
939
+ *
940
+ * DAY: Every day
941
+ * WEEK: Every week
942
+ * MONTH: Every month
943
+ * YEAR: Every year
944
+ *
945
+ * @enum {string}
946
+ */
947
+ RecurringPeriodEnum: 'DAY' | 'WEEK' | 'MONTH' | 'YEAR';
948
+ /** @description Recurring period of an entitlement. */
949
+ RecurringPeriodCreateInput: {
950
+ interval: components['schemas']['RecurringPeriodEnum'];
951
+ /**
952
+ * Format: date-time
953
+ * @description An arbitrary anchor to base the recurring period on.
954
+ * If not provided then defaults to now truncated to the hour.
955
+ */
956
+ anchor?: string;
957
+ };
958
+ /** @description Recurring period of an entitlement. */
959
+ RecurringPeriod: {
960
+ interval: components['schemas']['RecurringPeriodEnum'];
961
+ /**
962
+ * Format: date-time
963
+ * @description An arbitrary anchor to base the recurring period on.
964
+ */
965
+ anchor: string;
966
+ };
967
+ /** @description Grants are used to increase balance of specific subjects. */
968
+ EntitlementGrantCreateInput: {
969
+ /**
970
+ * Format: double
971
+ * @description The amount to grant. Should be a positive number.
972
+ *
973
+ * @example 100
974
+ */
975
+ amount: number;
976
+ /**
977
+ * @description The priority of the grant. Grants with higher priority are applied first.
978
+ * Priority is a positive decimal numbers. With lower numbers indicating higher importance.
979
+ * For example, a priority of 1 is more urgent than a priority of 2.
980
+ * When there are several grants available for the same subject, the system selects the grant with the highest priority.
981
+ * In cases where grants share the same priority level, the grant closest to its expiration will be used first.
982
+ * In the case of two grants have identical priorities and expiration dates, the system will use the grant that was created first.
983
+ *
984
+ * @default 1
985
+ * @example 1
986
+ */
987
+ priority?: number;
988
+ /**
989
+ * Format: date-time
990
+ * @description Effective date for grants and anchor for recurring grants. Provided value will be ceiled to metering windowSize (minute).
991
+ *
992
+ * @example 2023-01-01T00:00:00Z
993
+ */
994
+ effectiveAt: string;
995
+ expiration: components['schemas']['ExpirationPeriod'];
996
+ /**
997
+ * Format: double
998
+ * @description Grants are rolled over at reset, after which they can have a different balance compared to what they had before the reset.
999
+ *
1000
+ * Balance after the reset is calculated as:
1001
+ * Balance_After_Reset = MIN(MaxRolloverAmount, MAX(Balance_Before_Reset, MinRolloverAmount))
1002
+ *
1003
+ * @default 0
1004
+ * @example 100
1005
+ */
1006
+ maxRolloverAmount?: number;
1007
+ /**
1008
+ * Format: double
1009
+ * @description Grants are rolled over at reset, after which they can have a different balance compared to what they had before the reset.
1010
+ *
1011
+ * Balance after the reset is calculated as:
1012
+ * Balance_After_Reset = MIN(MaxRolloverAmount, MAX(Balance_Before_Reset, MinRolloverAmount))
1013
+ *
1014
+ * @default 0
1015
+ * @example 100
1016
+ */
1017
+ minRolloverAmount?: number;
1018
+ /**
1019
+ * @example {
1020
+ * "stripePaymentId": "pi_4OrAkhLvyihio9p51h9iiFnB"
1021
+ * }
1022
+ */
1023
+ metadata?: {
1024
+ [key: string]: string;
1025
+ };
1026
+ recurrence?: components['schemas']['RecurringPeriodCreateInput'];
1027
+ };
1028
+ EntitlementGrant: components['schemas']['EntitlementGrantCreateInput'] & components['schemas']['SharedMetaFields'] & {
1029
+ /**
1030
+ * @description The unique entitlement ULID that the grant is associated with.
1031
+ *
1032
+ * @example 01ARZ3NDEKTSV4RRFFQ69G5FAV
1033
+ */
1034
+ entitlementId: string;
1035
+ /**
1036
+ * Format: date-time
1037
+ * @description The next time the grant will recurr.
1038
+ *
1039
+ * @example 2023-01-01T00:00:00Z
1040
+ */
1041
+ nextRecurrence?: string;
1042
+ /**
1043
+ * Format: date-time
1044
+ * @description The expiration date of the grant.
1045
+ *
1046
+ * @example 2023-01-01T00:00:00Z
1047
+ */
1048
+ expiresAt?: string;
1049
+ /**
1050
+ * Format: date-time
1051
+ * @description The date and time the grant was voided (cannot be used after that).
1052
+ */
1053
+ voidedAt?: string;
1054
+ recurrence?: components['schemas']['RecurringPeriod'];
1055
+ };
1056
+ ListEntitlementGrantResponse: OneOf<[
1057
+ components['schemas']['EntitlementGrant'][],
1058
+ {
1059
+ /**
1060
+ * @description Total number of grants.
1061
+ * @example 500
1062
+ */
1063
+ totalCount: number;
1064
+ /**
1065
+ * @description Current page number.
1066
+ * @example 1
1067
+ */
1068
+ page: number;
1069
+ /**
1070
+ * @description Number of grants per page.
1071
+ * @example 100
1072
+ */
1073
+ pageSize: number;
1074
+ /** @description List of grants. */
1075
+ items: components['schemas']['EntitlementGrant'][];
1076
+ }
1077
+ ]>;
1078
+ EntitlementValue: {
1079
+ /**
1080
+ * @description Whether the subject has access to the feature. Shared accross all entitlement types.
1081
+ *
1082
+ * @example true
1083
+ */
1084
+ hasAccess: boolean;
1085
+ /**
1086
+ * Format: double
1087
+ * @description Only available for metered entitlements. Metered entitlements are built around a balance calculation where feature usage is deducted from the issued grants. Balance represents the remaining balance of the entitlement, it's value never turns negative.
1088
+ *
1089
+ * @example 100
1090
+ */
1091
+ balance?: number;
1092
+ /**
1093
+ * Format: double
1094
+ * @description Only available for metered entitlements. Returns the total feature usage in the current period.
1095
+ *
1096
+ * @example 50
1097
+ */
1098
+ usage?: number;
1099
+ /**
1100
+ * Format: double
1101
+ * @description Only available for metered entitlements. Overage represents the usage that wasn't covered by grants, e.g. if the subject had a total feature usage of 100 in the period but they were only granted 80, there would be 20 overage.
1102
+ *
1103
+ * @example 0
1104
+ */
1105
+ overage?: number;
1106
+ /**
1107
+ * @description Only available for static entitlements. The JSON parsable config of the entitlement.
1108
+ *
1109
+ * @example {"key1": "value1"}
1110
+ */
1111
+ config?: string;
1112
+ };
1113
+ /** @description Expiration period of a grant. */
1114
+ ExpirationPeriod: {
1115
+ /**
1116
+ * @description The expiration period duration like month.
1117
+ *
1118
+ * @enum {string}
1119
+ */
1120
+ duration: 'HOUR' | 'DAY' | 'WEEK' | 'MONTH' | 'YEAR';
1121
+ /**
1122
+ * @description The expiration period count like 12 months.
1123
+ *
1124
+ * @example 12
1125
+ */
1126
+ count: number;
1127
+ };
1128
+ /**
1129
+ * @description A meter is a configuration that defines how to match and aggregate events.
1130
+ * @example {
1131
+ * "slug": "tokens_total",
1132
+ * "description": "AI token usage",
1133
+ * "aggregation": "SUM",
1134
+ * "windowSize": "MINUTE",
1135
+ * "eventType": "prompt",
1136
+ * "valueProperty": "$.tokens",
1137
+ * "groupBy": {
1138
+ * "model": "$.model",
1139
+ * "type": "$.type"
1140
+ * }
1141
+ * }
1142
+ */
1143
+ Meter: {
1144
+ /**
1145
+ * @description A unique identifier for the meter.
1146
+ * @example 01G65Z755AFWAKHE12NY0CQ9FH
1147
+ */
1148
+ id?: string;
1149
+ /**
1150
+ * @description A unique, human-readable identifier for the meter. Must consist only alphanumeric and underscore characters.
1151
+ * @example tokens_total
1152
+ */
1153
+ slug: string;
1154
+ /**
1155
+ * @description A description of the meter.
1156
+ * @example AI Token Usage
1157
+ */
1158
+ description?: string | null;
1159
+ aggregation: components['schemas']['MeterAggregation'];
1160
+ windowSize: components['schemas']['WindowSize'];
1161
+ /**
1162
+ * @description The event type to aggregate.
1163
+ * @example prompt
1164
+ */
1165
+ eventType: string;
1166
+ /**
1167
+ * @description JSONPath expression to extract the value from the ingested event's data property.
1168
+ * The ingested value for SUM, AVG, MIN, and MAX aggregations is a number or a string that can be parsed to a number.
1169
+ * For UNIQUE_COUNT aggregation, the ingested value must be a string. For COUNT aggregation the valueProperty is ignored.
1170
+ *
1171
+ * @example $.tokens
1172
+ */
1173
+ valueProperty?: string;
1174
+ /**
1175
+ * @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.
1176
+ * @example {
1177
+ * "model": "$.model",
1178
+ * "type": "$.type"
1179
+ * }
1180
+ */
1181
+ groupBy?: {
1182
+ [key: string]: string;
1183
+ };
1184
+ };
1185
+ /**
1186
+ * @description The aggregation type to use for the meter.
1187
+ * @example SUM
1188
+ * @enum {string}
1189
+ */
1190
+ MeterAggregation: 'SUM' | 'COUNT' | 'UNIQUE_COUNT' | 'AVG' | 'MIN' | 'MAX';
1191
+ /**
1192
+ * @description Aggregation window size.
1193
+ * @example MINUTE
1194
+ * @enum {string}
1195
+ */
1196
+ WindowSize: 'MINUTE' | 'HOUR' | 'DAY';
1197
+ /**
1198
+ * @description The result of a meter query.
1199
+ * @example {
1200
+ * "from": "2023-01-01T00:00:00Z",
1201
+ * "to": "2023-01-02T00:00:00Z",
1202
+ * "windowSize": "MINUTE",
1203
+ * "data": [
1204
+ * {
1205
+ * "value": 12,
1206
+ * "windowStart": "2023-01-01T00:00:00Z",
1207
+ * "windowEnd": "2023-01-02T00:00:00Z",
1208
+ * "subject": "customer-id",
1209
+ * "groupBy": {
1210
+ * "model": "gpt-4-turbo",
1211
+ * "type": "prompt"
1212
+ * }
1213
+ * }
1214
+ * ]
1215
+ * }
1216
+ */
1217
+ MeterQueryResult: {
1218
+ /**
1219
+ * Format: date-time
1220
+ * @example 2023-01-01T00:00:00Z
1221
+ */
1222
+ from?: string;
1223
+ /**
1224
+ * Format: date-time
1225
+ * @example 2023-01-02T00:00:00Z
1226
+ */
1227
+ to?: string;
1228
+ windowSize?: components['schemas']['WindowSize'];
1229
+ /**
1230
+ * @example [
1231
+ * {
1232
+ * "value": 12,
1233
+ * "windowStart": "2023-01-01T00:00:00Z",
1234
+ * "windowEnd": "2023-01-02T00:00:00Z",
1235
+ * "subject": "customer-id",
1236
+ * "groupBy": {
1237
+ * "model": "gpt-4-turbo",
1238
+ * "type": "prompt"
1239
+ * }
1240
+ * }
1241
+ * ]
1242
+ */
1243
+ data: components['schemas']['MeterQueryRow'][];
1244
+ };
1245
+ /**
1246
+ * @description A row in the result of a meter query.
1247
+ * @example {
1248
+ * "value": 12,
1249
+ * "windowStart": "2023-01-01T00:00:00Z",
1250
+ * "windowEnd": "2023-01-02T00:00:00Z",
1251
+ * "subject": "customer-id",
1252
+ * "groupBy": {
1253
+ * "model": "gpt-4-turbo",
1254
+ * "type": "prompt"
1255
+ * }
1256
+ * }
1257
+ */
1258
+ MeterQueryRow: {
1259
+ /** @example 12 */
1260
+ value: number;
1261
+ /**
1262
+ * Format: date-time
1263
+ * @example 2023-01-01T00:00:00Z
1264
+ */
1265
+ windowStart: string;
1266
+ /**
1267
+ * Format: date-time
1268
+ * @example 2023-01-02T00:00:00Z
1269
+ */
1270
+ windowEnd: string;
1271
+ /**
1272
+ * @description The subject of the meter value.
1273
+ * @example customer-id
1274
+ */
1275
+ subject?: string | null;
1276
+ /**
1277
+ * @example {
1278
+ * "model": "gpt-4-turbo",
1279
+ * "type": "prompt"
1280
+ * }
1281
+ */
1282
+ groupBy?: {
1283
+ [key: string]: string;
1284
+ } | null;
1285
+ };
1286
+ /**
1287
+ * @description A consumer portal token.
1288
+ * @example {
1289
+ * "id": "01G65Z755AFWAKHE12NY0CQ9FH",
1290
+ * "subject": "customer-id",
1291
+ * "expiresAt": "2023-01-02T00:00:00Z",
1292
+ * "expired": false,
1293
+ * "createdAt": "2023-01-01T00:00:00Z",
1294
+ * "token": "om_portal_IAnD3PpWW2A2Wr8m9jfzeHlGX8xmCXwG.y5q4S-AWqFu6qjfaFz0zQq4Ez28RsnyVwJffX5qxMvo",
1295
+ * "allowedMeterSlugs": [
1296
+ * "tokens_total"
1297
+ * ]
1298
+ * }
1299
+ */
1300
+ PortalToken: {
1301
+ /** @example 01G65Z755AFWAKHE12NY0CQ9FH */
1302
+ id?: string;
1303
+ /** @example customer-id */
1304
+ subject: string;
1305
+ /**
1306
+ * Format: date-time
1307
+ * @example 2023-01-02T00:00:00Z
1308
+ */
1309
+ expiresAt?: string;
1310
+ expired?: boolean;
1311
+ /**
1312
+ * Format: date-time
1313
+ * @example 2023-01-01T00:00:00Z
1314
+ */
1315
+ createdAt?: string;
1316
+ /**
1317
+ * @description The token is only returned at creation.
1318
+ * @example om_portal_IAnD3PpWW2A2Wr8m9jfzeHlGX8xmCXwG.y5q4S-AWqFu6qjfaFz0zQq4Ez28RsnyVwJffX5qxMvo
1319
+ */
1320
+ token?: string;
1321
+ /**
1322
+ * @description Optional, if defined only the specified meters will be allowed
1323
+ * @example [
1324
+ * "tokens_total"
1325
+ * ]
1326
+ */
1327
+ allowedMeterSlugs?: string[];
1328
+ };
1329
+ /**
1330
+ * @description A subject is a unique identifier for a user or entity.
1331
+ * @example {
1332
+ * "id": "01G65Z755AFWAKHE12NY0CQ9FH",
1333
+ * "key": "customer-id",
1334
+ * "displayName": "Customer Name",
1335
+ * "metadata": {
1336
+ * "hubspotId": "123456"
1337
+ * },
1338
+ * "currentPeriodStart": "2023-01-01T00:00:00Z",
1339
+ * "currentPeriodEnd": "2023-02-01T00:00:00Z",
1340
+ * "stripeCustomerId": "cus_JMOlctsKV8"
1341
+ * }
1342
+ */
1343
+ Subject: {
1344
+ /** @example 01G65Z755AFWAKHE12NY0CQ9FH */
1345
+ id?: string;
1346
+ /** @example customer-id */
1347
+ key: string;
1348
+ /** @example Customer Name */
1349
+ displayName?: string | null;
1350
+ /**
1351
+ * @example {
1352
+ * "hubspotId": "123456"
1353
+ * }
1354
+ */
1355
+ metadata?: {
1356
+ [key: string]: unknown;
1357
+ } | null;
1358
+ /**
1359
+ * Format: date-time
1360
+ * @example 2023-01-01T00:00:00Z
1361
+ */
1362
+ currentPeriodStart?: string | null;
1363
+ /**
1364
+ * Format: date-time
1365
+ * @example 2023-02-01T00:00:00Z
1366
+ */
1367
+ currentPeriodEnd?: string | null;
1368
+ /** @example cus_JMOlctsKV8 */
1369
+ stripeCustomerId?: string | null;
1370
+ };
1371
+ /**
1372
+ * @description A unique identifier.
1373
+ * @example tokens_total
1374
+ */
1375
+ IdOrSlug: string;
1376
+ NotificationChannelCreateRequest: components['schemas']['NotificationChannelWebhookCreateRequest'];
1377
+ NotificationChannel: components['schemas']['NotificationChannelWebhook'];
1378
+ NotificationChannels: components['schemas']['NotificationChannel'][];
1379
+ NotificationChannelWebhookCreateRequest: components['schemas']['NotificationChannelCommonCreateRequest'] & {
1380
+ /**
1381
+ * @description Webhook URL where the notification is sent.
1382
+ * @example https://example.com/webhook
1383
+ */
1384
+ url: string;
1385
+ /**
1386
+ * @description Custom HTTP headers sent as part of the webhook request.
1387
+ * @example {
1388
+ * "X-CUSTOM-HEADER": "value"
1389
+ * }
1390
+ */
1391
+ customHeaders?: {
1392
+ [key: string]: unknown;
1393
+ } | null;
1394
+ /**
1395
+ * @description Signing secret used for webhook request validation on the receiving end. Automatically generated if not provided.
1396
+ *
1397
+ * Format: `base64` encoded random bytes optionally prefixed with `whsec_`. Recommended size: 24
1398
+ *
1399
+ * @example whsec_S6g2HLnTwd9AhHwUIMFggVS9OfoPafN8
1400
+ */
1401
+ signingSecret?: string | null;
1402
+ };
1403
+ /** @description Notification channel with webhook type. */
1404
+ NotificationChannelWebhook: components['schemas']['NotificationChannelCommon'] & {
1405
+ /**
1406
+ * @description Webhook URL where the notification is sent.
1407
+ * @example https://example.com/webhook
1408
+ */
1409
+ url: string;
1410
+ /**
1411
+ * @description Custom HTTP headers sent as part of the webhook request.
1412
+ * @example {
1413
+ * "X-CUSTOM-HEADER": "value"
1414
+ * }
1415
+ */
1416
+ customHeaders?: {
1417
+ [key: string]: unknown;
1418
+ } | null;
1419
+ /**
1420
+ * @description Signing secret used for webhook request validation on the receiving end.
1421
+ *
1422
+ * Format: `base64` encoded random bytes optionally prefixed with `whsec_`. Recommended size: 24
1423
+ *
1424
+ * @example whsec_S6g2HLnTwd9AhHwUIMFggVS9OfoPafN8
1425
+ */
1426
+ signingSecret: string;
1427
+ };
1428
+ /**
1429
+ * @description The type of the notification channel.
1430
+ * @example WEBHOOK
1431
+ * @enum {string}
1432
+ */
1433
+ NotificationChannelType: 'WEBHOOK';
1434
+ /** @description Common fields for create notification channel request. */
1435
+ NotificationChannelCommonCreateRequest: {
1436
+ /**
1437
+ * @description User friendly name of the channel.
1438
+ * @example customer-webhook
1439
+ */
1440
+ name: string;
1441
+ /**
1442
+ * @description Whether the channel is disabled or not.
1443
+ * @default false
1444
+ * @example false
1445
+ */
1446
+ disabled?: boolean;
1447
+ type: components['schemas']['NotificationChannelType'];
1448
+ };
1449
+ /** @description Limited representation of notification channel which includes only the channel identifier and its type. */
1450
+ NotificationChannelMeta: {
1451
+ /**
1452
+ * @description A unique identifier for the notification channel.
1453
+ * @example 01J2KNP1YTXQRXHTDJ4KPR7PZ0
1454
+ */
1455
+ id: string;
1456
+ type: components['schemas']['NotificationChannelType'];
1457
+ };
1458
+ /** @description Common fields for notification channel resources. */
1459
+ NotificationChannelCommon: components['schemas']['NotificationChannelMeta'] & {
1460
+ /**
1461
+ * @description User friendly name of the channel.
1462
+ * @example customer-webhook
1463
+ */
1464
+ name?: string;
1465
+ /**
1466
+ * Format: date-time
1467
+ * @description Timestamp when the channel was created.
1468
+ * @example 2023-01-01T00:00:00Z
1469
+ */
1470
+ createdAt?: string;
1471
+ /**
1472
+ * Format: date-time
1473
+ * @description Timestamp when the channel was modified.
1474
+ * @example 2023-01-02T00:00:00Z
1475
+ */
1476
+ updatedAt?: string;
1477
+ /**
1478
+ * @description Whether the channel is disabled or not.
1479
+ * @default false
1480
+ * @example false
1481
+ */
1482
+ disabled?: boolean;
1483
+ };
1484
+ NotificationRuleCreateRequest: components['schemas']['NotificationRuleBalanceThresholdCreateRequest'];
1485
+ NotificationRule: components['schemas']['NotificationRuleBalanceThreshold'];
1486
+ NotificationRules: components['schemas']['NotificationRule'][];
1487
+ /**
1488
+ * @description Request for creating new notification rule for triggering notification events base on conditions
1489
+ * applied to current balance of entitlements.
1490
+ */
1491
+ NotificationRuleBalanceThresholdCreateRequest: components['schemas']['NotificationRuleCommonCreateRequest'] & {
1492
+ /**
1493
+ * @description List of thresholds the rule suppose to be triggered.
1494
+ * @example [
1495
+ * {
1496
+ * "value": 100,
1497
+ * "type": "PERCENT"
1498
+ * },
1499
+ * {
1500
+ * "value": 10000,
1501
+ * "type": "NUMBER"
1502
+ * }
1503
+ * ]
1504
+ */
1505
+ thresholds: components['schemas']['NotificationRuleBalanceThresholdValue'][];
1506
+ /**
1507
+ * @description Optional field for defining the scope of notification by feature. It may contain features by id or key.
1508
+ *
1509
+ * @example [
1510
+ * "gpt4_tokens",
1511
+ * "01ARZ3NDEKTSV4RRFFQ69G5FAV"
1512
+ * ]
1513
+ */
1514
+ features?: string[] | null;
1515
+ };
1516
+ /** @description Threshold value with multiple supported types. */
1517
+ NotificationRuleBalanceThresholdValue: {
1518
+ /** Format: double */
1519
+ value: number;
1520
+ /** @enum {string} */
1521
+ type: 'NUMBER' | 'PERCENT';
1522
+ };
1523
+ /** @description Notification rule for triggering notification events by applying conditions to current balance of entitlements. */
1524
+ NotificationRuleBalanceThreshold: components['schemas']['NotificationRuleCommon'] & {
1525
+ /**
1526
+ * @description List of thresholds the rule suppose to be triggered.
1527
+ * @example [
1528
+ * {
1529
+ * "value": 100,
1530
+ * "type": "PERCENT"
1531
+ * },
1532
+ * {
1533
+ * "value": 10000,
1534
+ * "type": "NUMBER"
1535
+ * }
1536
+ * ]
1537
+ */
1538
+ thresholds: components['schemas']['NotificationRuleBalanceThresholdValue'][];
1539
+ /** @description Optional field containing list of features the rule applies to. */
1540
+ features?: components['schemas']['FeatureMeta'][] | null;
1541
+ };
1542
+ /**
1543
+ * @description The type of the notification event.
1544
+ * @example entitlements.balance.threshold
1545
+ * @enum {string}
1546
+ */
1547
+ NotificationEventType: 'entitlements.balance.threshold';
1548
+ /** @description Defines the common fields for create notification rule request. */
1549
+ NotificationRuleCommonCreateRequest: {
1550
+ type: components['schemas']['NotificationEventType'];
1551
+ /**
1552
+ * @description The user friendly name of the notification rule.
1553
+ * @example Balance threshold reached
1554
+ */
1555
+ name: string;
1556
+ /**
1557
+ * @description List of notification channel identifiers or names the rule applies to.
1558
+ * @example [
1559
+ * "01G65Z755AFWAKHE12NY0CQ9FH"
1560
+ * ]
1561
+ */
1562
+ channels: string[];
1563
+ /**
1564
+ * @description Whether the rule is disabled or not.
1565
+ * @default false
1566
+ * @example false
1567
+ */
1568
+ disabled?: boolean;
1569
+ };
1570
+ /** @description Defines the common fields of a notification rule. */
1571
+ NotificationRuleMeta: {
1572
+ /**
1573
+ * @description A unique identifier for the notification rule.
1574
+ * @example 01J2KNP1YTXQRXHTDJ4KPR7PZ0
1575
+ */
1576
+ id: string;
1577
+ type: components['schemas']['NotificationEventType'];
1578
+ };
1579
+ /** @description Common fields for notification rules. */
1580
+ NotificationRuleCommon: components['schemas']['NotificationRuleMeta'] & {
1581
+ /**
1582
+ * @description The user friendly name of the notification rule.
1583
+ * @example Balance threshold reached
1584
+ */
1585
+ name?: string;
1586
+ /** @description List of notification channels the rule applies to. */
1587
+ channels?: components['schemas']['NotificationChannelMeta'][];
1588
+ /**
1589
+ * Format: date-time
1590
+ * @description Timestamp when the rule was created.
1591
+ * @example 2023-01-01T00:00:00Z
1592
+ */
1593
+ createdAt?: string;
1594
+ /**
1595
+ * Format: date-time
1596
+ * @description Timestamp when the rule was modified.
1597
+ * @example 2023-01-02T00:00:00Z
1598
+ */
1599
+ updatedAt?: string;
1600
+ /**
1601
+ * @description Whether the rule is disabled or not.
1602
+ * @default false
1603
+ * @example false
1604
+ */
1605
+ disabled?: boolean;
1606
+ };
1607
+ /**
1608
+ * @description Notification event generated by the system based on the criteria defined in the corresponding
1609
+ * a notification rule.
1610
+ *
1611
+ * The `payload` field contains the actual message sent to the notification channel.
1612
+ */
1613
+ NotificationEvent: {
1614
+ /**
1615
+ * @description A unique identifier for the notification event.
1616
+ * @example 01J2KNP1YTXQRXHTDJ4KPR7PZ0
1617
+ */
1618
+ id: string;
1619
+ /**
1620
+ * Format: date-time
1621
+ * @description Timestamp when the notification event was created.
1622
+ * @example 2023-01-01T00:00:00Z
1623
+ */
1624
+ createdAt: string;
1625
+ rule?: components['schemas']['NotificationRuleMeta'];
1626
+ /** @description The delivery status of the notification event. */
1627
+ deliveryStatus: components['schemas']['NotificationEventDeliveryStatus'][];
1628
+ payload: components['schemas']['NotificationEventPayload'];
1629
+ };
1630
+ /** @description The actual payload sent to channel as part of the notification event. */
1631
+ NotificationEventPayload: components['schemas']['NotificationEventBalanceThresholdPayload'];
1632
+ /** @description Common fields for notification event payload. */
1633
+ NotificationEventCommonPayload: {
1634
+ /**
1635
+ * @description A unique identifier for the notification event the payload belongs to.
1636
+ * @example 01J2KNP1YTXQRXHTDJ4KPR7PZ0
1637
+ */
1638
+ id: string;
1639
+ type: components['schemas']['NotificationEventType'];
1640
+ /**
1641
+ * Format: date-time
1642
+ * @description Timestamp when the notification event was created.
1643
+ * @example 2023-01-01T00:00:00Z
1644
+ */
1645
+ timestamp: string;
1646
+ };
1647
+ /**
1648
+ * @description Defines payload for notification event which is triggered when the `balance` of the `entitlement`
1649
+ * surpass the user defined `threshold`.
1650
+ */
1651
+ NotificationEventBalanceThresholdPayload: components['schemas']['NotificationEventCommonPayload'] & {
1652
+ data: {
1653
+ entitlement: components['schemas']['EntitlementMetered'];
1654
+ feature: components['schemas']['Feature'];
1655
+ subject: components['schemas']['Subject'];
1656
+ balance: components['schemas']['EntitlementValue'];
1657
+ threshold: components['schemas']['NotificationRuleBalanceThresholdValue'];
1658
+ };
1659
+ };
1660
+ NotificationEventDeliveryStatus: {
1661
+ channel: components['schemas']['NotificationChannelMeta'];
1662
+ /** @enum {string} */
1663
+ state: 'SUCCESS' | 'FAILED' | 'SENDING';
1664
+ /**
1665
+ * Format: date-time
1666
+ * @example 2023-01-01T00:00:00Z
1667
+ */
1668
+ updatedAt: string;
1669
+ };
1670
+ };
1671
+ responses: {
1672
+ /** @description Conflict */
1673
+ ConflictProblemResponse: {
1674
+ content: {
1675
+ 'application/problem+json': components['schemas']['ConflictProblem'];
1676
+ };
1677
+ };
1678
+ /** @description Bad Request */
1679
+ BadRequestProblemResponse: {
1680
+ content: {
1681
+ 'application/problem+json': components['schemas']['Problem'];
1682
+ };
1683
+ };
1684
+ /** @description Unauthorized */
1685
+ UnauthorizedProblemResponse: {
1686
+ content: {
1687
+ 'application/problem+json': components['schemas']['Problem'];
1688
+ };
1689
+ };
1690
+ /** @description Not Found */
1691
+ NotFoundProblemResponse: {
1692
+ content: {
1693
+ 'application/problem+json': components['schemas']['Problem'];
1694
+ };
1695
+ };
1696
+ /** @description Not Implemented */
213
1697
  NotImplementedProblemResponse: {
214
1698
  content: {
215
- 'application/problem+json': components['schemas']['Problem'];
1699
+ 'application/problem+json': components['schemas']['Problem'];
1700
+ };
1701
+ };
1702
+ /** @description Unexpected error */
1703
+ UnexpectedProblemResponse: {
1704
+ content: {
1705
+ 'application/problem+json': components['schemas']['Problem'];
1706
+ };
1707
+ };
1708
+ };
1709
+ parameters: {
1710
+ /** @description A unique identifier for the meter. */
1711
+ meterIdOrSlug: components['schemas']['IdOrSlug'];
1712
+ /** @description A unique identifier for a subject. */
1713
+ subjectIdOrKey: string;
1714
+ /** @description A unique ULID identifier for a feature. */
1715
+ featureId: string;
1716
+ /** @description A unique identifier for a grant. */
1717
+ grantId: string;
1718
+ /** @description A unique ULID for an entitlement. */
1719
+ entitlementId: string;
1720
+ /** @description The id of the entitlement or the key of the feature. */
1721
+ entitlementIdOrFeatureKey: string;
1722
+ /** @description Include deleted entries. */
1723
+ includeDeleted?: boolean;
1724
+ /** @description Page number to return */
1725
+ queryPage?: number;
1726
+ /** @description Number of entries to return per page */
1727
+ queryPageSize?: number;
1728
+ /** @description Number of entries to return */
1729
+ queryLimit?: number;
1730
+ /** @description Number of entries to skip */
1731
+ queryOffset?: number;
1732
+ /**
1733
+ * @description Start date-time in RFC 3339 format.
1734
+ * Inclusive.
1735
+ */
1736
+ queryFrom?: string;
1737
+ /**
1738
+ * @description End date-time in RFC 3339 format.
1739
+ * Inclusive.
1740
+ */
1741
+ queryTo?: string;
1742
+ /** @description If not specified, a single usage aggregate will be returned for the entirety of the specified period for each subject and group. */
1743
+ queryWindowSize?: components['schemas']['WindowSize'];
1744
+ /**
1745
+ * @description The value is the name of the time zone as defined in the IANA Time Zone Database (http://www.iana.org/time-zones).
1746
+ * If not specified, the UTC timezone will be used.
1747
+ */
1748
+ queryWindowTimeZone?: string;
1749
+ /**
1750
+ * @description Filtering by multiple subjects.
1751
+ *
1752
+ * Usage: `?subject=customer-1&subject=customer-2`
1753
+ */
1754
+ queryFilterSubject?: string[];
1755
+ /**
1756
+ * @description Filtering by multiple features.
1757
+ *
1758
+ * Usage: `?feature=feature-1&feature=feature-2`
1759
+ */
1760
+ queryFilterFeature?: string[];
1761
+ /**
1762
+ * @description Filtering by multiple meterSlug.
1763
+ *
1764
+ * Usage: `?meterSlug=meter-1&meterSlug=meter-2`
1765
+ */
1766
+ queryFilterMeterSlug?: string[];
1767
+ /**
1768
+ * @description Filtering by multiple entitlement types.
1769
+ *
1770
+ * Usage: `?entitlementType=metered&entitlementType=static`
1771
+ */
1772
+ queryFilterEntitlementType?: string[];
1773
+ queryFilterGroupBy?: {
1774
+ [key: string]: string;
1775
+ };
1776
+ /**
1777
+ * @description If not specified a single aggregate will be returned for each subject and time window.
1778
+ * `subject` is a reserved group by value.
1779
+ */
1780
+ queryGroupBy?: string[];
1781
+ /** @description A unique ULID identifier for a notification channel. */
1782
+ channelId: string;
1783
+ /** @description A unique ULID identifier for a notification rule. */
1784
+ ruleId: string;
1785
+ /** @description A unique ULID identifier for a notification event. */
1786
+ eventId: string;
1787
+ /** @description Include disabled entries. */
1788
+ queryIncludeDisabled?: boolean;
1789
+ /**
1790
+ * @description Order by field.
1791
+ *
1792
+ * Usage: `?order=ASC`
1793
+ */
1794
+ order?: 'ASC' | 'DESC';
1795
+ };
1796
+ requestBodies: never;
1797
+ headers: never;
1798
+ pathItems: never;
1799
+ }
1800
+ export type $defs = Record<string, never>;
1801
+ export type external = Record<string, never>;
1802
+ export interface operations {
1803
+ /**
1804
+ * List ingested events
1805
+ * @description List ingested events within a time range.
1806
+ */
1807
+ listEvents: {
1808
+ parameters: {
1809
+ query?: {
1810
+ from?: components['parameters']['queryFrom'];
1811
+ to?: components['parameters']['queryTo'];
1812
+ /** @description Number of events to return */
1813
+ limit?: number;
1814
+ };
1815
+ };
1816
+ responses: {
1817
+ /** @description List of events for debugging. */
1818
+ 200: {
1819
+ content: {
1820
+ 'application/json': components['schemas']['IngestedEvent'][];
1821
+ };
1822
+ };
1823
+ 400: components['responses']['BadRequestProblemResponse'];
1824
+ 401: components['responses']['UnauthorizedProblemResponse'];
1825
+ default: components['responses']['UnexpectedProblemResponse'];
1826
+ };
1827
+ };
1828
+ /**
1829
+ * Ingest events
1830
+ * @description Ingests an event or batch of events following the CloudEvents specification.
1831
+ */
1832
+ ingestEvents: {
1833
+ /**
1834
+ * @description The event or batch of events to ingest.
1835
+ * The request body must be a CloudEvents JSON object or an array of CloudEvents JSON objects.
1836
+ * The CloudEvents JSON object must adhere to the CloudEvents Specification JSON Schema.
1837
+ */
1838
+ requestBody: {
1839
+ content: {
1840
+ 'application/cloudevents+json': components['schemas']['Event'];
1841
+ 'application/cloudevents-batch+json': components['schemas']['Event'][];
1842
+ };
1843
+ };
1844
+ responses: {
1845
+ /** @description Successfully ingested. */
1846
+ 204: {
1847
+ content: never;
1848
+ };
1849
+ 400: components['responses']['BadRequestProblemResponse'];
1850
+ 401: components['responses']['UnauthorizedProblemResponse'];
1851
+ default: components['responses']['UnexpectedProblemResponse'];
1852
+ };
1853
+ };
1854
+ /**
1855
+ * List meters
1856
+ * @description List meters.
1857
+ */
1858
+ listMeters: {
1859
+ responses: {
1860
+ /** @description List of meters. */
1861
+ 200: {
1862
+ content: {
1863
+ 'application/json': components['schemas']['Meter'][];
1864
+ };
1865
+ };
1866
+ 401: components['responses']['UnauthorizedProblemResponse'];
1867
+ default: components['responses']['UnexpectedProblemResponse'];
1868
+ };
1869
+ };
1870
+ /**
1871
+ * ☁ Create meter
1872
+ * @description *Available in OpenMeter Cloud.*
1873
+ * *In the open-source version, meters are created in the configuration file.*
1874
+ *
1875
+ * Create a meter.
1876
+ */
1877
+ createMeter: {
1878
+ /** @description The meter to create. */
1879
+ requestBody: {
1880
+ content: {
1881
+ 'application/json': components['schemas']['Meter'];
1882
+ };
1883
+ };
1884
+ responses: {
1885
+ /** @description Created. */
1886
+ 201: {
1887
+ content: {
1888
+ 'application/json': components['schemas']['Meter'];
1889
+ };
1890
+ };
1891
+ 400: components['responses']['BadRequestProblemResponse'];
1892
+ 401: components['responses']['UnauthorizedProblemResponse'];
1893
+ 501: components['responses']['NotImplementedProblemResponse'];
1894
+ default: components['responses']['UnexpectedProblemResponse'];
1895
+ };
1896
+ };
1897
+ /**
1898
+ * Get meter
1899
+ * @description Get meter by ID or slug
1900
+ */
1901
+ getMeter: {
1902
+ parameters: {
1903
+ path: {
1904
+ meterIdOrSlug: components['parameters']['meterIdOrSlug'];
1905
+ };
1906
+ };
1907
+ responses: {
1908
+ /** @description Meter found. */
1909
+ 200: {
1910
+ content: {
1911
+ 'application/json': components['schemas']['Meter'];
1912
+ };
1913
+ };
1914
+ 404: components['responses']['NotFoundProblemResponse'];
1915
+ default: components['responses']['UnexpectedProblemResponse'];
1916
+ };
1917
+ };
1918
+ /**
1919
+ * ☁ Delete meter
1920
+ * @description *Available in OpenMeter Cloud.*
1921
+ *
1922
+ * Delete a meter by ID or slug.
1923
+ */
1924
+ deleteMeter: {
1925
+ parameters: {
1926
+ path: {
1927
+ meterIdOrSlug: components['parameters']['meterIdOrSlug'];
1928
+ };
1929
+ };
1930
+ responses: {
1931
+ /** @description Meter deleted. */
1932
+ 204: {
1933
+ content: never;
1934
+ };
1935
+ 404: components['responses']['NotFoundProblemResponse'];
1936
+ 501: components['responses']['NotImplementedProblemResponse'];
1937
+ default: components['responses']['UnexpectedProblemResponse'];
1938
+ };
1939
+ };
1940
+ /**
1941
+ * Query meter
1942
+ * @description Query meter for usage.
1943
+ */
1944
+ queryMeter: {
1945
+ parameters: {
1946
+ query?: {
1947
+ from?: components['parameters']['queryFrom'];
1948
+ to?: components['parameters']['queryTo'];
1949
+ windowSize?: components['parameters']['queryWindowSize'];
1950
+ windowTimeZone?: components['parameters']['queryWindowTimeZone'];
1951
+ subject?: components['parameters']['queryFilterSubject'];
1952
+ filterGroupBy?: components['parameters']['queryFilterGroupBy'];
1953
+ groupBy?: components['parameters']['queryGroupBy'];
1954
+ };
1955
+ path: {
1956
+ meterIdOrSlug: components['parameters']['meterIdOrSlug'];
1957
+ };
1958
+ };
1959
+ responses: {
1960
+ /** @description Usage data. */
1961
+ 200: {
1962
+ content: {
1963
+ 'application/json': components['schemas']['MeterQueryResult'];
1964
+ 'text/csv': string;
1965
+ };
1966
+ };
1967
+ 400: components['responses']['BadRequestProblemResponse'];
1968
+ 401: components['responses']['UnauthorizedProblemResponse'];
1969
+ default: components['responses']['UnexpectedProblemResponse'];
1970
+ };
1971
+ };
1972
+ /**
1973
+ * List meter subjects
1974
+ * @description List subjects for a meter.
1975
+ */
1976
+ listMeterSubjects: {
1977
+ parameters: {
1978
+ path: {
1979
+ meterIdOrSlug: components['parameters']['meterIdOrSlug'];
1980
+ };
1981
+ };
1982
+ responses: {
1983
+ /** @description List of subjects. */
1984
+ 200: {
1985
+ content: {
1986
+ 'application/json': string[];
1987
+ };
1988
+ };
1989
+ 400: components['responses']['BadRequestProblemResponse'];
1990
+ default: components['responses']['UnexpectedProblemResponse'];
1991
+ };
1992
+ };
1993
+ /**
1994
+ * ☁ List portal tokens
1995
+ * @description *Available in OpenMeter Cloud.*
1996
+ *
1997
+ * List consumer portal tokens.
1998
+ */
1999
+ listPortalTokens: {
2000
+ parameters: {
2001
+ query?: {
2002
+ /** @description Number of portal tokens to return. Default is 25. */
2003
+ limit?: number;
2004
+ };
2005
+ };
2006
+ responses: {
2007
+ /** @description List of portal tokens. */
2008
+ 200: {
2009
+ content: {
2010
+ 'application/json': components['schemas']['PortalToken'][];
2011
+ };
2012
+ };
2013
+ 400: components['responses']['BadRequestProblemResponse'];
2014
+ 401: components['responses']['UnauthorizedProblemResponse'];
2015
+ 501: components['responses']['NotImplementedProblemResponse'];
2016
+ default: components['responses']['UnexpectedProblemResponse'];
2017
+ };
2018
+ };
2019
+ /**
2020
+ * Create portal token
2021
+ * @description Create a consumer portal token.
2022
+ */
2023
+ createPortalToken: {
2024
+ /** @description The portal token to create. */
2025
+ requestBody: {
2026
+ content: {
2027
+ /**
2028
+ * @example {
2029
+ * "subject": "customer-id",
2030
+ * "allowedMeterSlugs": [
2031
+ * "tokens_total"
2032
+ * ]
2033
+ * }
2034
+ */
2035
+ 'application/json': components['schemas']['PortalToken'];
2036
+ };
2037
+ };
2038
+ responses: {
2039
+ /** @description Created. */
2040
+ 200: {
2041
+ content: {
2042
+ 'application/json': components['schemas']['PortalToken'];
2043
+ };
2044
+ };
2045
+ 400: components['responses']['BadRequestProblemResponse'];
2046
+ 401: components['responses']['UnauthorizedProblemResponse'];
2047
+ default: components['responses']['UnexpectedProblemResponse'];
2048
+ };
2049
+ };
2050
+ /**
2051
+ * ☁ Invalidate portal tokens
2052
+ * @description *Available in OpenMeter Cloud.*
2053
+ *
2054
+ * Invalidates consumer portal tokens by ID or subject.
2055
+ */
2056
+ invalidatePortalTokens: {
2057
+ /** @description If no id or subject is specified, all tokens will be invalidated. */
2058
+ requestBody: {
2059
+ content: {
2060
+ 'application/json': {
2061
+ /** @description Invalidate a portal token by ID. */
2062
+ id?: string;
2063
+ /** @description Invalidate all portal tokens for a subject. */
2064
+ subject?: string;
2065
+ };
2066
+ };
2067
+ };
2068
+ responses: {
2069
+ /** @description Portal tokens invalidated. */
2070
+ 204: {
2071
+ content: never;
2072
+ };
2073
+ 400: components['responses']['BadRequestProblemResponse'];
2074
+ 401: components['responses']['UnauthorizedProblemResponse'];
2075
+ 501: components['responses']['NotImplementedProblemResponse'];
2076
+ default: components['responses']['UnexpectedProblemResponse'];
2077
+ };
2078
+ };
2079
+ /**
2080
+ * ☁ List subjects
2081
+ * @description *Available in OpenMeter Cloud.*
2082
+ *
2083
+ * List subjects.
2084
+ */
2085
+ listSubjects: {
2086
+ responses: {
2087
+ /** @description List of subjects. */
2088
+ 200: {
2089
+ content: {
2090
+ 'application/json': components['schemas']['Subject'][];
2091
+ };
2092
+ };
2093
+ 401: components['responses']['UnauthorizedProblemResponse'];
2094
+ default: components['responses']['UnexpectedProblemResponse'];
2095
+ };
2096
+ };
2097
+ /**
2098
+ * ☁ Upsert subject
2099
+ * @description *Available in OpenMeter Cloud.*
2100
+ *
2101
+ * Upserts a subject. Creates or updates subject.
2102
+ * If the subject doesn't exist, it will be created.
2103
+ * If the subject exists, it will be partially updated with the provided fields.
2104
+ */
2105
+ upsertSubject: {
2106
+ /** @description The subject to upsert. */
2107
+ requestBody: {
2108
+ content: {
2109
+ 'application/json': components['schemas']['Subject'][];
2110
+ };
2111
+ };
2112
+ responses: {
2113
+ /** @description Subject upserted. */
2114
+ 200: {
2115
+ content: {
2116
+ 'application/json': components['schemas']['Subject'][];
2117
+ };
2118
+ };
2119
+ 400: components['responses']['BadRequestProblemResponse'];
2120
+ 401: components['responses']['UnauthorizedProblemResponse'];
2121
+ 501: components['responses']['NotImplementedProblemResponse'];
2122
+ default: components['responses']['UnexpectedProblemResponse'];
2123
+ };
2124
+ };
2125
+ /**
2126
+ * ☁ Get subject
2127
+ * @description *Available in OpenMeter Cloud.*
2128
+ *
2129
+ * Get subject by ID or key.
2130
+ */
2131
+ getSubject: {
2132
+ parameters: {
2133
+ path: {
2134
+ subjectIdOrKey: components['parameters']['subjectIdOrKey'];
2135
+ };
2136
+ };
2137
+ responses: {
2138
+ /** @description Subject found. */
2139
+ 200: {
2140
+ content: {
2141
+ 'application/json': components['schemas']['Subject'];
2142
+ };
2143
+ };
2144
+ 401: components['responses']['UnauthorizedProblemResponse'];
2145
+ 404: components['responses']['NotFoundProblemResponse'];
2146
+ default: components['responses']['UnexpectedProblemResponse'];
2147
+ };
2148
+ };
2149
+ /**
2150
+ * ☁ Delete subject
2151
+ * @description *Available in OpenMeter Cloud.*
2152
+ *
2153
+ * Delete a subject by ID or key.
2154
+ */
2155
+ deleteSubject: {
2156
+ parameters: {
2157
+ path: {
2158
+ subjectIdOrKey: components['parameters']['subjectIdOrKey'];
2159
+ };
2160
+ };
2161
+ responses: {
2162
+ /** @description Subject deleted. */
2163
+ 204: {
2164
+ content: never;
2165
+ };
2166
+ 400: components['responses']['BadRequestProblemResponse'];
2167
+ 401: components['responses']['UnauthorizedProblemResponse'];
2168
+ 404: components['responses']['NotFoundProblemResponse'];
2169
+ 501: components['responses']['NotImplementedProblemResponse'];
2170
+ default: components['responses']['UnexpectedProblemResponse'];
2171
+ };
2172
+ };
2173
+ /**
2174
+ * Query portal meter
2175
+ * @description Query meter for consumer portal. This endpoint is publicly exposable to consumers.
2176
+ */
2177
+ queryPortalMeter: {
2178
+ parameters: {
2179
+ query?: {
2180
+ from?: components['parameters']['queryFrom'];
2181
+ to?: components['parameters']['queryTo'];
2182
+ windowSize?: components['parameters']['queryWindowSize'];
2183
+ windowTimeZone?: components['parameters']['queryWindowTimeZone'];
2184
+ filterGroupBy?: components['parameters']['queryFilterGroupBy'];
2185
+ groupBy?: components['parameters']['queryGroupBy'];
2186
+ };
2187
+ path: {
2188
+ /** @description A unique identifier for the meter. */
2189
+ meterSlug: string;
2190
+ };
2191
+ };
2192
+ responses: {
2193
+ /** @description Usage data. */
2194
+ 200: {
2195
+ content: {
2196
+ 'application/json': components['schemas']['MeterQueryResult'];
2197
+ 'text/csv': string;
2198
+ };
2199
+ };
2200
+ 400: components['responses']['BadRequestProblemResponse'];
2201
+ 401: components['responses']['UnauthorizedProblemResponse'];
2202
+ default: components['responses']['UnexpectedProblemResponse'];
2203
+ };
2204
+ };
2205
+ /**
2206
+ * List entitlements
2207
+ * @description List all entitlements regardless of subject. This endpoint is intended for administrative purposes.
2208
+ * If page is provided that takes precedence and the paginated response is returned.
2209
+ */
2210
+ listEntitlements: {
2211
+ parameters: {
2212
+ query?: {
2213
+ page?: components['parameters']['queryPage'];
2214
+ pageSize?: components['parameters']['queryPageSize'];
2215
+ limit?: components['parameters']['queryLimit'];
2216
+ offset?: components['parameters']['queryOffset'];
2217
+ subject?: components['parameters']['queryFilterSubject'];
2218
+ feature?: components['parameters']['queryFilterFeature'];
2219
+ entitlementType?: components['parameters']['queryFilterEntitlementType'];
2220
+ order?: components['parameters']['order'];
2221
+ /** @description Order by field */
2222
+ orderBy?: 'createdAt' | 'updatedAt';
2223
+ };
2224
+ };
2225
+ responses: {
2226
+ /** @description List of entitlements. If page is provided that takes precedence and the paginated response is returned. */
2227
+ 200: {
2228
+ content: {
2229
+ 'application/json': components['schemas']['ListEntitlementResponse'];
2230
+ };
2231
+ };
2232
+ 400: components['responses']['BadRequestProblemResponse'];
2233
+ 401: components['responses']['UnauthorizedProblemResponse'];
2234
+ default: components['responses']['UnexpectedProblemResponse'];
2235
+ };
2236
+ };
2237
+ /**
2238
+ * Get an entitlement
2239
+ * @description Get entitlement by id.
2240
+ */
2241
+ getEntitlementById: {
2242
+ parameters: {
2243
+ path: {
2244
+ entitlementId: components['parameters']['entitlementId'];
2245
+ };
2246
+ };
2247
+ responses: {
2248
+ /** @description Entitlement found. */
2249
+ 200: {
2250
+ content: {
2251
+ 'application/json': {
2252
+ type: 'json';
2253
+ } & Omit<components['schemas']['Entitlement'], 'type'> & {
2254
+ /**
2255
+ * Format: date-time
2256
+ * @description The last time usage was reset.
2257
+ * @example 2023-01-01T00:00:00Z
2258
+ */
2259
+ lastReset?: string;
2260
+ };
2261
+ };
2262
+ };
2263
+ 401: components['responses']['UnauthorizedProblemResponse'];
2264
+ 404: components['responses']['NotFoundProblemResponse'];
2265
+ default: components['responses']['UnexpectedProblemResponse'];
2266
+ };
2267
+ };
2268
+ /**
2269
+ * List features
2270
+ * @description List all features. If page is provided that takes precedence and the paginated response is returned.
2271
+ */
2272
+ listFeatures: {
2273
+ parameters: {
2274
+ query?: {
2275
+ page?: components['parameters']['queryPage'];
2276
+ pageSize?: components['parameters']['queryPageSize'];
2277
+ limit?: components['parameters']['queryLimit'];
2278
+ offset?: components['parameters']['queryOffset'];
2279
+ meterSlug?: components['parameters']['queryFilterMeterSlug'];
2280
+ order?: components['parameters']['order'];
2281
+ /** @description Order by field */
2282
+ orderBy?: 'id' | 'createdAt' | 'updatedAt';
2283
+ /** @description Include archived features. */
2284
+ includeArchived?: boolean;
2285
+ };
2286
+ };
2287
+ responses: {
2288
+ /** @description List of features. If page is provided that takes precedence and the paginated response is returned. */
2289
+ 200: {
2290
+ content: {
2291
+ 'application/json': components['schemas']['ListFeatureResponse'];
2292
+ };
2293
+ };
2294
+ 400: components['responses']['BadRequestProblemResponse'];
2295
+ 401: components['responses']['UnauthorizedProblemResponse'];
2296
+ default: components['responses']['UnexpectedProblemResponse'];
2297
+ };
2298
+ };
2299
+ /**
2300
+ * Create a feature
2301
+ * @description Features are either metered or static. A feature is metered if meterSlug is provided at creation.
2302
+ * For metered features you can pass additional filters that will be applied when calculating feature usage, based on the meter's groupBy fields. Only meters with SUM and COUNT aggregation are supported for features.
2303
+ *
2304
+ * Features cannot be updated later, only archived.
2305
+ */
2306
+ createFeature: {
2307
+ /** @description The feature to create. */
2308
+ requestBody: {
2309
+ content: {
2310
+ 'application/json': components['schemas']['FeatureCreateInputs'];
2311
+ };
2312
+ };
2313
+ responses: {
2314
+ /** @description Feature created. */
2315
+ 201: {
2316
+ content: {
2317
+ 'application/json': components['schemas']['Feature'];
2318
+ };
2319
+ };
2320
+ 400: components['responses']['BadRequestProblemResponse'];
2321
+ 401: components['responses']['UnauthorizedProblemResponse'];
2322
+ 501: components['responses']['NotImplementedProblemResponse'];
2323
+ default: components['responses']['UnexpectedProblemResponse'];
2324
+ };
2325
+ };
2326
+ /**
2327
+ * Get feature
2328
+ * @description Get a feature by id.
2329
+ */
2330
+ getFeature: {
2331
+ parameters: {
2332
+ path: {
2333
+ featureId: components['parameters']['featureId'];
2334
+ };
2335
+ };
2336
+ responses: {
2337
+ /** @description Feature found. */
2338
+ 200: {
2339
+ content: {
2340
+ 'application/json': components['schemas']['Feature'];
2341
+ };
2342
+ };
2343
+ 401: components['responses']['UnauthorizedProblemResponse'];
2344
+ 404: components['responses']['NotFoundProblemResponse'];
2345
+ default: components['responses']['UnexpectedProblemResponse'];
2346
+ };
2347
+ };
2348
+ /**
2349
+ * Archive a feature
2350
+ * @description Once a feature is archived it cannot be unarchived. If a feature is archived, new entitlements cannot be created for it, but archiving the feature does not affect existing entitlements. This means, if you want to create a new feature with the same key, and then create entitlements for it, the previous entitlements have to be deleted first on a per subject basis.
2351
+ */
2352
+ deleteFeature: {
2353
+ parameters: {
2354
+ path: {
2355
+ featureId: components['parameters']['featureId'];
2356
+ };
2357
+ };
2358
+ responses: {
2359
+ /** @description Feature deleted. */
2360
+ 204: {
2361
+ content: never;
2362
+ };
2363
+ 401: components['responses']['UnauthorizedProblemResponse'];
2364
+ 404: components['responses']['NotFoundProblemResponse'];
2365
+ default: components['responses']['UnexpectedProblemResponse'];
2366
+ };
2367
+ };
2368
+ /**
2369
+ * List grants
2370
+ * @description List all grants for all the subjects and entitlements. This endpoint is intended for administrative purposes only. To fetch the grants of a specific entitlement please use the /api/v1/subjects/{subjectKeyOrID}/entitlements/{entitlementOrFeatureID}/grants endpoint.
2371
+ *
2372
+ * If page is provided that takes precedence and the paginated response is returned.
2373
+ */
2374
+ listGrants: {
2375
+ parameters: {
2376
+ query?: {
2377
+ page?: components['parameters']['queryPage'];
2378
+ pageSize?: components['parameters']['queryPageSize'];
2379
+ limit?: components['parameters']['queryLimit'];
2380
+ offset?: components['parameters']['queryOffset'];
2381
+ subject?: components['parameters']['queryFilterSubject'];
2382
+ feature?: components['parameters']['queryFilterFeature'];
2383
+ order?: components['parameters']['order'];
2384
+ /** @description Order by field */
2385
+ orderBy?: 'id' | 'createdAt' | 'updatedAt';
2386
+ includeDeleted?: components['parameters']['includeDeleted'];
2387
+ };
2388
+ };
2389
+ responses: {
2390
+ /** @description List of grants. If page is provided that takes precedence and the paginated response is returned. */
2391
+ 200: {
2392
+ content: {
2393
+ 'application/json': components['schemas']['ListEntitlementGrantResponse'];
2394
+ };
2395
+ };
2396
+ 401: components['responses']['UnauthorizedProblemResponse'];
2397
+ default: components['responses']['UnexpectedProblemResponse'];
2398
+ };
2399
+ };
2400
+ /**
2401
+ * Void a grant
2402
+ * @description Voiding a grant means it is no longer valid, it doesn't take part in further balance calculations. Voiding a grant does not retroactively take effect, meaning any usage that has already been attributed to the grant will remain, but future usage cannot be burnt down from the grant.
2403
+ *
2404
+ * For example, if you have a single grant for your metered entitlement with an initial amount of 100, and so far 60 usage has been metered, the grant (and the entitlement itself) would have a balance of 40. If you then void that grant, balance becomes 0, but the 60 previous usage will not be affected.
2405
+ */
2406
+ voidGrant: {
2407
+ parameters: {
2408
+ path: {
2409
+ grantId: components['parameters']['grantId'];
2410
+ };
2411
+ };
2412
+ responses: {
2413
+ /** @description Grant has been voided. */
2414
+ 204: {
2415
+ content: never;
2416
+ };
2417
+ 400: components['responses']['BadRequestProblemResponse'];
2418
+ 401: components['responses']['UnauthorizedProblemResponse'];
2419
+ 404: components['responses']['NotFoundProblemResponse'];
2420
+ 409: components['responses']['ConflictProblemResponse'];
2421
+ default: components['responses']['UnexpectedProblemResponse'];
2422
+ };
2423
+ };
2424
+ /**
2425
+ * List entitlements of a subject
2426
+ * @description List all entitlements for a subject. For checking entitlement access, use the /value endpoint instead.
2427
+ */
2428
+ listSubjectEntitlements: {
2429
+ parameters: {
2430
+ query?: {
2431
+ includeDeleted?: components['parameters']['includeDeleted'];
2432
+ };
2433
+ path: {
2434
+ subjectIdOrKey: components['parameters']['subjectIdOrKey'];
216
2435
  };
217
2436
  };
218
- /** @description Unexpected error */
219
- UnexpectedProblemResponse: {
2437
+ responses: {
2438
+ /** @description List of entitlements. */
2439
+ 200: {
2440
+ content: {
2441
+ 'application/json': components['schemas']['Entitlement'][];
2442
+ };
2443
+ };
2444
+ 401: components['responses']['UnauthorizedProblemResponse'];
2445
+ default: components['responses']['UnexpectedProblemResponse'];
2446
+ };
2447
+ };
2448
+ /**
2449
+ * Create an entitlement
2450
+ * @description OpenMeter has three types of entitlements: metered, boolean, and static. The type property determines the type of entitlement. The underlying feature has to be compatible with the entitlement type specified in the request (e.g., a metered entitlement needs a feature associated with a meter).
2451
+ *
2452
+ * - Boolean entitlements define static feature access, e.g. "Can use SSO authentication".
2453
+ * - Static entitlements let you pass along a configuration while granting access, e.g. "Using this feature with X Y settings" (passed in the config).
2454
+ * - Metered entitlements have many use cases, from setting up usage-based access to implementing complex credit systems. Example: The customer can use 10000 AI tokens during the usage period of the entitlement.
2455
+ *
2456
+ * A given subject can only have one active (non-deleted) entitlement per featureKey. If you try to create a new entitlement for a featureKey that already has an active entitlement, the request will fail with a 409 error.
2457
+ *
2458
+ * Once an entitlement is created you cannot modify it, only delete it.
2459
+ */
2460
+ createEntitlement: {
2461
+ parameters: {
2462
+ path: {
2463
+ subjectIdOrKey: components['parameters']['subjectIdOrKey'];
2464
+ };
2465
+ };
2466
+ /** @description The entitlement to create. */
2467
+ requestBody: {
220
2468
  content: {
221
- 'application/problem+json': components['schemas']['Problem'];
2469
+ 'application/json': components['schemas']['EntitlementCreateInputs'];
2470
+ };
2471
+ };
2472
+ responses: {
2473
+ /** @description Entitlement created. */
2474
+ 201: {
2475
+ content: {
2476
+ 'application/json': components['schemas']['Entitlement'];
2477
+ };
222
2478
  };
2479
+ 400: components['responses']['BadRequestProblemResponse'];
2480
+ 401: components['responses']['UnauthorizedProblemResponse'];
2481
+ 409: components['responses']['ConflictProblemResponse'];
2482
+ 501: components['responses']['NotImplementedProblemResponse'];
2483
+ default: components['responses']['UnexpectedProblemResponse'];
223
2484
  };
224
2485
  };
225
- parameters: {
226
- /** @description A unique identifier for the meter. */
227
- meterIdOrSlug: components['schemas']['IdOrSlug'];
228
- /**
229
- * @description Start date-time in RFC 3339 format in UTC timezone.
230
- * Must be aligned with the window size.
231
- * Inclusive.
232
- */
233
- queryFrom?: string;
234
- /**
235
- * @description End date-time in RFC 3339 format in UTC timezone.
236
- * Must be aligned with the window size.
237
- * Inclusive.
238
- */
239
- queryTo?: string;
240
- /** @description If not specified, a single usage aggregate will be returned for the entirety of the specified period for each subject and group. */
241
- queryWindowSize?: components['schemas']['WindowSize'];
242
- querySubject?: string[];
243
- /** @description If not specified a single aggregate will be returned for each subject and time window. */
244
- queryGroupBy?: string[];
2486
+ /**
2487
+ * Get an entitlement
2488
+ * @description Get entitlement by id. For checking entitlement access, use the /value endpoint instead.
2489
+ */
2490
+ getEntitlement: {
2491
+ parameters: {
2492
+ path: {
2493
+ subjectIdOrKey: components['parameters']['subjectIdOrKey'];
2494
+ entitlementId: components['parameters']['entitlementId'];
2495
+ };
2496
+ };
2497
+ responses: {
2498
+ /** @description Entitlement found. */
2499
+ 200: {
2500
+ content: {
2501
+ 'application/json': {
2502
+ type: 'json';
2503
+ } & Omit<components['schemas']['Entitlement'], 'type'> & {
2504
+ /**
2505
+ * Format: date-time
2506
+ * @description The last time usage was reset.
2507
+ * @example 2023-01-01T00:00:00Z
2508
+ */
2509
+ lastReset?: string;
2510
+ };
2511
+ };
2512
+ };
2513
+ 401: components['responses']['UnauthorizedProblemResponse'];
2514
+ 404: components['responses']['NotFoundProblemResponse'];
2515
+ default: components['responses']['UnexpectedProblemResponse'];
2516
+ };
245
2517
  };
246
- requestBodies: never;
247
- headers: never;
248
- pathItems: never;
249
- }
250
- export type $defs = Record<string, never>;
251
- export type external = Record<string, never>;
252
- export interface operations {
253
- /** @description Retrieve latest raw events. */
254
- listEvents: {
2518
+ /**
2519
+ * Delete an entitlement
2520
+ * @description Deleting an entitlement revokes access to the associated feature. As a single subject can only have one entitlement per featureKey, when "migrating" features you have to delete the old entitlements as well.
2521
+ * As access and status checks can be historical queries, deleting an entitlement populates the deletedAt timestamp. When queried for a time before that, the entitlement is still considered active, you cannot have retroactive changes to access, which is important for, among other things, auditing.
2522
+ */
2523
+ deleteEntitlement: {
2524
+ parameters: {
2525
+ path: {
2526
+ subjectIdOrKey: components['parameters']['subjectIdOrKey'];
2527
+ entitlementId: components['parameters']['entitlementId'];
2528
+ };
2529
+ };
2530
+ responses: {
2531
+ /** @description Entitlement deleted. */
2532
+ 204: {
2533
+ content: never;
2534
+ };
2535
+ 401: components['responses']['UnauthorizedProblemResponse'];
2536
+ 404: components['responses']['NotFoundProblemResponse'];
2537
+ default: components['responses']['UnexpectedProblemResponse'];
2538
+ };
2539
+ };
2540
+ /**
2541
+ * List grants for an entitlement
2542
+ * @description List all grants issued for an entitlement. The entitlement can be defined either by its id or featureKey.
2543
+ */
2544
+ listEntitlementGrants: {
255
2545
  parameters: {
256
2546
  query?: {
257
- /** @description Number of events to return. */
258
- limit?: number;
2547
+ includeDeleted?: components['parameters']['includeDeleted'];
2548
+ /** @description Order by field */
2549
+ orderBy?: 'id' | 'createdAt' | 'updatedAt';
2550
+ };
2551
+ path: {
2552
+ subjectIdOrKey: components['parameters']['subjectIdOrKey'];
2553
+ entitlementIdOrFeatureKey: components['parameters']['entitlementIdOrFeatureKey'];
259
2554
  };
260
2555
  };
261
2556
  responses: {
262
- /** @description Events response */
2557
+ /** @description List of grants. */
263
2558
  200: {
264
2559
  content: {
265
- 'application/json': components['schemas']['Event'][];
2560
+ 'application/json': components['schemas']['EntitlementGrant'][];
2561
+ };
2562
+ };
2563
+ 401: components['responses']['UnauthorizedProblemResponse'];
2564
+ default: components['responses']['UnexpectedProblemResponse'];
2565
+ };
2566
+ };
2567
+ /**
2568
+ * Create a grant
2569
+ * @description Grants define a behavior of granting usage for a metered entitlement. They can have complicated recurrence and rollover rules, thanks to which you can define a wide range of access patterns with a single grant, in most cases you don't have to periodically create new grants. You can only issue grants for active metered entitlements.
2570
+ *
2571
+ * A grant defines a given amount of usage that can be consumed for the entitlement. The grant is in effect between its effective date and its expiration date. Specifying both is mandatory for new grants.
2572
+ *
2573
+ * Grants have a priority setting that determines their order of use. Lower numbers have higher priority, with 0 being the highest priority.
2574
+ *
2575
+ * Grants can have a recurrence setting intended to automate the manual reissuing of grants. For example, a daily recurrence is equal to reissuing that same grant every day (ignoring rollover settings).
2576
+ *
2577
+ * Rollover settings define what happens to the remaining balance of a grant at a reset. Balance_After_Reset = MIN(MaxRolloverAmount, MAX(Balance_Before_Reset, MinRolloverAmount))
2578
+ *
2579
+ * Grants cannot be changed once created, only deleted. This is to ensure that balance is deterministic regardless of when it is queried.
2580
+ */
2581
+ createGrant: {
2582
+ parameters: {
2583
+ path: {
2584
+ subjectIdOrKey: components['parameters']['subjectIdOrKey'];
2585
+ entitlementIdOrFeatureKey: components['parameters']['entitlementIdOrFeatureKey'];
2586
+ };
2587
+ };
2588
+ /** @description The grant to create. */
2589
+ requestBody: {
2590
+ content: {
2591
+ 'application/json': components['schemas']['EntitlementGrantCreateInput'];
2592
+ };
2593
+ };
2594
+ responses: {
2595
+ /** @description Grant created. */
2596
+ 201: {
2597
+ content: {
2598
+ 'application/json': components['schemas']['EntitlementGrant'];
266
2599
  };
267
2600
  };
268
2601
  400: components['responses']['BadRequestProblemResponse'];
2602
+ 401: components['responses']['UnauthorizedProblemResponse'];
2603
+ 501: components['responses']['NotImplementedProblemResponse'];
269
2604
  default: components['responses']['UnexpectedProblemResponse'];
270
2605
  };
271
2606
  };
272
- /** @description Ingest events */
273
- ingestEvents: {
2607
+ /**
2608
+ * Get the current value and access of an entitlement
2609
+ * @description This endpoint should be used for access checks and enforcement. All entitlement types share the hasAccess property in their value response, but multiple other properties are returned based on the entitlement type.
2610
+ *
2611
+ * For convenience reasons, /value works with both entitlementId and featureKey.
2612
+ */
2613
+ getEntitlementValue: {
2614
+ parameters: {
2615
+ query?: {
2616
+ /** @description Point of time to check value: date-time in RFC 3339 format. Defaults to now. */
2617
+ time?: string;
2618
+ };
2619
+ path: {
2620
+ subjectIdOrKey: components['parameters']['subjectIdOrKey'];
2621
+ entitlementIdOrFeatureKey: components['parameters']['entitlementIdOrFeatureKey'];
2622
+ };
2623
+ };
2624
+ responses: {
2625
+ /** @description The entitlement value. */
2626
+ 200: {
2627
+ content: {
2628
+ 'application/json': components['schemas']['EntitlementValue'];
2629
+ };
2630
+ };
2631
+ 400: components['responses']['BadRequestProblemResponse'];
2632
+ 401: components['responses']['UnauthorizedProblemResponse'];
2633
+ 404: components['responses']['NotFoundProblemResponse'];
2634
+ default: components['responses']['UnexpectedProblemResponse'];
2635
+ };
2636
+ };
2637
+ /**
2638
+ * Get the balance history of a specific entitlement.
2639
+ * @description Returns historical balance and usage data for the entitlement. The queried history can span accross multiple reset events.
2640
+ *
2641
+ * BurndownHistory returns a continous history of segments, where the segments are seperated by events that changed either the grant burndown priority or the usage period.
2642
+ *
2643
+ * WindowedHistory returns windowed usage data for the period enriched with balance information and the list of grants that were being burnt down in that window.
2644
+ */
2645
+ getEntitlementHistory: {
2646
+ parameters: {
2647
+ query: {
2648
+ /**
2649
+ * @description Start of time range to query entitlement: date-time in RFC 3339 format. Defaults to
2650
+ * the last reset.
2651
+ * Gets truncated to the granularity of the underlying meter.
2652
+ */
2653
+ from?: string;
2654
+ /**
2655
+ * @description End of time range to query entitlement: date-time in RFC 3339 format. Defaults to now.
2656
+ * If not now then gets truncated to the granularity of the underlying meter.
2657
+ */
2658
+ to?: string;
2659
+ /** @description Size of the time window to group the history by. Cannot be shorter than meter granularity. */
2660
+ windowSize: 'MINUTE' | 'HOUR' | 'DAY';
2661
+ windowTimeZone?: components['parameters']['queryWindowTimeZone'];
2662
+ };
2663
+ path: {
2664
+ subjectIdOrKey: components['parameters']['subjectIdOrKey'];
2665
+ entitlementId: components['parameters']['entitlementId'];
2666
+ };
2667
+ };
2668
+ responses: {
2669
+ /** @description The history response. */
2670
+ 200: {
2671
+ content: {
2672
+ 'application/json': components['schemas']['WindowedBalanceHistory'];
2673
+ };
2674
+ };
2675
+ 400: components['responses']['BadRequestProblemResponse'];
2676
+ 401: components['responses']['UnauthorizedProblemResponse'];
2677
+ 404: components['responses']['NotFoundProblemResponse'];
2678
+ default: components['responses']['UnexpectedProblemResponse'];
2679
+ };
2680
+ };
2681
+ /**
2682
+ * Reset an entitlement
2683
+ * @description Reset marks the start of a new usage period for the entitlement and initiates grant rollover. At the start of a period usage is zerod out and grants are rolled over based on their rollover settings. It would typically be synced with the subjects billing period to enforce usage based on their subscription.
2684
+ *
2685
+ * Usage is automatically reset for metered entitlements based on their usage period, but this endpoint allows to manually reset it at any time. When doing so the period anchor of the entitlement can be changed if needed.
2686
+ */
2687
+ resetEntitlementUsage: {
2688
+ parameters: {
2689
+ path: {
2690
+ subjectIdOrKey: components['parameters']['subjectIdOrKey'];
2691
+ entitlementId: components['parameters']['entitlementId'];
2692
+ };
2693
+ };
274
2694
  requestBody: {
275
2695
  content: {
276
- 'application/cloudevents+json': components['schemas']['Event'];
277
- 'application/cloudevents-batch+json': components['schemas']['Event'][];
2696
+ 'application/json': {
2697
+ /**
2698
+ * Format: date-time
2699
+ * @description The time at which the reset takes effect, defaults to now. The reset cannot be in the future. The provided value is truncated to the minute due to how historical meter data is stored.
2700
+ *
2701
+ * @example 2023-01-01T00:00:00Z
2702
+ */
2703
+ effectiveAt?: string;
2704
+ /**
2705
+ * @description Determines whether the usage period anchor is retained or reset to the effectiveAt time.
2706
+ * - If true, the usage period anchor is retained.
2707
+ * - If false, the usage period anchor is reset to the effectiveAt time.
2708
+ */
2709
+ retainAnchor?: boolean;
2710
+ };
278
2711
  };
279
2712
  };
280
2713
  responses: {
281
- /** @description OK */
2714
+ /** @description Entitlement reset. */
282
2715
  204: {
283
2716
  content: never;
284
2717
  };
285
2718
  400: components['responses']['BadRequestProblemResponse'];
2719
+ 401: components['responses']['UnauthorizedProblemResponse'];
2720
+ 404: components['responses']['NotFoundProblemResponse'];
286
2721
  default: components['responses']['UnexpectedProblemResponse'];
287
2722
  };
288
2723
  };
289
- /** @description List meters */
290
- listMeters: {
2724
+ /**
2725
+ * Get event metrics
2726
+ * @description Returns debug metrics like the number of ingested events since mindnight UTC.
2727
+ * The OpenMetrics Counter(s) reset every day at midnight UTC.
2728
+ */
2729
+ getDebugMetrics: {
291
2730
  responses: {
292
- /** @description Meters response */
2731
+ /** @description Dbeug metrics, like number of ingested events. */
293
2732
  200: {
294
2733
  content: {
295
- 'application/json': components['schemas']['Meter'][];
2734
+ 'text/plain': string;
296
2735
  };
297
2736
  };
2737
+ 401: components['responses']['UnauthorizedProblemResponse'];
298
2738
  default: components['responses']['UnexpectedProblemResponse'];
299
2739
  };
300
2740
  };
301
- /** @description Create meter */
302
- createMeter: {
2741
+ /**
2742
+ * List notification channels
2743
+ * @description List all notification channels.
2744
+ */
2745
+ listNotificationChannels: {
2746
+ parameters: {
2747
+ query?: {
2748
+ limit?: components['parameters']['queryLimit'];
2749
+ offset?: components['parameters']['queryOffset'];
2750
+ /** @description Order by field */
2751
+ orderBy?: 'id' | 'type' | 'createdAt' | 'updatedAt';
2752
+ includeDisabled?: components['parameters']['queryIncludeDisabled'];
2753
+ };
2754
+ };
2755
+ responses: {
2756
+ /** @description List of notification channels. */
2757
+ 200: {
2758
+ content: {
2759
+ 'application/json': components['schemas']['NotificationChannels'];
2760
+ };
2761
+ };
2762
+ 400: components['responses']['BadRequestProblemResponse'];
2763
+ 401: components['responses']['UnauthorizedProblemResponse'];
2764
+ default: components['responses']['UnexpectedProblemResponse'];
2765
+ };
2766
+ };
2767
+ /**
2768
+ * Create a notification channel
2769
+ * @description Create a new notification channel.
2770
+ */
2771
+ createNotificationChannel: {
2772
+ /** @description The notification channel to create. */
303
2773
  requestBody: {
304
2774
  content: {
305
- 'application/json': components['schemas']['Meter'];
2775
+ 'application/json': components['schemas']['NotificationChannelCreateRequest'];
306
2776
  };
307
2777
  };
308
2778
  responses: {
309
- /** @description Created */
2779
+ /** @description Notification channel created. */
310
2780
  201: {
311
2781
  content: {
312
- 'application/json': components['schemas']['Meter'];
2782
+ 'application/json': components['schemas']['NotificationChannel'];
313
2783
  };
314
2784
  };
315
2785
  400: components['responses']['BadRequestProblemResponse'];
316
- 501: components['responses']['NotImplementedProblemResponse'];
2786
+ 401: components['responses']['UnauthorizedProblemResponse'];
2787
+ 409: components['responses']['ConflictProblemResponse'];
317
2788
  default: components['responses']['UnexpectedProblemResponse'];
318
2789
  };
319
2790
  };
320
- /** @description Get meter by slugs */
321
- getMeter: {
2791
+ /**
2792
+ * Get notification channel
2793
+ * @description Get a notification channel by id.
2794
+ */
2795
+ getNotificationChannel: {
322
2796
  parameters: {
323
2797
  path: {
324
- meterIdOrSlug: components['parameters']['meterIdOrSlug'];
2798
+ channelId: components['parameters']['channelId'];
325
2799
  };
326
2800
  };
327
2801
  responses: {
328
- /** @description OK */
2802
+ /** @description Notification channel found. */
329
2803
  200: {
330
2804
  content: {
331
- 'application/json': components['schemas']['Meter'];
2805
+ 'application/json': components['schemas']['NotificationChannel'];
332
2806
  };
333
2807
  };
2808
+ 401: components['responses']['UnauthorizedProblemResponse'];
334
2809
  404: components['responses']['NotFoundProblemResponse'];
335
2810
  default: components['responses']['UnexpectedProblemResponse'];
336
2811
  };
337
2812
  };
338
- /** @description Delete meter by slug */
339
- deleteMeter: {
2813
+ /**
2814
+ * Update notification channel
2815
+ * @description Update a notification channel by id.
2816
+ */
2817
+ updateNotificationChannel: {
340
2818
  parameters: {
341
2819
  path: {
342
- meterIdOrSlug: components['parameters']['meterIdOrSlug'];
2820
+ channelId: components['parameters']['channelId'];
2821
+ };
2822
+ };
2823
+ /** @description The notification channel to update. */
2824
+ requestBody: {
2825
+ content: {
2826
+ 'application/json': components['schemas']['NotificationChannelCreateRequest'];
2827
+ };
2828
+ };
2829
+ responses: {
2830
+ /** @description Notification channel updated. */
2831
+ 200: {
2832
+ content: {
2833
+ 'application/json': components['schemas']['NotificationChannel'];
2834
+ };
2835
+ };
2836
+ 401: components['responses']['UnauthorizedProblemResponse'];
2837
+ 404: components['responses']['NotFoundProblemResponse'];
2838
+ default: components['responses']['UnexpectedProblemResponse'];
2839
+ };
2840
+ };
2841
+ /**
2842
+ * Delete a notification channel
2843
+ * @description Delete notification channel by id.
2844
+ */
2845
+ deleteNotificationChannel: {
2846
+ parameters: {
2847
+ path: {
2848
+ channelId: components['parameters']['channelId'];
343
2849
  };
344
2850
  };
345
2851
  responses: {
346
- /** @description No Content */
2852
+ /** @description Notification channel deleted. */
347
2853
  204: {
348
2854
  content: never;
349
2855
  };
2856
+ 401: components['responses']['UnauthorizedProblemResponse'];
350
2857
  404: components['responses']['NotFoundProblemResponse'];
351
- 501: components['responses']['NotImplementedProblemResponse'];
352
2858
  default: components['responses']['UnexpectedProblemResponse'];
353
2859
  };
354
2860
  };
355
- /** @description Query meter */
356
- queryMeter: {
2861
+ /**
2862
+ * List notification rules
2863
+ * @description List all notification rules.
2864
+ */
2865
+ listNotificationRules: {
357
2866
  parameters: {
358
2867
  query?: {
359
- from?: components['parameters']['queryFrom'];
360
- to?: components['parameters']['queryTo'];
361
- windowSize?: components['parameters']['queryWindowSize'];
362
- subject?: components['parameters']['querySubject'];
363
- groupBy?: components['parameters']['queryGroupBy'];
2868
+ limit?: components['parameters']['queryLimit'];
2869
+ offset?: components['parameters']['queryOffset'];
2870
+ /** @description Order by field */
2871
+ orderBy?: 'id' | 'type' | 'createdAt' | 'updatedAt';
2872
+ includeDisabled?: components['parameters']['queryIncludeDisabled'];
2873
+ feature?: components['parameters']['queryFilterFeature'];
2874
+ };
2875
+ };
2876
+ responses: {
2877
+ /** @description List of notification rules. */
2878
+ 200: {
2879
+ content: {
2880
+ 'application/json': components['schemas']['NotificationRules'];
2881
+ };
2882
+ };
2883
+ 400: components['responses']['BadRequestProblemResponse'];
2884
+ 401: components['responses']['UnauthorizedProblemResponse'];
2885
+ default: components['responses']['UnexpectedProblemResponse'];
2886
+ };
2887
+ };
2888
+ /**
2889
+ * Create a notification rule
2890
+ * @description Create a new notification rule.
2891
+ */
2892
+ createNotificationRule: {
2893
+ /** @description The notification rule to create. */
2894
+ requestBody: {
2895
+ content: {
2896
+ 'application/json': components['schemas']['NotificationRuleCreateRequest'];
2897
+ };
2898
+ };
2899
+ responses: {
2900
+ /** @description Notification rule created. */
2901
+ 201: {
2902
+ content: {
2903
+ 'application/json': components['schemas']['NotificationRule'];
2904
+ };
364
2905
  };
2906
+ 400: components['responses']['BadRequestProblemResponse'];
2907
+ 401: components['responses']['UnauthorizedProblemResponse'];
2908
+ 409: components['responses']['ConflictProblemResponse'];
2909
+ default: components['responses']['UnexpectedProblemResponse'];
2910
+ };
2911
+ };
2912
+ /**
2913
+ * Get notification rule
2914
+ * @description Get a notification rule by id.
2915
+ */
2916
+ getNotificationRule: {
2917
+ parameters: {
365
2918
  path: {
366
- meterIdOrSlug: components['parameters']['meterIdOrSlug'];
2919
+ ruleId: components['parameters']['ruleId'];
367
2920
  };
368
2921
  };
369
2922
  responses: {
370
- /** @description OK */
2923
+ /** @description Rule found. */
371
2924
  200: {
372
2925
  content: {
373
- 'application/json': {
374
- /** Format: date-time */
375
- from?: string;
376
- /** Format: date-time */
377
- to?: string;
378
- windowSize?: components['schemas']['WindowSize'];
379
- data: components['schemas']['MeterQueryRow'][];
380
- };
381
- 'text/csv': string;
2926
+ 'application/json': components['schemas']['NotificationRule'];
382
2927
  };
383
2928
  };
384
- 400: components['responses']['BadRequestProblemResponse'];
2929
+ 401: components['responses']['UnauthorizedProblemResponse'];
2930
+ 404: components['responses']['NotFoundProblemResponse'];
385
2931
  default: components['responses']['UnexpectedProblemResponse'];
386
2932
  };
387
2933
  };
388
- /** @description List meter subjects */
389
- listMeterSubjects: {
2934
+ /**
2935
+ * Update a notification rule
2936
+ * @description Update a notification rule by id.
2937
+ */
2938
+ updateNotificationRule: {
390
2939
  parameters: {
391
2940
  path: {
392
- meterIdOrSlug: components['parameters']['meterIdOrSlug'];
2941
+ ruleId: components['parameters']['ruleId'];
2942
+ };
2943
+ };
2944
+ /** @description The notification rule to update. */
2945
+ requestBody: {
2946
+ content: {
2947
+ 'application/json': components['schemas']['NotificationRuleCreateRequest'];
393
2948
  };
394
2949
  };
395
2950
  responses: {
396
- /** @description OK */
2951
+ /** @description Notification Rule updated. */
397
2952
  200: {
398
2953
  content: {
399
- 'application/json': string[];
2954
+ 'application/json': components['schemas']['NotificationRule'];
2955
+ };
2956
+ };
2957
+ 401: components['responses']['UnauthorizedProblemResponse'];
2958
+ 404: components['responses']['NotFoundProblemResponse'];
2959
+ default: components['responses']['UnexpectedProblemResponse'];
2960
+ };
2961
+ };
2962
+ /**
2963
+ * Delete a notification rule
2964
+ * @description Delete notification rule by id.
2965
+ */
2966
+ deleteNotificationRule: {
2967
+ parameters: {
2968
+ path: {
2969
+ ruleId: components['parameters']['ruleId'];
2970
+ };
2971
+ };
2972
+ responses: {
2973
+ /** @description Notification rule deleted. */
2974
+ 204: {
2975
+ content: never;
2976
+ };
2977
+ 401: components['responses']['UnauthorizedProblemResponse'];
2978
+ 404: components['responses']['NotFoundProblemResponse'];
2979
+ default: components['responses']['UnexpectedProblemResponse'];
2980
+ };
2981
+ };
2982
+ /**
2983
+ * List notification evens
2984
+ * @description List all notification events.
2985
+ */
2986
+ listNotificationEvents: {
2987
+ parameters: {
2988
+ query?: {
2989
+ limit?: components['parameters']['queryLimit'];
2990
+ offset?: components['parameters']['queryOffset'];
2991
+ /** @description Order by field */
2992
+ orderBy?: 'id' | 'createdAt';
2993
+ feature?: components['parameters']['queryFilterFeature'];
2994
+ subject?: components['parameters']['queryFilterSubject'];
2995
+ };
2996
+ };
2997
+ responses: {
2998
+ /** @description List of notification events. */
2999
+ 200: {
3000
+ content: {
3001
+ 'application/json': components['schemas']['NotificationEvent'][];
400
3002
  };
401
3003
  };
402
3004
  400: components['responses']['BadRequestProblemResponse'];
3005
+ 401: components['responses']['UnauthorizedProblemResponse'];
3006
+ default: components['responses']['UnexpectedProblemResponse'];
3007
+ };
3008
+ };
3009
+ /**
3010
+ * Get notification event
3011
+ * @description Get a notification event by id.
3012
+ */
3013
+ getNotificationEvent: {
3014
+ parameters: {
3015
+ path: {
3016
+ eventId: components['parameters']['eventId'];
3017
+ };
3018
+ };
3019
+ responses: {
3020
+ /** @description Notification event found. */
3021
+ 200: {
3022
+ content: {
3023
+ 'application/json': components['schemas']['NotificationEvent'];
3024
+ };
3025
+ };
3026
+ 401: components['responses']['UnauthorizedProblemResponse'];
3027
+ 404: components['responses']['NotFoundProblemResponse'];
403
3028
  default: components['responses']['UnexpectedProblemResponse'];
404
3029
  };
405
3030
  };
406
3031
  }
3032
+ export {};