@openmeter/sdk 1.0.0-beta.114 → 1.0.0-beta.116
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/clients/entitlement.cjs +3 -1
- package/dist/cjs/clients/entitlement.d.cts +3 -1
- package/dist/cjs/clients/entitlement.js.map +1 -1
- package/dist/cjs/clients/feature.cjs +7 -2
- package/dist/cjs/clients/feature.d.cts +7 -2
- package/dist/cjs/clients/feature.js.map +1 -1
- package/dist/cjs/clients/grant.cjs +14 -0
- package/dist/cjs/clients/grant.d.cts +8 -0
- package/dist/cjs/clients/grant.js.map +1 -1
- package/dist/cjs/clients/subject.cjs +21 -5
- package/dist/cjs/clients/subject.d.cts +12 -4
- package/dist/cjs/clients/subject.js.map +1 -1
- package/dist/cjs/schemas/openapi.d.cts +156 -88
- package/dist/cjs/{tsconfig.3368605f.tsbuildinfo → tsconfig.0c018185.tsbuildinfo} +1 -1
- package/dist/cjs/{tsconfig.660c8e61.tsbuildinfo → tsconfig.d65e33e9.tsbuildinfo} +1 -1
- package/dist/clients/entitlement.d.ts +3 -1
- package/dist/clients/entitlement.js +3 -1
- package/dist/clients/entitlement.js.map +1 -1
- package/dist/clients/feature.d.ts +7 -2
- package/dist/clients/feature.js +7 -2
- package/dist/clients/feature.js.map +1 -1
- package/dist/clients/grant.d.ts +8 -0
- package/dist/clients/grant.js +14 -0
- package/dist/clients/grant.js.map +1 -1
- package/dist/clients/subject.d.ts +12 -4
- package/dist/clients/subject.js +21 -5
- package/dist/clients/subject.js.map +1 -1
- package/dist/schemas/openapi.d.ts +156 -88
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +1 -1
|
@@ -125,105 +125,134 @@ export interface paths {
|
|
|
125
125
|
'/api/v1/entitlements': {
|
|
126
126
|
/**
|
|
127
127
|
* List entitlements
|
|
128
|
-
* @description List entitlements.
|
|
128
|
+
* @description List all entitlements regardless of subject. This endpoint is intended for administrative purposes.
|
|
129
129
|
*/
|
|
130
130
|
get: operations['listEntitlements'];
|
|
131
131
|
};
|
|
132
132
|
'/api/v1/features': {
|
|
133
133
|
/**
|
|
134
134
|
* List features
|
|
135
|
-
* @description List features.
|
|
135
|
+
* @description List all features.
|
|
136
136
|
*/
|
|
137
137
|
get: operations['listFeatures'];
|
|
138
138
|
/**
|
|
139
|
-
* Create feature
|
|
140
|
-
* @description
|
|
139
|
+
* Create a feature
|
|
140
|
+
* @description Features are either metered or static. A feature is metered if meterSlug is provided at creation.
|
|
141
|
+
* 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.
|
|
142
|
+
*
|
|
143
|
+
* Features cannot be updated later, only archived.
|
|
141
144
|
*/
|
|
142
145
|
post: operations['createFeature'];
|
|
143
146
|
};
|
|
144
147
|
'/api/v1/features/{featureId}': {
|
|
145
148
|
/**
|
|
146
149
|
* Get feature
|
|
147
|
-
* @description Get feature by id.
|
|
150
|
+
* @description Get a feature by id.
|
|
148
151
|
*/
|
|
149
152
|
get: operations['getFeature'];
|
|
150
153
|
/**
|
|
151
|
-
*
|
|
152
|
-
* @description
|
|
154
|
+
* Archive a feature
|
|
155
|
+
* @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.
|
|
153
156
|
*/
|
|
154
157
|
delete: operations['deleteFeature'];
|
|
155
158
|
};
|
|
156
159
|
'/api/v1/grants': {
|
|
157
160
|
/**
|
|
158
161
|
* List grants
|
|
159
|
-
* @description List all grants.
|
|
162
|
+
* @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.
|
|
160
163
|
*/
|
|
161
164
|
get: operations['listGrants'];
|
|
162
165
|
};
|
|
163
166
|
'/api/v1/grants/{grantId}': {
|
|
164
167
|
/**
|
|
165
|
-
*
|
|
166
|
-
* @description
|
|
168
|
+
* Void a grant
|
|
169
|
+
* @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.
|
|
170
|
+
*
|
|
171
|
+
* 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.
|
|
167
172
|
*/
|
|
168
173
|
delete: operations['voidGrant'];
|
|
169
174
|
};
|
|
170
175
|
'/api/v1/subjects/{subjectIdOrKey}/entitlements': {
|
|
171
176
|
/**
|
|
172
|
-
* List entitlements
|
|
173
|
-
* @description List all entitlements for a subject.
|
|
177
|
+
* List entitlements of a subject
|
|
178
|
+
* @description List all entitlements for a subject. For checking entitlement access, use the /value endpoint instead.
|
|
174
179
|
*/
|
|
175
180
|
get: operations['listSubjectEntitlements'];
|
|
176
181
|
/**
|
|
177
|
-
* Create entitlement
|
|
178
|
-
* @description
|
|
182
|
+
* Create an entitlement
|
|
183
|
+
* @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).
|
|
184
|
+
*
|
|
185
|
+
* - Boolean entitlements define static feature access, e.g. "Can use SSO authentication".
|
|
186
|
+
* - Static entitlements let you pass along a configuration while granting access, e.g. "Using this feature with X Y settings" (passed in the config).
|
|
187
|
+
* - 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.
|
|
188
|
+
*
|
|
189
|
+
* 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.
|
|
190
|
+
*
|
|
191
|
+
* Once an entitlement is created you cannot modify it, only delete it.
|
|
179
192
|
*/
|
|
180
193
|
post: operations['createEntitlement'];
|
|
181
194
|
};
|
|
182
195
|
'/api/v1/subjects/{subjectIdOrKey}/entitlements/{entitlementId}': {
|
|
183
196
|
/**
|
|
184
|
-
* Get entitlement
|
|
185
|
-
* @description Get entitlement by id.
|
|
197
|
+
* Get an entitlement
|
|
198
|
+
* @description Get entitlement by id. For checking entitlement access, use the /value endpoint instead.
|
|
186
199
|
*/
|
|
187
200
|
get: operations['getEntitlement'];
|
|
188
201
|
/**
|
|
189
|
-
* Delete entitlement
|
|
190
|
-
* @description
|
|
202
|
+
* Delete an entitlement
|
|
203
|
+
* @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.
|
|
204
|
+
* 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.
|
|
191
205
|
*/
|
|
192
206
|
delete: operations['deleteEntitlement'];
|
|
193
207
|
};
|
|
194
208
|
'/api/v1/subjects/{subjectIdOrKey}/entitlements/{entitlementId}/grants': {
|
|
195
209
|
/**
|
|
196
210
|
* List grants for an entitlement
|
|
197
|
-
* @description List all grants for an entitlement.
|
|
211
|
+
* @description List all grants issued for an entitlement. This endpoint is intended for administrative purposes.
|
|
198
212
|
*/
|
|
199
213
|
get: operations['listEntitlementGrants'];
|
|
200
214
|
/**
|
|
201
|
-
* Create grant
|
|
202
|
-
* @description
|
|
215
|
+
* Create a grant
|
|
216
|
+
* @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.
|
|
217
|
+
*
|
|
218
|
+
* 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.
|
|
219
|
+
*
|
|
220
|
+
* Grants have a priority setting that determines their order of use. Lower numbers have higher priority, with 0 being the highest priority.
|
|
221
|
+
*
|
|
222
|
+
* 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).
|
|
223
|
+
*
|
|
224
|
+
* 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))
|
|
225
|
+
*
|
|
226
|
+
* Grants cannot be changed once created, only deleted. This is to ensure that balance is deterministic regardless of when it is queried.
|
|
203
227
|
*/
|
|
204
228
|
post: operations['createGrant'];
|
|
205
229
|
};
|
|
206
230
|
'/api/v1/subjects/{subjectIdOrKey}/entitlements/{entitlementIdOrFeatureKey}/value': {
|
|
207
231
|
/**
|
|
208
|
-
* Get the
|
|
209
|
-
* @description
|
|
232
|
+
* Get the current value and access of an entitlement
|
|
233
|
+
* @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.
|
|
234
|
+
*
|
|
235
|
+
* For convenience reasons, /value works with both entitlementId and featureKey.
|
|
210
236
|
*/
|
|
211
237
|
get: operations['getEntitlementValue'];
|
|
212
238
|
};
|
|
213
239
|
'/api/v1/subjects/{subjectIdOrKey}/entitlements/{entitlementId}/history': {
|
|
214
240
|
/**
|
|
215
241
|
* Get the balance history of a specific entitlement.
|
|
216
|
-
* @description
|
|
242
|
+
* @description Returns historical balance and usage data for the entitlement. The queried history can span accross multiple reset events.
|
|
243
|
+
*
|
|
244
|
+
* 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.
|
|
217
245
|
*
|
|
218
|
-
*
|
|
219
|
-
* The last window may be smaller than the window size and is inclusive at both ends.
|
|
246
|
+
* 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.
|
|
220
247
|
*/
|
|
221
248
|
get: operations['getEntitlementHistory'];
|
|
222
249
|
};
|
|
223
250
|
'/api/v1/subjects/{subjectIdOrKey}/entitlements/{entitlementId}/reset': {
|
|
224
251
|
/**
|
|
225
|
-
* Reset entitlement
|
|
226
|
-
* @description Reset the
|
|
252
|
+
* Reset an entitlement
|
|
253
|
+
* @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.
|
|
254
|
+
*
|
|
255
|
+
* 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.
|
|
227
256
|
*/
|
|
228
257
|
post: operations['resetEntitlementUsage'];
|
|
229
258
|
};
|
|
@@ -240,8 +269,8 @@ export type webhooks = Record<string, never>;
|
|
|
240
269
|
export interface components {
|
|
241
270
|
schemas: {
|
|
242
271
|
/**
|
|
243
|
-
* @description Metadata fields for
|
|
244
|
-
* These fields are automatically populated by the system for
|
|
272
|
+
* @description Metadata fields for all resources.
|
|
273
|
+
* These fields are automatically populated by the system for managed entities. Their use and meaning is uniform across all resources.
|
|
245
274
|
*/
|
|
246
275
|
SharedMetaFields: {
|
|
247
276
|
/**
|
|
@@ -258,13 +287,13 @@ export interface components {
|
|
|
258
287
|
createdAt: string;
|
|
259
288
|
/**
|
|
260
289
|
* Format: date-time
|
|
261
|
-
* @description The date and time the resource was last updated.
|
|
290
|
+
* @description The date and time the resource was last updated. The initial value is the same as createdAt.
|
|
262
291
|
* @example 2023-01-01T00:00:00Z
|
|
263
292
|
*/
|
|
264
293
|
updatedAt: string;
|
|
265
294
|
/**
|
|
266
295
|
* Format: date-time
|
|
267
|
-
* @description The date and time the resource was deleted.
|
|
296
|
+
* @description The date and time the resource was deleted.
|
|
268
297
|
* @example 2023-01-01T00:00:00Z
|
|
269
298
|
*/
|
|
270
299
|
deletedAt?: string;
|
|
@@ -459,7 +488,7 @@ export interface components {
|
|
|
459
488
|
*/
|
|
460
489
|
FeatureCreateInputs: {
|
|
461
490
|
/**
|
|
462
|
-
* @description The unique
|
|
491
|
+
* @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.
|
|
463
492
|
*
|
|
464
493
|
* @example gpt4_tokens
|
|
465
494
|
*/
|
|
@@ -470,19 +499,19 @@ export interface components {
|
|
|
470
499
|
* @example AI Tokens
|
|
471
500
|
*/
|
|
472
501
|
name: string;
|
|
473
|
-
/** @description Additional metadata for the feature. */
|
|
502
|
+
/** @description Additional metadata for the feature, useful for syncing with external systems and annotating custom fields. */
|
|
474
503
|
metadata?: {
|
|
475
504
|
[key: string]: string;
|
|
476
505
|
};
|
|
477
506
|
/**
|
|
478
|
-
* @description The meter that the feature is associated with and
|
|
479
|
-
*
|
|
507
|
+
* @description The meter that the feature is associated with and and based on which usage is calculated.
|
|
508
|
+
* The meter selected must have SUM or COUNT aggregation.
|
|
480
509
|
*
|
|
481
510
|
* @example tokens_total
|
|
482
511
|
*/
|
|
483
512
|
meterSlug?: string;
|
|
484
513
|
/**
|
|
485
|
-
* @description Optional meter group by filters. Useful if the meter scope is broader than what feature tracks.
|
|
514
|
+
* @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.
|
|
486
515
|
*
|
|
487
516
|
* @example {
|
|
488
517
|
* "model": "gpt-4"
|
|
@@ -499,7 +528,7 @@ export interface components {
|
|
|
499
528
|
Feature: {
|
|
500
529
|
/**
|
|
501
530
|
* Format: date-time
|
|
502
|
-
* @description If the feature is archived,
|
|
531
|
+
* @description If the feature is archived, no new entitlements can be created for it.
|
|
503
532
|
*
|
|
504
533
|
* @example 2023-01-01T00:00:00Z
|
|
505
534
|
*/
|
|
@@ -556,13 +585,13 @@ export interface components {
|
|
|
556
585
|
*/
|
|
557
586
|
type: 'metered';
|
|
558
587
|
/**
|
|
559
|
-
* @description If softLimit=true the subject can use the feature even if the entitlement is exhausted.
|
|
588
|
+
* @description If softLimit=true the subject can use the feature even if the entitlement is exhausted, hasAccess will always be true.
|
|
560
589
|
*
|
|
561
590
|
* @default false
|
|
562
591
|
*/
|
|
563
592
|
isSoftLimit?: boolean;
|
|
564
593
|
/**
|
|
565
|
-
* @description
|
|
594
|
+
* @description Deprecated, ignored by the backend. Please use isSoftLimit instead; this field will be removed in the future.
|
|
566
595
|
*
|
|
567
596
|
* @default false
|
|
568
597
|
*/
|
|
@@ -570,7 +599,10 @@ export interface components {
|
|
|
570
599
|
usagePeriod: components['schemas']['RecurringPeriodCreateInput'];
|
|
571
600
|
/**
|
|
572
601
|
* Format: double
|
|
573
|
-
* @description You can
|
|
602
|
+
* @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.
|
|
603
|
+
* 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.
|
|
604
|
+
*
|
|
605
|
+
* Manually creating such a grant would mean having the "amount", "minRolloverAmount", and "maxRolloverAmount" fields all be the same.
|
|
574
606
|
*/
|
|
575
607
|
issueAfterReset?: number;
|
|
576
608
|
/**
|
|
@@ -582,13 +614,13 @@ export interface components {
|
|
|
582
614
|
issueAfterResetPriority?: number;
|
|
583
615
|
};
|
|
584
616
|
EntitlementCreateInputs: components['schemas']['EntitlementMeteredCreateInputs'] | components['schemas']['EntitlementStaticCreateInputs'] | components['schemas']['EntitlementBooleanCreateInputs'];
|
|
585
|
-
/** @description
|
|
617
|
+
/** @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). */
|
|
586
618
|
EntitlementMetered: components['schemas']['EntitlementMeteredCreateInputs'] & components['schemas']['EntitlementMeteredCalculatedFields'] & components['schemas']['EntitlementSharedFields'];
|
|
587
619
|
/** @description Calculated fields for a metered entitlement. */
|
|
588
620
|
EntitlementMeteredCalculatedFields: {
|
|
589
621
|
/**
|
|
590
622
|
* Format: date-time
|
|
591
|
-
* @description The last time
|
|
623
|
+
* @description The last time a reset happened.
|
|
592
624
|
*
|
|
593
625
|
* @example 2023-01-01T00:00:00Z
|
|
594
626
|
*/
|
|
@@ -602,7 +634,7 @@ export interface components {
|
|
|
602
634
|
*/
|
|
603
635
|
type: 'static';
|
|
604
636
|
/**
|
|
605
|
-
* @description The JSON parsable config of the entitlement.
|
|
637
|
+
* @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.
|
|
606
638
|
*
|
|
607
639
|
* @example {"key1": "value1"}
|
|
608
640
|
*/
|
|
@@ -623,7 +655,7 @@ export interface components {
|
|
|
623
655
|
/**
|
|
624
656
|
* @description A segment of the grant burn down history.
|
|
625
657
|
*
|
|
626
|
-
* A given segment represents the usage of a grant
|
|
658
|
+
* A given segment represents the usage of a grant between events that changed either the grant burn down priority order or the usag period.
|
|
627
659
|
*/
|
|
628
660
|
GrantBurnDownHistorySegment: {
|
|
629
661
|
period?: components['schemas']['Period'];
|
|
@@ -693,7 +725,7 @@ export interface components {
|
|
|
693
725
|
*/
|
|
694
726
|
usage?: number;
|
|
695
727
|
};
|
|
696
|
-
/** @description
|
|
728
|
+
/** @description Windowed usage and balance information. */
|
|
697
729
|
BalanceHistoryWindow: {
|
|
698
730
|
period?: components['schemas']['Period'];
|
|
699
731
|
/**
|
|
@@ -715,10 +747,12 @@ export interface components {
|
|
|
715
747
|
WindowedBalanceHistory: {
|
|
716
748
|
/**
|
|
717
749
|
* @description The windowed balance history.
|
|
718
|
-
*
|
|
750
|
+
* - It only returns rows for windows where there was usage.
|
|
751
|
+
* - The windows are inclusive at their start and exclusive at their end.
|
|
752
|
+
* - The last window may be smaller than the window size and is inclusive at both ends.
|
|
719
753
|
*/
|
|
720
754
|
windowedHistory?: components['schemas']['BalanceHistoryWindow'][];
|
|
721
|
-
/** @description
|
|
755
|
+
/** @description Grant burndown history. */
|
|
722
756
|
burndownHistory?: components['schemas']['GrantBurnDownHistorySegment'][];
|
|
723
757
|
};
|
|
724
758
|
/** @description A time period */
|
|
@@ -859,30 +893,35 @@ export interface components {
|
|
|
859
893
|
};
|
|
860
894
|
EntitlementValue: {
|
|
861
895
|
/**
|
|
862
|
-
* @description Whether the subject has access to the feature.
|
|
896
|
+
* @description Whether the subject has access to the feature. Shared accross all entitlement types.
|
|
897
|
+
*
|
|
863
898
|
* @example true
|
|
864
899
|
*/
|
|
865
900
|
hasAccess: boolean;
|
|
866
901
|
/**
|
|
867
902
|
* Format: double
|
|
868
|
-
* @description
|
|
903
|
+
* @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.
|
|
904
|
+
*
|
|
869
905
|
* @example 100
|
|
870
906
|
*/
|
|
871
907
|
balance?: number;
|
|
872
908
|
/**
|
|
873
909
|
* Format: double
|
|
874
|
-
* @description
|
|
910
|
+
* @description Only available for metered entitlements. Returns the total feature usage in the current period.
|
|
911
|
+
*
|
|
875
912
|
* @example 50
|
|
876
913
|
*/
|
|
877
914
|
usage?: number;
|
|
878
915
|
/**
|
|
879
916
|
* Format: double
|
|
880
|
-
* @description
|
|
917
|
+
* @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.
|
|
918
|
+
*
|
|
881
919
|
* @example 0
|
|
882
920
|
*/
|
|
883
921
|
overage?: number;
|
|
884
922
|
/**
|
|
885
|
-
* @description The JSON
|
|
923
|
+
* @description Only available for static entitlements. The JSON parsable config of the entitlement.
|
|
924
|
+
*
|
|
886
925
|
* @example {"key1": "value1"}
|
|
887
926
|
*/
|
|
888
927
|
config?: string;
|
|
@@ -1651,7 +1690,7 @@ export interface operations {
|
|
|
1651
1690
|
};
|
|
1652
1691
|
/**
|
|
1653
1692
|
* List entitlements
|
|
1654
|
-
* @description List entitlements.
|
|
1693
|
+
* @description List all entitlements regardless of subject. This endpoint is intended for administrative purposes.
|
|
1655
1694
|
*/
|
|
1656
1695
|
listEntitlements: {
|
|
1657
1696
|
parameters: {
|
|
@@ -1669,13 +1708,14 @@ export interface operations {
|
|
|
1669
1708
|
'application/json': components['schemas']['Entitlement'][];
|
|
1670
1709
|
};
|
|
1671
1710
|
};
|
|
1711
|
+
400: components['responses']['BadRequestProblemResponse'];
|
|
1672
1712
|
401: components['responses']['UnauthorizedProblemResponse'];
|
|
1673
1713
|
default: components['responses']['UnexpectedProblemResponse'];
|
|
1674
1714
|
};
|
|
1675
1715
|
};
|
|
1676
1716
|
/**
|
|
1677
1717
|
* List features
|
|
1678
|
-
* @description List features.
|
|
1718
|
+
* @description List all features.
|
|
1679
1719
|
*/
|
|
1680
1720
|
listFeatures: {
|
|
1681
1721
|
parameters: {
|
|
@@ -1695,13 +1735,17 @@ export interface operations {
|
|
|
1695
1735
|
'application/json': components['schemas']['Feature'][];
|
|
1696
1736
|
};
|
|
1697
1737
|
};
|
|
1738
|
+
400: components['responses']['BadRequestProblemResponse'];
|
|
1698
1739
|
401: components['responses']['UnauthorizedProblemResponse'];
|
|
1699
1740
|
default: components['responses']['UnexpectedProblemResponse'];
|
|
1700
1741
|
};
|
|
1701
1742
|
};
|
|
1702
1743
|
/**
|
|
1703
|
-
* Create feature
|
|
1704
|
-
* @description
|
|
1744
|
+
* Create a feature
|
|
1745
|
+
* @description Features are either metered or static. A feature is metered if meterSlug is provided at creation.
|
|
1746
|
+
* 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.
|
|
1747
|
+
*
|
|
1748
|
+
* Features cannot be updated later, only archived.
|
|
1705
1749
|
*/
|
|
1706
1750
|
createFeature: {
|
|
1707
1751
|
/** @description The feature to create. */
|
|
@@ -1725,7 +1769,7 @@ export interface operations {
|
|
|
1725
1769
|
};
|
|
1726
1770
|
/**
|
|
1727
1771
|
* Get feature
|
|
1728
|
-
* @description Get feature by id.
|
|
1772
|
+
* @description Get a feature by id.
|
|
1729
1773
|
*/
|
|
1730
1774
|
getFeature: {
|
|
1731
1775
|
parameters: {
|
|
@@ -1746,8 +1790,8 @@ export interface operations {
|
|
|
1746
1790
|
};
|
|
1747
1791
|
};
|
|
1748
1792
|
/**
|
|
1749
|
-
*
|
|
1750
|
-
* @description
|
|
1793
|
+
* Archive a feature
|
|
1794
|
+
* @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.
|
|
1751
1795
|
*/
|
|
1752
1796
|
deleteFeature: {
|
|
1753
1797
|
parameters: {
|
|
@@ -1767,7 +1811,7 @@ export interface operations {
|
|
|
1767
1811
|
};
|
|
1768
1812
|
/**
|
|
1769
1813
|
* List grants
|
|
1770
|
-
* @description List all grants.
|
|
1814
|
+
* @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.
|
|
1771
1815
|
*/
|
|
1772
1816
|
listGrants: {
|
|
1773
1817
|
parameters: {
|
|
@@ -1791,8 +1835,10 @@ export interface operations {
|
|
|
1791
1835
|
};
|
|
1792
1836
|
};
|
|
1793
1837
|
/**
|
|
1794
|
-
*
|
|
1795
|
-
* @description
|
|
1838
|
+
* Void a grant
|
|
1839
|
+
* @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.
|
|
1840
|
+
*
|
|
1841
|
+
* 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.
|
|
1796
1842
|
*/
|
|
1797
1843
|
voidGrant: {
|
|
1798
1844
|
parameters: {
|
|
@@ -1813,8 +1859,8 @@ export interface operations {
|
|
|
1813
1859
|
};
|
|
1814
1860
|
};
|
|
1815
1861
|
/**
|
|
1816
|
-
* List entitlements
|
|
1817
|
-
* @description List all entitlements for a subject.
|
|
1862
|
+
* List entitlements of a subject
|
|
1863
|
+
* @description List all entitlements for a subject. For checking entitlement access, use the /value endpoint instead.
|
|
1818
1864
|
*/
|
|
1819
1865
|
listSubjectEntitlements: {
|
|
1820
1866
|
parameters: {
|
|
@@ -1837,8 +1883,16 @@ export interface operations {
|
|
|
1837
1883
|
};
|
|
1838
1884
|
};
|
|
1839
1885
|
/**
|
|
1840
|
-
* Create entitlement
|
|
1841
|
-
* @description
|
|
1886
|
+
* Create an entitlement
|
|
1887
|
+
* @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).
|
|
1888
|
+
*
|
|
1889
|
+
* - Boolean entitlements define static feature access, e.g. "Can use SSO authentication".
|
|
1890
|
+
* - Static entitlements let you pass along a configuration while granting access, e.g. "Using this feature with X Y settings" (passed in the config).
|
|
1891
|
+
* - 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.
|
|
1892
|
+
*
|
|
1893
|
+
* 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.
|
|
1894
|
+
*
|
|
1895
|
+
* Once an entitlement is created you cannot modify it, only delete it.
|
|
1842
1896
|
*/
|
|
1843
1897
|
createEntitlement: {
|
|
1844
1898
|
parameters: {
|
|
@@ -1867,8 +1921,8 @@ export interface operations {
|
|
|
1867
1921
|
};
|
|
1868
1922
|
};
|
|
1869
1923
|
/**
|
|
1870
|
-
* Get entitlement
|
|
1871
|
-
* @description Get entitlement by id.
|
|
1924
|
+
* Get an entitlement
|
|
1925
|
+
* @description Get entitlement by id. For checking entitlement access, use the /value endpoint instead.
|
|
1872
1926
|
*/
|
|
1873
1927
|
getEntitlement: {
|
|
1874
1928
|
parameters: {
|
|
@@ -1899,8 +1953,9 @@ export interface operations {
|
|
|
1899
1953
|
};
|
|
1900
1954
|
};
|
|
1901
1955
|
/**
|
|
1902
|
-
* Delete entitlement
|
|
1903
|
-
* @description
|
|
1956
|
+
* Delete an entitlement
|
|
1957
|
+
* @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.
|
|
1958
|
+
* 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.
|
|
1904
1959
|
*/
|
|
1905
1960
|
deleteEntitlement: {
|
|
1906
1961
|
parameters: {
|
|
@@ -1921,7 +1976,7 @@ export interface operations {
|
|
|
1921
1976
|
};
|
|
1922
1977
|
/**
|
|
1923
1978
|
* List grants for an entitlement
|
|
1924
|
-
* @description List all grants for an entitlement.
|
|
1979
|
+
* @description List all grants issued for an entitlement. This endpoint is intended for administrative purposes.
|
|
1925
1980
|
*/
|
|
1926
1981
|
listEntitlementGrants: {
|
|
1927
1982
|
parameters: {
|
|
@@ -1947,8 +2002,18 @@ export interface operations {
|
|
|
1947
2002
|
};
|
|
1948
2003
|
};
|
|
1949
2004
|
/**
|
|
1950
|
-
* Create grant
|
|
1951
|
-
* @description
|
|
2005
|
+
* Create a grant
|
|
2006
|
+
* @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.
|
|
2007
|
+
*
|
|
2008
|
+
* 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.
|
|
2009
|
+
*
|
|
2010
|
+
* Grants have a priority setting that determines their order of use. Lower numbers have higher priority, with 0 being the highest priority.
|
|
2011
|
+
*
|
|
2012
|
+
* 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).
|
|
2013
|
+
*
|
|
2014
|
+
* 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))
|
|
2015
|
+
*
|
|
2016
|
+
* Grants cannot be changed once created, only deleted. This is to ensure that balance is deterministic regardless of when it is queried.
|
|
1952
2017
|
*/
|
|
1953
2018
|
createGrant: {
|
|
1954
2019
|
parameters: {
|
|
@@ -1977,8 +2042,10 @@ export interface operations {
|
|
|
1977
2042
|
};
|
|
1978
2043
|
};
|
|
1979
2044
|
/**
|
|
1980
|
-
* Get the
|
|
1981
|
-
* @description
|
|
2045
|
+
* Get the current value and access of an entitlement
|
|
2046
|
+
* @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.
|
|
2047
|
+
*
|
|
2048
|
+
* For convenience reasons, /value works with both entitlementId and featureKey.
|
|
1982
2049
|
*/
|
|
1983
2050
|
getEntitlementValue: {
|
|
1984
2051
|
parameters: {
|
|
@@ -2006,10 +2073,11 @@ export interface operations {
|
|
|
2006
2073
|
};
|
|
2007
2074
|
/**
|
|
2008
2075
|
* Get the balance history of a specific entitlement.
|
|
2009
|
-
* @description
|
|
2076
|
+
* @description Returns historical balance and usage data for the entitlement. The queried history can span accross multiple reset events.
|
|
2010
2077
|
*
|
|
2011
|
-
*
|
|
2012
|
-
*
|
|
2078
|
+
* 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.
|
|
2079
|
+
*
|
|
2080
|
+
* 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.
|
|
2013
2081
|
*/
|
|
2014
2082
|
getEntitlementHistory: {
|
|
2015
2083
|
parameters: {
|
|
@@ -2035,7 +2103,7 @@ export interface operations {
|
|
|
2035
2103
|
};
|
|
2036
2104
|
};
|
|
2037
2105
|
responses: {
|
|
2038
|
-
/** @description
|
|
2106
|
+
/** @description The history response. */
|
|
2039
2107
|
200: {
|
|
2040
2108
|
content: {
|
|
2041
2109
|
'application/json': components['schemas']['WindowedBalanceHistory'];
|
|
@@ -2048,8 +2116,10 @@ export interface operations {
|
|
|
2048
2116
|
};
|
|
2049
2117
|
};
|
|
2050
2118
|
/**
|
|
2051
|
-
* Reset entitlement
|
|
2052
|
-
* @description Reset the
|
|
2119
|
+
* Reset an entitlement
|
|
2120
|
+
* @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.
|
|
2121
|
+
*
|
|
2122
|
+
* 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.
|
|
2053
2123
|
*/
|
|
2054
2124
|
resetEntitlementUsage: {
|
|
2055
2125
|
parameters: {
|
|
@@ -2063,17 +2133,15 @@ export interface operations {
|
|
|
2063
2133
|
'application/json': {
|
|
2064
2134
|
/**
|
|
2065
2135
|
* Format: date-time
|
|
2066
|
-
* @description The time at which the reset takes effect, defaults to now.
|
|
2067
|
-
* The reset cannot be in the future.
|
|
2068
|
-
* The provided value is truncated to the granularity of the underlying meter.
|
|
2136
|
+
* @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.
|
|
2069
2137
|
*
|
|
2070
2138
|
* @example 2023-01-01T00:00:00Z
|
|
2071
2139
|
*/
|
|
2072
2140
|
effectiveAt?: string;
|
|
2073
2141
|
/**
|
|
2074
|
-
* @description
|
|
2075
|
-
* If true, the usage period anchor is retained.
|
|
2076
|
-
* If false, the usage period anchor is reset to the effectiveAt time.
|
|
2142
|
+
* @description Determines whether the usage period anchor is retained or reset to the effectiveAt time.
|
|
2143
|
+
* - If true, the usage period anchor is retained.
|
|
2144
|
+
* - If false, the usage period anchor is reset to the effectiveAt time.
|
|
2077
2145
|
*/
|
|
2078
2146
|
retainAnchor?: boolean;
|
|
2079
2147
|
};
|