latitudesh-typescript-sdk 0.8.0 → 0.8.2
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/bin/mcp-server.js +252 -113
- package/bin/mcp-server.js.map +19 -19
- package/dist/commonjs/funcs/virtualMachinesList.d.ts +4 -2
- package/dist/commonjs/funcs/virtualMachinesList.d.ts.map +1 -1
- package/dist/commonjs/funcs/virtualMachinesList.js +40 -7
- package/dist/commonjs/funcs/virtualMachinesList.js.map +1 -1
- package/dist/commonjs/lib/config.d.ts +3 -3
- package/dist/commonjs/lib/config.js +3 -3
- package/dist/commonjs/mcp-server/mcp-server.js +1 -1
- package/dist/commonjs/mcp-server/server.js +1 -1
- package/dist/commonjs/mcp-server/tools/virtualMachinesList.js +1 -1
- package/dist/commonjs/mcp-server/tools/virtualMachinesList.js.map +1 -1
- package/dist/commonjs/models/billingusage.d.ts +74 -8
- package/dist/commonjs/models/billingusage.d.ts.map +1 -1
- package/dist/commonjs/models/billingusage.js +83 -9
- package/dist/commonjs/models/billingusage.js.map +1 -1
- package/dist/commonjs/models/eventdata.d.ts +18 -18
- package/dist/commonjs/models/eventdata.d.ts.map +1 -1
- package/dist/commonjs/models/eventdata.js +18 -18
- package/dist/commonjs/models/eventdata.js.map +1 -1
- package/dist/commonjs/models/operations/indexvirtualmachine.d.ts +29 -0
- package/dist/commonjs/models/operations/indexvirtualmachine.d.ts.map +1 -1
- package/dist/commonjs/models/operations/indexvirtualmachine.js +38 -1
- package/dist/commonjs/models/operations/indexvirtualmachine.js.map +1 -1
- package/dist/commonjs/models/project.d.ts +57 -13
- package/dist/commonjs/models/project.d.ts.map +1 -1
- package/dist/commonjs/models/project.js +48 -11
- package/dist/commonjs/models/project.js.map +1 -1
- package/dist/commonjs/models/projectinclude.d.ts +6 -0
- package/dist/commonjs/models/projectinclude.d.ts.map +1 -1
- package/dist/commonjs/models/projectinclude.js +8 -0
- package/dist/commonjs/models/projectinclude.js.map +1 -1
- package/dist/commonjs/models/virtualmachineattributes.d.ts +14 -14
- package/dist/commonjs/models/virtualmachineattributes.d.ts.map +1 -1
- package/dist/commonjs/models/virtualmachineattributes.js +7 -15
- package/dist/commonjs/models/virtualmachineattributes.js.map +1 -1
- package/dist/commonjs/models/virtualmachinepayload.d.ts +21 -0
- package/dist/commonjs/models/virtualmachinepayload.d.ts.map +1 -1
- package/dist/commonjs/models/virtualmachinepayload.js +15 -1
- package/dist/commonjs/models/virtualmachinepayload.js.map +1 -1
- package/dist/commonjs/models/virtualmachines.d.ts +3 -11
- package/dist/commonjs/models/virtualmachines.d.ts.map +1 -1
- package/dist/commonjs/models/virtualmachines.js +4 -15
- package/dist/commonjs/models/virtualmachines.js.map +1 -1
- package/dist/commonjs/models/virtualmachineupdatepayload.d.ts +5 -5
- package/dist/commonjs/models/virtualmachineupdatepayload.d.ts.map +1 -1
- package/dist/commonjs/models/virtualmachineupdatepayload.js +6 -7
- package/dist/commonjs/models/virtualmachineupdatepayload.js.map +1 -1
- package/dist/commonjs/sdk/virtualmachines.d.ts +4 -1
- package/dist/commonjs/sdk/virtualmachines.d.ts.map +1 -1
- package/dist/commonjs/sdk/virtualmachines.js +2 -1
- package/dist/commonjs/sdk/virtualmachines.js.map +1 -1
- package/dist/esm/funcs/virtualMachinesList.d.ts +4 -2
- package/dist/esm/funcs/virtualMachinesList.d.ts.map +1 -1
- package/dist/esm/funcs/virtualMachinesList.js +40 -7
- package/dist/esm/funcs/virtualMachinesList.js.map +1 -1
- package/dist/esm/lib/config.d.ts +3 -3
- package/dist/esm/lib/config.js +3 -3
- package/dist/esm/mcp-server/mcp-server.js +1 -1
- package/dist/esm/mcp-server/server.js +1 -1
- package/dist/esm/mcp-server/tools/virtualMachinesList.js +1 -1
- package/dist/esm/mcp-server/tools/virtualMachinesList.js.map +1 -1
- package/dist/esm/models/billingusage.d.ts +74 -8
- package/dist/esm/models/billingusage.d.ts.map +1 -1
- package/dist/esm/models/billingusage.js +76 -8
- package/dist/esm/models/billingusage.js.map +1 -1
- package/dist/esm/models/eventdata.d.ts +18 -18
- package/dist/esm/models/eventdata.d.ts.map +1 -1
- package/dist/esm/models/eventdata.js +18 -18
- package/dist/esm/models/eventdata.js.map +1 -1
- package/dist/esm/models/operations/indexvirtualmachine.d.ts +29 -0
- package/dist/esm/models/operations/indexvirtualmachine.d.ts.map +1 -1
- package/dist/esm/models/operations/indexvirtualmachine.js +35 -0
- package/dist/esm/models/operations/indexvirtualmachine.js.map +1 -1
- package/dist/esm/models/project.d.ts +57 -13
- package/dist/esm/models/project.d.ts.map +1 -1
- package/dist/esm/models/project.js +45 -10
- package/dist/esm/models/project.js.map +1 -1
- package/dist/esm/models/projectinclude.d.ts +6 -0
- package/dist/esm/models/projectinclude.d.ts.map +1 -1
- package/dist/esm/models/projectinclude.js +8 -0
- package/dist/esm/models/projectinclude.js.map +1 -1
- package/dist/esm/models/virtualmachineattributes.d.ts +14 -14
- package/dist/esm/models/virtualmachineattributes.d.ts.map +1 -1
- package/dist/esm/models/virtualmachineattributes.js +6 -14
- package/dist/esm/models/virtualmachineattributes.js.map +1 -1
- package/dist/esm/models/virtualmachinepayload.d.ts +21 -0
- package/dist/esm/models/virtualmachinepayload.d.ts.map +1 -1
- package/dist/esm/models/virtualmachinepayload.js +14 -0
- package/dist/esm/models/virtualmachinepayload.js.map +1 -1
- package/dist/esm/models/virtualmachines.d.ts +3 -11
- package/dist/esm/models/virtualmachines.d.ts.map +1 -1
- package/dist/esm/models/virtualmachines.js +3 -12
- package/dist/esm/models/virtualmachines.js.map +1 -1
- package/dist/esm/models/virtualmachineupdatepayload.d.ts +5 -5
- package/dist/esm/models/virtualmachineupdatepayload.d.ts.map +1 -1
- package/dist/esm/models/virtualmachineupdatepayload.js +5 -6
- package/dist/esm/models/virtualmachineupdatepayload.js.map +1 -1
- package/dist/esm/sdk/virtualmachines.d.ts +4 -1
- package/dist/esm/sdk/virtualmachines.d.ts.map +1 -1
- package/dist/esm/sdk/virtualmachines.js +2 -1
- package/dist/esm/sdk/virtualmachines.js.map +1 -1
- package/jsr.json +1 -1
- package/package.json +1 -1
- package/src/funcs/virtualMachinesList.ts +102 -31
- package/src/lib/config.ts +3 -3
- package/src/mcp-server/mcp-server.ts +1 -1
- package/src/mcp-server/server.ts +1 -1
- package/src/mcp-server/tools/virtualMachinesList.ts +1 -1
- package/src/models/billingusage.ts +189 -16
- package/src/models/eventdata.ts +36 -36
- package/src/models/operations/indexvirtualmachine.ts +81 -0
- package/src/models/project.ts +128 -23
- package/src/models/projectinclude.ts +14 -0
- package/src/models/virtualmachineattributes.ts +20 -24
- package/src/models/virtualmachinepayload.ts +31 -0
- package/src/models/virtualmachines.ts +10 -39
- package/src/models/virtualmachineupdatepayload.ts +13 -9
- package/src/sdk/virtualmachines.ts +5 -2
- package/tests/integration/helpers/mock-data.ts +6 -2
- package/tests/integration/projects.test.ts +3 -1
|
@@ -13,6 +13,7 @@ import { virtualMachinesShowVirtualMachineMetrics } from "../funcs/virtualMachin
|
|
|
13
13
|
import { virtualMachinesUpdateVirtualMachine } from "../funcs/virtualMachinesUpdateVirtualMachine.js";
|
|
14
14
|
import { ClientSDK } from "../lib/sdks.js";
|
|
15
15
|
import { unwrapAsync } from "../types/fp.js";
|
|
16
|
+
import { unwrapResultIterator } from "../types/operations.js";
|
|
16
17
|
export class VirtualMachines extends ClientSDK {
|
|
17
18
|
/**
|
|
18
19
|
* Create VM
|
|
@@ -30,7 +31,7 @@ export class VirtualMachines extends ClientSDK {
|
|
|
30
31
|
* Show all Team's Virtual Machines.
|
|
31
32
|
*/
|
|
32
33
|
async list(request, options) {
|
|
33
|
-
return
|
|
34
|
+
return unwrapResultIterator(virtualMachinesList(this, request, options));
|
|
34
35
|
}
|
|
35
36
|
/**
|
|
36
37
|
* Retrieve VM
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"virtualmachines.js","sourceRoot":"","sources":["../../../src/sdk/virtualmachines.ts"],"names":[],"mappings":"AAAA;;GAEG;AAE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KAAK,CAAC,yBAAyB,CAC7B,OAAoD,EACpD,OAAwB;QAExB,OAAO,WAAW,CAAC,wCAAwC,CACzD,IAAI,EACJ,OAAO,EACP,OAAO,CACR,CAAC,CAAC;IACL,CAAC;IAED;;;;;OAKG;IACH,KAAK,CAAC,oCAAoC,CACxC,OAA+D,EAC/D,OAAwB;QAExB,OAAO,WAAW,CAAC,mDAAmD,CACpE,IAAI,EACJ,OAAO,EACP,OAAO,CACR,CAAC,CAAC;IACL,CAAC;IAED;;;;;OAKG;IACH,KAAK,CAAC,qCAAqC,CACzC,OAAgE,EAChE,OAAwB;QAExB,OAAO,WAAW,CAAC,oDAAoD,CACrE,IAAI,EACJ,OAAO,EACP,OAAO,CACR,CAAC,CAAC;IACL,CAAC;IAED;;;;;OAKG;IACH,KAAK,CAAC,sCAAsC,CAC1C,OAAiE,EACjE,OAAwB;QAExB,OAAO,WAAW,CAAC,qDAAqD,CACtE,IAAI,EACJ,OAAO,EACP,OAAO,CACR,CAAC,CAAC;IACL,CAAC;CACF"}
|
package/jsr.json
CHANGED
package/package.json
CHANGED
|
@@ -22,10 +22,15 @@ import * as errors from "../models/errors/index.js";
|
|
|
22
22
|
import { LatitudeshError } from "../models/errors/latitudesherror.js";
|
|
23
23
|
import { ResponseValidationError } from "../models/errors/responsevalidationerror.js";
|
|
24
24
|
import { SDKValidationError } from "../models/errors/sdkvalidationerror.js";
|
|
25
|
-
import * as models from "../models/index.js";
|
|
26
25
|
import * as operations from "../models/operations/index.js";
|
|
27
26
|
import { APICall, APIPromise } from "../types/async.js";
|
|
28
27
|
import { Result } from "../types/fp.js";
|
|
28
|
+
import {
|
|
29
|
+
createPageIterator,
|
|
30
|
+
haltIterator,
|
|
31
|
+
PageIterator,
|
|
32
|
+
Paginator,
|
|
33
|
+
} from "../types/operations.js";
|
|
29
34
|
|
|
30
35
|
/**
|
|
31
36
|
* List VMs
|
|
@@ -38,17 +43,20 @@ export function virtualMachinesList(
|
|
|
38
43
|
request?: operations.IndexVirtualMachineRequest | undefined,
|
|
39
44
|
options?: RequestOptions,
|
|
40
45
|
): APIPromise<
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
46
|
+
PageIterator<
|
|
47
|
+
Result<
|
|
48
|
+
operations.IndexVirtualMachineResponse,
|
|
49
|
+
| errors.ErrorObject
|
|
50
|
+
| LatitudeshError
|
|
51
|
+
| ResponseValidationError
|
|
52
|
+
| ConnectionError
|
|
53
|
+
| RequestAbortedError
|
|
54
|
+
| RequestTimeoutError
|
|
55
|
+
| InvalidRequestError
|
|
56
|
+
| UnexpectedClientError
|
|
57
|
+
| SDKValidationError
|
|
58
|
+
>,
|
|
59
|
+
{ page: number }
|
|
52
60
|
>
|
|
53
61
|
> {
|
|
54
62
|
return new APIPromise($do(
|
|
@@ -64,17 +72,20 @@ async function $do(
|
|
|
64
72
|
options?: RequestOptions,
|
|
65
73
|
): Promise<
|
|
66
74
|
[
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
75
|
+
PageIterator<
|
|
76
|
+
Result<
|
|
77
|
+
operations.IndexVirtualMachineResponse,
|
|
78
|
+
| errors.ErrorObject
|
|
79
|
+
| LatitudeshError
|
|
80
|
+
| ResponseValidationError
|
|
81
|
+
| ConnectionError
|
|
82
|
+
| RequestAbortedError
|
|
83
|
+
| RequestTimeoutError
|
|
84
|
+
| InvalidRequestError
|
|
85
|
+
| UnexpectedClientError
|
|
86
|
+
| SDKValidationError
|
|
87
|
+
>,
|
|
88
|
+
{ page: number }
|
|
78
89
|
>,
|
|
79
90
|
APICall,
|
|
80
91
|
]
|
|
@@ -88,7 +99,7 @@ async function $do(
|
|
|
88
99
|
"Input validation failed",
|
|
89
100
|
);
|
|
90
101
|
if (!parsed.ok) {
|
|
91
|
-
return [parsed, { status: "invalid" }];
|
|
102
|
+
return [haltIterator(parsed), { status: "invalid" }];
|
|
92
103
|
}
|
|
93
104
|
const payload = parsed.value;
|
|
94
105
|
const body = null;
|
|
@@ -100,7 +111,10 @@ async function $do(
|
|
|
100
111
|
?.["extra_fields[virtual_machines]"],
|
|
101
112
|
"filter[project]": payload?.["filter[project]"],
|
|
102
113
|
"filter[tags]": payload?.["filter[tags]"],
|
|
114
|
+
"page[number]": payload?.["page[number]"],
|
|
115
|
+
"page[size]": payload?.["page[size]"],
|
|
103
116
|
"sort": payload?.sort,
|
|
117
|
+
"stats[total]": payload?.["stats[total]"],
|
|
104
118
|
});
|
|
105
119
|
|
|
106
120
|
const headers = new Headers(compactMap({
|
|
@@ -138,7 +152,7 @@ async function $do(
|
|
|
138
152
|
timeoutMs: options?.timeoutMs || client._options.timeoutMs || -1,
|
|
139
153
|
}, options);
|
|
140
154
|
if (!requestRes.ok) {
|
|
141
|
-
return [requestRes, { status: "invalid" }];
|
|
155
|
+
return [haltIterator(requestRes), { status: "invalid" }];
|
|
142
156
|
}
|
|
143
157
|
const req = requestRes.value;
|
|
144
158
|
|
|
@@ -150,7 +164,7 @@ async function $do(
|
|
|
150
164
|
retryCodes: context.retryCodes,
|
|
151
165
|
});
|
|
152
166
|
if (!doResult.ok) {
|
|
153
|
-
return [doResult, { status: "request-error", request: req }];
|
|
167
|
+
return [haltIterator(doResult), { status: "request-error", request: req }];
|
|
154
168
|
}
|
|
155
169
|
const response = doResult.value;
|
|
156
170
|
|
|
@@ -158,8 +172,8 @@ async function $do(
|
|
|
158
172
|
HttpMeta: { Response: response, Request: req },
|
|
159
173
|
};
|
|
160
174
|
|
|
161
|
-
const [result] = await M.match<
|
|
162
|
-
|
|
175
|
+
const [result, raw] = await M.match<
|
|
176
|
+
operations.IndexVirtualMachineResponse,
|
|
163
177
|
| errors.ErrorObject
|
|
164
178
|
| LatitudeshError
|
|
165
179
|
| ResponseValidationError
|
|
@@ -170,8 +184,9 @@ async function $do(
|
|
|
170
184
|
| UnexpectedClientError
|
|
171
185
|
| SDKValidationError
|
|
172
186
|
>(
|
|
173
|
-
M.json(200,
|
|
187
|
+
M.json(200, operations.IndexVirtualMachineResponse$inboundSchema, {
|
|
174
188
|
ctype: "application/vnd.api+json",
|
|
189
|
+
key: "Result",
|
|
175
190
|
}),
|
|
176
191
|
M.jsonErr(400, errors.ErrorObject$inboundSchema, {
|
|
177
192
|
ctype: "application/vnd.api+json",
|
|
@@ -180,8 +195,64 @@ async function $do(
|
|
|
180
195
|
M.fail("5XX"),
|
|
181
196
|
)(response, req, { extraFields: responseFields });
|
|
182
197
|
if (!result.ok) {
|
|
183
|
-
return [result, {
|
|
198
|
+
return [haltIterator(result), {
|
|
199
|
+
status: "complete",
|
|
200
|
+
request: req,
|
|
201
|
+
response,
|
|
202
|
+
}];
|
|
184
203
|
}
|
|
185
204
|
|
|
186
|
-
|
|
205
|
+
const nextFunc = (
|
|
206
|
+
responseData: unknown,
|
|
207
|
+
): {
|
|
208
|
+
next: Paginator<
|
|
209
|
+
Result<
|
|
210
|
+
operations.IndexVirtualMachineResponse,
|
|
211
|
+
| errors.ErrorObject
|
|
212
|
+
| LatitudeshError
|
|
213
|
+
| ResponseValidationError
|
|
214
|
+
| ConnectionError
|
|
215
|
+
| RequestAbortedError
|
|
216
|
+
| RequestTimeoutError
|
|
217
|
+
| InvalidRequestError
|
|
218
|
+
| UnexpectedClientError
|
|
219
|
+
| SDKValidationError
|
|
220
|
+
>
|
|
221
|
+
>;
|
|
222
|
+
"~next"?: { page: number };
|
|
223
|
+
} => {
|
|
224
|
+
const page = request?.pageNumber ?? 1;
|
|
225
|
+
const nextPage = page + 1;
|
|
226
|
+
|
|
227
|
+
if (!responseData) {
|
|
228
|
+
return { next: () => null };
|
|
229
|
+
}
|
|
230
|
+
const results = (responseData as { data?: unknown }).data;
|
|
231
|
+
if (!Array.isArray(results) || !results.length) {
|
|
232
|
+
return { next: () => null };
|
|
233
|
+
}
|
|
234
|
+
const limit = request?.pageSize ?? 20;
|
|
235
|
+
if (results.length < limit) {
|
|
236
|
+
return { next: () => null };
|
|
237
|
+
}
|
|
238
|
+
|
|
239
|
+
const nextVal = () =>
|
|
240
|
+
virtualMachinesList(
|
|
241
|
+
client,
|
|
242
|
+
{
|
|
243
|
+
...request!,
|
|
244
|
+
pageNumber: nextPage,
|
|
245
|
+
},
|
|
246
|
+
options,
|
|
247
|
+
);
|
|
248
|
+
|
|
249
|
+
return { next: nextVal, "~next": { page: nextPage } };
|
|
250
|
+
};
|
|
251
|
+
|
|
252
|
+
const page = { ...result, ...nextFunc(raw) };
|
|
253
|
+
return [{ ...page, ...createPageIterator(page, (v) => !v.ok) }, {
|
|
254
|
+
status: "complete",
|
|
255
|
+
request: req,
|
|
256
|
+
response,
|
|
257
|
+
}];
|
|
187
258
|
}
|
package/src/lib/config.ts
CHANGED
|
@@ -74,8 +74,8 @@ export function serverURLFromOptions(options: SDKOptions): URL | null {
|
|
|
74
74
|
export const SDK_METADATA = {
|
|
75
75
|
language: "typescript",
|
|
76
76
|
openapiDocVersion: "2023-06-01",
|
|
77
|
-
sdkVersion: "0.8.
|
|
78
|
-
genVersion: "2.
|
|
77
|
+
sdkVersion: "0.8.2",
|
|
78
|
+
genVersion: "2.918.3",
|
|
79
79
|
userAgent:
|
|
80
|
-
"speakeasy-sdk/typescript 0.8.
|
|
80
|
+
"speakeasy-sdk/typescript 0.8.2 2.918.3 2023-06-01 latitudesh-typescript-sdk",
|
|
81
81
|
} as const;
|
package/src/mcp-server/server.ts
CHANGED
|
@@ -9,6 +9,8 @@ import { ClosedEnum } from "../types/enums.js";
|
|
|
9
9
|
import { Result as SafeParseResult } from "../types/fp.js";
|
|
10
10
|
import { SDKValidationError } from "./errors/sdkvalidationerror.js";
|
|
11
11
|
|
|
12
|
+
export type BillingUsageMeta = {};
|
|
13
|
+
|
|
12
14
|
/**
|
|
13
15
|
* The project in which the returned usage belongs to
|
|
14
16
|
*/
|
|
@@ -57,6 +59,7 @@ export const BillingUsageUnit = {
|
|
|
57
59
|
Quantity: "quantity",
|
|
58
60
|
Hour: "hour",
|
|
59
61
|
Minute: "minute",
|
|
62
|
+
Gb: "GB",
|
|
60
63
|
} as const;
|
|
61
64
|
export type BillingUsageUnit = ClosedEnum<typeof BillingUsageUnit>;
|
|
62
65
|
|
|
@@ -66,13 +69,28 @@ export const UsageType = {
|
|
|
66
69
|
} as const;
|
|
67
70
|
export type UsageType = ClosedEnum<typeof UsageType>;
|
|
68
71
|
|
|
69
|
-
export type
|
|
70
|
-
id?: string |
|
|
71
|
-
hostname?: string |
|
|
72
|
-
plan?: string |
|
|
72
|
+
export type BillingUsageServer = {
|
|
73
|
+
id?: string | undefined;
|
|
74
|
+
hostname?: string | undefined;
|
|
75
|
+
plan?: string | undefined;
|
|
73
76
|
tags?: Array<string> | undefined;
|
|
74
77
|
};
|
|
75
78
|
|
|
79
|
+
export type Bucket = {
|
|
80
|
+
id?: string | undefined;
|
|
81
|
+
name?: string | undefined;
|
|
82
|
+
location?: string | null | undefined;
|
|
83
|
+
};
|
|
84
|
+
|
|
85
|
+
export type Metadata = {
|
|
86
|
+
servers?: Array<BillingUsageServer> | undefined;
|
|
87
|
+
bucket?: Bucket | undefined;
|
|
88
|
+
/**
|
|
89
|
+
* For products priced per divided unit (e.g. $0.01 per 1000 API calls), the divisor applied to the quantity before pricing. Omitted for products that are not priced by divided units.
|
|
90
|
+
*/
|
|
91
|
+
billingUnitDivisor?: number | null | undefined;
|
|
92
|
+
};
|
|
93
|
+
|
|
76
94
|
export type Product = {
|
|
77
95
|
id?: string | undefined;
|
|
78
96
|
resource?: string | undefined;
|
|
@@ -85,12 +103,20 @@ export type Product = {
|
|
|
85
103
|
start?: Date | undefined;
|
|
86
104
|
end?: Date | null | undefined;
|
|
87
105
|
unit?: BillingUsageUnit | undefined;
|
|
106
|
+
/**
|
|
107
|
+
* The unit amount of the product in cents
|
|
108
|
+
*/
|
|
109
|
+
unitAmount?: number | undefined;
|
|
88
110
|
/**
|
|
89
111
|
* The unit price of the product in cents
|
|
90
112
|
*/
|
|
91
113
|
unitPrice?: number | undefined;
|
|
92
114
|
usageType?: UsageType | undefined;
|
|
93
115
|
quantity?: number | undefined;
|
|
116
|
+
/**
|
|
117
|
+
* The total usage amount of the product in cents
|
|
118
|
+
*/
|
|
119
|
+
amount?: number | undefined;
|
|
94
120
|
/**
|
|
95
121
|
* The total usage price of the product in cents
|
|
96
122
|
*/
|
|
@@ -111,6 +137,10 @@ export type BillingUsageAttributes = {
|
|
|
111
137
|
* The available credit balance in cents
|
|
112
138
|
*/
|
|
113
139
|
availableCreditBalance?: number | undefined;
|
|
140
|
+
/**
|
|
141
|
+
* The total usage amount in cents
|
|
142
|
+
*/
|
|
143
|
+
amount?: number | undefined;
|
|
114
144
|
/**
|
|
115
145
|
* The total usage price in cents
|
|
116
146
|
*/
|
|
@@ -124,13 +154,48 @@ export type BillingUsageAttributes = {
|
|
|
124
154
|
|
|
125
155
|
export type BillingUsageData = {
|
|
126
156
|
id?: string | undefined;
|
|
157
|
+
type?: string | undefined;
|
|
127
158
|
attributes?: BillingUsageAttributes | undefined;
|
|
128
159
|
};
|
|
129
160
|
|
|
130
161
|
export type BillingUsage = {
|
|
162
|
+
meta?: BillingUsageMeta | undefined;
|
|
131
163
|
data?: BillingUsageData | undefined;
|
|
132
164
|
};
|
|
133
165
|
|
|
166
|
+
/** @internal */
|
|
167
|
+
export const BillingUsageMeta$inboundSchema: z.ZodType<
|
|
168
|
+
BillingUsageMeta,
|
|
169
|
+
z.ZodTypeDef,
|
|
170
|
+
unknown
|
|
171
|
+
> = z.object({});
|
|
172
|
+
/** @internal */
|
|
173
|
+
export type BillingUsageMeta$Outbound = {};
|
|
174
|
+
|
|
175
|
+
/** @internal */
|
|
176
|
+
export const BillingUsageMeta$outboundSchema: z.ZodType<
|
|
177
|
+
BillingUsageMeta$Outbound,
|
|
178
|
+
z.ZodTypeDef,
|
|
179
|
+
BillingUsageMeta
|
|
180
|
+
> = z.object({});
|
|
181
|
+
|
|
182
|
+
export function billingUsageMetaToJSON(
|
|
183
|
+
billingUsageMeta: BillingUsageMeta,
|
|
184
|
+
): string {
|
|
185
|
+
return JSON.stringify(
|
|
186
|
+
BillingUsageMeta$outboundSchema.parse(billingUsageMeta),
|
|
187
|
+
);
|
|
188
|
+
}
|
|
189
|
+
export function billingUsageMetaFromJSON(
|
|
190
|
+
jsonString: string,
|
|
191
|
+
): SafeParseResult<BillingUsageMeta, SDKValidationError> {
|
|
192
|
+
return safeParse(
|
|
193
|
+
jsonString,
|
|
194
|
+
(x) => BillingUsageMeta$inboundSchema.parse(JSON.parse(x)),
|
|
195
|
+
`Failed to parse 'BillingUsageMeta' from JSON`,
|
|
196
|
+
);
|
|
197
|
+
}
|
|
198
|
+
|
|
134
199
|
/** @internal */
|
|
135
200
|
export const BillingUsageProject$inboundSchema: z.ZodType<
|
|
136
201
|
BillingUsageProject,
|
|
@@ -279,23 +344,111 @@ export const UsageType$inboundSchema: z.ZodNativeEnum<typeof UsageType> = z
|
|
|
279
344
|
export const UsageType$outboundSchema: z.ZodNativeEnum<typeof UsageType> =
|
|
280
345
|
UsageType$inboundSchema;
|
|
281
346
|
|
|
347
|
+
/** @internal */
|
|
348
|
+
export const BillingUsageServer$inboundSchema: z.ZodType<
|
|
349
|
+
BillingUsageServer,
|
|
350
|
+
z.ZodTypeDef,
|
|
351
|
+
unknown
|
|
352
|
+
> = z.object({
|
|
353
|
+
id: z.string().optional(),
|
|
354
|
+
hostname: z.string().optional(),
|
|
355
|
+
plan: z.string().optional(),
|
|
356
|
+
tags: z.array(z.string()).optional(),
|
|
357
|
+
});
|
|
358
|
+
/** @internal */
|
|
359
|
+
export type BillingUsageServer$Outbound = {
|
|
360
|
+
id?: string | undefined;
|
|
361
|
+
hostname?: string | undefined;
|
|
362
|
+
plan?: string | undefined;
|
|
363
|
+
tags?: Array<string> | undefined;
|
|
364
|
+
};
|
|
365
|
+
|
|
366
|
+
/** @internal */
|
|
367
|
+
export const BillingUsageServer$outboundSchema: z.ZodType<
|
|
368
|
+
BillingUsageServer$Outbound,
|
|
369
|
+
z.ZodTypeDef,
|
|
370
|
+
BillingUsageServer
|
|
371
|
+
> = z.object({
|
|
372
|
+
id: z.string().optional(),
|
|
373
|
+
hostname: z.string().optional(),
|
|
374
|
+
plan: z.string().optional(),
|
|
375
|
+
tags: z.array(z.string()).optional(),
|
|
376
|
+
});
|
|
377
|
+
|
|
378
|
+
export function billingUsageServerToJSON(
|
|
379
|
+
billingUsageServer: BillingUsageServer,
|
|
380
|
+
): string {
|
|
381
|
+
return JSON.stringify(
|
|
382
|
+
BillingUsageServer$outboundSchema.parse(billingUsageServer),
|
|
383
|
+
);
|
|
384
|
+
}
|
|
385
|
+
export function billingUsageServerFromJSON(
|
|
386
|
+
jsonString: string,
|
|
387
|
+
): SafeParseResult<BillingUsageServer, SDKValidationError> {
|
|
388
|
+
return safeParse(
|
|
389
|
+
jsonString,
|
|
390
|
+
(x) => BillingUsageServer$inboundSchema.parse(JSON.parse(x)),
|
|
391
|
+
`Failed to parse 'BillingUsageServer' from JSON`,
|
|
392
|
+
);
|
|
393
|
+
}
|
|
394
|
+
|
|
395
|
+
/** @internal */
|
|
396
|
+
export const Bucket$inboundSchema: z.ZodType<Bucket, z.ZodTypeDef, unknown> = z
|
|
397
|
+
.object({
|
|
398
|
+
id: z.string().optional(),
|
|
399
|
+
name: z.string().optional(),
|
|
400
|
+
location: z.nullable(z.string()).optional(),
|
|
401
|
+
});
|
|
402
|
+
/** @internal */
|
|
403
|
+
export type Bucket$Outbound = {
|
|
404
|
+
id?: string | undefined;
|
|
405
|
+
name?: string | undefined;
|
|
406
|
+
location?: string | null | undefined;
|
|
407
|
+
};
|
|
408
|
+
|
|
409
|
+
/** @internal */
|
|
410
|
+
export const Bucket$outboundSchema: z.ZodType<
|
|
411
|
+
Bucket$Outbound,
|
|
412
|
+
z.ZodTypeDef,
|
|
413
|
+
Bucket
|
|
414
|
+
> = z.object({
|
|
415
|
+
id: z.string().optional(),
|
|
416
|
+
name: z.string().optional(),
|
|
417
|
+
location: z.nullable(z.string()).optional(),
|
|
418
|
+
});
|
|
419
|
+
|
|
420
|
+
export function bucketToJSON(bucket: Bucket): string {
|
|
421
|
+
return JSON.stringify(Bucket$outboundSchema.parse(bucket));
|
|
422
|
+
}
|
|
423
|
+
export function bucketFromJSON(
|
|
424
|
+
jsonString: string,
|
|
425
|
+
): SafeParseResult<Bucket, SDKValidationError> {
|
|
426
|
+
return safeParse(
|
|
427
|
+
jsonString,
|
|
428
|
+
(x) => Bucket$inboundSchema.parse(JSON.parse(x)),
|
|
429
|
+
`Failed to parse 'Bucket' from JSON`,
|
|
430
|
+
);
|
|
431
|
+
}
|
|
432
|
+
|
|
282
433
|
/** @internal */
|
|
283
434
|
export const Metadata$inboundSchema: z.ZodType<
|
|
284
435
|
Metadata,
|
|
285
436
|
z.ZodTypeDef,
|
|
286
437
|
unknown
|
|
287
438
|
> = z.object({
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
439
|
+
servers: z.array(z.lazy(() => BillingUsageServer$inboundSchema)).optional(),
|
|
440
|
+
bucket: z.lazy(() => Bucket$inboundSchema).optional(),
|
|
441
|
+
billing_unit_divisor: z.nullable(z.number().int()).optional(),
|
|
442
|
+
}).transform((v) => {
|
|
443
|
+
return remap$(v, {
|
|
444
|
+
"billing_unit_divisor": "billingUnitDivisor",
|
|
445
|
+
});
|
|
292
446
|
});
|
|
293
447
|
/** @internal */
|
|
294
448
|
export type Metadata$Outbound = {
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
tags?: Array<string> | undefined;
|
|
449
|
+
servers?: Array<BillingUsageServer$Outbound> | undefined;
|
|
450
|
+
bucket?: Bucket$Outbound | undefined;
|
|
451
|
+
billing_unit_divisor?: number | null | undefined;
|
|
299
452
|
};
|
|
300
453
|
|
|
301
454
|
/** @internal */
|
|
@@ -304,10 +457,13 @@ export const Metadata$outboundSchema: z.ZodType<
|
|
|
304
457
|
z.ZodTypeDef,
|
|
305
458
|
Metadata
|
|
306
459
|
> = z.object({
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
460
|
+
servers: z.array(z.lazy(() => BillingUsageServer$outboundSchema)).optional(),
|
|
461
|
+
bucket: z.lazy(() => Bucket$outboundSchema).optional(),
|
|
462
|
+
billingUnitDivisor: z.nullable(z.number().int()).optional(),
|
|
463
|
+
}).transform((v) => {
|
|
464
|
+
return remap$(v, {
|
|
465
|
+
billingUnitDivisor: "billing_unit_divisor",
|
|
466
|
+
});
|
|
311
467
|
});
|
|
312
468
|
|
|
313
469
|
export function metadataToJSON(metadata: Metadata): string {
|
|
@@ -340,14 +496,17 @@ export const Product$inboundSchema: z.ZodType<Product, z.ZodTypeDef, unknown> =
|
|
|
340
496
|
z.string().datetime({ offset: true }).transform(v => new Date(v)),
|
|
341
497
|
).optional(),
|
|
342
498
|
unit: BillingUsageUnit$inboundSchema.optional(),
|
|
499
|
+
unit_amount: z.number().optional(),
|
|
343
500
|
unit_price: z.number().optional(),
|
|
344
501
|
usage_type: UsageType$inboundSchema.optional(),
|
|
345
502
|
quantity: z.number().optional(),
|
|
503
|
+
amount: z.number().optional(),
|
|
346
504
|
price: z.number().optional(),
|
|
347
505
|
metadata: z.lazy(() => Metadata$inboundSchema).optional(),
|
|
348
506
|
}).transform((v) => {
|
|
349
507
|
return remap$(v, {
|
|
350
508
|
"amount_without_discount": "amountWithoutDiscount",
|
|
509
|
+
"unit_amount": "unitAmount",
|
|
351
510
|
"unit_price": "unitPrice",
|
|
352
511
|
"usage_type": "usageType",
|
|
353
512
|
});
|
|
@@ -365,9 +524,11 @@ export type Product$Outbound = {
|
|
|
365
524
|
start?: string | undefined;
|
|
366
525
|
end?: string | null | undefined;
|
|
367
526
|
unit?: string | undefined;
|
|
527
|
+
unit_amount?: number | undefined;
|
|
368
528
|
unit_price?: number | undefined;
|
|
369
529
|
usage_type?: string | undefined;
|
|
370
530
|
quantity?: number | undefined;
|
|
531
|
+
amount?: number | undefined;
|
|
371
532
|
price?: number | undefined;
|
|
372
533
|
metadata?: Metadata$Outbound | undefined;
|
|
373
534
|
};
|
|
@@ -389,14 +550,17 @@ export const Product$outboundSchema: z.ZodType<
|
|
|
389
550
|
start: z.date().transform(v => v.toISOString()).optional(),
|
|
390
551
|
end: z.nullable(z.date().transform(v => v.toISOString())).optional(),
|
|
391
552
|
unit: BillingUsageUnit$outboundSchema.optional(),
|
|
553
|
+
unitAmount: z.number().optional(),
|
|
392
554
|
unitPrice: z.number().optional(),
|
|
393
555
|
usageType: UsageType$outboundSchema.optional(),
|
|
394
556
|
quantity: z.number().optional(),
|
|
557
|
+
amount: z.number().optional(),
|
|
395
558
|
price: z.number().optional(),
|
|
396
559
|
metadata: z.lazy(() => Metadata$outboundSchema).optional(),
|
|
397
560
|
}).transform((v) => {
|
|
398
561
|
return remap$(v, {
|
|
399
562
|
amountWithoutDiscount: "amount_without_discount",
|
|
563
|
+
unitAmount: "unit_amount",
|
|
400
564
|
unitPrice: "unit_price",
|
|
401
565
|
usageType: "usage_type",
|
|
402
566
|
});
|
|
@@ -424,6 +588,7 @@ export const BillingUsageAttributes$inboundSchema: z.ZodType<
|
|
|
424
588
|
project: z.lazy(() => BillingUsageProject$inboundSchema).optional(),
|
|
425
589
|
period: z.lazy(() => Period$inboundSchema).optional(),
|
|
426
590
|
available_credit_balance: z.number().int().optional(),
|
|
591
|
+
amount: z.number().optional(),
|
|
427
592
|
price: z.number().optional(),
|
|
428
593
|
threshold: z.nullable(z.number()).optional(),
|
|
429
594
|
products: z.array(z.lazy(() => Product$inboundSchema)).optional(),
|
|
@@ -437,6 +602,7 @@ export type BillingUsageAttributes$Outbound = {
|
|
|
437
602
|
project?: BillingUsageProject$Outbound | undefined;
|
|
438
603
|
period?: Period$Outbound | undefined;
|
|
439
604
|
available_credit_balance?: number | undefined;
|
|
605
|
+
amount?: number | undefined;
|
|
440
606
|
price?: number | undefined;
|
|
441
607
|
threshold?: number | null | undefined;
|
|
442
608
|
products?: Array<Product$Outbound> | undefined;
|
|
@@ -451,6 +617,7 @@ export const BillingUsageAttributes$outboundSchema: z.ZodType<
|
|
|
451
617
|
project: z.lazy(() => BillingUsageProject$outboundSchema).optional(),
|
|
452
618
|
period: z.lazy(() => Period$outboundSchema).optional(),
|
|
453
619
|
availableCreditBalance: z.number().int().optional(),
|
|
620
|
+
amount: z.number().optional(),
|
|
454
621
|
price: z.number().optional(),
|
|
455
622
|
threshold: z.nullable(z.number()).optional(),
|
|
456
623
|
products: z.array(z.lazy(() => Product$outboundSchema)).optional(),
|
|
@@ -484,11 +651,13 @@ export const BillingUsageData$inboundSchema: z.ZodType<
|
|
|
484
651
|
unknown
|
|
485
652
|
> = z.object({
|
|
486
653
|
id: z.string().optional(),
|
|
654
|
+
type: z.string().optional(),
|
|
487
655
|
attributes: z.lazy(() => BillingUsageAttributes$inboundSchema).optional(),
|
|
488
656
|
});
|
|
489
657
|
/** @internal */
|
|
490
658
|
export type BillingUsageData$Outbound = {
|
|
491
659
|
id?: string | undefined;
|
|
660
|
+
type?: string | undefined;
|
|
492
661
|
attributes?: BillingUsageAttributes$Outbound | undefined;
|
|
493
662
|
};
|
|
494
663
|
|
|
@@ -499,6 +668,7 @@ export const BillingUsageData$outboundSchema: z.ZodType<
|
|
|
499
668
|
BillingUsageData
|
|
500
669
|
> = z.object({
|
|
501
670
|
id: z.string().optional(),
|
|
671
|
+
type: z.string().optional(),
|
|
502
672
|
attributes: z.lazy(() => BillingUsageAttributes$outboundSchema).optional(),
|
|
503
673
|
});
|
|
504
674
|
|
|
@@ -525,10 +695,12 @@ export const BillingUsage$inboundSchema: z.ZodType<
|
|
|
525
695
|
z.ZodTypeDef,
|
|
526
696
|
unknown
|
|
527
697
|
> = z.object({
|
|
698
|
+
meta: z.lazy(() => BillingUsageMeta$inboundSchema).optional(),
|
|
528
699
|
data: z.lazy(() => BillingUsageData$inboundSchema).optional(),
|
|
529
700
|
});
|
|
530
701
|
/** @internal */
|
|
531
702
|
export type BillingUsage$Outbound = {
|
|
703
|
+
meta?: BillingUsageMeta$Outbound | undefined;
|
|
532
704
|
data?: BillingUsageData$Outbound | undefined;
|
|
533
705
|
};
|
|
534
706
|
|
|
@@ -538,6 +710,7 @@ export const BillingUsage$outboundSchema: z.ZodType<
|
|
|
538
710
|
z.ZodTypeDef,
|
|
539
711
|
BillingUsage
|
|
540
712
|
> = z.object({
|
|
713
|
+
meta: z.lazy(() => BillingUsageMeta$outboundSchema).optional(),
|
|
541
714
|
data: z.lazy(() => BillingUsageData$outboundSchema).optional(),
|
|
542
715
|
});
|
|
543
716
|
|