@lavapayments/nodejs 1.1.0 → 2.1.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/README.md +2 -2
- package/dist/index.d.mts +21 -8
- package/dist/index.d.ts +21 -8
- package/dist/index.js +8 -0
- package/dist/index.mjs +8 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -16,7 +16,7 @@ npm install @lavapayments/nodejs
|
|
|
16
16
|
import { Lava } from '@lavapayments/nodejs';
|
|
17
17
|
|
|
18
18
|
const lava = new Lava('your_secret_key', {
|
|
19
|
-
apiVersion: '2025-03-
|
|
19
|
+
apiVersion: '2025-03-27.v1',
|
|
20
20
|
});
|
|
21
21
|
```
|
|
22
22
|
|
|
@@ -42,7 +42,7 @@ const forwardToken = lava.generateForwardToken({
|
|
|
42
42
|
product_secret: 'product_secret',
|
|
43
43
|
});
|
|
44
44
|
|
|
45
|
-
// Use the token to make an API request through Lava
|
|
45
|
+
// Use the token to make an API request through Lava
|
|
46
46
|
const response = await fetch(lava.openaiUrl, {
|
|
47
47
|
method: 'POST',
|
|
48
48
|
headers: {
|
package/dist/index.d.mts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
type ApiVersion = "2025-03-
|
|
1
|
+
type ApiVersion = "2025-03-27.v1";
|
|
2
2
|
interface Config {
|
|
3
3
|
apiVersion: ApiVersion;
|
|
4
4
|
/**
|
|
@@ -163,6 +163,7 @@ interface Request {
|
|
|
163
163
|
fee: Fee;
|
|
164
164
|
service_charge: ServiceCharge;
|
|
165
165
|
total_request_cost: string;
|
|
166
|
+
metadata: Record<string, string>;
|
|
166
167
|
timestamp: string;
|
|
167
168
|
created_at: string;
|
|
168
169
|
}
|
|
@@ -171,6 +172,7 @@ interface RequestsListParams {
|
|
|
171
172
|
limit?: number;
|
|
172
173
|
connection_id?: string;
|
|
173
174
|
product_id?: string;
|
|
175
|
+
metadata_filters?: Record<string, string>;
|
|
174
176
|
}
|
|
175
177
|
interface RequestsListResponse {
|
|
176
178
|
data: Request[];
|
|
@@ -178,19 +180,30 @@ interface RequestsListResponse {
|
|
|
178
180
|
next_cursor?: string;
|
|
179
181
|
}
|
|
180
182
|
interface UsageData {
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
183
|
+
items: {
|
|
184
|
+
date: string;
|
|
185
|
+
total_requests: number;
|
|
186
|
+
total_usage_tokens: number;
|
|
187
|
+
total_usage_cost: string;
|
|
188
|
+
total_fee_amount: string;
|
|
189
|
+
total_service_charge_amount: string;
|
|
190
|
+
total_request_cost: string;
|
|
191
|
+
}[];
|
|
192
|
+
totals: {
|
|
193
|
+
total_requests: number;
|
|
194
|
+
total_usage_tokens: number;
|
|
195
|
+
total_usage_cost: string;
|
|
196
|
+
total_fee_amount: string;
|
|
197
|
+
total_service_charge_amount: string;
|
|
198
|
+
total_request_cost: string;
|
|
199
|
+
};
|
|
188
200
|
}
|
|
189
201
|
interface UsageParams {
|
|
190
202
|
start: string;
|
|
191
203
|
end?: string;
|
|
192
204
|
connection_id?: string;
|
|
193
205
|
product_id?: string;
|
|
206
|
+
metadata_filters?: Record<string, string>;
|
|
194
207
|
}
|
|
195
208
|
type Usage = UsageData[];
|
|
196
209
|
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
type ApiVersion = "2025-03-
|
|
1
|
+
type ApiVersion = "2025-03-27.v1";
|
|
2
2
|
interface Config {
|
|
3
3
|
apiVersion: ApiVersion;
|
|
4
4
|
/**
|
|
@@ -163,6 +163,7 @@ interface Request {
|
|
|
163
163
|
fee: Fee;
|
|
164
164
|
service_charge: ServiceCharge;
|
|
165
165
|
total_request_cost: string;
|
|
166
|
+
metadata: Record<string, string>;
|
|
166
167
|
timestamp: string;
|
|
167
168
|
created_at: string;
|
|
168
169
|
}
|
|
@@ -171,6 +172,7 @@ interface RequestsListParams {
|
|
|
171
172
|
limit?: number;
|
|
172
173
|
connection_id?: string;
|
|
173
174
|
product_id?: string;
|
|
175
|
+
metadata_filters?: Record<string, string>;
|
|
174
176
|
}
|
|
175
177
|
interface RequestsListResponse {
|
|
176
178
|
data: Request[];
|
|
@@ -178,19 +180,30 @@ interface RequestsListResponse {
|
|
|
178
180
|
next_cursor?: string;
|
|
179
181
|
}
|
|
180
182
|
interface UsageData {
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
183
|
+
items: {
|
|
184
|
+
date: string;
|
|
185
|
+
total_requests: number;
|
|
186
|
+
total_usage_tokens: number;
|
|
187
|
+
total_usage_cost: string;
|
|
188
|
+
total_fee_amount: string;
|
|
189
|
+
total_service_charge_amount: string;
|
|
190
|
+
total_request_cost: string;
|
|
191
|
+
}[];
|
|
192
|
+
totals: {
|
|
193
|
+
total_requests: number;
|
|
194
|
+
total_usage_tokens: number;
|
|
195
|
+
total_usage_cost: string;
|
|
196
|
+
total_fee_amount: string;
|
|
197
|
+
total_service_charge_amount: string;
|
|
198
|
+
total_request_cost: string;
|
|
199
|
+
};
|
|
188
200
|
}
|
|
189
201
|
interface UsageParams {
|
|
190
202
|
start: string;
|
|
191
203
|
end?: string;
|
|
192
204
|
connection_id?: string;
|
|
193
205
|
product_id?: string;
|
|
206
|
+
metadata_filters?: Record<string, string>;
|
|
194
207
|
}
|
|
195
208
|
type Usage = UsageData[];
|
|
196
209
|
|
package/dist/index.js
CHANGED
|
@@ -112,6 +112,10 @@ var Resources;
|
|
|
112
112
|
if (params.connection_id)
|
|
113
113
|
queryParams.connection_id = params.connection_id;
|
|
114
114
|
if (params.product_id) queryParams.product_id = params.product_id;
|
|
115
|
+
if (params.metadata_filters)
|
|
116
|
+
queryParams.metadata_filters = JSON.stringify(
|
|
117
|
+
Object.entries(params.metadata_filters)
|
|
118
|
+
);
|
|
115
119
|
}
|
|
116
120
|
return this.lava.request("GET", "requests", {
|
|
117
121
|
query: queryParams
|
|
@@ -141,6 +145,10 @@ var Resources;
|
|
|
141
145
|
if (params.connection_id)
|
|
142
146
|
queryParams.connection_id = params.connection_id;
|
|
143
147
|
if (params.product_id) queryParams.product_id = params.product_id;
|
|
148
|
+
if (params.metadata_filters)
|
|
149
|
+
queryParams.metadata_filters = JSON.stringify(
|
|
150
|
+
Object.entries(params.metadata_filters)
|
|
151
|
+
);
|
|
144
152
|
return this.lava.request("GET", "usage", {
|
|
145
153
|
query: queryParams
|
|
146
154
|
});
|
package/dist/index.mjs
CHANGED
|
@@ -85,6 +85,10 @@ var Resources;
|
|
|
85
85
|
if (params.connection_id)
|
|
86
86
|
queryParams.connection_id = params.connection_id;
|
|
87
87
|
if (params.product_id) queryParams.product_id = params.product_id;
|
|
88
|
+
if (params.metadata_filters)
|
|
89
|
+
queryParams.metadata_filters = JSON.stringify(
|
|
90
|
+
Object.entries(params.metadata_filters)
|
|
91
|
+
);
|
|
88
92
|
}
|
|
89
93
|
return this.lava.request("GET", "requests", {
|
|
90
94
|
query: queryParams
|
|
@@ -114,6 +118,10 @@ var Resources;
|
|
|
114
118
|
if (params.connection_id)
|
|
115
119
|
queryParams.connection_id = params.connection_id;
|
|
116
120
|
if (params.product_id) queryParams.product_id = params.product_id;
|
|
121
|
+
if (params.metadata_filters)
|
|
122
|
+
queryParams.metadata_filters = JSON.stringify(
|
|
123
|
+
Object.entries(params.metadata_filters)
|
|
124
|
+
);
|
|
117
125
|
return this.lava.request("GET", "usage", {
|
|
118
126
|
query: queryParams
|
|
119
127
|
});
|