@openmeter/sdk 1.0.0-beta.22 → 1.0.0-beta.221

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (170) hide show
  1. package/Makefile +43 -0
  2. package/README.md +38 -150
  3. package/dist/cjs/index.cjs +18 -0
  4. package/dist/cjs/index.d.cts +1 -0
  5. package/dist/cjs/index.js.map +1 -0
  6. package/dist/cjs/src/client/addons.cjs +105 -0
  7. package/dist/cjs/src/client/addons.d.cts +152 -0
  8. package/dist/cjs/src/client/addons.js.map +1 -0
  9. package/dist/cjs/src/client/apps.cjs +247 -0
  10. package/dist/cjs/src/client/apps.d.cts +327 -0
  11. package/dist/cjs/src/client/apps.js.map +1 -0
  12. package/dist/cjs/src/client/billing.cjs +361 -0
  13. package/dist/cjs/src/client/billing.d.cts +526 -0
  14. package/dist/cjs/src/client/billing.js.map +1 -0
  15. package/dist/cjs/src/client/common.cjs +47 -0
  16. package/dist/cjs/src/client/common.d.cts +30 -0
  17. package/dist/cjs/src/client/common.js.map +1 -0
  18. package/dist/cjs/src/client/customers.cjs +283 -0
  19. package/dist/cjs/src/client/customers.d.cts +251 -0
  20. package/dist/cjs/src/client/customers.js.map +1 -0
  21. package/dist/cjs/src/client/debug.cjs +27 -0
  22. package/dist/cjs/src/client/debug.d.cts +17 -0
  23. package/dist/cjs/src/client/debug.js.map +1 -0
  24. package/dist/cjs/src/client/entitlements.cjs +281 -0
  25. package/dist/cjs/src/client/entitlements.d.cts +556 -0
  26. package/dist/cjs/src/client/entitlements.js.map +1 -0
  27. package/dist/cjs/src/client/events.cjs +113 -0
  28. package/dist/cjs/src/client/events.d.cts +48 -0
  29. package/dist/cjs/src/client/events.js.map +1 -0
  30. package/dist/cjs/src/client/features.cjs +78 -0
  31. package/dist/cjs/src/client/features.d.cts +78 -0
  32. package/dist/cjs/src/client/features.js.map +1 -0
  33. package/dist/cjs/src/client/index.cjs +120 -0
  34. package/dist/cjs/src/client/index.d.cts +53 -0
  35. package/dist/cjs/src/client/index.js.map +1 -0
  36. package/dist/cjs/src/client/info.cjs +42 -0
  37. package/dist/cjs/src/client/info.d.cts +34 -0
  38. package/dist/cjs/src/client/info.js.map +1 -0
  39. package/dist/cjs/src/client/meters.cjs +115 -0
  40. package/dist/cjs/src/client/meters.d.cts +123 -0
  41. package/dist/cjs/src/client/meters.js.map +1 -0
  42. package/dist/cjs/src/client/notifications.cjs +249 -0
  43. package/dist/cjs/src/client/notifications.d.cts +397 -0
  44. package/dist/cjs/src/client/notifications.js.map +1 -0
  45. package/dist/cjs/src/client/plans.cjs +204 -0
  46. package/dist/cjs/src/client/plans.d.cts +247 -0
  47. package/dist/cjs/src/client/plans.js.map +1 -0
  48. package/dist/cjs/src/client/portal.cjs +55 -0
  49. package/dist/cjs/src/client/portal.d.cts +48 -0
  50. package/dist/cjs/src/client/portal.js.map +1 -0
  51. package/dist/cjs/src/client/schemas.cjs +3 -0
  52. package/dist/cjs/src/client/schemas.d.cts +25246 -0
  53. package/dist/cjs/src/client/schemas.js.map +1 -0
  54. package/dist/cjs/src/client/subjects.cjs +76 -0
  55. package/dist/cjs/src/client/subjects.d.cts +70 -0
  56. package/dist/cjs/src/client/subjects.js.map +1 -0
  57. package/dist/cjs/src/client/subscription-addons.cjs +70 -0
  58. package/dist/cjs/src/client/subscription-addons.d.cts +123 -0
  59. package/dist/cjs/src/client/subscription-addons.js.map +1 -0
  60. package/dist/cjs/src/client/subscriptions.cjs +132 -0
  61. package/dist/cjs/src/client/subscriptions.d.cts +170 -0
  62. package/dist/cjs/src/client/subscriptions.js.map +1 -0
  63. package/dist/cjs/src/client/utils.cjs +69 -0
  64. package/dist/cjs/src/client/utils.d.cts +12 -0
  65. package/dist/cjs/src/client/utils.js.map +1 -0
  66. package/dist/cjs/src/portal/index.cjs +89 -0
  67. package/dist/cjs/src/portal/index.d.cts +43 -0
  68. package/dist/cjs/src/portal/index.js.map +1 -0
  69. package/dist/cjs/src/react/context.cjs +35 -0
  70. package/dist/cjs/src/react/context.d.cts +9 -0
  71. package/dist/cjs/src/react/context.js.map +1 -0
  72. package/dist/cjs/src/zod/index.cjs +12205 -0
  73. package/dist/cjs/src/zod/index.d.cts +19139 -0
  74. package/dist/cjs/src/zod/index.js.map +1 -0
  75. package/dist/cjs/tsconfig.0bedc47d.tsbuildinfo +1 -0
  76. package/dist/cjs/tsconfig.c449a50f.tsbuildinfo +1 -0
  77. package/dist/index.d.ts +1 -14
  78. package/dist/index.js +2 -15
  79. package/dist/index.js.map +1 -0
  80. package/dist/src/client/addons.d.ts +152 -0
  81. package/dist/src/client/addons.js +101 -0
  82. package/dist/src/client/addons.js.map +1 -0
  83. package/dist/src/client/apps.d.ts +327 -0
  84. package/dist/src/client/apps.js +240 -0
  85. package/dist/src/client/apps.js.map +1 -0
  86. package/dist/src/client/billing.d.ts +526 -0
  87. package/dist/src/client/billing.js +354 -0
  88. package/dist/src/client/billing.js.map +1 -0
  89. package/dist/src/client/common.d.ts +30 -0
  90. package/dist/src/client/common.js +42 -0
  91. package/dist/src/client/common.js.map +1 -0
  92. package/dist/src/client/customers.d.ts +251 -0
  93. package/dist/src/client/customers.js +276 -0
  94. package/dist/src/client/customers.js.map +1 -0
  95. package/dist/src/client/debug.d.ts +17 -0
  96. package/dist/src/client/debug.js +23 -0
  97. package/dist/src/client/debug.js.map +1 -0
  98. package/dist/src/client/entitlements.d.ts +556 -0
  99. package/dist/src/client/entitlements.js +276 -0
  100. package/dist/src/client/entitlements.js.map +1 -0
  101. package/dist/src/client/events.d.ts +48 -0
  102. package/dist/src/client/events.js +108 -0
  103. package/dist/src/client/events.js.map +1 -0
  104. package/dist/src/client/features.d.ts +78 -0
  105. package/dist/src/client/features.js +74 -0
  106. package/dist/src/client/features.js.map +1 -0
  107. package/dist/src/client/index.d.ts +53 -0
  108. package/dist/src/client/index.js +80 -0
  109. package/dist/src/client/index.js.map +1 -0
  110. package/dist/src/client/info.d.ts +34 -0
  111. package/dist/src/client/info.js +38 -0
  112. package/dist/src/client/info.js.map +1 -0
  113. package/dist/src/client/meters.d.ts +123 -0
  114. package/dist/src/client/meters.js +111 -0
  115. package/dist/src/client/meters.js.map +1 -0
  116. package/dist/src/client/notifications.d.ts +397 -0
  117. package/dist/src/client/notifications.js +242 -0
  118. package/dist/src/client/notifications.js.map +1 -0
  119. package/dist/src/client/plans.d.ts +247 -0
  120. package/dist/src/client/plans.js +199 -0
  121. package/dist/src/client/plans.js.map +1 -0
  122. package/dist/src/client/portal.d.ts +48 -0
  123. package/dist/src/client/portal.js +51 -0
  124. package/dist/src/client/portal.js.map +1 -0
  125. package/dist/src/client/schemas.d.ts +25246 -0
  126. package/dist/src/client/schemas.js +2 -0
  127. package/dist/src/client/schemas.js.map +1 -0
  128. package/dist/src/client/subjects.d.ts +70 -0
  129. package/dist/src/client/subjects.js +72 -0
  130. package/dist/src/client/subjects.js.map +1 -0
  131. package/dist/src/client/subscription-addons.d.ts +123 -0
  132. package/dist/src/client/subscription-addons.js +66 -0
  133. package/dist/src/client/subscription-addons.js.map +1 -0
  134. package/dist/src/client/subscriptions.d.ts +170 -0
  135. package/dist/src/client/subscriptions.js +128 -0
  136. package/dist/src/client/subscriptions.js.map +1 -0
  137. package/dist/src/client/utils.d.ts +12 -0
  138. package/dist/src/client/utils.js +63 -0
  139. package/dist/src/client/utils.js.map +1 -0
  140. package/dist/src/portal/index.d.ts +43 -0
  141. package/dist/src/portal/index.js +52 -0
  142. package/dist/src/portal/index.js.map +1 -0
  143. package/dist/src/react/context.d.ts +9 -0
  144. package/dist/src/react/context.js +16 -0
  145. package/dist/src/react/context.js.map +1 -0
  146. package/dist/src/zod/index.d.ts +19139 -0
  147. package/dist/src/zod/index.js +12178 -0
  148. package/dist/src/zod/index.js.map +1 -0
  149. package/dist/tsconfig.tsbuildinfo +1 -1
  150. package/orval.config.ts +42 -0
  151. package/package.json +89 -35
  152. package/patches/openapi-typescript.patch +6194 -0
  153. package/dist/clients/client.d.ts +0 -40
  154. package/dist/clients/client.js +0 -104
  155. package/dist/clients/event.d.ts +0 -79
  156. package/dist/clients/event.js +0 -53
  157. package/dist/clients/meter.d.ts +0 -71
  158. package/dist/clients/meter.js +0 -64
  159. package/dist/clients/portal.d.ts +0 -23
  160. package/dist/clients/portal.js +0 -37
  161. package/dist/next.d.ts +0 -15
  162. package/dist/next.js +0 -46
  163. package/dist/schemas/openapi.d.ts +0 -460
  164. package/dist/schemas/openapi.js +0 -5
  165. package/dist/test/agent.d.ts +0 -2
  166. package/dist/test/agent.js +0 -178
  167. package/dist/test/mocks.d.ts +0 -12
  168. package/dist/test/mocks.js +0 -32
  169. package/index.ts +0 -22
  170. package/next.ts +0 -76
@@ -0,0 +1,556 @@
1
+ import type { RequestOptions } from './common.js';
2
+ import type { EntitlementCreateInputs, EntitlementGrantCreateInput, operations, paths, ResetEntitlementUsageInput } from './schemas.js';
3
+ import type { Client } from 'openapi-fetch';
4
+ /**
5
+ * Entitlements
6
+ * @description With Entitlements, you can define and enforce usage limits, implement quota-based pricing, and manage access to features in your application.
7
+ */
8
+ export declare class Entitlements {
9
+ private client;
10
+ grants: Grants;
11
+ constructor(client: Client<paths, `${string}/${string}`>);
12
+ /**
13
+ * Create an entitlement
14
+ *
15
+ * - Boolean entitlements define static feature access, e.g. "Can use SSO authentication".
16
+ * - Static entitlements let you pass along a configuration while granting access, e.g. "Using this feature with X Y settings" (passed in the config).
17
+ * - 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.
18
+ *
19
+ * 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.
20
+ *
21
+ * Once an entitlement is created you cannot modify it, only delete it.
22
+ *
23
+ * @param subjectIdOrKey - The ID or key of the subject
24
+ * @param entitlement - The entitlement to create
25
+ * @param signal - An optional abort signal
26
+ * @returns The created entitlement
27
+ */
28
+ create(subjectIdOrKey: operations['createEntitlement']['parameters']['path']['subjectIdOrKey'], entitlement: EntitlementCreateInputs, options?: RequestOptions): Promise<import("openapi-typescript-helpers").SuccessResponse<{
29
+ 201: {
30
+ headers: {
31
+ [name: string]: unknown;
32
+ };
33
+ content: {
34
+ "application/json": import("./schemas.js").components["schemas"]["Entitlement"];
35
+ };
36
+ };
37
+ 400: {
38
+ headers: {
39
+ [name: string]: unknown;
40
+ };
41
+ content: {
42
+ "application/problem+json": import("./schemas.js").components["schemas"]["BadRequestProblemResponse"];
43
+ };
44
+ };
45
+ 401: {
46
+ headers: {
47
+ [name: string]: unknown;
48
+ };
49
+ content: {
50
+ "application/problem+json": import("./schemas.js").components["schemas"]["UnauthorizedProblemResponse"];
51
+ };
52
+ };
53
+ 403: {
54
+ headers: {
55
+ [name: string]: unknown;
56
+ };
57
+ content: {
58
+ "application/problem+json": import("./schemas.js").components["schemas"]["ForbiddenProblemResponse"];
59
+ };
60
+ };
61
+ 409: {
62
+ headers: {
63
+ [name: string]: unknown;
64
+ };
65
+ content: {
66
+ "application/problem+json": import("./schemas.js").components["schemas"]["ConflictProblemResponse"];
67
+ };
68
+ };
69
+ 412: {
70
+ headers: {
71
+ [name: string]: unknown;
72
+ };
73
+ content: {
74
+ "application/problem+json": import("./schemas.js").components["schemas"]["PreconditionFailedProblemResponse"];
75
+ };
76
+ };
77
+ 500: {
78
+ headers: {
79
+ [name: string]: unknown;
80
+ };
81
+ content: {
82
+ "application/problem+json": import("./schemas.js").components["schemas"]["InternalServerErrorProblemResponse"];
83
+ };
84
+ };
85
+ 503: {
86
+ headers: {
87
+ [name: string]: unknown;
88
+ };
89
+ content: {
90
+ "application/problem+json": import("./schemas.js").components["schemas"]["ServiceUnavailableProblemResponse"];
91
+ };
92
+ };
93
+ default: {
94
+ headers: {
95
+ [name: string]: unknown;
96
+ };
97
+ content: {
98
+ "application/problem+json": import("./schemas.js").components["schemas"]["UnexpectedProblemResponse"];
99
+ };
100
+ };
101
+ }, `${string}/${string}`>>;
102
+ /**
103
+ * Get an entitlement by ID
104
+ *
105
+ * @param id - The ID of the entitlement
106
+ * @param signal - An optional abort signal
107
+ * @returns The entitlement
108
+ */
109
+ get(id: operations['getEntitlement']['parameters']['path']['entitlementId'], options?: RequestOptions): Promise<import("openapi-typescript-helpers").SuccessResponse<{
110
+ 200: {
111
+ headers: {
112
+ [name: string]: unknown;
113
+ };
114
+ content: {
115
+ "application/json": import("./schemas.js").components["schemas"]["Entitlement"];
116
+ };
117
+ };
118
+ 400: {
119
+ headers: {
120
+ [name: string]: unknown;
121
+ };
122
+ content: {
123
+ "application/problem+json": import("./schemas.js").components["schemas"]["BadRequestProblemResponse"];
124
+ };
125
+ };
126
+ 401: {
127
+ headers: {
128
+ [name: string]: unknown;
129
+ };
130
+ content: {
131
+ "application/problem+json": import("./schemas.js").components["schemas"]["UnauthorizedProblemResponse"];
132
+ };
133
+ };
134
+ 403: {
135
+ headers: {
136
+ [name: string]: unknown;
137
+ };
138
+ content: {
139
+ "application/problem+json": import("./schemas.js").components["schemas"]["ForbiddenProblemResponse"];
140
+ };
141
+ };
142
+ 404: {
143
+ headers: {
144
+ [name: string]: unknown;
145
+ };
146
+ content: {
147
+ "application/problem+json": import("./schemas.js").components["schemas"]["NotFoundProblemResponse"];
148
+ };
149
+ };
150
+ 412: {
151
+ headers: {
152
+ [name: string]: unknown;
153
+ };
154
+ content: {
155
+ "application/problem+json": import("./schemas.js").components["schemas"]["PreconditionFailedProblemResponse"];
156
+ };
157
+ };
158
+ 500: {
159
+ headers: {
160
+ [name: string]: unknown;
161
+ };
162
+ content: {
163
+ "application/problem+json": import("./schemas.js").components["schemas"]["InternalServerErrorProblemResponse"];
164
+ };
165
+ };
166
+ 503: {
167
+ headers: {
168
+ [name: string]: unknown;
169
+ };
170
+ content: {
171
+ "application/problem+json": import("./schemas.js").components["schemas"]["ServiceUnavailableProblemResponse"];
172
+ };
173
+ };
174
+ default: {
175
+ headers: {
176
+ [name: string]: unknown;
177
+ };
178
+ content: {
179
+ "application/problem+json": import("./schemas.js").components["schemas"]["UnexpectedProblemResponse"];
180
+ };
181
+ };
182
+ }, `${string}/${string}`>>;
183
+ /**
184
+ * List entitlements
185
+ *
186
+ * @param query - The query parameters
187
+ * @param signal - An optional abort signal
188
+ * @returns The entitlements
189
+ */
190
+ list(query?: Omit<operations['listEntitlements']['parameters']['query'], 'page' | 'pageSize'>, options?: RequestOptions): Promise<({
191
+ type: "metered";
192
+ isSoftLimit?: boolean;
193
+ isUnlimited?: boolean;
194
+ issueAfterReset?: number;
195
+ issueAfterResetPriority?: number;
196
+ preserveOverageAtReset?: boolean;
197
+ readonly createdAt: Date;
198
+ readonly updatedAt: Date;
199
+ readonly deletedAt?: Date;
200
+ metadata?: import("./schemas.js").components["schemas"]["Metadata"];
201
+ activeFrom: Date;
202
+ activeTo?: Date;
203
+ readonly annotations?: import("./schemas.js").components["schemas"]["Annotations"];
204
+ readonly id: string;
205
+ subjectKey: string;
206
+ featureKey: string;
207
+ featureId: string;
208
+ readonly lastReset: Date;
209
+ readonly currentUsagePeriod: import("./schemas.js").components["schemas"]["Period"];
210
+ readonly measureUsageFrom: Date;
211
+ readonly usagePeriod: import("./schemas.js").components["schemas"]["RecurringPeriod"];
212
+ } | {
213
+ type: "static";
214
+ config: string;
215
+ readonly createdAt: Date;
216
+ readonly updatedAt: Date;
217
+ readonly deletedAt?: Date;
218
+ metadata?: import("./schemas.js").components["schemas"]["Metadata"];
219
+ activeFrom: Date;
220
+ activeTo?: Date;
221
+ readonly annotations?: import("./schemas.js").components["schemas"]["Annotations"];
222
+ readonly id: string;
223
+ subjectKey: string;
224
+ featureKey: string;
225
+ featureId: string;
226
+ currentUsagePeriod?: import("./schemas.js").components["schemas"]["Period"];
227
+ usagePeriod?: import("./schemas.js").components["schemas"]["RecurringPeriod"];
228
+ } | ({
229
+ type: "boolean";
230
+ readonly createdAt: Date;
231
+ readonly updatedAt: Date;
232
+ readonly deletedAt?: Date;
233
+ metadata?: import("./schemas.js").components["schemas"]["Metadata"];
234
+ activeFrom: Date;
235
+ activeTo?: Date;
236
+ readonly annotations?: import("./schemas.js").components["schemas"]["Annotations"];
237
+ readonly id: string;
238
+ subjectKey: string;
239
+ featureKey: string;
240
+ featureId: string;
241
+ currentUsagePeriod?: import("./schemas.js").components["schemas"]["Period"];
242
+ usagePeriod?: import("./schemas.js").components["schemas"]["RecurringPeriod"];
243
+ } & {
244
+ readonly createdAt: Date;
245
+ readonly updatedAt: Date;
246
+ readonly deletedAt?: Date;
247
+ metadata?: import("./schemas.js").components["schemas"]["Metadata"];
248
+ activeFrom: Date;
249
+ activeTo?: Date;
250
+ readonly annotations?: import("./schemas.js").components["schemas"]["Annotations"];
251
+ readonly id: string;
252
+ type: import("./schemas.js").components["schemas"]["EntitlementType"];
253
+ subjectKey: string;
254
+ featureKey: string;
255
+ featureId: string;
256
+ currentUsagePeriod?: import("./schemas.js").components["schemas"]["Period"];
257
+ usagePeriod?: import("./schemas.js").components["schemas"]["RecurringPeriod"];
258
+ } & {
259
+ readonly id: string;
260
+ readonly createdAt: Date;
261
+ readonly updatedAt: Date;
262
+ type: import("./schemas.js").components["schemas"]["EntitlementType"];
263
+ activeFrom: Date;
264
+ subjectKey: string;
265
+ featureKey: string;
266
+ featureId: string;
267
+ } & {
268
+ type: "boolean";
269
+ }))[]>;
270
+ /**
271
+ * Delete an entitlement
272
+ *
273
+ * @param subjectIdOrKey - The ID or key of the subject
274
+ * @param entitlementId - The ID of the entitlement
275
+ * @param signal - An optional abort signal
276
+ * @returns The deleted entitlement
277
+ */
278
+ delete(subjectIdOrKey: operations['deleteEntitlement']['parameters']['path']['subjectIdOrKey'], entitlementId: operations['deleteEntitlement']['parameters']['path']['entitlementId'], options?: RequestOptions): Promise<undefined>;
279
+ /**
280
+ * Get the value of an entitlement to check access
281
+ * All entitlement types share the hasAccess property in their value response, but multiple other properties are returned based on the entitlement type.
282
+ *
283
+ * @param subjectIdOrKey - The ID or key of the subject
284
+ * @param entitlementIdOrFeatureKey - The ID or feature key of the entitlement
285
+ * @param query - The query parameters
286
+ * @param signal - An optional abort signal
287
+ * @returns The entitlement value
288
+ */
289
+ value(subjectIdOrKey: operations['getEntitlementValue']['parameters']['path']['subjectIdOrKey'], entitlementIdOrFeatureKey: operations['getEntitlementValue']['parameters']['path']['entitlementIdOrFeatureKey'], query?: operations['getEntitlementValue']['parameters']['query'], options?: RequestOptions): Promise<{
290
+ readonly hasAccess: boolean;
291
+ readonly balance?: number;
292
+ readonly usage?: number;
293
+ readonly overage?: number;
294
+ readonly config?: string;
295
+ }>;
296
+ /**
297
+ * Get the history of an entitlement
298
+ * Returns historical balance and usage data for the entitlement. The queried history can span accross multiple reset events.
299
+ *
300
+ * @param subjectIdOrKey - The ID or key of the subject
301
+ * @param entitlementId - The ID of the entitlement
302
+ * @param query - The query parameters
303
+ * @param signal - An optional abort signal
304
+ * @returns The history of the entitlement
305
+ */
306
+ history(subjectIdOrKey: operations['getEntitlementHistory']['parameters']['path']['subjectIdOrKey'], entitlementId: operations['getEntitlementHistory']['parameters']['path']['entitlementId'], query: operations['getEntitlementHistory']['parameters']['query'], options?: RequestOptions): Promise<{
307
+ windowedHistory: import("./schemas.js").components["schemas"]["BalanceHistoryWindow"][];
308
+ burndownHistory: import("./schemas.js").components["schemas"]["GrantBurnDownHistorySegment"][];
309
+ }>;
310
+ /**
311
+ * Override an entitlement
312
+ * This is useful for upgrades, downgrades, or other changes to entitlements that require a new entitlement to be created with zero downtime.
313
+ *
314
+ * @param subjectIdOrKey - The ID or key of the subject
315
+ * @param entitlementIdOrFeatureKey - The ID or feature key of the entitlement
316
+ * @param override - The override to create
317
+ * @param signal - An optional abort signal
318
+ * @returns The overridden entitlement
319
+ */
320
+ override(subjectIdOrKey: operations['overrideEntitlement']['parameters']['path']['subjectIdOrKey'], entitlementIdOrFeatureKey: operations['overrideEntitlement']['parameters']['path']['entitlementIdOrFeatureKey'], override: EntitlementCreateInputs, options?: RequestOptions): Promise<import("openapi-typescript-helpers").SuccessResponse<{
321
+ 201: {
322
+ headers: {
323
+ [name: string]: unknown;
324
+ };
325
+ content: {
326
+ "application/json": import("./schemas.js").components["schemas"]["Entitlement"];
327
+ };
328
+ };
329
+ 400: {
330
+ headers: {
331
+ [name: string]: unknown;
332
+ };
333
+ content: {
334
+ "application/problem+json": import("./schemas.js").components["schemas"]["BadRequestProblemResponse"];
335
+ };
336
+ };
337
+ 401: {
338
+ headers: {
339
+ [name: string]: unknown;
340
+ };
341
+ content: {
342
+ "application/problem+json": import("./schemas.js").components["schemas"]["UnauthorizedProblemResponse"];
343
+ };
344
+ };
345
+ 403: {
346
+ headers: {
347
+ [name: string]: unknown;
348
+ };
349
+ content: {
350
+ "application/problem+json": import("./schemas.js").components["schemas"]["ForbiddenProblemResponse"];
351
+ };
352
+ };
353
+ 404: {
354
+ headers: {
355
+ [name: string]: unknown;
356
+ };
357
+ content: {
358
+ "application/problem+json": import("./schemas.js").components["schemas"]["NotFoundProblemResponse"];
359
+ };
360
+ };
361
+ 409: {
362
+ headers: {
363
+ [name: string]: unknown;
364
+ };
365
+ content: {
366
+ "application/problem+json": import("./schemas.js").components["schemas"]["ConflictProblemResponse"];
367
+ };
368
+ };
369
+ 412: {
370
+ headers: {
371
+ [name: string]: unknown;
372
+ };
373
+ content: {
374
+ "application/problem+json": import("./schemas.js").components["schemas"]["PreconditionFailedProblemResponse"];
375
+ };
376
+ };
377
+ 500: {
378
+ headers: {
379
+ [name: string]: unknown;
380
+ };
381
+ content: {
382
+ "application/problem+json": import("./schemas.js").components["schemas"]["InternalServerErrorProblemResponse"];
383
+ };
384
+ };
385
+ 503: {
386
+ headers: {
387
+ [name: string]: unknown;
388
+ };
389
+ content: {
390
+ "application/problem+json": import("./schemas.js").components["schemas"]["ServiceUnavailableProblemResponse"];
391
+ };
392
+ };
393
+ default: {
394
+ headers: {
395
+ [name: string]: unknown;
396
+ };
397
+ content: {
398
+ "application/problem+json": import("./schemas.js").components["schemas"]["UnexpectedProblemResponse"];
399
+ };
400
+ };
401
+ }, `${string}/${string}`>>;
402
+ /**
403
+ * Reset entitlement usage
404
+ * - 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.
405
+ * - 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.
406
+ *
407
+ * @param subjectIdOrKey - The ID or key of the subject
408
+ * @param entitlementId - The ID of the entitlement
409
+ * @param body - The body of the request
410
+ * @param signal - An optional abort signal
411
+ * @returns The reset entitlement
412
+ */
413
+ reset(subjectIdOrKey: operations['resetEntitlementUsage']['parameters']['path']['subjectIdOrKey'], entitlementId: operations['resetEntitlementUsage']['parameters']['path']['entitlementId'], body: ResetEntitlementUsageInput, options?: RequestOptions): Promise<undefined>;
414
+ }
415
+ export declare class Grants {
416
+ private client;
417
+ constructor(client: Client<paths, `${string}/${string}`>);
418
+ /**
419
+ * Grant usage to a subject for an entitlement
420
+ *
421
+ * @param subjectIdOrKey - The ID or key of the subject
422
+ * @param entitlementIdOrFeatureKey - The ID or feature key of the entitlement
423
+ * @param grant - The grant to create
424
+ * @param signal - An optional abort signal
425
+ * @returns The created grant
426
+ */
427
+ create(subjectIdOrKey: operations['createGrant']['parameters']['path']['subjectIdOrKey'], entitlementIdOrFeatureKey: operations['createGrant']['parameters']['path']['entitlementIdOrFeatureKey'], grant: EntitlementGrantCreateInput, options?: RequestOptions): Promise<{
428
+ readonly createdAt: Date;
429
+ readonly updatedAt: Date;
430
+ readonly deletedAt?: Date;
431
+ amount: number;
432
+ priority?: number;
433
+ effectiveAt: Date;
434
+ expiration: import("./schemas.js").components["schemas"]["ExpirationPeriod"];
435
+ maxRolloverAmount?: number;
436
+ minRolloverAmount?: number;
437
+ metadata?: import("./schemas.js").components["schemas"]["Metadata"];
438
+ readonly id: string;
439
+ readonly entitlementId: string;
440
+ nextRecurrence?: Date;
441
+ readonly expiresAt?: Date;
442
+ voidedAt?: Date;
443
+ recurrence?: import("./schemas.js").components["schemas"]["RecurringPeriod"];
444
+ }>;
445
+ /**
446
+ * List grants for an entitlement
447
+ *
448
+ * @param subjectIdOrKey - The ID or key of the subject
449
+ * @param entitlementIdOrFeatureKey - The ID or feature key of the entitlement
450
+ * @param signal - An optional abort signal
451
+ * @returns The grants
452
+ */
453
+ list(subjectIdOrKey: operations['listEntitlementGrants']['parameters']['path']['subjectIdOrKey'], entitlementIdOrFeatureKey: operations['listEntitlementGrants']['parameters']['path']['entitlementIdOrFeatureKey'], query?: operations['listEntitlementGrants']['parameters']['query'], options?: RequestOptions): Promise<{
454
+ readonly createdAt: Date;
455
+ readonly updatedAt: Date;
456
+ readonly deletedAt?: Date;
457
+ amount: number;
458
+ priority?: number;
459
+ effectiveAt: Date;
460
+ expiration: import("./schemas.js").components["schemas"]["ExpirationPeriod"];
461
+ maxRolloverAmount?: number;
462
+ minRolloverAmount?: number;
463
+ metadata?: import("./schemas.js").components["schemas"]["Metadata"];
464
+ readonly id: string;
465
+ readonly entitlementId: string;
466
+ nextRecurrence?: Date;
467
+ readonly expiresAt?: Date;
468
+ voidedAt?: Date;
469
+ recurrence?: import("./schemas.js").components["schemas"]["RecurringPeriod"];
470
+ }[]>;
471
+ /**
472
+ * List all grants
473
+ * List all grants for all the subjects and entitlements.
474
+ *
475
+ * @param query - The query parameters
476
+ * @param options - The request options
477
+ * @returns The grants
478
+ */
479
+ listAll(query?: operations['listGrants']['parameters']['query'], options?: RequestOptions): Promise<import("openapi-typescript-helpers").SuccessResponse<{
480
+ 200: {
481
+ headers: {
482
+ [name: string]: unknown;
483
+ };
484
+ content: {
485
+ "application/json": import("./schemas.js").components["schemas"]["EntitlementGrant"][] | import("./schemas.js").components["schemas"]["GrantPaginatedResponse"];
486
+ };
487
+ };
488
+ 400: {
489
+ headers: {
490
+ [name: string]: unknown;
491
+ };
492
+ content: {
493
+ "application/problem+json": import("./schemas.js").components["schemas"]["BadRequestProblemResponse"];
494
+ };
495
+ };
496
+ 401: {
497
+ headers: {
498
+ [name: string]: unknown;
499
+ };
500
+ content: {
501
+ "application/problem+json": import("./schemas.js").components["schemas"]["UnauthorizedProblemResponse"];
502
+ };
503
+ };
504
+ 403: {
505
+ headers: {
506
+ [name: string]: unknown;
507
+ };
508
+ content: {
509
+ "application/problem+json": import("./schemas.js").components["schemas"]["ForbiddenProblemResponse"];
510
+ };
511
+ };
512
+ 412: {
513
+ headers: {
514
+ [name: string]: unknown;
515
+ };
516
+ content: {
517
+ "application/problem+json": import("./schemas.js").components["schemas"]["PreconditionFailedProblemResponse"];
518
+ };
519
+ };
520
+ 500: {
521
+ headers: {
522
+ [name: string]: unknown;
523
+ };
524
+ content: {
525
+ "application/problem+json": import("./schemas.js").components["schemas"]["InternalServerErrorProblemResponse"];
526
+ };
527
+ };
528
+ 503: {
529
+ headers: {
530
+ [name: string]: unknown;
531
+ };
532
+ content: {
533
+ "application/problem+json": import("./schemas.js").components["schemas"]["ServiceUnavailableProblemResponse"];
534
+ };
535
+ };
536
+ default: {
537
+ headers: {
538
+ [name: string]: unknown;
539
+ };
540
+ content: {
541
+ "application/problem+json": import("./schemas.js").components["schemas"]["UnexpectedProblemResponse"];
542
+ };
543
+ };
544
+ }, `${string}/${string}`>>;
545
+ /**
546
+ * Void a grant
547
+ * Voiding a grant means it is no longer valid, it doesn't take part in further balance calculations.
548
+ * Voiding a grant does not retroactively take effect, meaning any usage that has already been attributed
549
+ * to the grant will remain, but future usage cannot be burnt down from the grant.
550
+ *
551
+ * @param grantId - The ID of the grant
552
+ * @param options - The request options
553
+ * @returns The voided grant
554
+ */
555
+ void(grantId: operations['voidGrant']['parameters']['path']['grantId'], options?: RequestOptions): Promise<undefined>;
556
+ }