@lavapayments/nodejs 5.3.2 → 6.0.0
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.
- package/dist/index.d.mts +90 -5
- package/dist/index.d.ts +90 -5
- package/dist/index.js +77 -2
- package/dist/index.mjs +77 -2
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
interface CreateCheckoutSessionParams {
|
|
2
|
-
checkout_mode: 'onboarding' | 'topup';
|
|
2
|
+
checkout_mode: 'onboarding' | 'topup' | 'subscription';
|
|
3
3
|
origin_url: string;
|
|
4
4
|
reference_id?: string;
|
|
5
5
|
connection_id?: string;
|
|
6
|
+
subscription_config_id?: string;
|
|
6
7
|
}
|
|
7
8
|
interface CheckoutSessionsListParams {
|
|
8
9
|
cursor?: string;
|
|
@@ -50,13 +51,24 @@ interface ListResponse<T> {
|
|
|
50
51
|
has_more: boolean;
|
|
51
52
|
next_cursor?: string;
|
|
52
53
|
}
|
|
54
|
+
interface CreateSubscriptionConfigParams {
|
|
55
|
+
name: string;
|
|
56
|
+
period_amount: string;
|
|
57
|
+
rollover_type: 'full' | 'none';
|
|
58
|
+
}
|
|
59
|
+
interface UpdateSubscriptionConfigParams {
|
|
60
|
+
name?: string;
|
|
61
|
+
period_amount?: string;
|
|
62
|
+
rollover_type?: 'full' | 'none';
|
|
63
|
+
}
|
|
53
64
|
type RestCheckoutSession = {
|
|
54
65
|
checkout_session_id: string;
|
|
55
66
|
checkout_session_token: string;
|
|
56
|
-
checkout_mode: 'onboarding' | 'topup';
|
|
67
|
+
checkout_mode: 'onboarding' | 'topup' | 'subscription';
|
|
57
68
|
origin_url: string;
|
|
58
69
|
connection_id?: string;
|
|
59
70
|
reference_id?: string;
|
|
71
|
+
subscription_config_id?: string;
|
|
60
72
|
created_at: string;
|
|
61
73
|
completed_at?: string;
|
|
62
74
|
};
|
|
@@ -153,8 +165,36 @@ type RestUsage = {
|
|
|
153
165
|
total_merchant_cost: string;
|
|
154
166
|
};
|
|
155
167
|
};
|
|
168
|
+
type RestSubscriptionConfig = {
|
|
169
|
+
subscription_config_id: string;
|
|
170
|
+
merchant_id: string;
|
|
171
|
+
name: string;
|
|
172
|
+
period_amount: string;
|
|
173
|
+
rollover_type: 'full' | 'none';
|
|
174
|
+
created_at: string;
|
|
175
|
+
};
|
|
176
|
+
type RestActiveSubscription = {
|
|
177
|
+
active_subscription_id: string;
|
|
178
|
+
wallet_id: string;
|
|
179
|
+
subscription_config_id: string;
|
|
180
|
+
started_at: string;
|
|
181
|
+
billing_anchor: number;
|
|
182
|
+
cancelled_at?: string;
|
|
183
|
+
status: 'active' | 'cancelled';
|
|
184
|
+
created_at: string;
|
|
185
|
+
subscription_config: RestSubscriptionConfig;
|
|
186
|
+
wallet: {
|
|
187
|
+
wallet_id: string;
|
|
188
|
+
phone: string;
|
|
189
|
+
email?: string;
|
|
190
|
+
first_name?: string;
|
|
191
|
+
last_name?: string;
|
|
192
|
+
active_balance: string;
|
|
193
|
+
created_at: string;
|
|
194
|
+
};
|
|
195
|
+
};
|
|
156
196
|
|
|
157
|
-
/** biome-ignore-all lint/style/noNamespace:
|
|
197
|
+
/** biome-ignore-all lint/style/noNamespace: package uses namespace */
|
|
158
198
|
|
|
159
199
|
declare namespace Resources {
|
|
160
200
|
abstract class BaseResource {
|
|
@@ -243,6 +283,47 @@ declare namespace Resources {
|
|
|
243
283
|
*/
|
|
244
284
|
retrieve(params: UsageParams): Promise<RestUsage>;
|
|
245
285
|
}
|
|
286
|
+
export class SubscriptionsResource extends BaseResource {
|
|
287
|
+
/**
|
|
288
|
+
* List subscription configurations
|
|
289
|
+
* @returns List of subscription configurations
|
|
290
|
+
*/
|
|
291
|
+
listConfigs(): Promise<RestSubscriptionConfig[]>;
|
|
292
|
+
/**
|
|
293
|
+
* Create a subscription configuration
|
|
294
|
+
* @param params Subscription configuration parameters
|
|
295
|
+
* @returns Created subscription configuration
|
|
296
|
+
*/
|
|
297
|
+
createConfig(params: CreateSubscriptionConfigParams): Promise<RestSubscriptionConfig>;
|
|
298
|
+
/**
|
|
299
|
+
* Update a subscription configuration
|
|
300
|
+
* @param id Subscription configuration ID
|
|
301
|
+
* @param params Update parameters
|
|
302
|
+
* @returns Updated subscription configuration
|
|
303
|
+
*/
|
|
304
|
+
updateConfig(id: string, params: UpdateSubscriptionConfigParams): Promise<RestSubscriptionConfig>;
|
|
305
|
+
/**
|
|
306
|
+
* Delete a subscription configuration
|
|
307
|
+
* @param id Subscription configuration ID
|
|
308
|
+
* @returns Success response
|
|
309
|
+
*/
|
|
310
|
+
deleteConfig(id: string): Promise<{
|
|
311
|
+
success: boolean;
|
|
312
|
+
}>;
|
|
313
|
+
/**
|
|
314
|
+
* List active subscriptions for a merchant
|
|
315
|
+
* @returns List of active subscriptions
|
|
316
|
+
*/
|
|
317
|
+
listActiveSubscriptions(): Promise<RestActiveSubscription[]>;
|
|
318
|
+
/**
|
|
319
|
+
* Cancel an active subscription
|
|
320
|
+
* @param id Active subscription ID
|
|
321
|
+
* @returns Success response
|
|
322
|
+
*/
|
|
323
|
+
cancelActiveSubscription(id: string): Promise<{
|
|
324
|
+
success: boolean;
|
|
325
|
+
}>;
|
|
326
|
+
}
|
|
246
327
|
export { };
|
|
247
328
|
}
|
|
248
329
|
|
|
@@ -284,6 +365,10 @@ declare class Lava {
|
|
|
284
365
|
* The usage resource
|
|
285
366
|
*/
|
|
286
367
|
readonly usage: Resources.UsageResource;
|
|
368
|
+
/**
|
|
369
|
+
* The subscriptions resource
|
|
370
|
+
*/
|
|
371
|
+
readonly subscriptions: Resources.SubscriptionsResource;
|
|
287
372
|
/**
|
|
288
373
|
* Provider URLs for convenience
|
|
289
374
|
*/
|
|
@@ -329,7 +414,7 @@ declare class Lava {
|
|
|
329
414
|
* @returns Response data
|
|
330
415
|
*/
|
|
331
416
|
request<T>(method: string, path: string, { data, query }?: {
|
|
332
|
-
data?:
|
|
417
|
+
data?: unknown;
|
|
333
418
|
query?: Record<string, string>;
|
|
334
419
|
}): Promise<T>;
|
|
335
420
|
/**
|
|
@@ -340,4 +425,4 @@ declare class Lava {
|
|
|
340
425
|
generateForwardToken(options: ForwardTokenOptions): string;
|
|
341
426
|
}
|
|
342
427
|
|
|
343
|
-
export { type ApiVersion, type CheckoutSessionsListParams, type Config, type ConnectionsListParams, type CreateCheckoutSessionParams, type CreateRequestParams, type ForwardTokenOptions, Lava, type ListResponse, type RequestsListParams, type RequestsListResponse, Resources, type RestCheckoutSession, type RestConnection, type RestRequest, type RestUsage, type UsageParams };
|
|
428
|
+
export { type ApiVersion, type CheckoutSessionsListParams, type Config, type ConnectionsListParams, type CreateCheckoutSessionParams, type CreateRequestParams, type CreateSubscriptionConfigParams, type ForwardTokenOptions, Lava, type ListResponse, type RequestsListParams, type RequestsListResponse, Resources, type RestActiveSubscription, type RestCheckoutSession, type RestConnection, type RestRequest, type RestSubscriptionConfig, type RestUsage, type UpdateSubscriptionConfigParams, type UsageParams };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
interface CreateCheckoutSessionParams {
|
|
2
|
-
checkout_mode: 'onboarding' | 'topup';
|
|
2
|
+
checkout_mode: 'onboarding' | 'topup' | 'subscription';
|
|
3
3
|
origin_url: string;
|
|
4
4
|
reference_id?: string;
|
|
5
5
|
connection_id?: string;
|
|
6
|
+
subscription_config_id?: string;
|
|
6
7
|
}
|
|
7
8
|
interface CheckoutSessionsListParams {
|
|
8
9
|
cursor?: string;
|
|
@@ -50,13 +51,24 @@ interface ListResponse<T> {
|
|
|
50
51
|
has_more: boolean;
|
|
51
52
|
next_cursor?: string;
|
|
52
53
|
}
|
|
54
|
+
interface CreateSubscriptionConfigParams {
|
|
55
|
+
name: string;
|
|
56
|
+
period_amount: string;
|
|
57
|
+
rollover_type: 'full' | 'none';
|
|
58
|
+
}
|
|
59
|
+
interface UpdateSubscriptionConfigParams {
|
|
60
|
+
name?: string;
|
|
61
|
+
period_amount?: string;
|
|
62
|
+
rollover_type?: 'full' | 'none';
|
|
63
|
+
}
|
|
53
64
|
type RestCheckoutSession = {
|
|
54
65
|
checkout_session_id: string;
|
|
55
66
|
checkout_session_token: string;
|
|
56
|
-
checkout_mode: 'onboarding' | 'topup';
|
|
67
|
+
checkout_mode: 'onboarding' | 'topup' | 'subscription';
|
|
57
68
|
origin_url: string;
|
|
58
69
|
connection_id?: string;
|
|
59
70
|
reference_id?: string;
|
|
71
|
+
subscription_config_id?: string;
|
|
60
72
|
created_at: string;
|
|
61
73
|
completed_at?: string;
|
|
62
74
|
};
|
|
@@ -153,8 +165,36 @@ type RestUsage = {
|
|
|
153
165
|
total_merchant_cost: string;
|
|
154
166
|
};
|
|
155
167
|
};
|
|
168
|
+
type RestSubscriptionConfig = {
|
|
169
|
+
subscription_config_id: string;
|
|
170
|
+
merchant_id: string;
|
|
171
|
+
name: string;
|
|
172
|
+
period_amount: string;
|
|
173
|
+
rollover_type: 'full' | 'none';
|
|
174
|
+
created_at: string;
|
|
175
|
+
};
|
|
176
|
+
type RestActiveSubscription = {
|
|
177
|
+
active_subscription_id: string;
|
|
178
|
+
wallet_id: string;
|
|
179
|
+
subscription_config_id: string;
|
|
180
|
+
started_at: string;
|
|
181
|
+
billing_anchor: number;
|
|
182
|
+
cancelled_at?: string;
|
|
183
|
+
status: 'active' | 'cancelled';
|
|
184
|
+
created_at: string;
|
|
185
|
+
subscription_config: RestSubscriptionConfig;
|
|
186
|
+
wallet: {
|
|
187
|
+
wallet_id: string;
|
|
188
|
+
phone: string;
|
|
189
|
+
email?: string;
|
|
190
|
+
first_name?: string;
|
|
191
|
+
last_name?: string;
|
|
192
|
+
active_balance: string;
|
|
193
|
+
created_at: string;
|
|
194
|
+
};
|
|
195
|
+
};
|
|
156
196
|
|
|
157
|
-
/** biome-ignore-all lint/style/noNamespace:
|
|
197
|
+
/** biome-ignore-all lint/style/noNamespace: package uses namespace */
|
|
158
198
|
|
|
159
199
|
declare namespace Resources {
|
|
160
200
|
abstract class BaseResource {
|
|
@@ -243,6 +283,47 @@ declare namespace Resources {
|
|
|
243
283
|
*/
|
|
244
284
|
retrieve(params: UsageParams): Promise<RestUsage>;
|
|
245
285
|
}
|
|
286
|
+
export class SubscriptionsResource extends BaseResource {
|
|
287
|
+
/**
|
|
288
|
+
* List subscription configurations
|
|
289
|
+
* @returns List of subscription configurations
|
|
290
|
+
*/
|
|
291
|
+
listConfigs(): Promise<RestSubscriptionConfig[]>;
|
|
292
|
+
/**
|
|
293
|
+
* Create a subscription configuration
|
|
294
|
+
* @param params Subscription configuration parameters
|
|
295
|
+
* @returns Created subscription configuration
|
|
296
|
+
*/
|
|
297
|
+
createConfig(params: CreateSubscriptionConfigParams): Promise<RestSubscriptionConfig>;
|
|
298
|
+
/**
|
|
299
|
+
* Update a subscription configuration
|
|
300
|
+
* @param id Subscription configuration ID
|
|
301
|
+
* @param params Update parameters
|
|
302
|
+
* @returns Updated subscription configuration
|
|
303
|
+
*/
|
|
304
|
+
updateConfig(id: string, params: UpdateSubscriptionConfigParams): Promise<RestSubscriptionConfig>;
|
|
305
|
+
/**
|
|
306
|
+
* Delete a subscription configuration
|
|
307
|
+
* @param id Subscription configuration ID
|
|
308
|
+
* @returns Success response
|
|
309
|
+
*/
|
|
310
|
+
deleteConfig(id: string): Promise<{
|
|
311
|
+
success: boolean;
|
|
312
|
+
}>;
|
|
313
|
+
/**
|
|
314
|
+
* List active subscriptions for a merchant
|
|
315
|
+
* @returns List of active subscriptions
|
|
316
|
+
*/
|
|
317
|
+
listActiveSubscriptions(): Promise<RestActiveSubscription[]>;
|
|
318
|
+
/**
|
|
319
|
+
* Cancel an active subscription
|
|
320
|
+
* @param id Active subscription ID
|
|
321
|
+
* @returns Success response
|
|
322
|
+
*/
|
|
323
|
+
cancelActiveSubscription(id: string): Promise<{
|
|
324
|
+
success: boolean;
|
|
325
|
+
}>;
|
|
326
|
+
}
|
|
246
327
|
export { };
|
|
247
328
|
}
|
|
248
329
|
|
|
@@ -284,6 +365,10 @@ declare class Lava {
|
|
|
284
365
|
* The usage resource
|
|
285
366
|
*/
|
|
286
367
|
readonly usage: Resources.UsageResource;
|
|
368
|
+
/**
|
|
369
|
+
* The subscriptions resource
|
|
370
|
+
*/
|
|
371
|
+
readonly subscriptions: Resources.SubscriptionsResource;
|
|
287
372
|
/**
|
|
288
373
|
* Provider URLs for convenience
|
|
289
374
|
*/
|
|
@@ -329,7 +414,7 @@ declare class Lava {
|
|
|
329
414
|
* @returns Response data
|
|
330
415
|
*/
|
|
331
416
|
request<T>(method: string, path: string, { data, query }?: {
|
|
332
|
-
data?:
|
|
417
|
+
data?: unknown;
|
|
333
418
|
query?: Record<string, string>;
|
|
334
419
|
}): Promise<T>;
|
|
335
420
|
/**
|
|
@@ -340,4 +425,4 @@ declare class Lava {
|
|
|
340
425
|
generateForwardToken(options: ForwardTokenOptions): string;
|
|
341
426
|
}
|
|
342
427
|
|
|
343
|
-
export { type ApiVersion, type CheckoutSessionsListParams, type Config, type ConnectionsListParams, type CreateCheckoutSessionParams, type CreateRequestParams, type ForwardTokenOptions, Lava, type ListResponse, type RequestsListParams, type RequestsListResponse, Resources, type RestCheckoutSession, type RestConnection, type RestRequest, type RestUsage, type UsageParams };
|
|
428
|
+
export { type ApiVersion, type CheckoutSessionsListParams, type Config, type ConnectionsListParams, type CreateCheckoutSessionParams, type CreateRequestParams, type CreateSubscriptionConfigParams, type ForwardTokenOptions, Lava, type ListResponse, type RequestsListParams, type RequestsListResponse, Resources, type RestActiveSubscription, type RestCheckoutSession, type RestConnection, type RestRequest, type RestSubscriptionConfig, type RestUsage, type UpdateSubscriptionConfigParams, type UsageParams };
|
package/dist/index.js
CHANGED
|
@@ -219,6 +219,80 @@ var Resources;
|
|
|
219
219
|
}
|
|
220
220
|
}
|
|
221
221
|
Resources2.UsageResource = UsageResource;
|
|
222
|
+
class SubscriptionsResource extends BaseResource {
|
|
223
|
+
/**
|
|
224
|
+
* List subscription configurations
|
|
225
|
+
* @returns List of subscription configurations
|
|
226
|
+
*/
|
|
227
|
+
listConfigs() {
|
|
228
|
+
return this.lava.request(
|
|
229
|
+
"GET",
|
|
230
|
+
"subscription-configs"
|
|
231
|
+
);
|
|
232
|
+
}
|
|
233
|
+
/**
|
|
234
|
+
* Create a subscription configuration
|
|
235
|
+
* @param params Subscription configuration parameters
|
|
236
|
+
* @returns Created subscription configuration
|
|
237
|
+
*/
|
|
238
|
+
createConfig(params) {
|
|
239
|
+
return this.lava.request(
|
|
240
|
+
"POST",
|
|
241
|
+
"subscription-configs",
|
|
242
|
+
{
|
|
243
|
+
data: params
|
|
244
|
+
}
|
|
245
|
+
);
|
|
246
|
+
}
|
|
247
|
+
/**
|
|
248
|
+
* Update a subscription configuration
|
|
249
|
+
* @param id Subscription configuration ID
|
|
250
|
+
* @param params Update parameters
|
|
251
|
+
* @returns Updated subscription configuration
|
|
252
|
+
*/
|
|
253
|
+
updateConfig(id, params) {
|
|
254
|
+
return this.lava.request(
|
|
255
|
+
"PUT",
|
|
256
|
+
`subscription-configs/${id}`,
|
|
257
|
+
{
|
|
258
|
+
data: params
|
|
259
|
+
}
|
|
260
|
+
);
|
|
261
|
+
}
|
|
262
|
+
/**
|
|
263
|
+
* Delete a subscription configuration
|
|
264
|
+
* @param id Subscription configuration ID
|
|
265
|
+
* @returns Success response
|
|
266
|
+
*/
|
|
267
|
+
deleteConfig(id) {
|
|
268
|
+
return this.lava.request(
|
|
269
|
+
"DELETE",
|
|
270
|
+
`subscription-configs/${id}`
|
|
271
|
+
);
|
|
272
|
+
}
|
|
273
|
+
/**
|
|
274
|
+
* List active subscriptions for a merchant
|
|
275
|
+
* @returns List of active subscriptions
|
|
276
|
+
*/
|
|
277
|
+
listActiveSubscriptions() {
|
|
278
|
+
return this.lava.request(
|
|
279
|
+
"GET",
|
|
280
|
+
"active-subscriptions"
|
|
281
|
+
);
|
|
282
|
+
}
|
|
283
|
+
/**
|
|
284
|
+
* Cancel an active subscription
|
|
285
|
+
* @param id Active subscription ID
|
|
286
|
+
* @returns Success response
|
|
287
|
+
*/
|
|
288
|
+
cancelActiveSubscription(id) {
|
|
289
|
+
return this.lava.request(
|
|
290
|
+
"DELETE",
|
|
291
|
+
`active-subscriptions/${id}`
|
|
292
|
+
);
|
|
293
|
+
}
|
|
294
|
+
}
|
|
295
|
+
Resources2.SubscriptionsResource = SubscriptionsResource;
|
|
222
296
|
})(Resources || (Resources = {}));
|
|
223
297
|
|
|
224
298
|
// src/client.ts
|
|
@@ -237,6 +311,7 @@ var Lava = class {
|
|
|
237
311
|
this.connections = new Resources.ConnectionsResource(this);
|
|
238
312
|
this.requests = new Resources.RequestsResource(this);
|
|
239
313
|
this.usage = new Resources.UsageResource(this);
|
|
314
|
+
this.subscriptions = new Resources.SubscriptionsResource(this);
|
|
240
315
|
this.providers = {
|
|
241
316
|
openai: `${this.baseUrl}forward?u=https://api.openai.com/v1`,
|
|
242
317
|
anthropic: `${this.baseUrl}forward?u=https://api.anthropic.com/v1`,
|
|
@@ -276,11 +351,11 @@ var Lava = class {
|
|
|
276
351
|
async request(method, path, { data, query } = {}) {
|
|
277
352
|
const url = new URL(path, this.baseUrl);
|
|
278
353
|
if (query) {
|
|
279
|
-
|
|
354
|
+
for (const [key, value] of Object.entries(query)) {
|
|
280
355
|
if (value !== void 0) {
|
|
281
356
|
url.searchParams.append(key, value.toString());
|
|
282
357
|
}
|
|
283
|
-
}
|
|
358
|
+
}
|
|
284
359
|
}
|
|
285
360
|
const headers = {
|
|
286
361
|
Authorization: `Bearer ${this.secretKey}`,
|
package/dist/index.mjs
CHANGED
|
@@ -192,6 +192,80 @@ var Resources;
|
|
|
192
192
|
}
|
|
193
193
|
}
|
|
194
194
|
Resources2.UsageResource = UsageResource;
|
|
195
|
+
class SubscriptionsResource extends BaseResource {
|
|
196
|
+
/**
|
|
197
|
+
* List subscription configurations
|
|
198
|
+
* @returns List of subscription configurations
|
|
199
|
+
*/
|
|
200
|
+
listConfigs() {
|
|
201
|
+
return this.lava.request(
|
|
202
|
+
"GET",
|
|
203
|
+
"subscription-configs"
|
|
204
|
+
);
|
|
205
|
+
}
|
|
206
|
+
/**
|
|
207
|
+
* Create a subscription configuration
|
|
208
|
+
* @param params Subscription configuration parameters
|
|
209
|
+
* @returns Created subscription configuration
|
|
210
|
+
*/
|
|
211
|
+
createConfig(params) {
|
|
212
|
+
return this.lava.request(
|
|
213
|
+
"POST",
|
|
214
|
+
"subscription-configs",
|
|
215
|
+
{
|
|
216
|
+
data: params
|
|
217
|
+
}
|
|
218
|
+
);
|
|
219
|
+
}
|
|
220
|
+
/**
|
|
221
|
+
* Update a subscription configuration
|
|
222
|
+
* @param id Subscription configuration ID
|
|
223
|
+
* @param params Update parameters
|
|
224
|
+
* @returns Updated subscription configuration
|
|
225
|
+
*/
|
|
226
|
+
updateConfig(id, params) {
|
|
227
|
+
return this.lava.request(
|
|
228
|
+
"PUT",
|
|
229
|
+
`subscription-configs/${id}`,
|
|
230
|
+
{
|
|
231
|
+
data: params
|
|
232
|
+
}
|
|
233
|
+
);
|
|
234
|
+
}
|
|
235
|
+
/**
|
|
236
|
+
* Delete a subscription configuration
|
|
237
|
+
* @param id Subscription configuration ID
|
|
238
|
+
* @returns Success response
|
|
239
|
+
*/
|
|
240
|
+
deleteConfig(id) {
|
|
241
|
+
return this.lava.request(
|
|
242
|
+
"DELETE",
|
|
243
|
+
`subscription-configs/${id}`
|
|
244
|
+
);
|
|
245
|
+
}
|
|
246
|
+
/**
|
|
247
|
+
* List active subscriptions for a merchant
|
|
248
|
+
* @returns List of active subscriptions
|
|
249
|
+
*/
|
|
250
|
+
listActiveSubscriptions() {
|
|
251
|
+
return this.lava.request(
|
|
252
|
+
"GET",
|
|
253
|
+
"active-subscriptions"
|
|
254
|
+
);
|
|
255
|
+
}
|
|
256
|
+
/**
|
|
257
|
+
* Cancel an active subscription
|
|
258
|
+
* @param id Active subscription ID
|
|
259
|
+
* @returns Success response
|
|
260
|
+
*/
|
|
261
|
+
cancelActiveSubscription(id) {
|
|
262
|
+
return this.lava.request(
|
|
263
|
+
"DELETE",
|
|
264
|
+
`active-subscriptions/${id}`
|
|
265
|
+
);
|
|
266
|
+
}
|
|
267
|
+
}
|
|
268
|
+
Resources2.SubscriptionsResource = SubscriptionsResource;
|
|
195
269
|
})(Resources || (Resources = {}));
|
|
196
270
|
|
|
197
271
|
// src/client.ts
|
|
@@ -210,6 +284,7 @@ var Lava = class {
|
|
|
210
284
|
this.connections = new Resources.ConnectionsResource(this);
|
|
211
285
|
this.requests = new Resources.RequestsResource(this);
|
|
212
286
|
this.usage = new Resources.UsageResource(this);
|
|
287
|
+
this.subscriptions = new Resources.SubscriptionsResource(this);
|
|
213
288
|
this.providers = {
|
|
214
289
|
openai: `${this.baseUrl}forward?u=https://api.openai.com/v1`,
|
|
215
290
|
anthropic: `${this.baseUrl}forward?u=https://api.anthropic.com/v1`,
|
|
@@ -249,11 +324,11 @@ var Lava = class {
|
|
|
249
324
|
async request(method, path, { data, query } = {}) {
|
|
250
325
|
const url = new URL(path, this.baseUrl);
|
|
251
326
|
if (query) {
|
|
252
|
-
|
|
327
|
+
for (const [key, value] of Object.entries(query)) {
|
|
253
328
|
if (value !== void 0) {
|
|
254
329
|
url.searchParams.append(key, value.toString());
|
|
255
330
|
}
|
|
256
|
-
}
|
|
331
|
+
}
|
|
257
332
|
}
|
|
258
333
|
const headers = {
|
|
259
334
|
Authorization: `Bearer ${this.secretKey}`,
|