@openmeter/sdk 1.0.0-beta-7b2d9ed372e3 → 1.0.0-beta-bbb2af6bf3b0

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 (90) hide show
  1. package/dist/cjs/{tsconfig.3bd7bdb7.tsbuildinfo → tsconfig.7b29505b.tsbuildinfo} +1 -1
  2. package/dist/cjs/{tsconfig.769a7751.tsbuildinfo → tsconfig.e592f80c.tsbuildinfo} +1 -1
  3. package/dist/tsconfig.tsbuildinfo +1 -1
  4. package/package.json +1 -1
  5. package/dist/cjs/src/apps.cjs +0 -176
  6. package/dist/cjs/src/apps.d.cts +0 -338
  7. package/dist/cjs/src/apps.js.map +0 -1
  8. package/dist/cjs/src/billing.cjs +0 -309
  9. package/dist/cjs/src/billing.d.cts +0 -645
  10. package/dist/cjs/src/billing.js.map +0 -1
  11. package/dist/cjs/src/customers.cjs +0 -185
  12. package/dist/cjs/src/customers.d.cts +0 -231
  13. package/dist/cjs/src/customers.js.map +0 -1
  14. package/dist/cjs/src/entitlements.cjs +0 -244
  15. package/dist/cjs/src/entitlements.d.cts +0 -505
  16. package/dist/cjs/src/entitlements.js.map +0 -1
  17. package/dist/cjs/src/events.cjs +0 -65
  18. package/dist/cjs/src/events.d.cts +0 -101
  19. package/dist/cjs/src/events.js.map +0 -1
  20. package/dist/cjs/src/features.cjs +0 -78
  21. package/dist/cjs/src/features.d.cts +0 -153
  22. package/dist/cjs/src/features.js.map +0 -1
  23. package/dist/cjs/src/meters.cjs +0 -93
  24. package/dist/cjs/src/meters.d.cts +0 -184
  25. package/dist/cjs/src/meters.js.map +0 -1
  26. package/dist/cjs/src/notifications.cjs +0 -249
  27. package/dist/cjs/src/notifications.d.cts +0 -314
  28. package/dist/cjs/src/notifications.js.map +0 -1
  29. package/dist/cjs/src/plans.cjs +0 -127
  30. package/dist/cjs/src/plans.d.cts +0 -192
  31. package/dist/cjs/src/plans.js.map +0 -1
  32. package/dist/cjs/src/subjects.cjs +0 -76
  33. package/dist/cjs/src/subjects.d.cts +0 -101
  34. package/dist/cjs/src/subjects.js.map +0 -1
  35. package/dist/cjs/src/subscriptions.cjs +0 -116
  36. package/dist/cjs/src/subscriptions.d.cts +0 -197
  37. package/dist/cjs/src/subscriptions.js.map +0 -1
  38. package/dist/cjs/src/utils.cjs +0 -93
  39. package/dist/cjs/src/utils.d.cts +0 -29
  40. package/dist/cjs/src/utils.js.map +0 -1
  41. package/dist/cjs/tsconfig.01ab6c6b.tsbuildinfo +0 -1
  42. package/dist/cjs/tsconfig.1e12acbb.tsbuildinfo +0 -1
  43. package/dist/cjs/tsconfig.38849cd1.tsbuildinfo +0 -1
  44. package/dist/cjs/tsconfig.3db00db7.tsbuildinfo +0 -1
  45. package/dist/cjs/tsconfig.5cd8af0a.tsbuildinfo +0 -1
  46. package/dist/cjs/tsconfig.64c40770.tsbuildinfo +0 -1
  47. package/dist/cjs/tsconfig.8fd1c6cd.tsbuildinfo +0 -1
  48. package/dist/cjs/tsconfig.c9e83bdd.tsbuildinfo +0 -1
  49. package/dist/cjs/tsconfig.d3cb3b9e.tsbuildinfo +0 -1
  50. package/dist/cjs/tsconfig.db7aa141.tsbuildinfo +0 -1
  51. package/dist/cjs/tsconfig.edd7b7ed.tsbuildinfo +0 -1
  52. package/dist/cjs/tsconfig.f343a141.tsbuildinfo +0 -1
  53. package/dist/cjs/tsconfig.f36f8639.tsbuildinfo +0 -1
  54. package/dist/cjs/tsconfig.fc8d5fa4.tsbuildinfo +0 -1
  55. package/dist/src/apps.d.ts +0 -338
  56. package/dist/src/apps.js +0 -170
  57. package/dist/src/apps.js.map +0 -1
  58. package/dist/src/billing.d.ts +0 -645
  59. package/dist/src/billing.js +0 -302
  60. package/dist/src/billing.js.map +0 -1
  61. package/dist/src/customers.d.ts +0 -231
  62. package/dist/src/customers.js +0 -179
  63. package/dist/src/customers.js.map +0 -1
  64. package/dist/src/entitlements.d.ts +0 -505
  65. package/dist/src/entitlements.js +0 -239
  66. package/dist/src/entitlements.js.map +0 -1
  67. package/dist/src/events.d.ts +0 -101
  68. package/dist/src/events.js +0 -58
  69. package/dist/src/events.js.map +0 -1
  70. package/dist/src/features.d.ts +0 -153
  71. package/dist/src/features.js +0 -74
  72. package/dist/src/features.js.map +0 -1
  73. package/dist/src/meters.d.ts +0 -184
  74. package/dist/src/meters.js +0 -89
  75. package/dist/src/meters.js.map +0 -1
  76. package/dist/src/notifications.d.ts +0 -314
  77. package/dist/src/notifications.js +0 -242
  78. package/dist/src/notifications.js.map +0 -1
  79. package/dist/src/plans.d.ts +0 -192
  80. package/dist/src/plans.js +0 -123
  81. package/dist/src/plans.js.map +0 -1
  82. package/dist/src/subjects.d.ts +0 -101
  83. package/dist/src/subjects.js +0 -72
  84. package/dist/src/subjects.js.map +0 -1
  85. package/dist/src/subscriptions.d.ts +0 -197
  86. package/dist/src/subscriptions.js +0 -112
  87. package/dist/src/subscriptions.js.map +0 -1
  88. package/dist/src/utils.d.ts +0 -29
  89. package/dist/src/utils.js +0 -85
  90. package/dist/src/utils.js.map +0 -1
@@ -1,179 +0,0 @@
1
- import { transformResponse } from './utils.js';
2
- /**
3
- * Customers
4
- * Manage customer subscription lifecycles and plan assignments.
5
- */
6
- export class Customers {
7
- client;
8
- apps;
9
- entitlements;
10
- constructor(client) {
11
- this.client = client;
12
- this.apps = new CustomerApps(client);
13
- this.entitlements = new CustomerEntitlements(client);
14
- }
15
- /**
16
- * Create a customer
17
- * @param customer - The customer to create
18
- * @param signal - An optional abort signal
19
- * @returns The created customer
20
- */
21
- async create(customer, signal) {
22
- const resp = await this.client.POST('/api/v1/customers', {
23
- signal,
24
- body: customer,
25
- });
26
- return transformResponse(resp);
27
- }
28
- /**
29
- * Get a customer by ID
30
- * @param id - The ID of the customer
31
- * @param signal - An optional abort signal
32
- * @returns The customer
33
- */
34
- async get(id, signal) {
35
- const resp = await this.client.GET('/api/v1/customers/{id}', {
36
- signal,
37
- params: {
38
- path: {
39
- id,
40
- },
41
- },
42
- });
43
- return transformResponse(resp);
44
- }
45
- /**
46
- * Update a customer
47
- * @param id - The ID of the customer
48
- * @param customer - The customer to update
49
- * @param signal - An optional abort signal
50
- * @returns The updated customer
51
- */
52
- async update(id, customer, signal) {
53
- const resp = await this.client.PUT('/api/v1/customers/{id}', {
54
- signal,
55
- params: {
56
- path: {
57
- id,
58
- },
59
- },
60
- body: customer,
61
- });
62
- return transformResponse(resp);
63
- }
64
- /**
65
- * Delete a customer
66
- * @param id - The ID of the customer
67
- * @param signal - An optional abort signal
68
- * @returns The deleted customer
69
- */
70
- async delete(id, signal) {
71
- const resp = await this.client.DELETE('/api/v1/customers/{id}', {
72
- signal,
73
- params: {
74
- path: {
75
- id,
76
- },
77
- },
78
- });
79
- return transformResponse(resp);
80
- }
81
- /**
82
- * List customers
83
- * @param signal - An optional abort signal
84
- * @returns The list of customers
85
- */
86
- async list(query, signal) {
87
- const resp = await this.client.GET('/api/v1/customers', {
88
- signal,
89
- params: {
90
- query,
91
- },
92
- });
93
- return transformResponse(resp);
94
- }
95
- }
96
- /**
97
- * Customer Apps
98
- * Manage customer apps.
99
- */
100
- export class CustomerApps {
101
- client;
102
- constructor(client) {
103
- this.client = client;
104
- }
105
- /**
106
- * Upsert customer app data
107
- * @param customerId - The ID of the customer
108
- * @param appData - The app data to upsert
109
- * @param signal - An optional abort signal
110
- * @returns The upserted app data
111
- */
112
- async upsert(customerId, appData, signal) {
113
- const resp = await this.client.PUT('/api/v1/customers/{customerId}/apps', {
114
- signal,
115
- params: {
116
- path: {
117
- customerId,
118
- },
119
- },
120
- body: appData,
121
- });
122
- return transformResponse(resp);
123
- }
124
- /**
125
- * List customer app data
126
- * @param customerId - The ID of the customer
127
- * @param query - The query parameters
128
- * @param signal - An optional abort signal
129
- * @returns The list of customer app data
130
- */
131
- async list(customerId, query, signal) {
132
- const resp = await this.client.GET('/api/v1/customers/{customerId}/apps', {
133
- signal,
134
- params: {
135
- path: { customerId },
136
- query,
137
- },
138
- });
139
- return transformResponse(resp);
140
- }
141
- /**
142
- * Delete customer app data
143
- * @param customerId - The ID of the customer
144
- * @param appId - The ID of the app
145
- * @param signal - An optional abort signal
146
- * @returns The deleted customer app data
147
- */
148
- async delete(customerId, appId, signal) {
149
- const resp = await this.client.DELETE('/api/v1/customers/{customerId}/apps/{appId}', {
150
- signal,
151
- params: { path: { customerId, appId } },
152
- });
153
- return transformResponse(resp);
154
- }
155
- }
156
- /**
157
- * Customer Entitlements
158
- */
159
- export class CustomerEntitlements {
160
- client;
161
- constructor(client) {
162
- this.client = client;
163
- }
164
- /**
165
- * Get the value of an entitlement for a customer
166
- * @param customerId - The ID of the customer
167
- * @param featureKey - The key of the feature
168
- * @param signal - An optional abort signal
169
- * @returns The value of the entitlement
170
- */
171
- async value(customerId, featureKey, signal) {
172
- const resp = await this.client.GET('/api/v1/customers/{customerId}/entitlements/{featureKey}/value', {
173
- signal,
174
- params: { path: { customerId, featureKey } },
175
- });
176
- return transformResponse(resp);
177
- }
178
- }
179
- //# sourceMappingURL=customers.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"customers.js","sourceRoot":"","sources":["../../src/customers.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAA;AAU9C;;;GAGG;AACH,MAAM,OAAO,SAAS;IAIA;IAHb,IAAI,CAAc;IAClB,YAAY,CAAsB;IAEzC,YAAoB,MAA4C;QAA5C,WAAM,GAAN,MAAM,CAAsC;QAC9D,IAAI,CAAC,IAAI,GAAG,IAAI,YAAY,CAAC,MAAM,CAAC,CAAA;QACpC,IAAI,CAAC,YAAY,GAAG,IAAI,oBAAoB,CAAC,MAAM,CAAC,CAAA;IACtD,CAAC;IAED;;;;;OAKG;IACI,KAAK,CAAC,MAAM,CAAC,QAAwB,EAAE,MAAoB;QAChE,MAAM,IAAI,GAAG,MAAM,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,mBAAmB,EAAE;YACvD,MAAM;YACN,IAAI,EA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;;;OAMG;IACI,KAAK,CAAC,KAAK,CAChB,UAAyF,EACzF,UAAyF,EACzF,MAAoB;QAEpB,MAAM,IAAI,GAAG,MAAM,IAAI,CAAC,MAAM,CAAC,GAAG,CAChC,gEAAgE,EAChE;YACE,MAAM;YACN,MAAM,EAAE,EAAE,IAAI,EAAE,EAAE,UAAU,EAAE,UAAU,EAAE,EAAE;SAC7C,CACF,CAAA;QAED,OAAO,iBAAiB,CAAC,IAAI,CAAC,CAAA;IAChC,CAAC;CACF"}
@@ -1,505 +0,0 @@
1
- import type { EntitlementCreateInputs, EntitlementGrantCreateInput, operations, paths, ResetEntitlementUsageInput } from './schemas.js';
2
- import type { Client } from 'openapi-fetch';
3
- /**
4
- * Entitlements
5
- * @description With Entitlements, you can define and enforce usage limits, implement quota-based pricing, and manage access to features in your application.
6
- */
7
- export declare class Entitlements {
8
- private client;
9
- grants: Grants;
10
- constructor(client: Client<paths, `${string}/${string}`>);
11
- /**
12
- * Create an entitlement
13
- *
14
- * - Boolean entitlements define static feature access, e.g. "Can use SSO authentication".
15
- * - Static entitlements let you pass along a configuration while granting access, e.g. "Using this feature with X Y settings" (passed in the config).
16
- * - 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.
17
- *
18
- * 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.
19
- *
20
- * Once an entitlement is created you cannot modify it, only delete it.
21
- *
22
- * @param subjectIdOrKey - The ID or key of the subject
23
- * @param entitlement - The entitlement to create
24
- * @param signal - An optional abort signal
25
- * @returns The created entitlement
26
- */
27
- create(subjectIdOrKey: operations['createEntitlement']['parameters']['path']['subjectIdOrKey'], entitlement: EntitlementCreateInputs, signal?: AbortSignal): Promise<{
28
- data?: never;
29
- error: import("./utils.js").Problem;
30
- response: Response;
31
- } | {
32
- data: import("openapi-typescript-helpers").SuccessResponse<{
33
- 201: {
34
- headers: {
35
- [name: string]: unknown;
36
- };
37
- content: {
38
- "application/json": import("./schemas.js").components["schemas"]["Entitlement"];
39
- };
40
- };
41
- 400: {
42
- headers: {
43
- [name: string]: unknown;
44
- };
45
- content: {
46
- "application/problem+json": import("./schemas.js").components["schemas"]["BadRequestProblemResponse"];
47
- };
48
- };
49
- 401: {
50
- headers: {
51
- [name: string]: unknown;
52
- };
53
- content: {
54
- "application/problem+json": import("./schemas.js").components["schemas"]["UnauthorizedProblemResponse"];
55
- };
56
- };
57
- 403: {
58
- headers: {
59
- [name: string]: unknown;
60
- };
61
- content: {
62
- "application/problem+json": import("./schemas.js").components["schemas"]["ForbiddenProblemResponse"];
63
- };
64
- };
65
- 409: {
66
- headers: {
67
- [name: string]: unknown;
68
- };
69
- content: {
70
- "application/problem+json": import("./schemas.js").components["schemas"]["ConflictProblemResponse"];
71
- };
72
- };
73
- 500: {
74
- headers: {
75
- [name: string]: unknown;
76
- };
77
- content: {
78
- "application/problem+json": import("./schemas.js").components["schemas"]["InternalServerErrorProblemResponse"];
79
- };
80
- };
81
- 503: {
82
- headers: {
83
- [name: string]: unknown;
84
- };
85
- content: {
86
- "application/problem+json": import("./schemas.js").components["schemas"]["ServiceUnavailableProblemResponse"];
87
- };
88
- };
89
- default: {
90
- headers: {
91
- [name: string]: unknown;
92
- };
93
- content: {
94
- "application/problem+json": import("./schemas.js").components["schemas"]["UnexpectedProblemResponse"];
95
- };
96
- };
97
- }, `${string}/${string}`>;
98
- error?: never;
99
- response: Response;
100
- }>;
101
- /**
102
- * Get an entitlement by ID
103
- *
104
- * @param id - The ID of the entitlement
105
- * @param signal - An optional abort signal
106
- * @returns The entitlement
107
- */
108
- get(id: operations['getEntitlement']['parameters']['path']['entitlementId'], signal?: AbortSignal): Promise<{
109
- data?: never;
110
- error: import("./utils.js").Problem;
111
- response: Response;
112
- } | {
113
- data: import("openapi-typescript-helpers").SuccessResponse<{
114
- 200: {
115
- headers: {
116
- [name: string]: unknown;
117
- };
118
- content: {
119
- "application/json": import("./schemas.js").components["schemas"]["Entitlement"];
120
- };
121
- };
122
- 400: {
123
- headers: {
124
- [name: string]: unknown;
125
- };
126
- content: {
127
- "application/problem+json": import("./schemas.js").components["schemas"]["BadRequestProblemResponse"];
128
- };
129
- };
130
- 401: {
131
- headers: {
132
- [name: string]: unknown;
133
- };
134
- content: {
135
- "application/problem+json": import("./schemas.js").components["schemas"]["UnauthorizedProblemResponse"];
136
- };
137
- };
138
- 403: {
139
- headers: {
140
- [name: string]: unknown;
141
- };
142
- content: {
143
- "application/problem+json": import("./schemas.js").components["schemas"]["ForbiddenProblemResponse"];
144
- };
145
- };
146
- 404: {
147
- headers: {
148
- [name: string]: unknown;
149
- };
150
- content: {
151
- "application/problem+json": import("./schemas.js").components["schemas"]["NotFoundProblemResponse"];
152
- };
153
- };
154
- 500: {
155
- headers: {
156
- [name: string]: unknown;
157
- };
158
- content: {
159
- "application/problem+json": import("./schemas.js").components["schemas"]["InternalServerErrorProblemResponse"];
160
- };
161
- };
162
- 503: {
163
- headers: {
164
- [name: string]: unknown;
165
- };
166
- content: {
167
- "application/problem+json": import("./schemas.js").components["schemas"]["ServiceUnavailableProblemResponse"];
168
- };
169
- };
170
- default: {
171
- headers: {
172
- [name: string]: unknown;
173
- };
174
- content: {
175
- "application/problem+json": import("./schemas.js").components["schemas"]["UnexpectedProblemResponse"];
176
- };
177
- };
178
- }, `${string}/${string}`>;
179
- error?: never;
180
- response: Response;
181
- }>;
182
- /**
183
- * List entitlements
184
- *
185
- * @param query - The query parameters
186
- * @param signal - An optional abort signal
187
- * @returns The entitlements
188
- */
189
- list(query?: operations['listEntitlements']['parameters']['query'], signal?: AbortSignal): Promise<{
190
- data?: never;
191
- error: import("./utils.js").Problem;
192
- response: Response;
193
- } | {
194
- data: import("openapi-typescript-helpers").SuccessResponse<{
195
- 200: {
196
- headers: {
197
- [name: string]: unknown;
198
- };
199
- content: {
200
- "application/json": import("./schemas.js").components["schemas"]["ListEntitlementsResult"];
201
- };
202
- };
203
- 400: {
204
- headers: {
205
- [name: string]: unknown;
206
- };
207
- content: {
208
- "application/problem+json": import("./schemas.js").components["schemas"]["BadRequestProblemResponse"];
209
- };
210
- };
211
- 401: {
212
- headers: {
213
- [name: string]: unknown;
214
- };
215
- content: {
216
- "application/problem+json": import("./schemas.js").components["schemas"]["UnauthorizedProblemResponse"];
217
- };
218
- };
219
- 403: {
220
- headers: {
221
- [name: string]: unknown;
222
- };
223
- content: {
224
- "application/problem+json": import("./schemas.js").components["schemas"]["ForbiddenProblemResponse"];
225
- };
226
- };
227
- 500: {
228
- headers: {
229
- [name: string]: unknown;
230
- };
231
- content: {
232
- "application/problem+json": import("./schemas.js").components["schemas"]["InternalServerErrorProblemResponse"];
233
- };
234
- };
235
- 503: {
236
- headers: {
237
- [name: string]: unknown;
238
- };
239
- content: {
240
- "application/problem+json": import("./schemas.js").components["schemas"]["ServiceUnavailableProblemResponse"];
241
- };
242
- };
243
- default: {
244
- headers: {
245
- [name: string]: unknown;
246
- };
247
- content: {
248
- "application/problem+json": import("./schemas.js").components["schemas"]["UnexpectedProblemResponse"];
249
- };
250
- };
251
- }, `${string}/${string}`>;
252
- error?: never;
253
- response: Response;
254
- }>;
255
- /**
256
- * Delete an entitlement
257
- *
258
- * @param subjectIdOrKey - The ID or key of the subject
259
- * @param entitlementId - The ID of the entitlement
260
- * @param signal - An optional abort signal
261
- * @returns The deleted entitlement
262
- */
263
- delete(subjectIdOrKey: operations['deleteEntitlement']['parameters']['path']['subjectIdOrKey'], entitlementId: operations['deleteEntitlement']['parameters']['path']['entitlementId'], signal?: AbortSignal): Promise<{
264
- data?: never;
265
- error: import("./utils.js").Problem;
266
- response: Response;
267
- } | {
268
- data: undefined;
269
- error?: never;
270
- response: Response;
271
- }>;
272
- /**
273
- * Get the value of an entitlement to check access
274
- * All entitlement types share the hasAccess property in their value response, but multiple other properties are returned based on the entitlement type.
275
- *
276
- * @param subjectIdOrKey - The ID or key of the subject
277
- * @param entitlementIdOrFeatureKey - The ID or feature key of the entitlement
278
- * @param query - The query parameters
279
- * @param signal - An optional abort signal
280
- * @returns The entitlement value
281
- */
282
- value(subjectIdOrKey: operations['getEntitlementValue']['parameters']['path']['subjectIdOrKey'], entitlementIdOrFeatureKey: operations['getEntitlementValue']['parameters']['path']['entitlementIdOrFeatureKey'], query?: operations['getEntitlementValue']['parameters']['query'], signal?: AbortSignal): Promise<{
283
- data?: never;
284
- error: import("./utils.js").Problem;
285
- response: Response;
286
- } | {
287
- data: {
288
- readonly hasAccess: boolean;
289
- readonly balance?: number;
290
- readonly usage?: number;
291
- readonly overage?: number;
292
- readonly config?: string;
293
- };
294
- error?: never;
295
- response: Response;
296
- }>;
297
- /**
298
- * Get the history of an entitlement
299
- * Returns historical balance and usage data for the entitlement. The queried history can span accross multiple reset events.
300
- *
301
- * @param subjectIdOrKey - The ID or key of the subject
302
- * @param entitlementId - The ID of the entitlement
303
- * @param query - The query parameters
304
- * @param signal - An optional abort signal
305
- * @returns The history of the entitlement
306
- */
307
- history(subjectIdOrKey: operations['getEntitlementHistory']['parameters']['path']['subjectIdOrKey'], entitlementId: operations['getEntitlementHistory']['parameters']['path']['entitlementId'], query: operations['getEntitlementHistory']['parameters']['query'], signal?: AbortSignal): Promise<{
308
- data?: never;
309
- error: import("./utils.js").Problem;
310
- response: Response;
311
- } | {
312
- data: {
313
- windowedHistory: import("./schemas.js").components["schemas"]["BalanceHistoryWindow"][];
314
- burndownHistory: import("./schemas.js").components["schemas"]["GrantBurnDownHistorySegment"][];
315
- };
316
- error?: never;
317
- response: Response;
318
- }>;
319
- /**
320
- * Override an entitlement
321
- * This is useful for upgrades, downgrades, or other changes to entitlements that require a new entitlement to be created with zero downtime.
322
- *
323
- * @param subjectIdOrKey - The ID or key of the subject
324
- * @param entitlementIdOrFeatureKey - The ID or feature key of the entitlement
325
- * @param override - The override to create
326
- * @param signal - An optional abort signal
327
- * @returns The overridden entitlement
328
- */
329
- override(subjectIdOrKey: operations['overrideEntitlement']['parameters']['path']['subjectIdOrKey'], entitlementIdOrFeatureKey: operations['overrideEntitlement']['parameters']['path']['entitlementIdOrFeatureKey'], override: EntitlementCreateInputs, signal?: AbortSignal): Promise<{
330
- data?: never;
331
- error: import("./utils.js").Problem;
332
- response: Response;
333
- } | {
334
- data: import("openapi-typescript-helpers").SuccessResponse<{
335
- 201: {
336
- headers: {
337
- [name: string]: unknown;
338
- };
339
- content: {
340
- "application/json": import("./schemas.js").components["schemas"]["Entitlement"];
341
- };
342
- };
343
- 400: {
344
- headers: {
345
- [name: string]: unknown;
346
- };
347
- content: {
348
- "application/problem+json": import("./schemas.js").components["schemas"]["BadRequestProblemResponse"];
349
- };
350
- };
351
- 401: {
352
- headers: {
353
- [name: string]: unknown;
354
- };
355
- content: {
356
- "application/problem+json": import("./schemas.js").components["schemas"]["UnauthorizedProblemResponse"];
357
- };
358
- };
359
- 403: {
360
- headers: {
361
- [name: string]: unknown;
362
- };
363
- content: {
364
- "application/problem+json": import("./schemas.js").components["schemas"]["ForbiddenProblemResponse"];
365
- };
366
- };
367
- 404: {
368
- headers: {
369
- [name: string]: unknown;
370
- };
371
- content: {
372
- "application/problem+json": import("./schemas.js").components["schemas"]["NotFoundProblemResponse"];
373
- };
374
- };
375
- 409: {
376
- headers: {
377
- [name: string]: unknown;
378
- };
379
- content: {
380
- "application/problem+json": import("./schemas.js").components["schemas"]["ConflictProblemResponse"];
381
- };
382
- };
383
- 500: {
384
- headers: {
385
- [name: string]: unknown;
386
- };
387
- content: {
388
- "application/problem+json": import("./schemas.js").components["schemas"]["InternalServerErrorProblemResponse"];
389
- };
390
- };
391
- 503: {
392
- headers: {
393
- [name: string]: unknown;
394
- };
395
- content: {
396
- "application/problem+json": import("./schemas.js").components["schemas"]["ServiceUnavailableProblemResponse"];
397
- };
398
- };
399
- default: {
400
- headers: {
401
- [name: string]: unknown;
402
- };
403
- content: {
404
- "application/problem+json": import("./schemas.js").components["schemas"]["UnexpectedProblemResponse"];
405
- };
406
- };
407
- }, `${string}/${string}`>;
408
- error?: never;
409
- response: Response;
410
- }>;
411
- /**
412
- * Reset entitlement usage
413
- * - 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.
414
- * - 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.
415
- *
416
- * @param subjectIdOrKey - The ID or key of the subject
417
- * @param entitlementId - The ID of the entitlement
418
- * @param body - The body of the request
419
- * @param signal - An optional abort signal
420
- * @returns The reset entitlement
421
- */
422
- reset(subjectIdOrKey: operations['resetEntitlementUsage']['parameters']['path']['subjectIdOrKey'], entitlementId: operations['resetEntitlementUsage']['parameters']['path']['entitlementId'], body: ResetEntitlementUsageInput, signal?: AbortSignal): Promise<{
423
- data?: never;
424
- error: import("./utils.js").Problem;
425
- response: Response;
426
- } | {
427
- data: undefined;
428
- error?: never;
429
- response: Response;
430
- }>;
431
- }
432
- export declare class Grants {
433
- private client;
434
- constructor(client: Client<paths, `${string}/${string}`>);
435
- /**
436
- /**
437
- * Grant usage to a subject for an entitlement
438
- *
439
- * @param subjectIdOrKey - The ID or key of the subject
440
- * @param entitlementIdOrFeatureKey - The ID or feature key of the entitlement
441
- * @param grant - The grant to create
442
- * @param signal - An optional abort signal
443
- * @returns The created grant
444
- */
445
- create(subjectIdOrKey: operations['createGrant']['parameters']['path']['subjectIdOrKey'], entitlementIdOrFeatureKey: operations['createGrant']['parameters']['path']['entitlementIdOrFeatureKey'], grant: EntitlementGrantCreateInput, signal?: AbortSignal): Promise<{
446
- data?: never;
447
- error: import("./utils.js").Problem;
448
- response: Response;
449
- } | {
450
- data: {
451
- readonly createdAt: Date;
452
- readonly updatedAt: Date;
453
- readonly deletedAt?: Date;
454
- amount: number;
455
- priority?: number;
456
- effectiveAt: Date;
457
- expiration: import("./schemas.js").components["schemas"]["ExpirationPeriod"];
458
- maxRolloverAmount?: number;
459
- minRolloverAmount?: number;
460
- metadata?: import("./schemas.js").components["schemas"]["Metadata"];
461
- readonly id: string;
462
- readonly entitlementId: string;
463
- nextRecurrence?: Date;
464
- readonly expiresAt?: Date;
465
- voidedAt?: Date;
466
- recurrence?: import("./schemas.js").components["schemas"]["RecurringPeriod"];
467
- };
468
- error?: never;
469
- response: Response;
470
- }>;
471
- /**
472
- * List grants for an entitlement
473
- *
474
- * @param subjectIdOrKey - The ID or key of the subject
475
- * @param entitlementIdOrFeatureKey - The ID or feature key of the entitlement
476
- * @param signal - An optional abort signal
477
- * @returns The grants
478
- */
479
- list(subjectIdOrKey: operations['listEntitlementGrants']['parameters']['path']['subjectIdOrKey'], entitlementIdOrFeatureKey: operations['listEntitlementGrants']['parameters']['path']['entitlementIdOrFeatureKey'], query?: operations['listEntitlementGrants']['parameters']['query'], signal?: AbortSignal): Promise<{
480
- data?: never;
481
- error: import("./utils.js").Problem;
482
- response: Response;
483
- } | {
484
- data: {
485
- readonly createdAt: Date;
486
- readonly updatedAt: Date;
487
- readonly deletedAt?: Date;
488
- amount: number;
489
- priority?: number;
490
- effectiveAt: Date;
491
- expiration: import("./schemas.js").components["schemas"]["ExpirationPeriod"];
492
- maxRolloverAmount?: number;
493
- minRolloverAmount?: number;
494
- metadata?: import("./schemas.js").components["schemas"]["Metadata"];
495
- readonly id: string;
496
- readonly entitlementId: string;
497
- nextRecurrence?: Date;
498
- readonly expiresAt?: Date;
499
- voidedAt?: Date;
500
- recurrence?: import("./schemas.js").components["schemas"]["RecurringPeriod"];
501
- }[];
502
- error?: never;
503
- response: Response;
504
- }>;
505
- }