@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,251 @@
1
+ import type { RequestOptions } from './common.js';
2
+ import type { CreateStripeCustomerPortalSessionParams, CustomerAppData, CustomerCreate, CustomerReplaceUpdate, operations, paths, StripeCustomerAppDataBase } from './schemas.js';
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.js").components["schemas"]["Metadata"] | null;
25
+ readonly createdAt: Date;
26
+ readonly updatedAt: Date;
27
+ readonly deletedAt?: Date;
28
+ key?: string;
29
+ usageAttribution: import("./schemas.js").components["schemas"]["CustomerUsageAttribution"];
30
+ primaryEmail?: string;
31
+ currency?: import("./schemas.js").components["schemas"]["CurrencyCode"];
32
+ billingAddress?: import("./schemas.js").components["schemas"]["Address"];
33
+ readonly currentSubscriptionId?: string;
34
+ readonly subscriptions?: import("./schemas.js").components["schemas"]["Subscription"][];
35
+ readonly annotations?: import("./schemas.js").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.js").components["schemas"]["Metadata"] | null;
48
+ readonly createdAt: Date;
49
+ readonly updatedAt: Date;
50
+ readonly deletedAt?: Date;
51
+ key?: string;
52
+ usageAttribution: import("./schemas.js").components["schemas"]["CustomerUsageAttribution"];
53
+ primaryEmail?: string;
54
+ currency?: import("./schemas.js").components["schemas"]["CurrencyCode"];
55
+ billingAddress?: import("./schemas.js").components["schemas"]["Address"];
56
+ readonly currentSubscriptionId?: string;
57
+ readonly subscriptions?: import("./schemas.js").components["schemas"]["Subscription"][];
58
+ readonly annotations?: import("./schemas.js").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.js").components["schemas"]["Metadata"] | null;
72
+ readonly createdAt: Date;
73
+ readonly updatedAt: Date;
74
+ readonly deletedAt?: Date;
75
+ key?: string;
76
+ usageAttribution: import("./schemas.js").components["schemas"]["CustomerUsageAttribution"];
77
+ primaryEmail?: string;
78
+ currency?: import("./schemas.js").components["schemas"]["CurrencyCode"];
79
+ billingAddress?: import("./schemas.js").components["schemas"]["Address"];
80
+ readonly currentSubscriptionId?: string;
81
+ readonly subscriptions?: import("./schemas.js").components["schemas"]["Subscription"][];
82
+ readonly annotations?: import("./schemas.js").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.js").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.js").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.js").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.js").components["schemas"]["CustomInvoicingApp"];
143
+ id?: string;
144
+ type: "custom_invoicing";
145
+ metadata?: import("./schemas.js").components["schemas"]["Metadata"];
146
+ } | {
147
+ id?: string;
148
+ type: "stripe";
149
+ stripeCustomerId: string;
150
+ stripeDefaultPaymentMethodId?: string;
151
+ readonly app?: import("./schemas.js").components["schemas"]["StripeApp"];
152
+ } | {
153
+ readonly app?: import("./schemas.js").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.js").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.js").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.js").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,276 @@
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
+ stripe;
11
+ constructor(client) {
12
+ this.client = client;
13
+ this.apps = new CustomerApps(client);
14
+ this.entitlements = new CustomerEntitlements(client);
15
+ this.stripe = new CustomerStripe(client);
16
+ }
17
+ /**
18
+ * Create a customer
19
+ * @param customer - The customer to create
20
+ * @param signal - An optional abort signal
21
+ * @returns The created customer
22
+ */
23
+ async create(customer, options) {
24
+ const resp = await this.client.POST('/api/v1/customers', {
25
+ body: customer,
26
+ ...options,
27
+ });
28
+ return transformResponse(resp);
29
+ }
30
+ /**
31
+ * Get a customer by ID
32
+ * @param customerIdOrKey - The ID or Key of the customer
33
+ * @param signal - An optional abort signal
34
+ * @returns The customer
35
+ */
36
+ async get(customerIdOrKey, options) {
37
+ const resp = await this.client.GET('/api/v1/customers/{customerIdOrKey}', {
38
+ params: {
39
+ path: {
40
+ customerIdOrKey,
41
+ },
42
+ },
43
+ ...options,
44
+ });
45
+ return transformResponse(resp);
46
+ }
47
+ /**
48
+ * Update a customer
49
+ * @param customerIdOrKey - The ID or Key of the customer
50
+ * @param customer - The customer to update
51
+ * @param signal - An optional abort signal
52
+ * @returns The updated customer
53
+ */
54
+ async update(customerIdOrKey, customer, options) {
55
+ const resp = await this.client.PUT('/api/v1/customers/{customerIdOrKey}', {
56
+ body: customer,
57
+ params: {
58
+ path: {
59
+ customerIdOrKey,
60
+ },
61
+ },
62
+ ...options,
63
+ });
64
+ return transformResponse(resp);
65
+ }
66
+ /**
67
+ * Delete a customer
68
+ * @param customerIdOrKey - The ID or Key of the customer
69
+ * @param signal - An optional abort signal
70
+ * @returns The deleted customer
71
+ */
72
+ async delete(customerIdOrKey, options) {
73
+ const resp = await this.client.DELETE('/api/v1/customers/{customerIdOrKey}', {
74
+ params: {
75
+ path: {
76
+ customerIdOrKey,
77
+ },
78
+ },
79
+ ...options,
80
+ });
81
+ return transformResponse(resp);
82
+ }
83
+ /**
84
+ * List customers
85
+ * @param signal - An optional abort signal
86
+ * @returns The list of customers
87
+ */
88
+ async list(query, options) {
89
+ const resp = await this.client.GET('/api/v1/customers', {
90
+ params: {
91
+ query,
92
+ },
93
+ ...options,
94
+ });
95
+ return transformResponse(resp);
96
+ }
97
+ /**
98
+ * Get customer access
99
+ * @param customerIdOrKey - The ID or Key of the customer
100
+ * @param options - Optional request options
101
+ * @returns The customer access information
102
+ */
103
+ async getAccess(customerIdOrKey, options) {
104
+ const resp = await this.client.GET('/api/v1/customers/{customerIdOrKey}/access', {
105
+ params: {
106
+ path: {
107
+ customerIdOrKey,
108
+ },
109
+ },
110
+ ...options,
111
+ });
112
+ return transformResponse(resp);
113
+ }
114
+ /**
115
+ * List customer subscriptions
116
+ * @param customerIdOrKey - The ID or key of the customer
117
+ * @param query - The query parameters
118
+ * @param signal - An optional abort signal
119
+ * @returns The list of customer subscriptions
120
+ */
121
+ async listSubscriptions(customerIdOrKey, query, options) {
122
+ const resp = await this.client.GET('/api/v1/customers/{customerIdOrKey}/subscriptions', {
123
+ params: { path: { customerIdOrKey }, query },
124
+ ...options,
125
+ });
126
+ return transformResponse(resp);
127
+ }
128
+ }
129
+ /**
130
+ * Customer Apps
131
+ * Manage customer apps.
132
+ */
133
+ export class CustomerApps {
134
+ client;
135
+ constructor(client) {
136
+ this.client = client;
137
+ }
138
+ /**
139
+ * Upsert customer app data
140
+ * @param customerIdOrKey - The ID or Key of the customer
141
+ * @param appData - The app data to upsert
142
+ * @param signal - An optional abort signal
143
+ * @returns The upserted app data
144
+ */
145
+ async upsert(customerIdOrKey, appData, options) {
146
+ const resp = await this.client.PUT('/api/v1/customers/{customerIdOrKey}/apps', {
147
+ body: appData,
148
+ params: {
149
+ path: {
150
+ customerIdOrKey,
151
+ },
152
+ },
153
+ ...options,
154
+ });
155
+ return transformResponse(resp);
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
+ async list(customerIdOrKey, query, options) {
165
+ const resp = await this.client.GET('/api/v1/customers/{customerIdOrKey}/apps', {
166
+ params: {
167
+ path: { customerIdOrKey },
168
+ query,
169
+ },
170
+ ...options,
171
+ });
172
+ return transformResponse(resp);
173
+ }
174
+ /**
175
+ * Delete customer app data
176
+ * @param customerIdOrKey - The ID or key of the customer
177
+ * @param appId - The ID of the app
178
+ * @param signal - An optional abort signal
179
+ * @returns The deleted customer app data
180
+ */
181
+ async delete(customerIdOrKey, appId, options) {
182
+ const resp = await this.client.DELETE('/api/v1/customers/{customerIdOrKey}/apps/{appId}', {
183
+ params: { path: { appId, customerIdOrKey } },
184
+ ...options,
185
+ });
186
+ return transformResponse(resp);
187
+ }
188
+ }
189
+ /**
190
+ * Customer Stripe
191
+ * Manage customer Stripe data.
192
+ */
193
+ export class CustomerStripe {
194
+ client;
195
+ constructor(client) {
196
+ this.client = client;
197
+ }
198
+ /**
199
+ * Upsert customer stripe app data
200
+ * @param customerIdOrKey - The ID or Key of the customer
201
+ * @param appData - The app data to upsert
202
+ * @param signal - An optional abort signal
203
+ * @returns The upserted customer stripe app data
204
+ */
205
+ async upsert(customerIdOrKey, stripeAppData, options) {
206
+ const resp = await this.client.PUT('/api/v1/customers/{customerIdOrKey}/stripe', {
207
+ body: stripeAppData,
208
+ params: {
209
+ path: {
210
+ customerIdOrKey,
211
+ },
212
+ },
213
+ ...options,
214
+ });
215
+ return transformResponse(resp);
216
+ }
217
+ /**
218
+ * Get customer stripe app data
219
+ * @param customerIdOrKey - The ID or key of the customer
220
+ * @param query - The query parameters
221
+ * @param signal - An optional abort signal
222
+ * @returns The customer stripe app data
223
+ */
224
+ async get(customerIdOrKey, options) {
225
+ const resp = await this.client.GET('/api/v1/customers/{customerIdOrKey}/apps', {
226
+ params: {
227
+ path: { customerIdOrKey },
228
+ },
229
+ ...options,
230
+ });
231
+ return transformResponse(resp);
232
+ }
233
+ /**
234
+ * Create a Stripe customer portal session
235
+ * @param customerIdOrKey - The ID or Key of the customer
236
+ * @param params - The parameters for creating a Stripe customer portal session
237
+ * @param signal - An optional abort signal
238
+ * @returns The Stripe customer portal session
239
+ */
240
+ async createPortalSession(customerIdOrKey, params, options) {
241
+ const resp = await this.client.POST('/api/v1/customers/{customerIdOrKey}/stripe/portal', {
242
+ body: params,
243
+ params: {
244
+ path: {
245
+ customerIdOrKey,
246
+ },
247
+ },
248
+ ...options,
249
+ });
250
+ return transformResponse(resp);
251
+ }
252
+ }
253
+ /**
254
+ * Customer Entitlements
255
+ */
256
+ export class CustomerEntitlements {
257
+ client;
258
+ constructor(client) {
259
+ this.client = client;
260
+ }
261
+ /**
262
+ * Get the value of an entitlement for a customer
263
+ * @param customerIdOrKey - The ID or Key of the customer
264
+ * @param featureKey - The key of the feature
265
+ * @param signal - An optional abort signal
266
+ * @returns The value of the entitlement
267
+ */
268
+ async value(customerIdOrKey, featureKey, options) {
269
+ const resp = await this.client.GET('/api/v1/customers/{customerIdOrKey}/entitlements/{featureKey}/value', {
270
+ params: { path: { customerIdOrKey, featureKey } },
271
+ ...options,
272
+ });
273
+ return transformResponse(resp);
274
+ }
275
+ }
276
+ //# sourceMappingURL=customers.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"customers.js","sourceRoot":"","sources":["../../../src/client/customers.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAA;AAa9C;;;GAGG;AAC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AAE,EAAE;YACjD,GAAG,OAAO;SACX,CACF,CAAA;QAED,OAAO,iBAAiB,CAAC,IAAI,CAAC,CAAA;IAChC,CAAC;CACF"}
@@ -0,0 +1,17 @@
1
+ import type { RequestOptions } from './common.js';
2
+ import type { paths } from './schemas.js';
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,23 @@
1
+ import { transformResponse } from './utils.js';
2
+ /**
3
+ * Debug utilities for OpenMeter
4
+ */
5
+ export class Debug {
6
+ client;
7
+ constructor(client) {
8
+ this.client = client;
9
+ }
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
+ async getMetrics(options) {
17
+ const resp = await this.client.GET('/api/v1/debug/metrics', {
18
+ ...options,
19
+ });
20
+ return transformResponse(resp);
21
+ }
22
+ }
23
+ //# sourceMappingURL=debug.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"debug.js","sourceRoot":"","sources":["../../../src/client/debug.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAA;AAK9C;;GAEG;AACH,MAAM,OAAO,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,iBAAiB,CAAC,IAAI,CAAC,CAAA;IAChC,CAAC;CACF"}