@openmeter/sdk 1.0.0-beta.184 → 1.0.0-beta.188

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