@openmeter/sdk 1.0.0-beta.185 → 1.0.0-beta.189

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