@openmeter/sdk 1.0.0-beta.90 → 1.0.0-beta.91

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.
@@ -122,6 +122,13 @@ export interface paths {
122
122
  */
123
123
  get: operations['queryPortalMeter'];
124
124
  };
125
+ '/api/v1/entitlements': {
126
+ /**
127
+ * List entitlements
128
+ * @description List entitlements.
129
+ */
130
+ get: operations['listEntitlements'];
131
+ };
125
132
  '/api/v1/features': {
126
133
  /**
127
134
  * List features
@@ -134,10 +141,10 @@ export interface paths {
134
141
  */
135
142
  post: operations['createFeature'];
136
143
  };
137
- '/api/v1/features/{featureID}': {
144
+ '/api/v1/features/{featureId}': {
138
145
  /**
139
146
  * Get feature
140
- * @description Get feature by key.
147
+ * @description Get feature by id.
141
148
  */
142
149
  get: operations['getFeature'];
143
150
  /**
@@ -146,75 +153,163 @@ export interface paths {
146
153
  */
147
154
  delete: operations['deleteFeature'];
148
155
  };
149
- '/api/v1/ledgers': {
156
+ '/api/v1/grants': {
150
157
  /**
151
- * List the already defined ledgers.
152
- * @description List the already defined ledgers.
158
+ * List grants
159
+ * @description List all grants.
153
160
  */
154
- get: operations['listLedgers'];
161
+ get: operations['listGrants'];
162
+ };
163
+ '/api/v1/grants/{grantId}': {
155
164
  /**
156
- * Creates the specified ledger
157
- * @description Create or update the specified ledger.
165
+ * Delete a grant
166
+ * @description Void (delete) a grant. A grant can only be deleted if it hasn't been used.
158
167
  */
159
- post: operations['createLedger'];
168
+ delete: operations['voidGrant'];
160
169
  };
161
- '/api/v1/ledgers/{ledgerID}/balance': {
170
+ '/api/v1/subjects/{subjectIdOrKey}/entitlements': {
162
171
  /**
163
- * Get the balance of a specific subject.
164
- * @description Get the balance of a specific subject.
172
+ * List entitlements
173
+ * @description List all entitlements for a subject.
165
174
  */
166
- get: operations['getLedgerBalance'];
167
- };
168
- '/api/v1/ledgers/{ledgerID}/history': {
175
+ get: operations['listSubjectEntitlements'];
169
176
  /**
170
- * Get the history of a ledger
171
- * @description Get the history of a specific ledger
177
+ * Create entitlement
178
+ * @description Create an entitlement for a subject.
172
179
  */
173
- get: operations['getLedgerHistory'];
180
+ post: operations['createEntitlement'];
174
181
  };
175
- '/api/v1/ledgers/{ledgerID}/reset': {
182
+ '/api/v1/subjects/{subjectIdOrKey}/entitlements/{entitlementId}': {
176
183
  /**
177
- * Reset the ledger's balance
178
- * @description Resets the ledger's balances to zero for a specific subject and re-apply active grants with rollover configuration.
184
+ * Get entitlement
185
+ * @description Get entitlement by id.
179
186
  */
180
- post: operations['resetLedger'];
181
- };
182
- '/api/v1/ledgers/grants': {
187
+ get: operations['getEntitlement'];
183
188
  /**
184
- * List grants for multiple ledgers.
185
- * @description List grants for multiple ledgers.
189
+ * Delete entitlement
190
+ * @description Delete an entitlement by id.
186
191
  */
187
- get: operations['listLedgerGrants'];
192
+ delete: operations['deleteEntitlement'];
188
193
  };
189
- '/api/v1/ledgers/{ledgerID}/grants': {
194
+ '/api/v1/subjects/{subjectIdOrKey}/entitlements/{entitlementId}/grants': {
190
195
  /**
191
- * List ledger grants
192
- * @description List ledger grants for a specific ledger.
196
+ * List grants for an entitlement
197
+ * @description List all grants for an entitlement.
193
198
  */
194
- get: operations['listLedgerGrantsByLedger'];
199
+ get: operations['listEntitlementGrants'];
195
200
  /**
196
- * Create a grant on a specific ledger.
197
- * @description Create a grant on a specific ledger.
201
+ * Create grant
202
+ * @description Create a grant for an entitlement.
198
203
  */
199
- post: operations['createLedgerGrant'];
204
+ post: operations['createGrant'];
200
205
  };
201
- '/api/v1/ledgers/{ledgerID}/grants/{ledgerGrantID}': {
206
+ '/api/v1/subjects/{subjectIdOrKey}/entitlements/{entitlementIdOrFeatureKey}/value': {
202
207
  /**
203
- * Get a single grant.
204
- * @description Gets the grant for a ledger by ID.
208
+ * Get the balance of a specific entitlement.
209
+ * @description Get the balance of a specific entitlement.
205
210
  */
206
- get: operations['getLedgerGrant'];
211
+ get: operations['getEntitlementValue'];
212
+ };
213
+ '/api/v1/subjects/{subjectIdOrKey}/entitlements/{entitlementId}/history': {
207
214
  /**
208
- * Void ledger grant
209
- * @description Void a ledger grant by ID. Partially or fully used grants cannot be voided.
210
- * Voided grant won't be applied to the subject's balance anymore.
215
+ * Get the balance history of a specific entitlement.
216
+ * @description Get the balance history of a specific entitlement.
217
+ *
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.
220
+ */
221
+ get: operations['getEntitlementHistory'];
222
+ };
223
+ '/api/v1/subjects/{subjectIdOrKey}/entitlements/{entitlementId}/reset': {
224
+ /**
225
+ * Reset entitlement
226
+ * @description Reset the entitlement usage and start a new period. Grants that can be are rolled over.
211
227
  */
212
- delete: operations['voidLedgerGrant'];
228
+ post: operations['resetEntitlementUsage'];
213
229
  };
214
230
  }
215
231
  export type webhooks = Record<string, never>;
216
232
  export interface components {
217
233
  schemas: {
234
+ /**
235
+ * @description Metadata fields for a resource.
236
+ * These fields are automatically populated by the system for the entities we manage.
237
+ */
238
+ SharedMetaFields: {
239
+ /**
240
+ * @description Readonly unique ULID identifier.
241
+ *
242
+ * @example 01ARZ3NDEKTSV4RRFFQ69G5FAV
243
+ */
244
+ id: string;
245
+ /**
246
+ * Format: date-time
247
+ * @description The date and time the resource was created.
248
+ * @example 2023-01-01T00:00:00Z
249
+ */
250
+ createdAt: string;
251
+ /**
252
+ * Format: date-time
253
+ * @description The date and time the resource was last updated.
254
+ * @example 2023-01-01T00:00:00Z
255
+ */
256
+ updatedAt: string;
257
+ /**
258
+ * Format: date-time
259
+ * @description The date and time the resource was deleted.
260
+ * @example null
261
+ */
262
+ deletedAt: string | null;
263
+ };
264
+ /**
265
+ * @description Conflict
266
+ * @example {
267
+ * "type": "about:blank",
268
+ * "title": "Conflict",
269
+ * "status": 409,
270
+ * "detail": "ledger (default.01HXVNDJR532E8GTBVSC2XK5D4) already exitst for subject subject-1",
271
+ * "instance": "urn:request:local/JMOlctsKV8-000001",
272
+ * "conflictingEntityId": "01HXVNDJR532E8GTBVSC2XK5D4"
273
+ * }
274
+ */
275
+ ConflictProblem: {
276
+ /**
277
+ * Format: uri
278
+ * @description Type contains a URI that identifies the problem type.
279
+ * @example urn:problem-type:bad-request
280
+ */
281
+ type: string;
282
+ /**
283
+ * @description A a short, human-readable summary of the problem type.
284
+ * @example Bad Request
285
+ */
286
+ title: string;
287
+ /**
288
+ * Format: int32
289
+ * @description The HTTP status code generated by the origin server for this occurrence of the problem.
290
+ * @example 400
291
+ */
292
+ status: number;
293
+ /**
294
+ * @description A human-readable explanation specific to this occurrence of the problem.
295
+ * @example body must be a JSON object
296
+ */
297
+ detail: string;
298
+ /**
299
+ * Format: uri
300
+ * @description A URI reference that identifies the specific occurrence of the problem.
301
+ * @example urn:request:local/JMOlctsKV8-000001
302
+ */
303
+ instance?: string;
304
+ extensions?: {
305
+ /**
306
+ * @description The id of the conflicting entity.
307
+ * @example 01ARZ3NDEKTSV4RRFFQ69G5FAV
308
+ */
309
+ conflictingEntityId: string;
310
+ };
311
+ [key: string]: unknown;
312
+ };
218
313
  /**
219
314
  * @description A Problem Details object (RFC 7807).
220
315
  * Additional properties specific to the problem type may be present.
@@ -354,19 +449,30 @@ export interface components {
354
449
  * @description A feature is a feature or service offered to a customer.
355
450
  * For example: CPU-Hours, Tokens, API Calls, etc.
356
451
  */
357
- CreateFeatureRequest: {
452
+ FeatureCreateInputs: {
453
+ /**
454
+ * @description The unique key of the feature to reference it from your application.
455
+ *
456
+ * @example gpt4_tokens
457
+ */
458
+ key: string;
358
459
  /**
359
460
  * @description The name of the feature.
360
461
  *
361
462
  * @example AI Tokens
362
463
  */
363
464
  name: string;
465
+ /** @description Additional metadata for the feature. */
466
+ metadata?: {
467
+ [key: string]: string;
468
+ };
364
469
  /**
365
470
  * @description The meter that the feature is associated with and decreases grants by usage.
471
+ * If present, the usage of the feature can be metered.
366
472
  *
367
473
  * @example tokens_total
368
474
  */
369
- meterSlug: string;
475
+ meterSlug?: string;
370
476
  /**
371
477
  * @description Optional meter group by filters. Useful if the meter scope is broader than what feature tracks.
372
478
  *
@@ -377,256 +483,239 @@ export interface components {
377
483
  meterGroupByFilters?: {
378
484
  [key: string]: string;
379
485
  };
380
- /**
381
- * @description If the feature is archived, it will not be used for grants or usage.
382
- *
383
- * @example false
384
- */
385
- archived?: boolean;
386
486
  };
387
487
  /**
388
488
  * @description A feature is a feature or service offered to a customer.
389
489
  * For example: CPU-Hours, Tokens, API Calls, etc.
390
490
  */
391
- Feature: components['schemas']['CreateFeatureRequest'] & {
392
- /**
393
- * @description Readonly unique ULID identifier of the feature.
394
- *
395
- * @example 01ARZ3NDEKTSV4RRFFQ69G5FAV
396
- */
397
- id: string;
491
+ Feature: {
398
492
  /**
399
493
  * Format: date-time
400
- * @description The time the feature was created.
494
+ * @description If the feature is archived, it will not be used for grants or usage.
401
495
  *
402
496
  * @example 2023-01-01T00:00:00Z
403
497
  */
404
- createdAt?: string;
498
+ archivedAt?: string;
499
+ } & components['schemas']['FeatureCreateInputs'] & components['schemas']['SharedMetaFields'];
500
+ EntitlementCreateSharedFields: {
405
501
  /**
406
- * Format: date-time
407
- * @description The time the feature was last updated.
502
+ * @description The feature the subject is entitled to use
408
503
  *
409
- * @example 2023-01-01T00:00:00Z
410
- */
411
- updatedAt?: string;
412
- };
413
- /**
414
- * @description A ledger represented in open meter. A ledger must be assigned to a single
415
- * subject.
416
- */
417
- CreateLedger: {
418
- /** @description The metering subject this ledger used to track grants for. */
419
- subject: string;
420
- /**
421
- * @example {
422
- * "stripePaymentId": "pi_4OrAkhLvyihio9p51h9iiFnB"
423
- * }
504
+ * @example 01ARZ3NDEKTSV4RRFFQ69G5FAV
424
505
  */
506
+ featureId: string;
507
+ /** @description Additional metadata for the feature. */
425
508
  metadata?: {
426
509
  [key: string]: string;
427
510
  };
511
+ usagePeriod?: components['schemas']['RecurringPeriod'];
428
512
  };
429
- /**
430
- * @description Ledger Exists
431
- * @example {
432
- * "type": "about:blank",
433
- * "title": "Conflict",
434
- * "status": 409,
435
- * "detail": "ledger (default.01HXVNDJR532E8GTBVSC2XK5D4) already exitst for subject subject-1",
436
- * "instance": "urn:request:local/JMOlctsKV8-000001",
437
- * "conflictingEntity": {
438
- * "id": "01HXVNDJR532E8GTBVSC2XK5D4",
439
- * "subject": "subject-1"
440
- * }
441
- * }
442
- */
443
- LedgerAlreadyExistsProblem: {
513
+ EntitlementSharedFields: components['schemas']['SharedMetaFields'] & components['schemas']['EntitlementCreateSharedFields'] & {
444
514
  /**
445
- * Format: uri
446
- * @description Type contains a URI that identifies the problem type.
447
- * @example urn:problem-type:bad-request
448
- */
449
- type: string;
450
- /**
451
- * @description A a short, human-readable summary of the problem type.
452
- * @example Bad Request
453
- */
454
- title: string;
455
- /**
456
- * Format: int32
457
- * @description The HTTP status code generated by the origin server for this occurrence of the problem.
458
- * @example 400
515
+ * @description The identifier key unique to the subject
516
+ * @example customer-1
459
517
  */
460
- status: number;
518
+ subjectKey: string;
519
+ usagePeriod?: components['schemas']['RecurringPeriod'];
520
+ };
521
+ EntitlementMeteredCreateInputs: components['schemas']['EntitlementCreateSharedFields'] & {
461
522
  /**
462
- * @description A human-readable explanation specific to this occurrence of the problem.
463
- * @example body must be a JSON object
523
+ * @example metered
524
+ * @enum {string}
464
525
  */
465
- detail: string;
526
+ type: 'metered';
466
527
  /**
467
- * Format: uri
468
- * @description A URI reference that identifies the specific occurrence of the problem.
469
- * @example urn:request:local/JMOlctsKV8-000001
528
+ * @description If unlimited=true the subject can use the feature an unlimited amount.
529
+ *
530
+ * @default false
470
531
  */
471
- instance?: string;
472
- conflictingEntity?: components['schemas']['Ledger'];
473
- [key: string]: unknown;
532
+ isUnlimited?: boolean;
533
+ usagePeriod: components['schemas']['RecurringPeriod'];
534
+ /** @description You can issue usage automatically after reset. This usage is not rolled over. */
535
+ issueAfterReset?: number;
474
536
  };
475
- /** @description A ledger represented in our system. */
476
- Ledger: components['schemas']['CreateLedger'] & {
537
+ /** @description Entitles a subject to use a feature. */
538
+ EntitlementMetered: components['schemas']['EntitlementMeteredCreateInputs'] & components['schemas']['EntitlementSharedFields'];
539
+ EntitlementStaticCreateInputs: components['schemas']['EntitlementCreateSharedFields'] & {
477
540
  /**
478
- * @description Readonly unique ULID identifier of the ledger.
479
- *
480
- * @example 01ARZ3NDEKTSV4RRFFQ69G5FAV
541
+ * @example static
542
+ * @enum {string}
481
543
  */
482
- id: string;
544
+ type: 'static';
483
545
  /**
484
- * Format: date-time
485
- * @description The time the ledger was created.
546
+ * @description The JSON parsable config of the entitlement.
486
547
  *
487
- * @example 2023-01-01T00:00:00Z
548
+ * @example {"key1": "value1"}
488
549
  */
489
- createdAt?: string;
550
+ config: string;
490
551
  };
491
- /** @description A ledger entry. */
492
- LedgerEntry: {
493
- /**
494
- * @description Readonly unique ULID identifier of the ledger entry.
495
- *
496
- * @example 01ARZ3NDEKTSV4RRFFQ69G5FAV
497
- */
498
- id: string;
499
- type: components['schemas']['LedgerEntryType'];
552
+ /** @description Entitles a subject to use a feature. */
553
+ EntitlementStatic: components['schemas']['EntitlementStaticCreateInputs'] & components['schemas']['EntitlementSharedFields'];
554
+ EntitlementBooleanCreateInputs: components['schemas']['EntitlementCreateSharedFields'] & {
500
555
  /**
501
- * Format: date-time
502
- * @description The time the ledger entry was created.
503
- *
504
- * @example 2023-01-01T00:00:00Z
556
+ * @example boolean
557
+ * @enum {string}
505
558
  */
506
- time: string;
559
+ type: 'boolean';
560
+ };
561
+ /** @description Entitles a subject to use a feature. */
562
+ EntitlementBoolean: components['schemas']['EntitlementBooleanCreateInputs'] & components['schemas']['EntitlementSharedFields'];
563
+ Entitlement: components['schemas']['EntitlementMetered'] | components['schemas']['EntitlementStatic'] | components['schemas']['EntitlementBoolean'];
564
+ /**
565
+ * @description A segment of the grant burn down history.
566
+ *
567
+ * A given segment represents the usage of a grant in a specific period.
568
+ */
569
+ GrantBurnDownHistorySegment: {
570
+ period?: components['schemas']['Period'];
507
571
  /**
508
572
  * Format: double
509
- * @description The amount to apply. Can be positive or negative number. If applicable.
573
+ * @description The usage of the grant in the period.
510
574
  *
511
575
  * @example 100
512
576
  */
513
- amount: number;
577
+ usage?: number;
514
578
  /**
515
- * @description The unique feature ULID that the entry is associated with.
579
+ * Format: double
580
+ * @description Overuse that wasn't covered by grants.
516
581
  *
517
- * @example 01ARZ3NDEKTSV4RRFFQ69G5FAV
582
+ * @example 25
518
583
  */
519
- featureID: string;
520
- period?: components['schemas']['Period'];
521
- };
522
- /** @description A time period */
523
- Period: {
584
+ overage?: number;
524
585
  /**
525
- * Format: date-time
526
- * @description Period start time where the amount was applied. If applicable.
586
+ * Format: double
587
+ * @description The entitlement balance at the start of the period.
527
588
  *
528
- * @example 2023-01-01T00:00:00Z
589
+ * @example 100
529
590
  */
530
- from: string;
591
+ balanceAtStart?: number;
531
592
  /**
532
- * Format: date-time
533
- * @description Period end time where the amount was applied. If applicable.
593
+ * @description The balance breakdown of each active grant at the start of the period: GrantID: Balance
534
594
  *
535
- * @example 2023-01-01T00:00:00Z
536
- */
537
- to: string;
538
- };
539
- /**
540
- * @example GRANT
541
- * @enum {string}
542
- */
543
- LedgerEntryType: 'GRANT' | 'VOID' | 'RESET' | 'GRANT_USAGE';
544
- /** @description Balance of a subject. */
545
- LedgerBalance: {
546
- /** @description Features with balances. */
547
- featureBalances: components['schemas']['FeatureBalance'][];
548
- /** @description The grants applied to the subject. */
549
- grantBalances: components['schemas']['LedgerGrantBalance'][];
550
- /**
551
595
  * @example {
552
- * "stripePaymentId": "pi_4OrAkhLvyihio9p51h9iiFnB"
596
+ * "01ARZ3NDEKTSV4RRFFQ69G5FAV": 100
553
597
  * }
554
598
  */
555
- metadata?: {
556
- [key: string]: string;
599
+ grantBalancesAtStart?: {
600
+ [key: string]: number;
557
601
  };
558
602
  /**
559
- * @description The subject of the ledger.
603
+ * Format: double
604
+ * @description The entitlement balance at the end of the period.
560
605
  *
561
- * @example subject-1
606
+ * @example 100
562
607
  */
563
- subject: string;
608
+ balanceAtEnd?: number;
564
609
  /**
565
- * Format: date-time
566
- * @description The last reset of the ledger.
610
+ * @description The balance breakdown of each active grant at the start of the period: GrantID: Balance
567
611
  *
568
- * @example 2023-01-01T00:00:00Z
612
+ * @example {
613
+ * "01ARZ3NDEKTSV4RRFFQ69G5FAV": 100
614
+ * }
569
615
  */
570
- lastReset?: string;
616
+ grantBalancesAtEnd?: {
617
+ [key: string]: number;
618
+ };
619
+ /** @description Which grants were actually burnt down in the period and by what amount. */
620
+ grantUsages?: readonly components['schemas']['GrantUsageRecord'][];
571
621
  };
572
- /** @description Ledger reset configuration. */
573
- LedgerReset: {
622
+ GrantUsageRecord: {
574
623
  /**
575
- * @description Readonly unique ULID identifier of the reset.
624
+ * @description The id of the grant.
576
625
  *
577
626
  * @example 01ARZ3NDEKTSV4RRFFQ69G5FAV
578
627
  */
579
- id: string;
628
+ grantId?: string;
580
629
  /**
581
- * Format: date-time
582
- * @description The time to reset the ledger. It cannot be in the future.
583
- * The value will be floored to metering windowSize (minute).
630
+ * Format: double
631
+ * @description The usage of the grant.
584
632
  *
585
- * @example 2023-01-01T00:00:00Z
633
+ * @example 100
586
634
  */
587
- effectiveAt: string;
635
+ usage?: number;
588
636
  };
589
- LedgerGrantBalance: components['schemas']['LedgerGrantResponse'] & {
637
+ /** @description A window of balance history. */
638
+ BalanceHistoryWindow: {
639
+ period?: components['schemas']['Period'];
590
640
  /**
591
641
  * Format: double
592
- * @description The balance of the grant.
642
+ * @description The total usage of the feature in the period.
593
643
  *
594
644
  * @example 100
595
645
  */
596
- balance: number;
597
- };
598
- FeatureBalance: components['schemas']['Feature'] & {
646
+ usage?: number;
599
647
  /**
600
648
  * Format: double
601
- * @description The balance of the feature.
649
+ * @description The entitlement balance at the start of the period.
602
650
  *
603
651
  * @example 100
604
652
  */
605
- balance: number;
653
+ balanceAtStart?: number;
654
+ };
655
+ /** @description The windowed balance history. */
656
+ WindowedBalanceHistory: {
606
657
  /**
607
- * Format: double
608
- * @description The usage of the feature.
658
+ * @description The windowed balance history.
659
+ * Only returns rows for windows where there was usage.
660
+ */
661
+ windowedHistory?: components['schemas']['BalanceHistoryWindow'][];
662
+ /** @description The grant burn down history in the period. */
663
+ burndownHistory?: components['schemas']['GrantBurnDownHistorySegment'][];
664
+ };
665
+ /** @description A time period */
666
+ Period: {
667
+ /**
668
+ * Format: date-time
669
+ * @description Period start time where the amount was applied. If applicable.
609
670
  *
610
- * @example 100
671
+ * @example 2023-01-01T00:00:00Z
672
+ */
673
+ from: string;
674
+ /**
675
+ * Format: date-time
676
+ * @description Period end time where the amount was applied. If applicable.
677
+ *
678
+ * @example 2023-01-01T00:00:00Z
679
+ */
680
+ to: string;
681
+ };
682
+ /**
683
+ * @description List of pre-defined periods that can be used for recurring & scheduling.
684
+ *
685
+ * DAILY: Every day
686
+ * # MONDAY: Every Monday
687
+ * # TUESDAY: Every Tuesday
688
+ * # WEDNESDAY: Every Wednesday
689
+ * # THURSDAY: Every Thursday
690
+ * # FRIDAY: Every Friday
691
+ * # SATURDAY: Every Saturday
692
+ * # SUNDAY: Every Sunday
693
+ * WEEKLY: Every week
694
+ * MONTHLY: Every month
695
+ * YEARLY: Every year
696
+ * BILLING: Every billing cycle
697
+ *
698
+ * @enum {string}
699
+ */
700
+ RecurringPeriodEnum: 'DAILY' | 'WEEKLY' | 'MONTHLY' | 'YEARLY' | 'BILLING';
701
+ /** @description Recurring period of an entitlement. */
702
+ RecurringPeriod: {
703
+ interval: components['schemas']['RecurringPeriodEnum'];
704
+ /**
705
+ * Format: date-time
706
+ * @description An arbitrary anchor to base the recurring period on.
611
707
  */
612
- usage: number;
708
+ anchor: string;
613
709
  };
614
710
  /** @description Grants are used to increase balance of specific subjects. */
615
- CreateLedgerGrantRequest: {
616
- type: components['schemas']['LedgerGrantType'];
711
+ EntitlementGrantCreateInput: {
617
712
  /**
618
713
  * Format: double
619
- * @description The amount to grant. Can be positive or negative number.
714
+ * @description The amount to grant. Should be a positive number.
620
715
  *
621
716
  * @example 100
622
717
  */
623
718
  amount: number;
624
- /**
625
- * @description The unique feature ULID that the grant is associated with, if any.
626
- *
627
- * @example 01ARZ3NDEKTSV4RRFFQ69G5FAV
628
- */
629
- featureID: string;
630
719
  /**
631
720
  * @description The priority of the grant. Grants with higher priority are applied first.
632
721
  * Priority is a positive decimal numbers. With lower numbers indicating higher importance.
@@ -646,8 +735,21 @@ export interface components {
646
735
  * @example 2023-01-01T00:00:00Z
647
736
  */
648
737
  effectiveAt: string;
649
- expiration: components['schemas']['LedgerGrantExpirationPeriod'];
650
- rollover?: components['schemas']['LedgerGrantRollover'];
738
+ expiration: components['schemas']['ExpirationPeriod'];
739
+ /**
740
+ * Format: double
741
+ * @description The maximum amount of the grant that can be rolled over. Defaults to 0.
742
+ *
743
+ * - maxAmount = {original_amount} -> rollover original amount
744
+ * - maxAmount = 0 -> no rollover
745
+ * - maxAmount = 90 -> rollover 90 max
746
+ *
747
+ * If it's larger than 0 then the grant's balance will be the MAX(maxRollover, balance) + amount.
748
+ *
749
+ * @default 0
750
+ * @example 100
751
+ */
752
+ maxRolloverAmount?: number;
651
753
  /**
652
754
  * @example {
653
755
  * "stripePaymentId": "pi_4OrAkhLvyihio9p51h9iiFnB"
@@ -656,78 +758,73 @@ export interface components {
656
758
  metadata?: {
657
759
  [key: string]: string;
658
760
  };
761
+ recurrence?: components['schemas']['RecurringPeriod'];
762
+ };
763
+ EntitlementGrant: components['schemas']['EntitlementGrantCreateInput'] & components['schemas']['SharedMetaFields'] & {
659
764
  /**
660
- * @description The parent grant ULID that the grant is associated with, if any.
765
+ * @description The unique entitlement ULID that the grant is associated with.
661
766
  *
662
767
  * @example 01ARZ3NDEKTSV4RRFFQ69G5FAV
663
768
  */
664
- parentId?: string;
769
+ entitlementId: string;
770
+ /**
771
+ * @description The subject that is granted the entitlement.
772
+ *
773
+ * @example customer-id
774
+ */
775
+ subjectKey: string;
665
776
  /**
666
777
  * Format: date-time
667
- * @description The time the grant was created.
778
+ * @description The next time the grant will recurr.
668
779
  *
669
780
  * @example 2023-01-01T00:00:00Z
670
781
  */
671
- createdAt?: string;
782
+ nextRecurrence?: string;
672
783
  /**
673
784
  * Format: date-time
674
- * @description The time the grant was last updated.
785
+ * @description The expiration date of the grant.
675
786
  *
676
787
  * @example 2023-01-01T00:00:00Z
677
788
  */
678
- updatedAt?: string;
789
+ expiresAt?: string;
790
+ /**
791
+ * Format: date-time
792
+ * @description The date and time the grant was voided (cannot be used after that).
793
+ */
794
+ voidedAt?: string;
679
795
  };
680
- LedgerGrantResponse: components['schemas']['CreateLedgerGrantRequest'] & {
796
+ EntitlementValue: {
681
797
  /**
682
- * @description Readonly unique ULID identifier of the grant.
683
- *
684
- * @example 01ARZ3NDEKTSV4RRFFQ69G5FAV
798
+ * @description Whether the subject has access to the feature.
799
+ * @example true
685
800
  */
686
- id: string;
801
+ hasAccess: boolean;
687
802
  /**
688
- * @description The ledger ID.
689
- * @example 01ARZ3NDEKTSV4RRFFQ69G5FAV
803
+ * Format: double
804
+ * @description The balance of a metered entitlement.
805
+ * @example 100
690
806
  */
691
- ledgerID: string;
807
+ balance?: number;
692
808
  /**
693
- * @description If the grant is voided, it will not be applied to the subject's balance anymore.
694
- *
695
- * @example false
809
+ * Format: double
810
+ * @description Total usage of the feature in the period. Includes overages.
811
+ * @example 50
696
812
  */
697
- void: boolean;
813
+ usage?: number;
698
814
  /**
699
- * Format: date-time
700
- * @description The expiration date of the grant.
701
- *
702
- * @example 2023-01-01T00:00:00Z
815
+ * Format: double
816
+ * @description The overage of a metered entitlement.
817
+ * @example 0
703
818
  */
704
- expiresAt?: string;
705
- };
706
- /**
707
- * @description The grant type:
708
- * - `USAGE` - Increase balance by the amount in the unit of the associated meter.
709
- *
710
- * @example USAGE
711
- * @enum {string}
712
- */
713
- LedgerGrantType: 'USAGE';
714
- /** @description Grant rollover configuration. */
715
- LedgerGrantRollover: {
716
- type: components['schemas']['LedgerGrantRolloverType'];
717
- /** @description Maximum amount to rollover. */
718
- maxAmount?: number;
819
+ overage?: number;
820
+ /**
821
+ * @description The JSON parseable configuration value of a static entitlement.
822
+ * @example {"key1": "value1"}
823
+ */
824
+ config?: string;
719
825
  };
720
- /**
721
- * @description The rollover type to use:
722
- * - `REMAINING_AMOUNT` - Rollover remaining amount.
723
- * - `ORIGINAL_AMOUNT` - Rollover re-applies the full grant amount.
724
- *
725
- * @example ORIGINAL_AMOUNT
726
- * @enum {string}
727
- */
728
- LedgerGrantRolloverType: 'REMAINING_AMOUNT' | 'ORIGINAL_AMOUNT';
729
- /** @description Expiration period of a ledger grant. */
730
- LedgerGrantExpirationPeriod: {
826
+ /** @description Expiration period of a grant. */
827
+ ExpirationPeriod: {
731
828
  /**
732
829
  * @description The expiration period duration like month.
733
830
  *
@@ -991,6 +1088,12 @@ export interface components {
991
1088
  IdOrSlug: string;
992
1089
  };
993
1090
  responses: {
1091
+ /** @description Ledger Exists */
1092
+ ConflictProblemResponse: {
1093
+ content: {
1094
+ 'application/problem+json': components['schemas']['ConflictProblem'];
1095
+ };
1096
+ };
994
1097
  /** @description Bad Request */
995
1098
  BadRequestProblemResponse: {
996
1099
  content: {
@@ -1003,12 +1106,6 @@ export interface components {
1003
1106
  'application/problem+json': components['schemas']['Problem'];
1004
1107
  };
1005
1108
  };
1006
- /** @description Ledger Exists */
1007
- LedgerAlreadyExistsProblemResponse: {
1008
- content: {
1009
- 'application/problem+json': components['schemas']['LedgerAlreadyExistsProblem'];
1010
- };
1011
- };
1012
1109
  /** @description Not Found */
1013
1110
  NotFoundProblemResponse: {
1014
1111
  content: {
@@ -1034,17 +1131,19 @@ export interface components {
1034
1131
  /** @description A unique identifier for a subject. */
1035
1132
  subjectIdOrKey: string;
1036
1133
  /** @description A unique ULID identifier for a feature. */
1037
- featureID: string;
1038
- /** @description A unique identifier for a ledger grant. */
1039
- ledgerGrantID: string;
1040
- /** @description A unique identifier for a ledger. */
1041
- ledgerID: string;
1042
- /** @description Include void entries in the response. */
1043
- ledgerIncludeVoids?: boolean;
1134
+ featureId: string;
1135
+ /** @description A unique identifier for a grant. */
1136
+ grantId: string;
1137
+ /** @description A unique ULID for an entitlement. */
1138
+ entitlementId: string;
1139
+ /** @description The id of the entitlement or the key of the feature. */
1140
+ entitlementIdOrFeatureKey: string;
1141
+ /** @description Include deleted entries. */
1142
+ includeDeleted?: boolean;
1044
1143
  /** @description Number of entries to return */
1045
- ledgerQueryLimit?: number;
1144
+ queryLimit?: number;
1046
1145
  /** @description Number of entries to skip */
1047
- ledgerQueryOffset?: number;
1146
+ queryOffset?: number;
1048
1147
  /**
1049
1148
  * @description Start date-time in RFC 3339 format.
1050
1149
  * Inclusive.
@@ -1062,14 +1161,6 @@ export interface components {
1062
1161
  * If not specified, the UTC timezone will be used.
1063
1162
  */
1064
1163
  queryWindowTimeZone?: string;
1065
- /**
1066
- * @description Filtering and group by multiple subjects.
1067
- *
1068
- * Usage: `?ledgerID=01HX6VK5C498B3ABY9PR1069PP`
1069
- *
1070
- * @example 01HX6VK5C498B3ABY9PR1069PP
1071
- */
1072
- queryFilterLedgerID?: string;
1073
1164
  /**
1074
1165
  * @description Filtering by multiple subjects.
1075
1166
  *
@@ -1494,6 +1585,30 @@ export interface operations {
1494
1585
  default: components['responses']['UnexpectedProblemResponse'];
1495
1586
  };
1496
1587
  };
1588
+ /**
1589
+ * List entitlements
1590
+ * @description List entitlements.
1591
+ */
1592
+ listEntitlements: {
1593
+ parameters: {
1594
+ query?: {
1595
+ limit?: components['parameters']['queryLimit'];
1596
+ offset?: components['parameters']['queryOffset'];
1597
+ /** @description Order by field */
1598
+ orderBy?: 'createdAt' | 'updatedAt';
1599
+ };
1600
+ };
1601
+ responses: {
1602
+ /** @description List of entitlements. */
1603
+ 200: {
1604
+ content: {
1605
+ 'application/json': components['schemas']['Entitlement'][];
1606
+ };
1607
+ };
1608
+ 401: components['responses']['UnauthorizedProblemResponse'];
1609
+ default: components['responses']['UnexpectedProblemResponse'];
1610
+ };
1611
+ };
1497
1612
  /**
1498
1613
  * List features
1499
1614
  * @description List features.
@@ -1501,8 +1616,8 @@ export interface operations {
1501
1616
  listFeatures: {
1502
1617
  parameters: {
1503
1618
  query?: {
1504
- limit?: components['parameters']['ledgerQueryLimit'];
1505
- offset?: components['parameters']['ledgerQueryOffset'];
1619
+ limit?: components['parameters']['queryLimit'];
1620
+ offset?: components['parameters']['queryOffset'];
1506
1621
  /** @description Order by field */
1507
1622
  orderBy?: 'id' | 'createdAt' | 'updatedAt';
1508
1623
  /** @description Include archived features. */
@@ -1528,7 +1643,7 @@ export interface operations {
1528
1643
  /** @description The feature to create. */
1529
1644
  requestBody: {
1530
1645
  content: {
1531
- 'application/json': components['schemas']['CreateFeatureRequest'];
1646
+ 'application/json': components['schemas']['FeatureCreateInputs'];
1532
1647
  };
1533
1648
  };
1534
1649
  responses: {
@@ -1546,12 +1661,12 @@ export interface operations {
1546
1661
  };
1547
1662
  /**
1548
1663
  * Get feature
1549
- * @description Get feature by key.
1664
+ * @description Get feature by id.
1550
1665
  */
1551
1666
  getFeature: {
1552
1667
  parameters: {
1553
1668
  path: {
1554
- featureID: components['parameters']['featureID'];
1669
+ featureId: components['parameters']['featureId'];
1555
1670
  };
1556
1671
  };
1557
1672
  responses: {
@@ -1573,7 +1688,7 @@ export interface operations {
1573
1688
  deleteFeature: {
1574
1689
  parameters: {
1575
1690
  path: {
1576
- featureID: components['parameters']['featureID'];
1691
+ featureId: components['parameters']['featureId'];
1577
1692
  };
1578
1693
  };
1579
1694
  responses: {
@@ -1587,261 +1702,318 @@ export interface operations {
1587
1702
  };
1588
1703
  };
1589
1704
  /**
1590
- * List the already defined ledgers.
1591
- * @description List the already defined ledgers.
1705
+ * List grants
1706
+ * @description List all grants.
1592
1707
  */
1593
- listLedgers: {
1708
+ listGrants: {
1594
1709
  parameters: {
1595
1710
  query?: {
1596
- /** @description Query ledgers specific to subjects. */
1597
- subject?: string[];
1598
- /** @description Query ledgers with subjects that are similar to the provided text. */
1599
- subjectSimilarTo?: string;
1600
- limit?: components['parameters']['ledgerQueryLimit'];
1601
- offset?: components['parameters']['ledgerQueryOffset'];
1711
+ limit?: components['parameters']['queryLimit'];
1712
+ offset?: components['parameters']['queryOffset'];
1602
1713
  /** @description Order by field */
1603
- orderBy?: 'subject' | 'createdAt' | 'id';
1714
+ orderBy?: 'id' | 'createdAt' | 'updatedAt';
1715
+ includeDeleted?: components['parameters']['includeDeleted'];
1604
1716
  };
1605
1717
  };
1606
1718
  responses: {
1607
- /** @description List of the matching ledgers. */
1719
+ /** @description List of grants. */
1608
1720
  200: {
1609
1721
  content: {
1610
- 'application/json': components['schemas']['Ledger'][];
1722
+ 'application/json': components['schemas']['EntitlementGrant'][];
1611
1723
  };
1612
1724
  };
1613
- 400: components['responses']['BadRequestProblemResponse'];
1614
1725
  401: components['responses']['UnauthorizedProblemResponse'];
1615
1726
  default: components['responses']['UnexpectedProblemResponse'];
1616
1727
  };
1617
1728
  };
1618
1729
  /**
1619
- * Creates the specified ledger
1620
- * @description Create or update the specified ledger.
1730
+ * Delete a grant
1731
+ * @description Void (delete) a grant. A grant can only be deleted if it hasn't been used.
1621
1732
  */
1622
- createLedger: {
1623
- /** @description The ledger to be created */
1624
- requestBody: {
1625
- content: {
1626
- 'application/json': components['schemas']['CreateLedger'];
1733
+ voidGrant: {
1734
+ parameters: {
1735
+ path: {
1736
+ grantId: components['parameters']['grantId'];
1627
1737
  };
1628
1738
  };
1629
1739
  responses: {
1630
- /** @description The created ledger. */
1631
- 201: {
1632
- content: {
1633
- 'application/json': components['schemas']['Ledger'];
1634
- };
1740
+ /** @description Grant has been voided. */
1741
+ 204: {
1742
+ content: never;
1635
1743
  };
1636
1744
  400: components['responses']['BadRequestProblemResponse'];
1637
1745
  401: components['responses']['UnauthorizedProblemResponse'];
1638
- 409: components['responses']['LedgerAlreadyExistsProblemResponse'];
1746
+ 404: components['responses']['NotFoundProblemResponse'];
1747
+ 409: components['responses']['ConflictProblemResponse'];
1639
1748
  default: components['responses']['UnexpectedProblemResponse'];
1640
1749
  };
1641
1750
  };
1642
1751
  /**
1643
- * Get the balance of a specific subject.
1644
- * @description Get the balance of a specific subject.
1752
+ * List entitlements
1753
+ * @description List all entitlements for a subject.
1645
1754
  */
1646
- getLedgerBalance: {
1755
+ listSubjectEntitlements: {
1647
1756
  parameters: {
1648
1757
  query?: {
1649
- /** @description Point of time to query balances: date-time in RFC 3339 format. Defaults to now. */
1650
- time?: string;
1758
+ includeDeleted?: components['parameters']['includeDeleted'];
1651
1759
  };
1652
1760
  path: {
1653
- ledgerID: components['parameters']['ledgerID'];
1761
+ subjectIdOrKey: components['parameters']['subjectIdOrKey'];
1654
1762
  };
1655
1763
  };
1656
1764
  responses: {
1657
- /** @description Ledger balances available. */
1765
+ /** @description List of entitlements. */
1658
1766
  200: {
1659
1767
  content: {
1660
- 'application/json': components['schemas']['LedgerBalance'];
1768
+ 'application/json': components['schemas']['Entitlement'][];
1661
1769
  };
1662
1770
  };
1663
1771
  401: components['responses']['UnauthorizedProblemResponse'];
1664
- 404: components['responses']['NotFoundProblemResponse'];
1665
1772
  default: components['responses']['UnexpectedProblemResponse'];
1666
1773
  };
1667
1774
  };
1668
1775
  /**
1669
- * Get the history of a ledger
1670
- * @description Get the history of a specific ledger
1776
+ * Create entitlement
1777
+ * @description Create an entitlement for a subject.
1671
1778
  */
1672
- getLedgerHistory: {
1779
+ createEntitlement: {
1673
1780
  parameters: {
1674
- query: {
1675
- limit?: components['parameters']['ledgerQueryLimit'];
1676
- offset?: components['parameters']['ledgerQueryOffset'];
1677
- /** @description Start of time range to query ledger: date-time in RFC 3339 format. */
1678
- from: string;
1679
- /** @description End of time range to query ledger: date-time in RFC 3339 format. Defaults to now. */
1680
- to?: string;
1681
- };
1682
1781
  path: {
1683
- ledgerID: components['parameters']['ledgerID'];
1782
+ subjectIdOrKey: components['parameters']['subjectIdOrKey'];
1783
+ };
1784
+ };
1785
+ /** @description The entitlement to create. */
1786
+ requestBody: {
1787
+ content: {
1788
+ 'application/json': components['schemas']['EntitlementMeteredCreateInputs'] | components['schemas']['EntitlementStaticCreateInputs'] | components['schemas']['EntitlementBooleanCreateInputs'];
1684
1789
  };
1685
1790
  };
1686
1791
  responses: {
1687
- /** @description Ledger balance history. */
1688
- 200: {
1792
+ /** @description Entitlement created. */
1793
+ 201: {
1689
1794
  content: {
1690
- 'application/json': components['schemas']['LedgerEntry'][];
1795
+ 'application/json': components['schemas']['Entitlement'];
1691
1796
  };
1692
1797
  };
1798
+ 400: components['responses']['BadRequestProblemResponse'];
1693
1799
  401: components['responses']['UnauthorizedProblemResponse'];
1694
- 404: components['responses']['NotFoundProblemResponse'];
1800
+ 409: components['responses']['ConflictProblemResponse'];
1801
+ 501: components['responses']['NotImplementedProblemResponse'];
1695
1802
  default: components['responses']['UnexpectedProblemResponse'];
1696
1803
  };
1697
1804
  };
1698
1805
  /**
1699
- * Reset the ledger's balance
1700
- * @description Resets the ledger's balances to zero for a specific subject and re-apply active grants with rollover configuration.
1806
+ * Get entitlement
1807
+ * @description Get entitlement by id.
1701
1808
  */
1702
- resetLedger: {
1809
+ getEntitlement: {
1703
1810
  parameters: {
1704
1811
  path: {
1705
- ledgerID: components['parameters']['ledgerID'];
1706
- };
1707
- };
1708
- /** @description Details for the reset. */
1709
- requestBody: {
1710
- content: {
1711
- 'application/json': components['schemas']['LedgerReset'];
1812
+ subjectIdOrKey: components['parameters']['subjectIdOrKey'];
1813
+ entitlementId: components['parameters']['entitlementId'];
1712
1814
  };
1713
1815
  };
1714
1816
  responses: {
1715
- /** @description Ledger balance reset. */
1716
- 201: {
1817
+ /** @description Entitlement found. */
1818
+ 200: {
1717
1819
  content: {
1718
- 'application/json': components['schemas']['LedgerReset'];
1820
+ 'application/json': {
1821
+ type: 'json';
1822
+ } & Omit<components['schemas']['Entitlement'], 'type'> & {
1823
+ /**
1824
+ * Format: date-time
1825
+ * @description The last time usage was reset.
1826
+ * @example 2023-01-01T00:00:00Z
1827
+ */
1828
+ lastReset?: string;
1829
+ };
1719
1830
  };
1720
1831
  };
1721
- 400: components['responses']['BadRequestProblemResponse'];
1722
1832
  401: components['responses']['UnauthorizedProblemResponse'];
1723
1833
  404: components['responses']['NotFoundProblemResponse'];
1724
1834
  default: components['responses']['UnexpectedProblemResponse'];
1725
1835
  };
1726
1836
  };
1727
1837
  /**
1728
- * List grants for multiple ledgers.
1729
- * @description List grants for multiple ledgers.
1838
+ * Delete entitlement
1839
+ * @description Delete an entitlement by id.
1730
1840
  */
1731
- listLedgerGrants: {
1841
+ deleteEntitlement: {
1732
1842
  parameters: {
1733
- query?: {
1734
- ledgerID?: components['parameters']['queryFilterLedgerID'];
1735
- limit?: components['parameters']['ledgerQueryLimit'];
1736
- includeVoids?: components['parameters']['ledgerIncludeVoids'];
1843
+ path: {
1844
+ subjectIdOrKey: components['parameters']['subjectIdOrKey'];
1845
+ entitlementId: components['parameters']['entitlementId'];
1737
1846
  };
1738
1847
  };
1739
1848
  responses: {
1740
- /** @description List of ledger grants. */
1741
- 200: {
1742
- content: {
1743
- 'application/json': components['schemas']['LedgerGrantResponse'][];
1744
- };
1849
+ /** @description Entitlement deleted. */
1850
+ 204: {
1851
+ content: never;
1745
1852
  };
1746
- 400: components['responses']['BadRequestProblemResponse'];
1747
1853
  401: components['responses']['UnauthorizedProblemResponse'];
1854
+ 404: components['responses']['NotFoundProblemResponse'];
1748
1855
  default: components['responses']['UnexpectedProblemResponse'];
1749
1856
  };
1750
1857
  };
1751
1858
  /**
1752
- * List ledger grants
1753
- * @description List ledger grants for a specific ledger.
1859
+ * List grants for an entitlement
1860
+ * @description List all grants for an entitlement.
1754
1861
  */
1755
- listLedgerGrantsByLedger: {
1862
+ listEntitlementGrants: {
1756
1863
  parameters: {
1757
1864
  query?: {
1758
- limit?: components['parameters']['ledgerQueryLimit'];
1759
- includeVoids?: components['parameters']['ledgerIncludeVoids'];
1865
+ includeDeleted?: components['parameters']['includeDeleted'];
1866
+ /** @description Order by field */
1867
+ orderBy?: 'id' | 'createdAt' | 'updatedAt';
1760
1868
  };
1761
1869
  path: {
1762
- ledgerID: components['parameters']['ledgerID'];
1870
+ subjectIdOrKey: components['parameters']['subjectIdOrKey'];
1871
+ entitlementId: components['parameters']['entitlementId'];
1763
1872
  };
1764
1873
  };
1765
1874
  responses: {
1766
- /** @description List of ledger grants created. */
1875
+ /** @description List of grants. */
1767
1876
  200: {
1768
1877
  content: {
1769
- 'application/json': components['schemas']['LedgerGrantResponse'][];
1878
+ 'application/json': components['schemas']['EntitlementGrant'][];
1770
1879
  };
1771
1880
  };
1772
- 400: components['responses']['BadRequestProblemResponse'];
1773
1881
  401: components['responses']['UnauthorizedProblemResponse'];
1774
1882
  default: components['responses']['UnexpectedProblemResponse'];
1775
1883
  };
1776
1884
  };
1777
1885
  /**
1778
- * Create a grant on a specific ledger.
1779
- * @description Create a grant on a specific ledger.
1886
+ * Create grant
1887
+ * @description Create a grant for an entitlement.
1780
1888
  */
1781
- createLedgerGrant: {
1889
+ createGrant: {
1782
1890
  parameters: {
1783
1891
  path: {
1784
- ledgerID: components['parameters']['ledgerID'];
1892
+ subjectIdOrKey: components['parameters']['subjectIdOrKey'];
1893
+ entitlementId: components['parameters']['entitlementId'];
1785
1894
  };
1786
1895
  };
1787
1896
  /** @description The grant to create. */
1788
1897
  requestBody: {
1789
1898
  content: {
1790
- 'application/json': components['schemas']['CreateLedgerGrantRequest'];
1899
+ 'application/json': components['schemas']['EntitlementGrantCreateInput'];
1791
1900
  };
1792
1901
  };
1793
1902
  responses: {
1794
- /** @description LedgerGrant created. */
1903
+ /** @description Grant created. */
1795
1904
  201: {
1796
1905
  content: {
1797
- 'application/json': components['schemas']['LedgerGrantResponse'];
1906
+ 'application/json': components['schemas']['EntitlementGrant'];
1798
1907
  };
1799
1908
  };
1800
1909
  400: components['responses']['BadRequestProblemResponse'];
1801
1910
  401: components['responses']['UnauthorizedProblemResponse'];
1911
+ 501: components['responses']['NotImplementedProblemResponse'];
1802
1912
  default: components['responses']['UnexpectedProblemResponse'];
1803
1913
  };
1804
1914
  };
1805
1915
  /**
1806
- * Get a single grant.
1807
- * @description Gets the grant for a ledger by ID.
1916
+ * Get the balance of a specific entitlement.
1917
+ * @description Get the balance of a specific entitlement.
1808
1918
  */
1809
- getLedgerGrant: {
1919
+ getEntitlementValue: {
1810
1920
  parameters: {
1921
+ query?: {
1922
+ /** @description Point of time to check value: date-time in RFC 3339 format. Defaults to now. */
1923
+ time?: string;
1924
+ };
1811
1925
  path: {
1812
- ledgerID: components['parameters']['ledgerID'];
1813
- ledgerGrantID: components['parameters']['ledgerGrantID'];
1926
+ subjectIdOrKey: components['parameters']['subjectIdOrKey'];
1927
+ entitlementIdOrFeatureKey: components['parameters']['entitlementIdOrFeatureKey'];
1814
1928
  };
1815
1929
  };
1816
1930
  responses: {
1817
- /** @description Ledger grant found. */
1931
+ /** @description The entitlement value. */
1818
1932
  200: {
1819
1933
  content: {
1820
- 'application/json': components['schemas']['LedgerGrantResponse'];
1934
+ 'application/json': components['schemas']['EntitlementValue'];
1821
1935
  };
1822
1936
  };
1937
+ 400: components['responses']['BadRequestProblemResponse'];
1823
1938
  401: components['responses']['UnauthorizedProblemResponse'];
1824
1939
  404: components['responses']['NotFoundProblemResponse'];
1825
1940
  default: components['responses']['UnexpectedProblemResponse'];
1826
1941
  };
1827
1942
  };
1828
1943
  /**
1829
- * Void ledger grant
1830
- * @description Void a ledger grant by ID. Partially or fully used grants cannot be voided.
1831
- * Voided grant won't be applied to the subject's balance anymore.
1944
+ * Get the balance history of a specific entitlement.
1945
+ * @description Get the balance history of a specific entitlement.
1946
+ *
1947
+ * The windows are inclusive at their start and exclusive at their end.
1948
+ * The last window may be smaller than the window size and is inclusive at both ends.
1832
1949
  */
1833
- voidLedgerGrant: {
1950
+ getEntitlementHistory: {
1834
1951
  parameters: {
1952
+ query: {
1953
+ /**
1954
+ * @description Start of time range to query entitlement: date-time in RFC 3339 format.
1955
+ * Gets truncated to the granularity of the underlying meter.
1956
+ */
1957
+ from: string;
1958
+ /**
1959
+ * @description End of time range to query entitlement: date-time in RFC 3339 format. Defaults to now.
1960
+ * If not now then gets truncated to the granularity of the underlying meter.
1961
+ */
1962
+ to?: string;
1963
+ /** @description Size of the time window to group the history by. Cannot be shorter than meter granularity. */
1964
+ windowSize: 'MINUTE' | 'HOUR' | 'DAY';
1965
+ windowTimeZone?: components['parameters']['queryWindowTimeZone'];
1966
+ };
1835
1967
  path: {
1836
- ledgerGrantID: components['parameters']['ledgerGrantID'];
1837
- ledgerID: components['parameters']['ledgerID'];
1968
+ subjectIdOrKey: components['parameters']['subjectIdOrKey'];
1969
+ entitlementId: components['parameters']['entitlementId'];
1838
1970
  };
1839
1971
  };
1840
1972
  responses: {
1841
- /** @description Ledger grant voided. */
1973
+ /** @description Entitlement balance history. If windowsize is specified then the history is grouped by the window size. */
1974
+ 200: {
1975
+ content: {
1976
+ 'application/json': components['schemas']['WindowedBalanceHistory'];
1977
+ };
1978
+ };
1979
+ 400: components['responses']['BadRequestProblemResponse'];
1980
+ 401: components['responses']['UnauthorizedProblemResponse'];
1981
+ 404: components['responses']['NotFoundProblemResponse'];
1982
+ default: components['responses']['UnexpectedProblemResponse'];
1983
+ };
1984
+ };
1985
+ /**
1986
+ * Reset entitlement
1987
+ * @description Reset the entitlement usage and start a new period. Grants that can be are rolled over.
1988
+ */
1989
+ resetEntitlementUsage: {
1990
+ parameters: {
1991
+ path: {
1992
+ subjectIdOrKey: components['parameters']['subjectIdOrKey'];
1993
+ entitlementId: components['parameters']['entitlementId'];
1994
+ };
1995
+ };
1996
+ requestBody: {
1997
+ content: {
1998
+ 'application/json': {
1999
+ /**
2000
+ * Format: date-time
2001
+ * @description The time at which the reset takes effect, defaults to now.
2002
+ * The reset cannot be in the future.
2003
+ * The provided value is truncated to the granularity of the underlying meter.
2004
+ *
2005
+ * @example 2023-01-01T00:00:00Z
2006
+ */
2007
+ effectiveAt?: string;
2008
+ };
2009
+ };
2010
+ };
2011
+ responses: {
2012
+ /** @description Entitlement reset. */
1842
2013
  204: {
1843
2014
  content: never;
1844
2015
  };
2016
+ 400: components['responses']['BadRequestProblemResponse'];
1845
2017
  401: components['responses']['UnauthorizedProblemResponse'];
1846
2018
  404: components['responses']['NotFoundProblemResponse'];
1847
2019
  default: components['responses']['UnexpectedProblemResponse'];