@openmeter/sdk 1.0.0-beta.98 → 1.0.0-beta-9958c9245841

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 (203) hide show
  1. package/Makefile +43 -0
  2. package/README.md +232 -137
  3. package/biome.json +67 -0
  4. package/dist/cjs/index.cjs +15 -21
  5. package/dist/cjs/index.d.cts +1 -15
  6. package/dist/cjs/index.js.map +1 -1
  7. package/dist/cjs/src/client/addons.cjs +105 -0
  8. package/dist/cjs/src/client/addons.d.cts +152 -0
  9. package/dist/cjs/src/client/addons.js.map +1 -0
  10. package/dist/cjs/src/client/apps.cjs +247 -0
  11. package/dist/cjs/src/client/apps.d.cts +327 -0
  12. package/dist/cjs/src/client/apps.js.map +1 -0
  13. package/dist/cjs/src/client/billing.cjs +375 -0
  14. package/dist/cjs/src/client/billing.d.cts +563 -0
  15. package/dist/cjs/src/client/billing.js.map +1 -0
  16. package/dist/cjs/src/client/common.cjs +47 -0
  17. package/dist/cjs/src/client/common.d.cts +30 -0
  18. package/dist/cjs/src/client/common.js.map +1 -0
  19. package/dist/cjs/src/client/customers.cjs +469 -0
  20. package/dist/cjs/src/client/customers.d.cts +617 -0
  21. package/dist/cjs/src/client/customers.js.map +1 -0
  22. package/dist/cjs/src/client/debug.cjs +27 -0
  23. package/dist/cjs/src/client/debug.d.cts +17 -0
  24. package/dist/cjs/src/client/debug.js.map +1 -0
  25. package/dist/cjs/src/client/entitlements.cjs +372 -0
  26. package/dist/cjs/src/client/entitlements.d.cts +670 -0
  27. package/dist/cjs/src/client/entitlements.js.map +1 -0
  28. package/dist/cjs/src/client/events.cjs +113 -0
  29. package/dist/cjs/src/client/events.d.cts +48 -0
  30. package/dist/cjs/src/client/events.js.map +1 -0
  31. package/dist/cjs/src/client/features.cjs +78 -0
  32. package/dist/cjs/src/client/features.d.cts +87 -0
  33. package/dist/cjs/src/client/features.js.map +1 -0
  34. package/dist/cjs/src/client/index.cjs +122 -0
  35. package/dist/cjs/src/client/index.d.cts +54 -0
  36. package/dist/cjs/src/client/index.js.map +1 -0
  37. package/dist/cjs/src/client/info.cjs +42 -0
  38. package/dist/cjs/src/client/info.d.cts +34 -0
  39. package/dist/cjs/src/client/info.js.map +1 -0
  40. package/dist/cjs/src/client/meters.cjs +160 -0
  41. package/dist/cjs/src/client/meters.d.cts +151 -0
  42. package/dist/cjs/src/client/meters.js.map +1 -0
  43. package/dist/cjs/src/client/notifications.cjs +269 -0
  44. package/dist/cjs/src/client/notifications.d.cts +412 -0
  45. package/dist/cjs/src/client/notifications.js.map +1 -0
  46. package/dist/cjs/src/client/plans.cjs +204 -0
  47. package/dist/cjs/src/client/plans.d.cts +247 -0
  48. package/dist/cjs/src/client/plans.js.map +1 -0
  49. package/dist/cjs/src/client/portal.cjs +55 -0
  50. package/dist/cjs/src/client/portal.d.cts +48 -0
  51. package/dist/cjs/src/client/portal.js.map +1 -0
  52. package/dist/cjs/src/client/schemas.cjs +3 -0
  53. package/dist/cjs/src/client/schemas.d.cts +27081 -0
  54. package/dist/cjs/src/client/schemas.js.map +1 -0
  55. package/dist/cjs/src/client/subjects.cjs +76 -0
  56. package/dist/cjs/src/client/subjects.d.cts +79 -0
  57. package/dist/cjs/src/client/subjects.js.map +1 -0
  58. package/dist/cjs/src/client/subscription-addons.cjs +70 -0
  59. package/dist/cjs/src/client/subscription-addons.d.cts +123 -0
  60. package/dist/cjs/src/client/subscription-addons.js.map +1 -0
  61. package/dist/cjs/src/client/subscriptions.cjs +132 -0
  62. package/dist/cjs/src/client/subscriptions.d.cts +175 -0
  63. package/dist/cjs/src/client/subscriptions.js.map +1 -0
  64. package/dist/cjs/src/client/utils.cjs +67 -0
  65. package/dist/cjs/src/client/utils.d.cts +12 -0
  66. package/dist/cjs/src/client/utils.js.map +1 -0
  67. package/dist/cjs/src/portal/index.cjs +89 -0
  68. package/dist/cjs/src/portal/index.d.cts +43 -0
  69. package/dist/cjs/src/portal/index.js.map +1 -0
  70. package/dist/cjs/src/react/context.cjs +35 -0
  71. package/dist/cjs/src/react/context.d.cts +9 -0
  72. package/dist/cjs/src/react/context.js.map +1 -0
  73. package/dist/cjs/src/zod/index.cjs +13102 -0
  74. package/dist/cjs/src/zod/index.d.cts +20044 -0
  75. package/dist/cjs/src/zod/index.js.map +1 -0
  76. package/dist/cjs/tsconfig.0781fa96.tsbuildinfo +1 -0
  77. package/dist/cjs/tsconfig.6c95ff08.tsbuildinfo +1 -0
  78. package/dist/index.d.ts +1 -15
  79. package/dist/index.js +1 -17
  80. package/dist/index.js.map +1 -1
  81. package/dist/src/client/addons.d.ts +152 -0
  82. package/dist/src/client/addons.js +101 -0
  83. package/dist/src/client/addons.js.map +1 -0
  84. package/dist/src/client/apps.d.ts +327 -0
  85. package/dist/src/client/apps.js +240 -0
  86. package/dist/src/client/apps.js.map +1 -0
  87. package/dist/src/client/billing.d.ts +563 -0
  88. package/dist/src/client/billing.js +368 -0
  89. package/dist/src/client/billing.js.map +1 -0
  90. package/dist/src/client/common.d.ts +30 -0
  91. package/dist/src/client/common.js +42 -0
  92. package/dist/src/client/common.js.map +1 -0
  93. package/dist/src/client/customers.d.ts +617 -0
  94. package/dist/src/client/customers.js +461 -0
  95. package/dist/src/client/customers.js.map +1 -0
  96. package/dist/src/client/debug.d.ts +17 -0
  97. package/dist/src/client/debug.js +23 -0
  98. package/dist/src/client/debug.js.map +1 -0
  99. package/dist/src/client/entitlements.d.ts +670 -0
  100. package/dist/src/client/entitlements.js +365 -0
  101. package/dist/src/client/entitlements.js.map +1 -0
  102. package/dist/src/client/events.d.ts +48 -0
  103. package/dist/src/client/events.js +108 -0
  104. package/dist/src/client/events.js.map +1 -0
  105. package/dist/src/client/features.d.ts +87 -0
  106. package/dist/src/client/features.js +74 -0
  107. package/dist/src/client/features.js.map +1 -0
  108. package/dist/src/client/index.d.ts +54 -0
  109. package/dist/src/client/index.js +82 -0
  110. package/dist/src/client/index.js.map +1 -0
  111. package/dist/src/client/info.d.ts +34 -0
  112. package/dist/src/client/info.js +38 -0
  113. package/dist/src/client/info.js.map +1 -0
  114. package/dist/src/client/meters.d.ts +151 -0
  115. package/dist/src/client/meters.js +156 -0
  116. package/dist/src/client/meters.js.map +1 -0
  117. package/dist/src/client/notifications.d.ts +412 -0
  118. package/dist/src/client/notifications.js +262 -0
  119. package/dist/src/client/notifications.js.map +1 -0
  120. package/dist/src/client/plans.d.ts +247 -0
  121. package/dist/src/client/plans.js +199 -0
  122. package/dist/src/client/plans.js.map +1 -0
  123. package/dist/src/client/portal.d.ts +48 -0
  124. package/dist/src/client/portal.js +51 -0
  125. package/dist/src/client/portal.js.map +1 -0
  126. package/dist/src/client/schemas.d.ts +27081 -0
  127. package/dist/src/client/schemas.js +2 -0
  128. package/dist/src/client/schemas.js.map +1 -0
  129. package/dist/src/client/subjects.d.ts +79 -0
  130. package/dist/src/client/subjects.js +72 -0
  131. package/dist/src/client/subjects.js.map +1 -0
  132. package/dist/src/client/subscription-addons.d.ts +123 -0
  133. package/dist/src/client/subscription-addons.js +66 -0
  134. package/dist/src/client/subscription-addons.js.map +1 -0
  135. package/dist/src/client/subscriptions.d.ts +175 -0
  136. package/dist/src/client/subscriptions.js +128 -0
  137. package/dist/src/client/subscriptions.js.map +1 -0
  138. package/dist/src/client/utils.d.ts +12 -0
  139. package/dist/src/client/utils.js +61 -0
  140. package/dist/src/client/utils.js.map +1 -0
  141. package/dist/src/portal/index.d.ts +43 -0
  142. package/dist/src/portal/index.js +52 -0
  143. package/dist/src/portal/index.js.map +1 -0
  144. package/dist/src/react/context.d.ts +9 -0
  145. package/dist/src/react/context.js +16 -0
  146. package/dist/src/react/context.js.map +1 -0
  147. package/dist/src/zod/index.d.ts +20044 -0
  148. package/dist/src/zod/index.js +13071 -0
  149. package/dist/src/zod/index.js.map +1 -0
  150. package/dist/tsconfig.tsbuildinfo +1 -1
  151. package/orval.config.ts +38 -0
  152. package/package.json +62 -32
  153. package/patches/openapi-typescript.patch +6194 -0
  154. package/dist/cjs/clients/client.cjs +0 -117
  155. package/dist/cjs/clients/client.d.cts +0 -40
  156. package/dist/cjs/clients/client.js.map +0 -1
  157. package/dist/cjs/clients/event.cjs +0 -71
  158. package/dist/cjs/clients/event.d.cts +0 -79
  159. package/dist/cjs/clients/event.js.map +0 -1
  160. package/dist/cjs/clients/meter.cjs +0 -69
  161. package/dist/cjs/clients/meter.d.cts +0 -75
  162. package/dist/cjs/clients/meter.js.map +0 -1
  163. package/dist/cjs/clients/portal.cjs +0 -41
  164. package/dist/cjs/clients/portal.d.cts +0 -22
  165. package/dist/cjs/clients/portal.js.map +0 -1
  166. package/dist/cjs/clients/subject.cjs +0 -60
  167. package/dist/cjs/clients/subject.d.cts +0 -27
  168. package/dist/cjs/clients/subject.js.map +0 -1
  169. package/dist/cjs/schemas/openapi.cjs +0 -7
  170. package/dist/cjs/schemas/openapi.d.cts +0 -2078
  171. package/dist/cjs/schemas/openapi.js.map +0 -1
  172. package/dist/cjs/test/agent.cjs +0 -266
  173. package/dist/cjs/test/agent.d.cts +0 -2
  174. package/dist/cjs/test/agent.js.map +0 -1
  175. package/dist/cjs/test/mocks.cjs +0 -44
  176. package/dist/cjs/test/mocks.d.cts +0 -14
  177. package/dist/cjs/test/mocks.js.map +0 -1
  178. package/dist/cjs/tsconfig.4e4a4d92.tsbuildinfo +0 -1
  179. package/dist/cjs/tsconfig.d9d2f106.tsbuildinfo +0 -1
  180. package/dist/clients/client.d.ts +0 -40
  181. package/dist/clients/client.js +0 -112
  182. package/dist/clients/client.js.map +0 -1
  183. package/dist/clients/event.d.ts +0 -79
  184. package/dist/clients/event.js +0 -64
  185. package/dist/clients/event.js.map +0 -1
  186. package/dist/clients/meter.d.ts +0 -75
  187. package/dist/clients/meter.js +0 -65
  188. package/dist/clients/meter.js.map +0 -1
  189. package/dist/clients/portal.d.ts +0 -22
  190. package/dist/clients/portal.js +0 -37
  191. package/dist/clients/portal.js.map +0 -1
  192. package/dist/clients/subject.d.ts +0 -27
  193. package/dist/clients/subject.js +0 -56
  194. package/dist/clients/subject.js.map +0 -1
  195. package/dist/schemas/openapi.d.ts +0 -2078
  196. package/dist/schemas/openapi.js +0 -6
  197. package/dist/schemas/openapi.js.map +0 -1
  198. package/dist/test/agent.d.ts +0 -2
  199. package/dist/test/agent.js +0 -263
  200. package/dist/test/agent.js.map +0 -1
  201. package/dist/test/mocks.d.ts +0 -14
  202. package/dist/test/mocks.js +0 -41
  203. package/dist/test/mocks.js.map +0 -1
@@ -0,0 +1,30 @@
1
+ import type { UnexpectedProblemResponse } from './schemas.cjs';
2
+ /**
3
+ * Request options
4
+ */
5
+ export type RequestOptions = Pick<RequestInit, 'signal'>;
6
+ /**
7
+ * An error that occurred during an HTTP request
8
+ */
9
+ export declare class HTTPError extends Error {
10
+ message: string;
11
+ type: string;
12
+ title: string;
13
+ status: number;
14
+ url: string;
15
+ protected __raw?: Record<string, unknown> | undefined;
16
+ name: string;
17
+ client: string;
18
+ constructor(message: string, type: string, title: string, status: number, url: string, __raw?: Record<string, unknown> | undefined);
19
+ static fromResponse(resp: {
20
+ response: Response;
21
+ error?: UnexpectedProblemResponse;
22
+ }): HTTPError;
23
+ getField(key: string): unknown;
24
+ }
25
+ /**
26
+ * Check if an error is an HTTPError
27
+ * @param error - The error to check
28
+ * @returns Whether the error is an HTTPError
29
+ */
30
+ export declare function isHTTPError(error: unknown): error is HTTPError;
@@ -0,0 +1 @@
1
+ {"version":3,"file":"common.js","sourceRoot":"","sources":["../../../../src/client/common.ts"],"names":[],"mappings":";;;AA+DA,kCAEC;AA1DD;;GAEG;AACH,MAAa,SAAU,SAAQ,KAAK;IAKzB;IACA;IACA;IACA;IACA;IACG;IATL,IAAI,GAAG,WAAW,CAAA;IAClB,MAAM,GAAG,WAAW,CAAA;IAE3B,YACS,OAAe,EACf,IAAY,EACZ,KAAa,EACb,MAAc,EACd,GAAW,EACR,KAA+B;QAEzC,KAAK,CAAC,OAAO,CAAC,CAAA;QAPP,YAAO,GAAP,OAAO,CAAQ;QACf,SAAI,GAAJ,IAAI,CAAQ;QACZ,UAAK,GAAL,KAAK,CAAQ;QACb,WAAM,GAAN,MAAM,CAAQ;QACd,QAAG,GAAH,GAAG,CAAQ;QACR,UAAK,GAAL,KAAK,CAA0B;IAG3C,CAAC;IAED,MAAM,CAAC,YAAY,CAAC,IAGnB;QACC,IACE,IAAI,CAAC,QAAQ,CAAC,OAAO,CAAC,GAAG,CAAC,cAAc,CAAC;YACvC,0BAA0B;YAC5B,IAAI,CAAC,KAAK,EACV,CAAC;YACD,OAAO,IAAI,SAAS,CAClB,mBAAmB,IAAI,CAAC,QAAQ,CAAC,GAAG,MAAM,IAAI,CAAC,QAAQ,CAAC,MAAM,MAAM,IAAI,CAAC,KAAK,CAAC,MAAM,EAAE,EACvF,IAAI,CAAC,KAAK,CAAC,IAAI,EACf,IAAI,CAAC,KAAK,CAAC,KAAK,EAChB,IAAI,CAAC,KAAK,CAAC,MAAM,IAAI,IAAI,CAAC,QAAQ,CAAC,MAAM,EACzC,IAAI,CAAC,QAAQ,CAAC,GAAG,EACjB,IAAI,CAAC,KAAK,CACX,CAAA;QACH,CAAC;QAED,OAAO,IAAI,SAAS,CAClB,mBAAmB,IAAI,CAAC,QAAQ,CAAC,GAAG,MAAM,IAAI,CAAC,QAAQ,CAAC,MAAM,MAAM,IAAI,CAAC,QAAQ,CAAC,UAAU,EAAE,EAC9F,IAAI,CAAC,QAAQ,CAAC,UAAU,EACxB,IAAI,CAAC,QAAQ,CAAC,UAAU,EACxB,IAAI,CAAC,QAAQ,CAAC,MAAM,EACpB,IAAI,CAAC,QAAQ,CAAC,GAAG,CAClB,CAAA;IACH,CAAC;IAED,QAAQ,CAAC,GAAW;QAClB,OAAO,IAAI,CAAC,KAAK,EAAE,CAAC,GAAG,CAAC,CAAA;IAC1B,CAAC;CACF;AA9CD,8BA8CC;AAED;;;;GAIG;AACH,SAAgB,WAAW,CAAC,KAAc;IACxC,OAAO,KAAK,YAAY,SAAS,CAAA;AACnC,CAAC"}
@@ -0,0 +1,469 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.CustomerEntitlementsV2 = exports.CustomerEntitlements = exports.CustomerStripe = exports.CustomerApps = exports.Customers = void 0;
4
+ const utils_js_1 = require("./utils.cjs");
5
+ /**
6
+ * Customers
7
+ * Manage customer subscription lifecycles and plan assignments.
8
+ */
9
+ class Customers {
10
+ client;
11
+ apps;
12
+ entitlementsV1;
13
+ entitlements;
14
+ stripe;
15
+ constructor(client) {
16
+ this.client = client;
17
+ this.apps = new CustomerApps(client);
18
+ this.entitlementsV1 = new CustomerEntitlements(client);
19
+ this.entitlements = new CustomerEntitlementsV2(client);
20
+ this.stripe = new CustomerStripe(client);
21
+ }
22
+ /**
23
+ * Create a customer
24
+ * @param customer - The customer to create
25
+ * @param signal - An optional abort signal
26
+ * @returns The created customer
27
+ */
28
+ async create(customer, options) {
29
+ const resp = await this.client.POST('/api/v1/customers', {
30
+ body: customer,
31
+ ...options,
32
+ });
33
+ return (0, utils_js_1.transformResponse)(resp);
34
+ }
35
+ /**
36
+ * Get a customer by ID
37
+ * @param customerIdOrKey - The ID or Key of the customer
38
+ * @param signal - An optional abort signal
39
+ * @returns The customer
40
+ */
41
+ async get(customerIdOrKey, options) {
42
+ const resp = await this.client.GET('/api/v1/customers/{customerIdOrKey}', {
43
+ params: {
44
+ path: {
45
+ customerIdOrKey,
46
+ },
47
+ },
48
+ ...options,
49
+ });
50
+ return (0, utils_js_1.transformResponse)(resp);
51
+ }
52
+ /**
53
+ * Update a customer
54
+ * @param customerIdOrKey - The ID or Key of the customer
55
+ * @param customer - The customer to update
56
+ * @param signal - An optional abort signal
57
+ * @returns The updated customer
58
+ */
59
+ async update(customerIdOrKey, customer, options) {
60
+ const resp = await this.client.PUT('/api/v1/customers/{customerIdOrKey}', {
61
+ body: customer,
62
+ params: {
63
+ path: {
64
+ customerIdOrKey,
65
+ },
66
+ },
67
+ ...options,
68
+ });
69
+ return (0, utils_js_1.transformResponse)(resp);
70
+ }
71
+ /**
72
+ * Delete a customer
73
+ * @param customerIdOrKey - The ID or Key of the customer
74
+ * @param signal - An optional abort signal
75
+ * @returns The deleted customer
76
+ */
77
+ async delete(customerIdOrKey, options) {
78
+ const resp = await this.client.DELETE('/api/v1/customers/{customerIdOrKey}', {
79
+ params: {
80
+ path: {
81
+ customerIdOrKey,
82
+ },
83
+ },
84
+ ...options,
85
+ });
86
+ return (0, utils_js_1.transformResponse)(resp);
87
+ }
88
+ /**
89
+ * List customers
90
+ * @param signal - An optional abort signal
91
+ * @returns The list of customers
92
+ */
93
+ async list(query, options) {
94
+ const resp = await this.client.GET('/api/v1/customers', {
95
+ params: {
96
+ query,
97
+ },
98
+ ...options,
99
+ });
100
+ return (0, utils_js_1.transformResponse)(resp);
101
+ }
102
+ /**
103
+ * Get customer access
104
+ * @param customerIdOrKey - The ID or Key of the customer
105
+ * @param options - Optional request options
106
+ * @returns The customer access information
107
+ */
108
+ async getAccess(customerIdOrKey, options) {
109
+ const resp = await this.client.GET('/api/v1/customers/{customerIdOrKey}/access', {
110
+ params: {
111
+ path: {
112
+ customerIdOrKey,
113
+ },
114
+ },
115
+ ...options,
116
+ });
117
+ return (0, utils_js_1.transformResponse)(resp);
118
+ }
119
+ /**
120
+ * List customer subscriptions
121
+ * @param customerIdOrKey - The ID or key of the customer
122
+ * @param query - The query parameters
123
+ * @param signal - An optional abort signal
124
+ * @returns The list of customer subscriptions
125
+ */
126
+ async listSubscriptions(customerIdOrKey, query, options) {
127
+ const resp = await this.client.GET('/api/v1/customers/{customerIdOrKey}/subscriptions', {
128
+ params: { path: { customerIdOrKey }, query },
129
+ ...options,
130
+ });
131
+ return (0, utils_js_1.transformResponse)(resp);
132
+ }
133
+ }
134
+ exports.Customers = Customers;
135
+ /**
136
+ * Customer Apps
137
+ * Manage customer apps.
138
+ */
139
+ class CustomerApps {
140
+ client;
141
+ constructor(client) {
142
+ this.client = client;
143
+ }
144
+ /**
145
+ * Upsert customer app data
146
+ * @param customerIdOrKey - The ID or Key of the customer
147
+ * @param appData - The app data to upsert
148
+ * @param signal - An optional abort signal
149
+ * @returns The upserted app data
150
+ */
151
+ async upsert(customerIdOrKey, appData, options) {
152
+ const resp = await this.client.PUT('/api/v1/customers/{customerIdOrKey}/apps', {
153
+ body: appData,
154
+ params: {
155
+ path: {
156
+ customerIdOrKey,
157
+ },
158
+ },
159
+ ...options,
160
+ });
161
+ return (0, utils_js_1.transformResponse)(resp);
162
+ }
163
+ /**
164
+ * List customer app data
165
+ * @param customerIdOrKey - The ID or key of the customer
166
+ * @param query - The query parameters
167
+ * @param signal - An optional abort signal
168
+ * @returns The list of customer app data
169
+ */
170
+ async list(customerIdOrKey, query, options) {
171
+ const resp = await this.client.GET('/api/v1/customers/{customerIdOrKey}/apps', {
172
+ params: {
173
+ path: { customerIdOrKey },
174
+ query,
175
+ },
176
+ ...options,
177
+ });
178
+ return (0, utils_js_1.transformResponse)(resp);
179
+ }
180
+ /**
181
+ * Delete customer app data
182
+ * @param customerIdOrKey - The ID or key of the customer
183
+ * @param appId - The ID of the app
184
+ * @param signal - An optional abort signal
185
+ * @returns The deleted customer app data
186
+ */
187
+ async delete(customerIdOrKey, appId, options) {
188
+ const resp = await this.client.DELETE('/api/v1/customers/{customerIdOrKey}/apps/{appId}', {
189
+ params: { path: { appId, customerIdOrKey } },
190
+ ...options,
191
+ });
192
+ return (0, utils_js_1.transformResponse)(resp);
193
+ }
194
+ }
195
+ exports.CustomerApps = CustomerApps;
196
+ /**
197
+ * Customer Stripe
198
+ * Manage customer Stripe data.
199
+ */
200
+ class CustomerStripe {
201
+ client;
202
+ constructor(client) {
203
+ this.client = client;
204
+ }
205
+ /**
206
+ * Upsert customer stripe app data
207
+ * @param customerIdOrKey - The ID or Key of the customer
208
+ * @param appData - The app data to upsert
209
+ * @param signal - An optional abort signal
210
+ * @returns The upserted customer stripe app data
211
+ */
212
+ async upsert(customerIdOrKey, stripeAppData, options) {
213
+ const resp = await this.client.PUT('/api/v1/customers/{customerIdOrKey}/stripe', {
214
+ body: stripeAppData,
215
+ params: {
216
+ path: {
217
+ customerIdOrKey,
218
+ },
219
+ },
220
+ ...options,
221
+ });
222
+ return (0, utils_js_1.transformResponse)(resp);
223
+ }
224
+ /**
225
+ * Get customer stripe app data
226
+ * @param customerIdOrKey - The ID or key of the customer
227
+ * @param query - The query parameters
228
+ * @param signal - An optional abort signal
229
+ * @returns The customer stripe app data
230
+ */
231
+ async get(customerIdOrKey, options) {
232
+ const resp = await this.client.GET('/api/v1/customers/{customerIdOrKey}/stripe', {
233
+ params: {
234
+ path: { customerIdOrKey },
235
+ },
236
+ ...options,
237
+ });
238
+ return (0, utils_js_1.transformResponse)(resp);
239
+ }
240
+ /**
241
+ * Create a Stripe customer portal session
242
+ * @param customerIdOrKey - The ID or Key of the customer
243
+ * @param params - The parameters for creating a Stripe customer portal session
244
+ * @param signal - An optional abort signal
245
+ * @returns The Stripe customer portal session
246
+ */
247
+ async createPortalSession(customerIdOrKey, params, options) {
248
+ const resp = await this.client.POST('/api/v1/customers/{customerIdOrKey}/stripe/portal', {
249
+ body: params,
250
+ params: {
251
+ path: {
252
+ customerIdOrKey,
253
+ },
254
+ },
255
+ ...options,
256
+ });
257
+ return (0, utils_js_1.transformResponse)(resp);
258
+ }
259
+ }
260
+ exports.CustomerStripe = CustomerStripe;
261
+ /**
262
+ * Customer Entitlements
263
+ */
264
+ class CustomerEntitlements {
265
+ client;
266
+ constructor(client) {
267
+ this.client = client;
268
+ }
269
+ /**
270
+ * Get the value of an entitlement for a customer
271
+ * @param customerIdOrKey - The ID or Key of the customer
272
+ * @param featureKey - The key of the feature
273
+ * @param signal - An optional abort signal
274
+ * @returns The value of the entitlement
275
+ */
276
+ async value(customerIdOrKey, featureKey, options) {
277
+ const resp = await this.client.GET('/api/v1/customers/{customerIdOrKey}/entitlements/{featureKey}/value', {
278
+ params: { path: { customerIdOrKey, featureKey } },
279
+ ...options,
280
+ });
281
+ return (0, utils_js_1.transformResponse)(resp);
282
+ }
283
+ }
284
+ exports.CustomerEntitlements = CustomerEntitlements;
285
+ /**
286
+ * Customer Entitlements V2
287
+ */
288
+ class CustomerEntitlementsV2 {
289
+ client;
290
+ constructor(client) {
291
+ this.client = client;
292
+ }
293
+ /**
294
+ * List all entitlements for a customer
295
+ * @param customerIdOrKey - The ID or Key of the customer
296
+ * @param options - Request options including query parameters
297
+ * @returns List of customer entitlements
298
+ */
299
+ async list(customerIdOrKey, options) {
300
+ const resp = await this.client.GET('/api/v2/customers/{customerIdOrKey}/entitlements', {
301
+ params: {
302
+ path: { customerIdOrKey },
303
+ query: options?.query,
304
+ },
305
+ ...options,
306
+ });
307
+ return (0, utils_js_1.transformResponse)(resp);
308
+ }
309
+ /**
310
+ * Create a customer entitlement
311
+ * @param customerIdOrKey - The ID or Key of the customer
312
+ * @param entitlement - The entitlement data to create
313
+ * @param options - Request options
314
+ * @returns The created entitlement
315
+ */
316
+ async create(customerIdOrKey, entitlement, options) {
317
+ const resp = await this.client.POST('/api/v2/customers/{customerIdOrKey}/entitlements', {
318
+ body: entitlement,
319
+ params: {
320
+ path: { customerIdOrKey },
321
+ },
322
+ ...options,
323
+ });
324
+ return (0, utils_js_1.transformResponse)(resp);
325
+ }
326
+ /**
327
+ * Get a specific customer entitlement
328
+ * @param customerIdOrKey - The ID or Key of the customer
329
+ * @param entitlementIdOrFeatureKey - The ID or feature key of the entitlement
330
+ * @param options - Request options
331
+ * @returns The entitlement
332
+ */
333
+ async get(customerIdOrKey, entitlementIdOrFeatureKey, options) {
334
+ const resp = await this.client.GET('/api/v2/customers/{customerIdOrKey}/entitlements/{entitlementIdOrFeatureKey}', {
335
+ params: {
336
+ path: { customerIdOrKey, entitlementIdOrFeatureKey },
337
+ },
338
+ ...options,
339
+ });
340
+ return (0, utils_js_1.transformResponse)(resp);
341
+ }
342
+ /**
343
+ * Delete a customer entitlement
344
+ * @param customerIdOrKey - The ID or Key of the customer
345
+ * @param entitlementIdOrFeatureKey - The ID or feature key of the entitlement
346
+ * @param options - Request options
347
+ * @returns The deletion response
348
+ */
349
+ async delete(customerIdOrKey, entitlementIdOrFeatureKey, options) {
350
+ const resp = await this.client.DELETE('/api/v2/customers/{customerIdOrKey}/entitlements/{entitlementIdOrFeatureKey}', {
351
+ params: {
352
+ path: { customerIdOrKey, entitlementIdOrFeatureKey },
353
+ },
354
+ ...options,
355
+ });
356
+ return (0, utils_js_1.transformResponse)(resp);
357
+ }
358
+ /**
359
+ * Override a customer entitlement
360
+ * @param customerIdOrKey - The ID or Key of the customer
361
+ * @param entitlementIdOrFeatureKey - The ID or feature key of the entitlement
362
+ * @param entitlement - The new entitlement data
363
+ * @param options - Request options
364
+ * @returns The overridden entitlement
365
+ */
366
+ async override(customerIdOrKey, entitlementIdOrFeatureKey, entitlement, options) {
367
+ const resp = await this.client.PUT('/api/v2/customers/{customerIdOrKey}/entitlements/{entitlementIdOrFeatureKey}/override', {
368
+ body: entitlement,
369
+ params: {
370
+ path: { customerIdOrKey, entitlementIdOrFeatureKey },
371
+ },
372
+ ...options,
373
+ });
374
+ return (0, utils_js_1.transformResponse)(resp);
375
+ }
376
+ /**
377
+ * List grants for a customer entitlement
378
+ * @param customerIdOrKey - The ID or Key of the customer
379
+ * @param entitlementIdOrFeatureKey - The ID or feature key of the entitlement
380
+ * @param options - Request options including query parameters
381
+ * @returns List of entitlement grants
382
+ */
383
+ async listGrants(customerIdOrKey, entitlementIdOrFeatureKey, options) {
384
+ const resp = await this.client.GET('/api/v2/customers/{customerIdOrKey}/entitlements/{entitlementIdOrFeatureKey}/grants', {
385
+ params: {
386
+ path: { customerIdOrKey, entitlementIdOrFeatureKey },
387
+ query: options?.query,
388
+ },
389
+ ...options,
390
+ });
391
+ return (0, utils_js_1.transformResponse)(resp);
392
+ }
393
+ /**
394
+ * Create a grant for a customer entitlement
395
+ * @param customerIdOrKey - The ID or Key of the customer
396
+ * @param entitlementIdOrFeatureKey - The ID or feature key of the entitlement
397
+ * @param grant - The grant data to create
398
+ * @param options - Request options
399
+ * @returns The created grant
400
+ */
401
+ async createGrant(customerIdOrKey, entitlementIdOrFeatureKey, grant, options) {
402
+ const resp = await this.client.POST('/api/v2/customers/{customerIdOrKey}/entitlements/{entitlementIdOrFeatureKey}/grants', {
403
+ body: grant,
404
+ params: {
405
+ path: { customerIdOrKey, entitlementIdOrFeatureKey },
406
+ },
407
+ ...options,
408
+ });
409
+ return (0, utils_js_1.transformResponse)(resp);
410
+ }
411
+ /**
412
+ * Get the value of a customer entitlement
413
+ * @param customerIdOrKey - The ID or Key of the customer
414
+ * @param entitlementIdOrFeatureKey - The ID or feature key of the entitlement
415
+ * @param options - Request options including query parameters
416
+ * @returns The entitlement value
417
+ */
418
+ async value(customerIdOrKey, entitlementIdOrFeatureKey, options) {
419
+ const resp = await this.client.GET('/api/v2/customers/{customerIdOrKey}/entitlements/{entitlementIdOrFeatureKey}/value', {
420
+ params: {
421
+ path: { customerIdOrKey, entitlementIdOrFeatureKey },
422
+ query: options?.query,
423
+ },
424
+ ...options,
425
+ });
426
+ return (0, utils_js_1.transformResponse)(resp);
427
+ }
428
+ /**
429
+ * Get the history of a customer entitlement
430
+ * @param customerIdOrKey - The ID or Key of the customer
431
+ * @param entitlementIdOrFeatureKey - The ID or feature key of the entitlement
432
+ * @param windowSize - The window size for the history
433
+ * @param options - Request options including query parameters
434
+ * @returns The entitlement history
435
+ */
436
+ async history(customerIdOrKey, entitlementIdOrFeatureKey, windowSize, options) {
437
+ const resp = await this.client.GET('/api/v2/customers/{customerIdOrKey}/entitlements/{entitlementIdOrFeatureKey}/history', {
438
+ params: {
439
+ path: { customerIdOrKey, entitlementIdOrFeatureKey },
440
+ query: {
441
+ windowSize,
442
+ ...options?.query,
443
+ },
444
+ },
445
+ ...options,
446
+ });
447
+ return (0, utils_js_1.transformResponse)(resp);
448
+ }
449
+ /**
450
+ * Reset the usage of a customer entitlement
451
+ * @param customerIdOrKey - The ID or Key of the customer
452
+ * @param entitlementIdOrFeatureKey - The ID or feature key of the entitlement
453
+ * @param reset - The reset data
454
+ * @param options - Request options
455
+ * @returns The reset response
456
+ */
457
+ async resetUsage(customerIdOrKey, entitlementIdOrFeatureKey, reset, options) {
458
+ const resp = await this.client.POST('/api/v2/customers/{customerIdOrKey}/entitlements/{entitlementIdOrFeatureKey}/reset', {
459
+ body: reset,
460
+ params: {
461
+ path: { customerIdOrKey, entitlementIdOrFeatureKey },
462
+ },
463
+ ...options,
464
+ });
465
+ return (0, utils_js_1.transformResponse)(resp);
466
+ }
467
+ }
468
+ exports.CustomerEntitlementsV2 = CustomerEntitlementsV2;
469
+ //# sourceMappingURL=customers.js.map