@openmeter/sdk 1.0.0-beta-7cf71f2fbc46 → 1.0.0-beta-01a09ff04a38

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.
@@ -543,7 +543,7 @@ export declare class CustomerEntitlementsV2 {
543
543
  totalCount: number;
544
544
  page: number;
545
545
  pageSize: number;
546
- items: import("./schemas.cjs").components["schemas"]["EntitlementGrant"][];
546
+ items: import("./schemas.cjs").components["schemas"]["EntitlementGrantV2"][];
547
547
  }>;
548
548
  /**
549
549
  * Create a grant for a customer entitlement
@@ -560,10 +560,11 @@ export declare class CustomerEntitlementsV2 {
560
560
  amount: number;
561
561
  priority?: number;
562
562
  effectiveAt: Date;
563
- expiration: import("./schemas.cjs").components["schemas"]["ExpirationPeriod"];
564
- maxRolloverAmount?: number;
565
563
  minRolloverAmount?: number;
564
+ maxRolloverAmount?: number;
565
+ expiration?: import("./schemas.cjs").components["schemas"]["ExpirationPeriod"];
566
566
  metadata?: import("./schemas.cjs").components["schemas"]["Metadata"];
567
+ annotations?: import("./schemas.cjs").components["schemas"]["Annotations"];
567
568
  readonly id: string;
568
569
  readonly entitlementId: string;
569
570
  nextRecurrence?: Date;
@@ -651,7 +651,7 @@ export declare class GrantsV2 {
651
651
  totalCount: number;
652
652
  page: number;
653
653
  pageSize: number;
654
- items: import("./schemas.cjs").components["schemas"]["EntitlementGrant"][];
654
+ items: import("./schemas.cjs").components["schemas"]["EntitlementGrantV2"][];
655
655
  }>;
656
656
  /**
657
657
  * Void a grant (legacy method using V1 endpoint)
@@ -4695,6 +4695,175 @@ export interface components {
4695
4695
  /** @description The subject of the grant. */
4696
4696
  recurrence?: components['schemas']['RecurringPeriodCreateInput'];
4697
4697
  };
4698
+ /** @description The grant creation input. */
4699
+ EntitlementGrantCreateInputV2: {
4700
+ /**
4701
+ * Format: double
4702
+ * @description The amount to grant. Should be a positive number.
4703
+ * @example 100
4704
+ */
4705
+ amount: number;
4706
+ /**
4707
+ * Format: uint8
4708
+ * @description The priority of the grant. Grants with higher priority are applied first.
4709
+ * Priority is a positive decimal numbers. With lower numbers indicating higher importance.
4710
+ * For example, a priority of 1 is more urgent than a priority of 2.
4711
+ * When there are several grants available for the same subject, the system selects the grant with the highest priority.
4712
+ * In cases where grants share the same priority level, the grant closest to its expiration will be used first.
4713
+ * In the case of two grants have identical priorities and expiration dates, the system will use the grant that was created first.
4714
+ * @example 1
4715
+ */
4716
+ priority?: number;
4717
+ /**
4718
+ * Format: date-time
4719
+ * @description Effective date for grants and anchor for recurring grants. Provided value will be ceiled to metering windowSize (minute).
4720
+ * @example 2023-01-01T01:01:01.001Z
4721
+ */
4722
+ effectiveAt: Date;
4723
+ /**
4724
+ * Format: double
4725
+ * @description Grants are rolled over at reset, after which they can have a different balance compared to what they had before the reset.
4726
+ * Balance after the reset is calculated as: Balance_After_Reset = MIN(MaxRolloverAmount, MAX(Balance_Before_Reset, MinRolloverAmount))
4727
+ * @default 0
4728
+ * @example 100
4729
+ */
4730
+ minRolloverAmount?: number;
4731
+ /** @description The subject of the grant. */
4732
+ recurrence?: components['schemas']['RecurringPeriodCreateInput'];
4733
+ /**
4734
+ * Format: double
4735
+ * @description Grants are rolled over at reset, after which they can have a different balance compared to what they had before the reset. The default value equals grant amount.
4736
+ * Balance after the reset is calculated as: Balance_After_Reset = MIN(MaxRolloverAmount, MAX(Balance_Before_Reset, MinRolloverAmount))
4737
+ * @example 100
4738
+ */
4739
+ maxRolloverAmount?: number;
4740
+ /** @description The grant expiration definition. If no expiration is provided, the grant can be active indefinitely. */
4741
+ expiration?: components['schemas']['ExpirationPeriod'];
4742
+ /**
4743
+ * @deprecated
4744
+ * @description The grant metadata.
4745
+ * @example {
4746
+ * "stripePaymentId": "pi_4OrAkhLvyihio9p51h9iiFnB"
4747
+ * }
4748
+ */
4749
+ metadata?: components['schemas']['Metadata'];
4750
+ /**
4751
+ * @description The grant metadata.
4752
+ * @example {
4753
+ * "stripePaymentId": "pi_4OrAkhLvyihio9p51h9iiFnB"
4754
+ * }
4755
+ */
4756
+ annotations?: components['schemas']['Annotations'];
4757
+ };
4758
+ /** @description The grant. */
4759
+ EntitlementGrantV2: {
4760
+ /**
4761
+ * Creation Time
4762
+ * Format: date-time
4763
+ * @description Timestamp of when the resource was created.
4764
+ * @example 2024-01-01T01:01:01.001Z
4765
+ */
4766
+ readonly createdAt: Date;
4767
+ /**
4768
+ * Last Update Time
4769
+ * Format: date-time
4770
+ * @description Timestamp of when the resource was last updated.
4771
+ * @example 2024-01-01T01:01:01.001Z
4772
+ */
4773
+ readonly updatedAt: Date;
4774
+ /**
4775
+ * Deletion Time
4776
+ * Format: date-time
4777
+ * @description Timestamp of when the resource was permanently deleted.
4778
+ * @example 2024-01-01T01:01:01.001Z
4779
+ */
4780
+ readonly deletedAt?: Date;
4781
+ /**
4782
+ * Format: double
4783
+ * @description The amount to grant. Should be a positive number.
4784
+ * @example 100
4785
+ */
4786
+ amount: number;
4787
+ /**
4788
+ * Format: uint8
4789
+ * @description The priority of the grant. Grants with higher priority are applied first.
4790
+ * Priority is a positive decimal numbers. With lower numbers indicating higher importance.
4791
+ * For example, a priority of 1 is more urgent than a priority of 2.
4792
+ * When there are several grants available for the same subject, the system selects the grant with the highest priority.
4793
+ * In cases where grants share the same priority level, the grant closest to its expiration will be used first.
4794
+ * In the case of two grants have identical priorities and expiration dates, the system will use the grant that was created first.
4795
+ * @example 1
4796
+ */
4797
+ priority?: number;
4798
+ /**
4799
+ * Format: date-time
4800
+ * @description Effective date for grants and anchor for recurring grants. Provided value will be ceiled to metering windowSize (minute).
4801
+ * @example 2023-01-01T01:01:01.001Z
4802
+ */
4803
+ effectiveAt: Date;
4804
+ /**
4805
+ * Format: double
4806
+ * @description Grants are rolled over at reset, after which they can have a different balance compared to what they had before the reset.
4807
+ * Balance after the reset is calculated as: Balance_After_Reset = MIN(MaxRolloverAmount, MAX(Balance_Before_Reset, MinRolloverAmount))
4808
+ * @default 0
4809
+ * @example 100
4810
+ */
4811
+ minRolloverAmount?: number;
4812
+ /**
4813
+ * Format: double
4814
+ * @description Grants are rolled over at reset, after which they can have a different balance compared to what they had before the reset. The default value equals grant amount.
4815
+ * Balance after the reset is calculated as: Balance_After_Reset = MIN(MaxRolloverAmount, MAX(Balance_Before_Reset, MinRolloverAmount))
4816
+ * @example 100
4817
+ */
4818
+ maxRolloverAmount?: number;
4819
+ /** @description The grant expiration definition. If no expiration is provided, the grant can be active indefinitely. */
4820
+ expiration?: components['schemas']['ExpirationPeriod'];
4821
+ /**
4822
+ * @deprecated
4823
+ * @description The grant metadata.
4824
+ * @example {
4825
+ * "stripePaymentId": "pi_4OrAkhLvyihio9p51h9iiFnB"
4826
+ * }
4827
+ */
4828
+ metadata?: components['schemas']['Metadata'];
4829
+ /**
4830
+ * @description The grant metadata.
4831
+ * @example {
4832
+ * "stripePaymentId": "pi_4OrAkhLvyihio9p51h9iiFnB"
4833
+ * }
4834
+ */
4835
+ annotations?: components['schemas']['Annotations'];
4836
+ /**
4837
+ * @description Readonly unique ULID identifier.
4838
+ * @example 01ARZ3NDEKTSV4RRFFQ69G5FAV
4839
+ */
4840
+ readonly id: string;
4841
+ /**
4842
+ * @description The unique entitlement ULID that the grant is associated with.
4843
+ * @example 01ARZ3NDEKTSV4RRFFQ69G5FAV
4844
+ */
4845
+ readonly entitlementId: string;
4846
+ /**
4847
+ * Format: date-time
4848
+ * @description The next time the grant will recurr.
4849
+ * @example 2023-01-01T01:01:01.001Z
4850
+ */
4851
+ nextRecurrence?: Date;
4852
+ /**
4853
+ * Format: date-time
4854
+ * @description The time the grant expires.
4855
+ * @example 2023-01-01T01:01:01.001Z
4856
+ */
4857
+ readonly expiresAt?: Date;
4858
+ /**
4859
+ * Format: date-time
4860
+ * @description The time the grant was voided.
4861
+ * @example 2023-01-01T01:01:01.001Z
4862
+ */
4863
+ voidedAt?: Date;
4864
+ /** @description The recurrence period of the grant. */
4865
+ recurrence?: components['schemas']['RecurringPeriod'];
4866
+ };
4698
4867
  /** @description Metered entitlements are useful for many different use cases, from setting up usage based access to implementing complex credit systems.
4699
4868
  * 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). */
4700
4869
  EntitlementMetered: {
@@ -4892,14 +5061,15 @@ export interface components {
4892
5061
  */
4893
5062
  isSoftLimit?: boolean;
4894
5063
  /**
4895
- * @deprecated
4896
- * @description Deprecated, ignored by the backend. Please use isSoftLimit instead; this field will be removed in the future.
5064
+ * Preserve overage at reset
5065
+ * @description If true, the overage is preserved at reset. If false, the usage is reset to 0.
4897
5066
  * @default false
4898
5067
  */
4899
- isUnlimited?: boolean;
5068
+ preserveOverageAtReset?: boolean;
4900
5069
  /**
4901
5070
  * Initial grant amount
4902
5071
  * Format: double
5072
+ * @deprecated
4903
5073
  * @description You can grant usage automatically alongside the entitlement, the example scenario would be creating a starting balance.
4904
5074
  * If an amount is specified here, a grant will be created alongside the entitlement with the specified amount.
4905
5075
  * 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.
@@ -4909,16 +5079,16 @@ export interface components {
4909
5079
  /**
4910
5080
  * Issue grant after reset priority
4911
5081
  * Format: uint8
5082
+ * @deprecated
4912
5083
  * @description Defines the grant priority for the default grant.
4913
5084
  * @default 1
4914
5085
  */
4915
5086
  issueAfterResetPriority?: number;
4916
5087
  /**
4917
- * Preserve overage at reset
4918
- * @description If true, the overage is preserved at reset. If false, the usage is reset to 0.
4919
- * @default false
5088
+ * Issue after reset
5089
+ * @description Issue after reset
4920
5090
  */
4921
- preserveOverageAtReset?: boolean;
5091
+ issue?: components['schemas']['IssueAfterReset'];
4922
5092
  /**
4923
5093
  * Creation Time
4924
5094
  * Format: date-time
@@ -5003,6 +5173,72 @@ export interface components {
5003
5173
  */
5004
5174
  customerId: string;
5005
5175
  };
5176
+ /** @description Create inputs for metered entitlement */
5177
+ EntitlementMeteredV2CreateInputs: {
5178
+ /**
5179
+ * @description The feature the subject is entitled to use.
5180
+ * Either featureKey or featureId is required.
5181
+ * @example example-feature-key
5182
+ */
5183
+ featureKey?: string;
5184
+ /**
5185
+ * @description The feature the subject is entitled to use.
5186
+ * Either featureKey or featureId is required.
5187
+ * @example 01ARZ3NDEKTSV4RRFFQ69G5FAV
5188
+ */
5189
+ featureId?: string;
5190
+ /** @description Additional metadata for the feature. */
5191
+ metadata?: components['schemas']['Metadata'];
5192
+ /**
5193
+ * @description discriminator enum property added by openapi-typescript
5194
+ * @enum {string}
5195
+ */
5196
+ type: 'metered';
5197
+ /**
5198
+ * Soft limit
5199
+ * @description If softLimit=true the subject can use the feature even if the entitlement is exhausted, hasAccess will always be true.
5200
+ * @default false
5201
+ */
5202
+ isSoftLimit?: boolean;
5203
+ /** @description The usage period associated with the entitlement. */
5204
+ usagePeriod: components['schemas']['RecurringPeriodCreateInput'];
5205
+ /** @description Defines the time from which usage is measured. If not specified on creation, defaults to entitlement creation time. */
5206
+ measureUsageFrom?: components['schemas']['MeasureUsageFrom'];
5207
+ /**
5208
+ * Preserve overage at reset
5209
+ * @description If true, the overage is preserved at reset. If false, the usage is reset to 0.
5210
+ * @default false
5211
+ */
5212
+ preserveOverageAtReset?: boolean;
5213
+ /**
5214
+ * Initial grant amount
5215
+ * Format: double
5216
+ * @deprecated
5217
+ * @description You can grant usage automatically alongside the entitlement, the example scenario would be creating a starting balance.
5218
+ * If an amount is specified here, a grant will be created alongside the entitlement with the specified amount.
5219
+ * 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.
5220
+ * Manually creating such a grant would mean having the "amount", "minRolloverAmount", and "maxRolloverAmount" fields all be the same.
5221
+ */
5222
+ issueAfterReset?: number;
5223
+ /**
5224
+ * Issue grant after reset priority
5225
+ * Format: uint8
5226
+ * @deprecated
5227
+ * @description Defines the grant priority for the default grant.
5228
+ * @default 1
5229
+ */
5230
+ issueAfterResetPriority?: number;
5231
+ /**
5232
+ * Issue after reset
5233
+ * @description Issue after reset
5234
+ */
5235
+ issue?: components['schemas']['IssueAfterReset'];
5236
+ /**
5237
+ * Grants
5238
+ * @description Grants
5239
+ */
5240
+ grants?: components['schemas']['EntitlementGrantCreateInputV2'][];
5241
+ };
5006
5242
  /**
5007
5243
  * @description Order by options for entitlements.
5008
5244
  * @enum {string}
@@ -5232,6 +5468,8 @@ export interface components {
5232
5468
  /** @description Entitlement templates are used to define the entitlements of a plan.
5233
5469
  * Features are omitted from the entitlement template, as they are defined in the rate card. */
5234
5470
  EntitlementV2: components['schemas']['EntitlementMeteredV2'] | components['schemas']['EntitlementStaticV2'] | components['schemas']['EntitlementBooleanV2'];
5471
+ /** @description Create inputs for entitlement */
5472
+ EntitlementV2CreateInputs: components['schemas']['EntitlementMeteredV2CreateInputs'] | components['schemas']['EntitlementStaticCreateInputs'] | components['schemas']['EntitlementBooleanCreateInputs'];
5235
5473
  /** @description Paginated response */
5236
5474
  EntitlementV2PaginatedResponse: {
5237
5475
  /**
@@ -5697,6 +5935,26 @@ export interface components {
5697
5935
  */
5698
5936
  usage: number;
5699
5937
  };
5938
+ /** @description Paginated response */
5939
+ GrantV2PaginatedResponse: {
5940
+ /**
5941
+ * @description The total number of items.
5942
+ * @example 500
5943
+ */
5944
+ totalCount: number;
5945
+ /**
5946
+ * @description The page index.
5947
+ * @example 1
5948
+ */
5949
+ page: number;
5950
+ /**
5951
+ * @description The maximum number of items per page.
5952
+ * @example 100
5953
+ */
5954
+ pageSize: number;
5955
+ /** @description The items in the current page. */
5956
+ items: components['schemas']['EntitlementGrantV2'][];
5957
+ };
5700
5958
  /** @description IDResource is a resouce with an ID. */
5701
5959
  IDResource: {
5702
5960
  /**
@@ -6805,6 +7063,22 @@ export interface components {
6805
7063
  /** @description The payment settings for this workflow */
6806
7064
  payment: components['schemas']['BillingWorkflowPaymentSettings'];
6807
7065
  };
7066
+ /** @description Issue after reset */
7067
+ IssueAfterReset: {
7068
+ /**
7069
+ * Initial grant amount
7070
+ * Format: double
7071
+ * @description The initial grant amount
7072
+ */
7073
+ amount: number;
7074
+ /**
7075
+ * Issue grant after reset priority
7076
+ * Format: uint8
7077
+ * @description The priority of the issue after reset
7078
+ * @default 1
7079
+ */
7080
+ priority?: number;
7081
+ };
6808
7082
  /** @description List entitlements result */
6809
7083
  ListEntitlementsResult: components['schemas']['Entitlement'][] | components['schemas']['EntitlementPaginatedResponse'];
6810
7084
  /** @description List features result */
@@ -11029,9 +11303,12 @@ export type EntitlementBooleanV2 = components['schemas']['EntitlementBooleanV2']
11029
11303
  export type EntitlementCreateInputs = components['schemas']['EntitlementCreateInputs'];
11030
11304
  export type EntitlementGrant = components['schemas']['EntitlementGrant'];
11031
11305
  export type EntitlementGrantCreateInput = components['schemas']['EntitlementGrantCreateInput'];
11306
+ export type EntitlementGrantCreateInputV2 = components['schemas']['EntitlementGrantCreateInputV2'];
11307
+ export type EntitlementGrantV2 = components['schemas']['EntitlementGrantV2'];
11032
11308
  export type EntitlementMetered = components['schemas']['EntitlementMetered'];
11033
11309
  export type EntitlementMeteredCreateInputs = components['schemas']['EntitlementMeteredCreateInputs'];
11034
11310
  export type EntitlementMeteredV2 = components['schemas']['EntitlementMeteredV2'];
11311
+ export type EntitlementMeteredV2CreateInputs = components['schemas']['EntitlementMeteredV2CreateInputs'];
11035
11312
  export type EntitlementOrderBy = components['schemas']['EntitlementOrderBy'];
11036
11313
  export type EntitlementPaginatedResponse = components['schemas']['EntitlementPaginatedResponse'];
11037
11314
  export type EntitlementStatic = components['schemas']['EntitlementStatic'];
@@ -11039,6 +11316,7 @@ export type EntitlementStaticCreateInputs = components['schemas']['EntitlementSt
11039
11316
  export type EntitlementStaticV2 = components['schemas']['EntitlementStaticV2'];
11040
11317
  export type EntitlementType = components['schemas']['EntitlementType'];
11041
11318
  export type EntitlementV2 = components['schemas']['EntitlementV2'];
11319
+ export type EntitlementV2CreateInputs = components['schemas']['EntitlementV2CreateInputs'];
11042
11320
  export type EntitlementV2PaginatedResponse = components['schemas']['EntitlementV2PaginatedResponse'];
11043
11321
  export type EntitlementValue = components['schemas']['EntitlementValue'];
11044
11322
  export type Event = components['schemas']['Event'];
@@ -11060,6 +11338,7 @@ export type GrantBurnDownHistorySegment = components['schemas']['GrantBurnDownHi
11060
11338
  export type GrantOrderBy = components['schemas']['GrantOrderBy'];
11061
11339
  export type GrantPaginatedResponse = components['schemas']['GrantPaginatedResponse'];
11062
11340
  export type GrantUsageRecord = components['schemas']['GrantUsageRecord'];
11341
+ export type GrantV2PaginatedResponse = components['schemas']['GrantV2PaginatedResponse'];
11063
11342
  export type IdResource = components['schemas']['IDResource'];
11064
11343
  export type IngestEventsBody = components['schemas']['IngestEventsBody'];
11065
11344
  export type IngestedEvent = components['schemas']['IngestedEvent'];
@@ -11111,6 +11390,7 @@ export type InvoiceWorkflowInvoicingSettingsReplaceUpdate = components['schemas'
11111
11390
  export type InvoiceWorkflowReplaceUpdate = components['schemas']['InvoiceWorkflowReplaceUpdate'];
11112
11391
  export type InvoiceWorkflowSettings = components['schemas']['InvoiceWorkflowSettings'];
11113
11392
  export type InvoiceWorkflowSettingsReplaceUpdate = components['schemas']['InvoiceWorkflowSettingsReplaceUpdate'];
11393
+ export type IssueAfterReset = components['schemas']['IssueAfterReset'];
11114
11394
  export type ListEntitlementsResult = components['schemas']['ListEntitlementsResult'];
11115
11395
  export type ListFeaturesResult = components['schemas']['ListFeaturesResult'];
11116
11396
  export type MarketplaceInstallRequestPayload = components['schemas']['MarketplaceInstallRequestPayload'];
@@ -24741,7 +25021,7 @@ export interface operations {
24741
25021
  };
24742
25022
  requestBody: {
24743
25023
  content: {
24744
- 'application/json': components['schemas']['EntitlementCreateInputs'];
25024
+ 'application/json': components['schemas']['EntitlementV2CreateInputs'];
24745
25025
  };
24746
25026
  };
24747
25027
  responses: {
@@ -25056,7 +25336,7 @@ export interface operations {
25056
25336
  [name: string]: unknown;
25057
25337
  };
25058
25338
  content: {
25059
- 'application/json': components['schemas']['GrantPaginatedResponse'];
25339
+ 'application/json': components['schemas']['GrantV2PaginatedResponse'];
25060
25340
  };
25061
25341
  };
25062
25342
  /** @description The server cannot or will not process the request due to something that is perceived to be a client error (e.g., malformed request syntax, invalid request message framing, or deceptive request routing). */
@@ -25136,7 +25416,7 @@ export interface operations {
25136
25416
  };
25137
25417
  requestBody: {
25138
25418
  content: {
25139
- 'application/json': components['schemas']['EntitlementGrantCreateInput'];
25419
+ 'application/json': components['schemas']['EntitlementGrantCreateInputV2'];
25140
25420
  };
25141
25421
  };
25142
25422
  responses: {
@@ -25146,7 +25426,7 @@ export interface operations {
25146
25426
  [name: string]: unknown;
25147
25427
  };
25148
25428
  content: {
25149
- 'application/json': components['schemas']['EntitlementGrant'];
25429
+ 'application/json': components['schemas']['EntitlementGrantV2'];
25150
25430
  };
25151
25431
  };
25152
25432
  /** @description The server cannot or will not process the request due to something that is perceived to be a client error (e.g., malformed request syntax, invalid request message framing, or deceptive request routing). */
@@ -25340,7 +25620,7 @@ export interface operations {
25340
25620
  };
25341
25621
  requestBody: {
25342
25622
  content: {
25343
- 'application/json': components['schemas']['EntitlementCreateInputs'];
25623
+ 'application/json': components['schemas']['EntitlementV2CreateInputs'];
25344
25624
  };
25345
25625
  };
25346
25626
  responses: {
@@ -25985,7 +26265,7 @@ export interface operations {
25985
26265
  [name: string]: unknown;
25986
26266
  };
25987
26267
  content: {
25988
- 'application/json': components['schemas']['GrantPaginatedResponse'];
26268
+ 'application/json': components['schemas']['GrantV2PaginatedResponse'];
25989
26269
  };
25990
26270
  };
25991
26271
  /** @description The server cannot or will not process the request due to something that is perceived to be a client error (e.g., malformed request syntax, invalid request message framing, or deceptive request routing). */