@openmeter/sdk 1.0.0-beta.113 → 1.0.0-beta.115

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.
@@ -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 Creates a feature.
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
- * Delete feature
152
- * @description Delete a feature by key.
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
- * Delete a grant
166
- * @description Void (delete) a grant. A grant can only be deleted if it hasn't been used.
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 Create an entitlement for a subject.
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 Delete an entitlement by id.
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 Create a grant for an entitlement.
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 balance of a specific entitlement.
209
- * @description Get the balance of a specific entitlement.
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 Get the balance history of a specific entitlement.
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
- * The windows are inclusive at their start and exclusive at their end.
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 entitlement usage and start a new period. Grants that can be are rolled over.
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 a resource.
244
- * These fields are automatically populated by the system for the entities we manage.
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. Defaults to createdAt if not 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. Null if not 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 key of the feature to reference it from your application.
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 decreases grants by usage.
479
- * If present, the usage of the feature can be metered.
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, it will not be used for grants or usage.
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 If unlimited=true the subject can use the feature an unlimited amount.
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,18 +599,28 @@ export interface components {
570
599
  usagePeriod: components['schemas']['RecurringPeriodCreateInput'];
571
600
  /**
572
601
  * Format: double
573
- * @description You can issue usage automatically after reset. This usage is not rolled over.
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;
608
+ /**
609
+ * @description Defines the grant priority for the default grant. If provided, issueAfterReset must have a value.
610
+ *
611
+ * @default 1
612
+ * @example 1
613
+ */
614
+ issueAfterResetPriority?: number;
576
615
  };
577
616
  EntitlementCreateInputs: components['schemas']['EntitlementMeteredCreateInputs'] | components['schemas']['EntitlementStaticCreateInputs'] | components['schemas']['EntitlementBooleanCreateInputs'];
578
- /** @description Entitles a subject to use a feature. */
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). */
579
618
  EntitlementMetered: components['schemas']['EntitlementMeteredCreateInputs'] & components['schemas']['EntitlementMeteredCalculatedFields'] & components['schemas']['EntitlementSharedFields'];
580
619
  /** @description Calculated fields for a metered entitlement. */
581
620
  EntitlementMeteredCalculatedFields: {
582
621
  /**
583
622
  * Format: date-time
584
- * @description The last time the meter was reset.
623
+ * @description The last time a reset happened.
585
624
  *
586
625
  * @example 2023-01-01T00:00:00Z
587
626
  */
@@ -595,7 +634,7 @@ export interface components {
595
634
  */
596
635
  type: 'static';
597
636
  /**
598
- * @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.
599
638
  *
600
639
  * @example {"key1": "value1"}
601
640
  */
@@ -616,7 +655,7 @@ export interface components {
616
655
  /**
617
656
  * @description A segment of the grant burn down history.
618
657
  *
619
- * A given segment represents the usage of a grant in a specific period.
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.
620
659
  */
621
660
  GrantBurnDownHistorySegment: {
622
661
  period?: components['schemas']['Period'];
@@ -686,7 +725,7 @@ export interface components {
686
725
  */
687
726
  usage?: number;
688
727
  };
689
- /** @description A window of balance history. */
728
+ /** @description Windowed usage and balance information. */
690
729
  BalanceHistoryWindow: {
691
730
  period?: components['schemas']['Period'];
692
731
  /**
@@ -708,10 +747,12 @@ export interface components {
708
747
  WindowedBalanceHistory: {
709
748
  /**
710
749
  * @description The windowed balance history.
711
- * Only returns rows for windows where there was usage.
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.
712
753
  */
713
754
  windowedHistory?: components['schemas']['BalanceHistoryWindow'][];
714
- /** @description The grant burn down history in the period. */
755
+ /** @description Grant burndown history. */
715
756
  burndownHistory?: components['schemas']['GrantBurnDownHistorySegment'][];
716
757
  };
717
758
  /** @description A time period */
@@ -852,30 +893,35 @@ export interface components {
852
893
  };
853
894
  EntitlementValue: {
854
895
  /**
855
- * @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
+ *
856
898
  * @example true
857
899
  */
858
900
  hasAccess: boolean;
859
901
  /**
860
902
  * Format: double
861
- * @description The balance of a metered entitlement.
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
+ *
862
905
  * @example 100
863
906
  */
864
907
  balance?: number;
865
908
  /**
866
909
  * Format: double
867
- * @description Total usage of the feature in the period. Includes overages.
910
+ * @description Only available for metered entitlements. Returns the total feature usage in the current period.
911
+ *
868
912
  * @example 50
869
913
  */
870
914
  usage?: number;
871
915
  /**
872
916
  * Format: double
873
- * @description The overage of a metered entitlement.
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
+ *
874
919
  * @example 0
875
920
  */
876
921
  overage?: number;
877
922
  /**
878
- * @description The JSON parseable configuration value of a static entitlement.
923
+ * @description Only available for static entitlements. The JSON parsable config of the entitlement.
924
+ *
879
925
  * @example {"key1": "value1"}
880
926
  */
881
927
  config?: string;
@@ -1644,7 +1690,7 @@ export interface operations {
1644
1690
  };
1645
1691
  /**
1646
1692
  * List entitlements
1647
- * @description List entitlements.
1693
+ * @description List all entitlements regardless of subject. This endpoint is intended for administrative purposes.
1648
1694
  */
1649
1695
  listEntitlements: {
1650
1696
  parameters: {
@@ -1662,13 +1708,14 @@ export interface operations {
1662
1708
  'application/json': components['schemas']['Entitlement'][];
1663
1709
  };
1664
1710
  };
1711
+ 400: components['responses']['BadRequestProblemResponse'];
1665
1712
  401: components['responses']['UnauthorizedProblemResponse'];
1666
1713
  default: components['responses']['UnexpectedProblemResponse'];
1667
1714
  };
1668
1715
  };
1669
1716
  /**
1670
1717
  * List features
1671
- * @description List features.
1718
+ * @description List all features.
1672
1719
  */
1673
1720
  listFeatures: {
1674
1721
  parameters: {
@@ -1688,13 +1735,17 @@ export interface operations {
1688
1735
  'application/json': components['schemas']['Feature'][];
1689
1736
  };
1690
1737
  };
1738
+ 400: components['responses']['BadRequestProblemResponse'];
1691
1739
  401: components['responses']['UnauthorizedProblemResponse'];
1692
1740
  default: components['responses']['UnexpectedProblemResponse'];
1693
1741
  };
1694
1742
  };
1695
1743
  /**
1696
- * Create feature
1697
- * @description Creates a feature.
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.
1698
1749
  */
1699
1750
  createFeature: {
1700
1751
  /** @description The feature to create. */
@@ -1718,7 +1769,7 @@ export interface operations {
1718
1769
  };
1719
1770
  /**
1720
1771
  * Get feature
1721
- * @description Get feature by id.
1772
+ * @description Get a feature by id.
1722
1773
  */
1723
1774
  getFeature: {
1724
1775
  parameters: {
@@ -1739,8 +1790,8 @@ export interface operations {
1739
1790
  };
1740
1791
  };
1741
1792
  /**
1742
- * Delete feature
1743
- * @description Delete a feature by key.
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.
1744
1795
  */
1745
1796
  deleteFeature: {
1746
1797
  parameters: {
@@ -1760,7 +1811,7 @@ export interface operations {
1760
1811
  };
1761
1812
  /**
1762
1813
  * List grants
1763
- * @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.
1764
1815
  */
1765
1816
  listGrants: {
1766
1817
  parameters: {
@@ -1784,8 +1835,10 @@ export interface operations {
1784
1835
  };
1785
1836
  };
1786
1837
  /**
1787
- * Delete a grant
1788
- * @description Void (delete) a grant. A grant can only be deleted if it hasn't been used.
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.
1789
1842
  */
1790
1843
  voidGrant: {
1791
1844
  parameters: {
@@ -1806,8 +1859,8 @@ export interface operations {
1806
1859
  };
1807
1860
  };
1808
1861
  /**
1809
- * List entitlements
1810
- * @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.
1811
1864
  */
1812
1865
  listSubjectEntitlements: {
1813
1866
  parameters: {
@@ -1830,8 +1883,16 @@ export interface operations {
1830
1883
  };
1831
1884
  };
1832
1885
  /**
1833
- * Create entitlement
1834
- * @description Create an entitlement for a subject.
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.
1835
1896
  */
1836
1897
  createEntitlement: {
1837
1898
  parameters: {
@@ -1860,8 +1921,8 @@ export interface operations {
1860
1921
  };
1861
1922
  };
1862
1923
  /**
1863
- * Get entitlement
1864
- * @description Get entitlement by id.
1924
+ * Get an entitlement
1925
+ * @description Get entitlement by id. For checking entitlement access, use the /value endpoint instead.
1865
1926
  */
1866
1927
  getEntitlement: {
1867
1928
  parameters: {
@@ -1892,8 +1953,9 @@ export interface operations {
1892
1953
  };
1893
1954
  };
1894
1955
  /**
1895
- * Delete entitlement
1896
- * @description Delete an entitlement by id.
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.
1897
1959
  */
1898
1960
  deleteEntitlement: {
1899
1961
  parameters: {
@@ -1914,7 +1976,7 @@ export interface operations {
1914
1976
  };
1915
1977
  /**
1916
1978
  * List grants for an entitlement
1917
- * @description List all grants for an entitlement.
1979
+ * @description List all grants issued for an entitlement. This endpoint is intended for administrative purposes.
1918
1980
  */
1919
1981
  listEntitlementGrants: {
1920
1982
  parameters: {
@@ -1940,8 +2002,18 @@ export interface operations {
1940
2002
  };
1941
2003
  };
1942
2004
  /**
1943
- * Create grant
1944
- * @description Create a grant for an entitlement.
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.
1945
2017
  */
1946
2018
  createGrant: {
1947
2019
  parameters: {
@@ -1970,8 +2042,10 @@ export interface operations {
1970
2042
  };
1971
2043
  };
1972
2044
  /**
1973
- * Get the balance of a specific entitlement.
1974
- * @description Get the balance of a specific entitlement.
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.
1975
2049
  */
1976
2050
  getEntitlementValue: {
1977
2051
  parameters: {
@@ -1999,10 +2073,11 @@ export interface operations {
1999
2073
  };
2000
2074
  /**
2001
2075
  * Get the balance history of a specific entitlement.
2002
- * @description Get the balance history of a specific entitlement.
2076
+ * @description Returns historical balance and usage data for the entitlement. The queried history can span accross multiple reset events.
2003
2077
  *
2004
- * The windows are inclusive at their start and exclusive at their end.
2005
- * The last window may be smaller than the window size and is inclusive at both ends.
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.
2006
2081
  */
2007
2082
  getEntitlementHistory: {
2008
2083
  parameters: {
@@ -2028,7 +2103,7 @@ export interface operations {
2028
2103
  };
2029
2104
  };
2030
2105
  responses: {
2031
- /** @description Entitlement balance history. If windowsize is specified then the history is grouped by the window size. */
2106
+ /** @description The history response. */
2032
2107
  200: {
2033
2108
  content: {
2034
2109
  'application/json': components['schemas']['WindowedBalanceHistory'];
@@ -2041,8 +2116,10 @@ export interface operations {
2041
2116
  };
2042
2117
  };
2043
2118
  /**
2044
- * Reset entitlement
2045
- * @description Reset the entitlement usage and start a new period. Grants that can be are rolled over.
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.
2046
2123
  */
2047
2124
  resetEntitlementUsage: {
2048
2125
  parameters: {
@@ -2056,17 +2133,15 @@ export interface operations {
2056
2133
  'application/json': {
2057
2134
  /**
2058
2135
  * Format: date-time
2059
- * @description The time at which the reset takes effect, defaults to now.
2060
- * The reset cannot be in the future.
2061
- * 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.
2062
2137
  *
2063
2138
  * @example 2023-01-01T00:00:00Z
2064
2139
  */
2065
2140
  effectiveAt?: string;
2066
2141
  /**
2067
- * @description Should the reset retain the usage period anchor.
2068
- * If true, the usage period anchor is retained.
2069
- * 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.
2070
2145
  */
2071
2146
  retainAnchor?: boolean;
2072
2147
  };