@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,283 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ 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
+ entitlements;
13
+ stripe;
14
+ constructor(client) {
15
+ this.client = client;
16
+ this.apps = new CustomerApps(client);
17
+ this.entitlements = new CustomerEntitlements(client);
18
+ this.stripe = new CustomerStripe(client);
19
+ }
20
+ /**
21
+ * Create a customer
22
+ * @param customer - The customer to create
23
+ * @param signal - An optional abort signal
24
+ * @returns The created customer
25
+ */
26
+ async create(customer, options) {
27
+ const resp = await this.client.POST('/api/v1/customers', {
28
+ body: customer,
29
+ ...options,
30
+ });
31
+ return (0, utils_js_1.transformResponse)(resp);
32
+ }
33
+ /**
34
+ * Get a customer by ID
35
+ * @param customerIdOrKey - The ID or Key of the customer
36
+ * @param signal - An optional abort signal
37
+ * @returns The customer
38
+ */
39
+ async get(customerIdOrKey, options) {
40
+ const resp = await this.client.GET('/api/v1/customers/{customerIdOrKey}', {
41
+ params: {
42
+ path: {
43
+ customerIdOrKey,
44
+ },
45
+ },
46
+ ...options,
47
+ });
48
+ return (0, utils_js_1.transformResponse)(resp);
49
+ }
50
+ /**
51
+ * Update a customer
52
+ * @param customerIdOrKey - The ID or Key of the customer
53
+ * @param customer - The customer to update
54
+ * @param signal - An optional abort signal
55
+ * @returns The updated customer
56
+ */
57
+ async update(customerIdOrKey, customer, options) {
58
+ const resp = await this.client.PUT('/api/v1/customers/{customerIdOrKey}', {
59
+ body: customer,
60
+ params: {
61
+ path: {
62
+ customerIdOrKey,
63
+ },
64
+ },
65
+ ...options,
66
+ });
67
+ return (0, utils_js_1.transformResponse)(resp);
68
+ }
69
+ /**
70
+ * Delete a customer
71
+ * @param customerIdOrKey - The ID or Key of the customer
72
+ * @param signal - An optional abort signal
73
+ * @returns The deleted customer
74
+ */
75
+ async delete(customerIdOrKey, options) {
76
+ const resp = await this.client.DELETE('/api/v1/customers/{customerIdOrKey}', {
77
+ params: {
78
+ path: {
79
+ customerIdOrKey,
80
+ },
81
+ },
82
+ ...options,
83
+ });
84
+ return (0, utils_js_1.transformResponse)(resp);
85
+ }
86
+ /**
87
+ * List customers
88
+ * @param signal - An optional abort signal
89
+ * @returns The list of customers
90
+ */
91
+ async list(query, options) {
92
+ const resp = await this.client.GET('/api/v1/customers', {
93
+ params: {
94
+ query,
95
+ },
96
+ ...options,
97
+ });
98
+ return (0, utils_js_1.transformResponse)(resp);
99
+ }
100
+ /**
101
+ * Get customer access
102
+ * @param customerIdOrKey - The ID or Key of the customer
103
+ * @param options - Optional request options
104
+ * @returns The customer access information
105
+ */
106
+ async getAccess(customerIdOrKey, options) {
107
+ const resp = await this.client.GET('/api/v1/customers/{customerIdOrKey}/access', {
108
+ params: {
109
+ path: {
110
+ customerIdOrKey,
111
+ },
112
+ },
113
+ ...options,
114
+ });
115
+ return (0, utils_js_1.transformResponse)(resp);
116
+ }
117
+ /**
118
+ * List customer subscriptions
119
+ * @param customerIdOrKey - The ID or key of the customer
120
+ * @param query - The query parameters
121
+ * @param signal - An optional abort signal
122
+ * @returns The list of customer subscriptions
123
+ */
124
+ async listSubscriptions(customerIdOrKey, query, options) {
125
+ const resp = await this.client.GET('/api/v1/customers/{customerIdOrKey}/subscriptions', {
126
+ params: { path: { customerIdOrKey }, query },
127
+ ...options,
128
+ });
129
+ return (0, utils_js_1.transformResponse)(resp);
130
+ }
131
+ }
132
+ exports.Customers = Customers;
133
+ /**
134
+ * Customer Apps
135
+ * Manage customer apps.
136
+ */
137
+ class CustomerApps {
138
+ client;
139
+ constructor(client) {
140
+ this.client = client;
141
+ }
142
+ /**
143
+ * Upsert customer app data
144
+ * @param customerIdOrKey - The ID or Key of the customer
145
+ * @param appData - The app data to upsert
146
+ * @param signal - An optional abort signal
147
+ * @returns The upserted app data
148
+ */
149
+ async upsert(customerIdOrKey, appData, options) {
150
+ const resp = await this.client.PUT('/api/v1/customers/{customerIdOrKey}/apps', {
151
+ body: appData,
152
+ params: {
153
+ path: {
154
+ customerIdOrKey,
155
+ },
156
+ },
157
+ ...options,
158
+ });
159
+ return (0, utils_js_1.transformResponse)(resp);
160
+ }
161
+ /**
162
+ * List customer app data
163
+ * @param customerIdOrKey - The ID or key of the customer
164
+ * @param query - The query parameters
165
+ * @param signal - An optional abort signal
166
+ * @returns The list of customer app data
167
+ */
168
+ async list(customerIdOrKey, query, options) {
169
+ const resp = await this.client.GET('/api/v1/customers/{customerIdOrKey}/apps', {
170
+ params: {
171
+ path: { customerIdOrKey },
172
+ query,
173
+ },
174
+ ...options,
175
+ });
176
+ return (0, utils_js_1.transformResponse)(resp);
177
+ }
178
+ /**
179
+ * Delete customer app data
180
+ * @param customerIdOrKey - The ID or key of the customer
181
+ * @param appId - The ID of the app
182
+ * @param signal - An optional abort signal
183
+ * @returns The deleted customer app data
184
+ */
185
+ async delete(customerIdOrKey, appId, options) {
186
+ const resp = await this.client.DELETE('/api/v1/customers/{customerIdOrKey}/apps/{appId}', {
187
+ params: { path: { appId, customerIdOrKey } },
188
+ ...options,
189
+ });
190
+ return (0, utils_js_1.transformResponse)(resp);
191
+ }
192
+ }
193
+ exports.CustomerApps = CustomerApps;
194
+ /**
195
+ * Customer Stripe
196
+ * Manage customer Stripe data.
197
+ */
198
+ class CustomerStripe {
199
+ client;
200
+ constructor(client) {
201
+ this.client = client;
202
+ }
203
+ /**
204
+ * Upsert customer stripe app data
205
+ * @param customerIdOrKey - The ID or Key of the customer
206
+ * @param appData - The app data to upsert
207
+ * @param signal - An optional abort signal
208
+ * @returns The upserted customer stripe app data
209
+ */
210
+ async upsert(customerIdOrKey, stripeAppData, options) {
211
+ const resp = await this.client.PUT('/api/v1/customers/{customerIdOrKey}/stripe', {
212
+ body: stripeAppData,
213
+ params: {
214
+ path: {
215
+ customerIdOrKey,
216
+ },
217
+ },
218
+ ...options,
219
+ });
220
+ return (0, utils_js_1.transformResponse)(resp);
221
+ }
222
+ /**
223
+ * Get customer stripe app data
224
+ * @param customerIdOrKey - The ID or key of the customer
225
+ * @param query - The query parameters
226
+ * @param signal - An optional abort signal
227
+ * @returns The customer stripe app data
228
+ */
229
+ async get(customerIdOrKey, options) {
230
+ const resp = await this.client.GET('/api/v1/customers/{customerIdOrKey}/apps', {
231
+ params: {
232
+ path: { customerIdOrKey },
233
+ },
234
+ ...options,
235
+ });
236
+ return (0, utils_js_1.transformResponse)(resp);
237
+ }
238
+ /**
239
+ * Create a Stripe customer portal session
240
+ * @param customerIdOrKey - The ID or Key of the customer
241
+ * @param params - The parameters for creating a Stripe customer portal session
242
+ * @param signal - An optional abort signal
243
+ * @returns The Stripe customer portal session
244
+ */
245
+ async createPortalSession(customerIdOrKey, params, options) {
246
+ const resp = await this.client.POST('/api/v1/customers/{customerIdOrKey}/stripe/portal', {
247
+ body: params,
248
+ params: {
249
+ path: {
250
+ customerIdOrKey,
251
+ },
252
+ },
253
+ ...options,
254
+ });
255
+ return (0, utils_js_1.transformResponse)(resp);
256
+ }
257
+ }
258
+ exports.CustomerStripe = CustomerStripe;
259
+ /**
260
+ * Customer Entitlements
261
+ */
262
+ class CustomerEntitlements {
263
+ client;
264
+ constructor(client) {
265
+ this.client = client;
266
+ }
267
+ /**
268
+ * Get the value of an entitlement for a customer
269
+ * @param customerIdOrKey - The ID or Key of the customer
270
+ * @param featureKey - The key of the feature
271
+ * @param signal - An optional abort signal
272
+ * @returns The value of the entitlement
273
+ */
274
+ async value(customerIdOrKey, featureKey, options) {
275
+ const resp = await this.client.GET('/api/v1/customers/{customerIdOrKey}/entitlements/{featureKey}/value', {
276
+ params: { path: { customerIdOrKey, featureKey } },
277
+ ...options,
278
+ });
279
+ return (0, utils_js_1.transformResponse)(resp);
280
+ }
281
+ }
282
+ exports.CustomerEntitlements = CustomerEntitlements;
283
+ //# sourceMappingURL=customers.js.map
@@ -0,0 +1,251 @@
1
+ import type { RequestOptions } from './common.cjs';
2
+ import type { CreateStripeCustomerPortalSessionParams, CustomerAppData, CustomerCreate, CustomerReplaceUpdate, operations, paths, StripeCustomerAppDataBase } from './schemas.cjs';
3
+ import type { Client } from 'openapi-fetch';
4
+ /**
5
+ * Customers
6
+ * Manage customer subscription lifecycles and plan assignments.
7
+ */
8
+ export declare class Customers {
9
+ private client;
10
+ apps: CustomerApps;
11
+ entitlements: CustomerEntitlements;
12
+ stripe: CustomerStripe;
13
+ constructor(client: Client<paths, `${string}/${string}`>);
14
+ /**
15
+ * Create a customer
16
+ * @param customer - The customer to create
17
+ * @param signal - An optional abort signal
18
+ * @returns The created customer
19
+ */
20
+ create(customer: CustomerCreate, options?: RequestOptions): Promise<{
21
+ readonly id: string;
22
+ name: string;
23
+ description?: string;
24
+ metadata?: import("./schemas.cjs").components["schemas"]["Metadata"] | null;
25
+ readonly createdAt: Date;
26
+ readonly updatedAt: Date;
27
+ readonly deletedAt?: Date;
28
+ key?: string;
29
+ usageAttribution: import("./schemas.cjs").components["schemas"]["CustomerUsageAttribution"];
30
+ primaryEmail?: string;
31
+ currency?: import("./schemas.cjs").components["schemas"]["CurrencyCode"];
32
+ billingAddress?: import("./schemas.cjs").components["schemas"]["Address"];
33
+ readonly currentSubscriptionId?: string;
34
+ readonly subscriptions?: import("./schemas.cjs").components["schemas"]["Subscription"][];
35
+ readonly annotations?: import("./schemas.cjs").components["schemas"]["Annotations"];
36
+ }>;
37
+ /**
38
+ * Get a customer by ID
39
+ * @param customerIdOrKey - The ID or Key of the customer
40
+ * @param signal - An optional abort signal
41
+ * @returns The customer
42
+ */
43
+ get(customerIdOrKey: operations['getCustomer']['parameters']['path']['customerIdOrKey'], options?: RequestOptions): Promise<{
44
+ readonly id: string;
45
+ name: string;
46
+ description?: string;
47
+ metadata?: import("./schemas.cjs").components["schemas"]["Metadata"] | null;
48
+ readonly createdAt: Date;
49
+ readonly updatedAt: Date;
50
+ readonly deletedAt?: Date;
51
+ key?: string;
52
+ usageAttribution: import("./schemas.cjs").components["schemas"]["CustomerUsageAttribution"];
53
+ primaryEmail?: string;
54
+ currency?: import("./schemas.cjs").components["schemas"]["CurrencyCode"];
55
+ billingAddress?: import("./schemas.cjs").components["schemas"]["Address"];
56
+ readonly currentSubscriptionId?: string;
57
+ readonly subscriptions?: import("./schemas.cjs").components["schemas"]["Subscription"][];
58
+ readonly annotations?: import("./schemas.cjs").components["schemas"]["Annotations"];
59
+ }>;
60
+ /**
61
+ * Update a customer
62
+ * @param customerIdOrKey - The ID or Key of the customer
63
+ * @param customer - The customer to update
64
+ * @param signal - An optional abort signal
65
+ * @returns The updated customer
66
+ */
67
+ update(customerIdOrKey: operations['updateCustomer']['parameters']['path']['customerIdOrKey'], customer: CustomerReplaceUpdate, options?: RequestOptions): Promise<{
68
+ readonly id: string;
69
+ name: string;
70
+ description?: string;
71
+ metadata?: import("./schemas.cjs").components["schemas"]["Metadata"] | null;
72
+ readonly createdAt: Date;
73
+ readonly updatedAt: Date;
74
+ readonly deletedAt?: Date;
75
+ key?: string;
76
+ usageAttribution: import("./schemas.cjs").components["schemas"]["CustomerUsageAttribution"];
77
+ primaryEmail?: string;
78
+ currency?: import("./schemas.cjs").components["schemas"]["CurrencyCode"];
79
+ billingAddress?: import("./schemas.cjs").components["schemas"]["Address"];
80
+ readonly currentSubscriptionId?: string;
81
+ readonly subscriptions?: import("./schemas.cjs").components["schemas"]["Subscription"][];
82
+ readonly annotations?: import("./schemas.cjs").components["schemas"]["Annotations"];
83
+ }>;
84
+ /**
85
+ * Delete a customer
86
+ * @param customerIdOrKey - The ID or Key of the customer
87
+ * @param signal - An optional abort signal
88
+ * @returns The deleted customer
89
+ */
90
+ delete(customerIdOrKey: operations['deleteCustomer']['parameters']['path']['customerIdOrKey'], options?: RequestOptions): Promise<undefined>;
91
+ /**
92
+ * List customers
93
+ * @param signal - An optional abort signal
94
+ * @returns The list of customers
95
+ */
96
+ list(query?: operations['listCustomers']['parameters']['query'], options?: RequestOptions): Promise<{
97
+ totalCount: number;
98
+ page: number;
99
+ pageSize: number;
100
+ items: import("./schemas.cjs").components["schemas"]["Customer"][];
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
+ getAccess(customerIdOrKey: operations['getCustomerAccess']['parameters']['path']['customerIdOrKey'], options?: RequestOptions): Promise<{
109
+ readonly entitlements: {
110
+ [key: string]: import("./schemas.cjs").components["schemas"]["EntitlementValue"];
111
+ };
112
+ }>;
113
+ /**
114
+ * List customer subscriptions
115
+ * @param customerIdOrKey - The ID or key of the customer
116
+ * @param query - The query parameters
117
+ * @param signal - An optional abort signal
118
+ * @returns The list of customer subscriptions
119
+ */
120
+ listSubscriptions(customerIdOrKey: operations['listCustomerSubscriptions']['parameters']['path']['customerIdOrKey'], query?: operations['listCustomerSubscriptions']['parameters']['query'], options?: RequestOptions): Promise<{
121
+ totalCount: number;
122
+ page: number;
123
+ pageSize: number;
124
+ items: import("./schemas.cjs").components["schemas"]["Subscription"][];
125
+ }>;
126
+ }
127
+ /**
128
+ * Customer Apps
129
+ * Manage customer apps.
130
+ */
131
+ export declare class CustomerApps {
132
+ private client;
133
+ constructor(client: Client<paths, `${string}/${string}`>);
134
+ /**
135
+ * Upsert customer app data
136
+ * @param customerIdOrKey - The ID or Key of the customer
137
+ * @param appData - The app data to upsert
138
+ * @param signal - An optional abort signal
139
+ * @returns The upserted app data
140
+ */
141
+ upsert(customerIdOrKey: operations['upsertCustomerAppData']['parameters']['path']['customerIdOrKey'], appData: CustomerAppData[], options?: RequestOptions): Promise<({
142
+ readonly app?: import("./schemas.cjs").components["schemas"]["CustomInvoicingApp"];
143
+ id?: string;
144
+ type: "custom_invoicing";
145
+ metadata?: import("./schemas.cjs").components["schemas"]["Metadata"];
146
+ } | {
147
+ id?: string;
148
+ type: "stripe";
149
+ stripeCustomerId: string;
150
+ stripeDefaultPaymentMethodId?: string;
151
+ readonly app?: import("./schemas.cjs").components["schemas"]["StripeApp"];
152
+ } | {
153
+ readonly app?: import("./schemas.cjs").components["schemas"]["SandboxApp"];
154
+ id?: string;
155
+ type: "sandbox";
156
+ })[]>;
157
+ /**
158
+ * List customer app data
159
+ * @param customerIdOrKey - The ID or key of the customer
160
+ * @param query - The query parameters
161
+ * @param signal - An optional abort signal
162
+ * @returns The list of customer app data
163
+ */
164
+ list(customerIdOrKey: operations['listCustomerAppData']['parameters']['path']['customerIdOrKey'], query?: operations['listCustomerAppData']['parameters']['query'], options?: RequestOptions): Promise<{
165
+ totalCount: number;
166
+ page: number;
167
+ pageSize: number;
168
+ items: import("./schemas.cjs").components["schemas"]["CustomerAppData"][];
169
+ }>;
170
+ /**
171
+ * Delete customer app data
172
+ * @param customerIdOrKey - The ID or key of the customer
173
+ * @param appId - The ID of the app
174
+ * @param signal - An optional abort signal
175
+ * @returns The deleted customer app data
176
+ */
177
+ delete(customerIdOrKey: operations['deleteCustomerAppData']['parameters']['path']['customerIdOrKey'], appId: operations['deleteCustomerAppData']['parameters']['path']['appId'], options?: RequestOptions): Promise<undefined>;
178
+ }
179
+ /**
180
+ * Customer Stripe
181
+ * Manage customer Stripe data.
182
+ */
183
+ export declare class CustomerStripe {
184
+ private client;
185
+ constructor(client: Client<paths, `${string}/${string}`>);
186
+ /**
187
+ * Upsert customer stripe app data
188
+ * @param customerIdOrKey - The ID or Key of the customer
189
+ * @param appData - The app data to upsert
190
+ * @param signal - An optional abort signal
191
+ * @returns The upserted customer stripe app data
192
+ */
193
+ upsert(customerIdOrKey: operations['upsertCustomerStripeAppData']['parameters']['path']['customerIdOrKey'], stripeAppData: StripeCustomerAppDataBase, options?: RequestOptions): Promise<{
194
+ id?: string;
195
+ type: "stripe";
196
+ stripeCustomerId: string;
197
+ stripeDefaultPaymentMethodId?: string;
198
+ readonly app?: import("./schemas.cjs").components["schemas"]["StripeApp"];
199
+ }>;
200
+ /**
201
+ * Get customer stripe app data
202
+ * @param customerIdOrKey - The ID or key of the customer
203
+ * @param query - The query parameters
204
+ * @param signal - An optional abort signal
205
+ * @returns The customer stripe app data
206
+ */
207
+ get(customerIdOrKey: operations['getCustomerStripeAppData']['parameters']['path']['customerIdOrKey'], options?: RequestOptions): Promise<{
208
+ totalCount: number;
209
+ page: number;
210
+ pageSize: number;
211
+ items: import("./schemas.cjs").components["schemas"]["CustomerAppData"][];
212
+ }>;
213
+ /**
214
+ * Create a Stripe customer portal session
215
+ * @param customerIdOrKey - The ID or Key of the customer
216
+ * @param params - The parameters for creating a Stripe customer portal session
217
+ * @param signal - An optional abort signal
218
+ * @returns The Stripe customer portal session
219
+ */
220
+ createPortalSession(customerIdOrKey: operations['createCustomerStripePortalSession']['parameters']['path']['customerIdOrKey'], params: CreateStripeCustomerPortalSessionParams, options?: RequestOptions): Promise<{
221
+ id: string;
222
+ stripeCustomerId: string;
223
+ configurationId: string;
224
+ livemode: boolean;
225
+ createdAt: Date;
226
+ returnUrl: string;
227
+ locale: string;
228
+ url: string;
229
+ }>;
230
+ }
231
+ /**
232
+ * Customer Entitlements
233
+ */
234
+ export declare class CustomerEntitlements {
235
+ private client;
236
+ constructor(client: Client<paths, `${string}/${string}`>);
237
+ /**
238
+ * Get the value of an entitlement for a customer
239
+ * @param customerIdOrKey - The ID or Key of the customer
240
+ * @param featureKey - The key of the feature
241
+ * @param signal - An optional abort signal
242
+ * @returns The value of the entitlement
243
+ */
244
+ value(customerIdOrKey: operations['getCustomerEntitlementValue']['parameters']['path']['customerIdOrKey'], featureKey: operations['getCustomerEntitlementValue']['parameters']['path']['featureKey'], options?: RequestOptions): Promise<{
245
+ readonly hasAccess: boolean;
246
+ readonly balance?: number;
247
+ readonly usage?: number;
248
+ readonly overage?: number;
249
+ readonly config?: string;
250
+ }>;
251
+ }
@@ -0,0 +1 @@
1
+ {"version":3,"file":"customers.js","sourceRoot":"","sources":["../../../../src/client/customers.ts"],"names":[],"mappings":";;;AAAA,yCAA8C;AAa9C;;;GAGG;AACH,MAAa,SAAS;IAKA;IAJb,IAAI,CAAc;IAClB,YAAY,CAAsB;IAClC,MAAM,CAAgB;IAE7B,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;QACpD,IAAI,CAAC,MAAM,GAAG,IAAI,cAAc,CAAC,MAAM,CAAC,CAAA;IAC1C,CAAC;IAED;;;;;OAKG;IACI,KAAK,CAAC,MAAM,CAAC,QAAwB,EAAE,OAAwB;QACpE,MAAM,IAAI,GAAG,MAAM,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,mBAAmB,EAAE;YACvD,IAAI,EAAE,QAAQ;YACd,GAAG,OAAO;SACX,CAAC,CAAA;QAEF,OAAO,IAAA,4BAAiB,EAAC,IAAI,CAAC,CAAA;IAChC,CAAC;IAED;;;;;OAKG;IACI,KAAK,CAAC,GAAG,CACd,eAAmF,EACnF,OAAwB;QAExB,MAAM,IAAI,GAAG,MAAM,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,qCAAqC,EAAE;YACxE,MAAM,EAAE;gBACN,IAAI,EAAE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jC,mDAAmD,EACnD;YACE,IAAI,EAAE,MAAM;YACZ,MAAM,EAAE;gBACN,IAAI,EAAE;oBACJ,eAAe;iBAChB;aACF;YACD,GAAG,OAAO;SACX,CACF,CAAA;QAED,OAAO,IAAA,4BAAiB,EAAC,IAAI,CAAC,CAAA;IAChC,CAAC;CACF;AAlFD,wCAkFC;AAED;;GAEG;AACH,MAAa,oBAAoB;IACX;IAApB,YAAoB,MAA4C;QAA5C,WAAM,GAAN,MAAM,CAAsC;IAAI,CAAC;IAErE;;;;;;OAMG;IACI,KAAK,CAAC,KAAK,CAChB,eAAmG,EACnG,UAAyF,EACzF,OAAwB;QAExB,MAAM,IAAI,GAAG,MAAM,IAAI,CAAC,MAAM,CAAC,GAAG,CAChC,qEAAqE,EACrE;YACE,MAAM,EAAE,EAAE,IAAI,EAAE,EAAE,eAAe,EAAE,UAAU,EAAE,EAAE;YACjD,GAAG,OAAO;SACX,CACF,CAAA;QAED,OAAO,IAAA,4BAAiB,EAAC,IAAI,CAAC,CAAA;IAChC,CAAC;CACF;AAzBD,oDAyBC"}
@@ -0,0 +1,27 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Debug = void 0;
4
+ const utils_js_1 = require("./utils.cjs");
5
+ /**
6
+ * Debug utilities for OpenMeter
7
+ */
8
+ class Debug {
9
+ client;
10
+ constructor(client) {
11
+ this.client = client;
12
+ }
13
+ /**
14
+ * Get event metrics
15
+ * @description Returns debug metrics (in OpenMetrics format) like the number of ingested events since mindnight UTC.
16
+ * @param options - The request options
17
+ * @returns The debug metrics
18
+ */
19
+ async getMetrics(options) {
20
+ const resp = await this.client.GET('/api/v1/debug/metrics', {
21
+ ...options,
22
+ });
23
+ return (0, utils_js_1.transformResponse)(resp);
24
+ }
25
+ }
26
+ exports.Debug = Debug;
27
+ //# sourceMappingURL=debug.js.map
@@ -0,0 +1,17 @@
1
+ import type { RequestOptions } from './common.cjs';
2
+ import type { paths } from './schemas.cjs';
3
+ import type { Client } from 'openapi-fetch';
4
+ /**
5
+ * Debug utilities for OpenMeter
6
+ */
7
+ export declare class Debug {
8
+ private client;
9
+ constructor(client: Client<paths, `${string}/${string}`>);
10
+ /**
11
+ * Get event metrics
12
+ * @description Returns debug metrics (in OpenMetrics format) like the number of ingested events since mindnight UTC.
13
+ * @param options - The request options
14
+ * @returns The debug metrics
15
+ */
16
+ getMetrics(options?: RequestOptions): Promise<string>;
17
+ }
@@ -0,0 +1 @@
1
+ {"version":3,"file":"debug.js","sourceRoot":"","sources":["../../../../src/client/debug.ts"],"names":[],"mappings":";;;AAAA,yCAA8C;AAK9C;;GAEG;AACH,MAAa,KAAK;IACI;IAApB,YAAoB,MAA4C;QAA5C,WAAM,GAAN,MAAM,CAAsC;IAAG,CAAC;IAEpE;;;;;OAKG;IACI,KAAK,CAAC,UAAU,CAAC,OAAwB;QAC9C,MAAM,IAAI,GAAG,MAAM,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,uBAAuB,EAAE;YAC1D,GAAG,OAAO;SACX,CAAC,CAAA;QAEF,OAAO,IAAA,4BAAiB,EAAC,IAAI,CAAC,CAAA;IAChC,CAAC;CACF;AAhBD,sBAgBC"}