@openrouter/sdk 1.1.17 → 1.1.19
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/esm/funcs/benchmarksGetBenchmarks.d.ts +1 -1
- package/esm/funcs/benchmarksGetBenchmarks.js +1 -1
- package/esm/funcs/filesDelete.d.ts +1 -1
- package/esm/funcs/filesDelete.js +2 -1
- package/esm/funcs/filesDownload.d.ts +1 -1
- package/esm/funcs/filesDownload.js +2 -1
- package/esm/funcs/filesList.d.ts +1 -1
- package/esm/funcs/filesList.js +10 -3
- package/esm/funcs/filesRetrieve.d.ts +1 -1
- package/esm/funcs/filesRetrieve.js +2 -1
- package/esm/funcs/filesUpload.d.ts +1 -1
- package/esm/funcs/filesUpload.js +2 -1
- package/esm/lib/config.d.ts +2 -2
- package/esm/lib/config.js +2 -2
- package/esm/models/anthropicfile.d.ts +33 -0
- package/esm/models/anthropicfile.js +40 -0
- package/esm/models/anthropicfiledeleted.d.ts +22 -0
- package/esm/models/anthropicfiledeleted.js +26 -0
- package/esm/models/anthropicfilelist.d.ts +18 -0
- package/esm/models/anthropicfilelist.js +27 -0
- package/esm/models/filedeleteresponse.d.ts +6 -12
- package/esm/models/filedeleteresponse.js +9 -10
- package/esm/models/filelistresponse.d.ts +6 -12
- package/esm/models/filelistresponse.js +9 -16
- package/esm/models/fileprovider.d.ts +16 -0
- package/esm/models/fileprovider.js +15 -0
- package/esm/models/fileresponse.d.ts +21 -0
- package/esm/models/fileresponse.js +26 -0
- package/esm/models/index.d.ts +12 -1
- package/esm/models/index.js +12 -1
- package/esm/models/openaifile.d.ts +53 -0
- package/esm/models/openaifile.js +58 -0
- package/esm/models/openaifiledeleted.d.ts +23 -0
- package/esm/models/openaifiledeleted.js +27 -0
- package/esm/models/openaifilelist.d.ts +26 -0
- package/esm/models/openaifilelist.js +33 -0
- package/esm/models/openrouterfile.d.ts +33 -0
- package/esm/models/openrouterfile.js +39 -0
- package/esm/models/openrouterfiledeleted.d.ts +22 -0
- package/esm/models/openrouterfiledeleted.js +26 -0
- package/esm/models/openrouterfilelist.d.ts +22 -0
- package/esm/models/openrouterfilelist.js +28 -0
- package/esm/models/operations/deletefile.d.ts +6 -0
- package/esm/models/operations/deletefile.js +2 -0
- package/esm/models/operations/downloadfilecontent.d.ts +6 -0
- package/esm/models/operations/downloadfilecontent.js +2 -0
- package/esm/models/operations/getbenchmarks.d.ts +1 -0
- package/esm/models/operations/getbenchmarks.js +1 -0
- package/esm/models/operations/getfilemetadata.d.ts +6 -0
- package/esm/models/operations/getfilemetadata.js +2 -0
- package/esm/models/operations/listfiles.d.ts +39 -0
- package/esm/models/operations/listfiles.js +18 -0
- package/esm/models/operations/uploadfile.d.ts +6 -0
- package/esm/models/operations/uploadfile.js +2 -0
- package/esm/models/unifiedbenchmarksmeta.d.ts +1 -0
- package/esm/models/unifiedbenchmarksmeta.js +1 -0
- package/esm/models/unifiedbenchmarksoritem.d.ts +59 -0
- package/esm/models/unifiedbenchmarksoritem.js +43 -0
- package/esm/models/unifiedbenchmarksresponse.d.ts +3 -2
- package/esm/models/unifiedbenchmarksresponse.js +3 -0
- package/esm/sdk/benchmarks.d.ts +1 -1
- package/esm/sdk/benchmarks.js +1 -1
- package/esm/sdk/files.d.ts +2 -2
- package/jsr.json +1 -1
- package/package.json +4 -4
- package/esm/models/filemetadata.d.ts +0 -26
- package/esm/models/filemetadata.js +0 -33
|
@@ -13,7 +13,7 @@ import { Result } from "../types/fp.js";
|
|
|
13
13
|
* List Benchmarks
|
|
14
14
|
*
|
|
15
15
|
* @remarks
|
|
16
|
-
* Unified benchmark endpoint that aggregates scores from multiple benchmark sources (Artificial Analysis, Design Arena). Filter by source to reproduce the exact shapes from the legacy per-source endpoints, or use task_type to find models suited for specific workloads. Authenticate with any valid OpenRouter API key. Rate-limited to 30 requests/minute per key and 500 requests/day per account.
|
|
16
|
+
* Unified benchmark endpoint that aggregates scores from multiple benchmark sources (Artificial Analysis, Design Arena, and OpenRouter's own tau-bench and GPQA evals). Filter by source to reproduce the exact shapes from the legacy per-source endpoints, or use task_type to find models suited for specific workloads. Authenticate with any valid OpenRouter API key. Rate-limited to 30 requests/minute per key and 500 requests/day per account.
|
|
17
17
|
*/
|
|
18
18
|
export declare function benchmarksGetBenchmarks(client: OpenRouterCore, request?: operations.GetBenchmarksRequest | undefined, options?: RequestOptions): APIPromise<Result<models.UnifiedBenchmarksResponse, errors.BadRequestResponseError | errors.UnauthorizedResponseError | errors.TooManyRequestsResponseError | errors.InternalServerResponseError | OpenRouterError | ResponseValidationError | ConnectionError | RequestAbortedError | RequestTimeoutError | InvalidRequestError | UnexpectedClientError | SDKValidationError>>;
|
|
19
19
|
//# sourceMappingURL=benchmarksGetBenchmarks.d.ts.map
|
|
@@ -17,7 +17,7 @@ import { APIPromise } from "../types/async.js";
|
|
|
17
17
|
* List Benchmarks
|
|
18
18
|
*
|
|
19
19
|
* @remarks
|
|
20
|
-
* Unified benchmark endpoint that aggregates scores from multiple benchmark sources (Artificial Analysis, Design Arena). Filter by source to reproduce the exact shapes from the legacy per-source endpoints, or use task_type to find models suited for specific workloads. Authenticate with any valid OpenRouter API key. Rate-limited to 30 requests/minute per key and 500 requests/day per account.
|
|
20
|
+
* Unified benchmark endpoint that aggregates scores from multiple benchmark sources (Artificial Analysis, Design Arena, and OpenRouter's own tau-bench and GPQA evals). Filter by source to reproduce the exact shapes from the legacy per-source endpoints, or use task_type to find models suited for specific workloads. Authenticate with any valid OpenRouter API key. Rate-limited to 30 requests/minute per key and 500 requests/day per account.
|
|
21
21
|
*/
|
|
22
22
|
export function benchmarksGetBenchmarks(client, request, options) {
|
|
23
23
|
return new APIPromise($do(client, request, options));
|
|
@@ -15,5 +15,5 @@ import { Result } from "../types/fp.js";
|
|
|
15
15
|
* @remarks
|
|
16
16
|
* Deletes a file owned by the requesting workspace. Deletion is irreversible.
|
|
17
17
|
*/
|
|
18
|
-
export declare function filesDelete(client: OpenRouterCore, request: operations.DeleteFileRequest, options?: RequestOptions): APIPromise<Result<models.FileDeleteResponse, errors.UnauthorizedResponseError | errors.NotFoundResponseError | errors.TooManyRequestsResponseError | errors.InternalServerResponseError | OpenRouterError | ResponseValidationError | ConnectionError | RequestAbortedError | RequestTimeoutError | InvalidRequestError | UnexpectedClientError | SDKValidationError>>;
|
|
18
|
+
export declare function filesDelete(client: OpenRouterCore, request: operations.DeleteFileRequest, options?: RequestOptions): APIPromise<Result<models.FileDeleteResponse, errors.UnauthorizedResponseError | errors.ForbiddenResponseError | errors.NotFoundResponseError | errors.TooManyRequestsResponseError | errors.InternalServerResponseError | errors.BadGatewayResponseError | errors.ServiceUnavailableResponseError | OpenRouterError | ResponseValidationError | ConnectionError | RequestAbortedError | RequestTimeoutError | InvalidRequestError | UnexpectedClientError | SDKValidationError>>;
|
|
19
19
|
//# sourceMappingURL=filesDelete.d.ts.map
|
package/esm/funcs/filesDelete.js
CHANGED
|
@@ -37,6 +37,7 @@ async function $do(client, request, options) {
|
|
|
37
37
|
};
|
|
38
38
|
const path = pathToFunc("/files/{file_id}")(pathParams);
|
|
39
39
|
const query = encodeFormQuery({
|
|
40
|
+
"provider": payload.provider,
|
|
40
41
|
"workspace_id": payload.workspace_id,
|
|
41
42
|
});
|
|
42
43
|
const headers = new Headers(compactMap({
|
|
@@ -98,7 +99,7 @@ async function $do(client, request, options) {
|
|
|
98
99
|
const responseFields = {
|
|
99
100
|
HttpMeta: { Response: response, Request: req },
|
|
100
101
|
};
|
|
101
|
-
const [result] = await M.match(M.json(200, models.FileDeleteResponse$inboundSchema), M.jsonErr(401, errors.UnauthorizedResponseError$inboundSchema), M.jsonErr(404, errors.NotFoundResponseError$inboundSchema), M.jsonErr(429, errors.TooManyRequestsResponseError$inboundSchema), M.jsonErr(500, errors.InternalServerResponseError$inboundSchema), M.fail("4XX"), M.fail("5XX"))(response, req, { extraFields: responseFields });
|
|
102
|
+
const [result] = await M.match(M.json(200, models.FileDeleteResponse$inboundSchema), M.jsonErr(401, errors.UnauthorizedResponseError$inboundSchema), M.jsonErr(403, errors.ForbiddenResponseError$inboundSchema), M.jsonErr(404, errors.NotFoundResponseError$inboundSchema), M.jsonErr(429, errors.TooManyRequestsResponseError$inboundSchema), M.jsonErr(500, errors.InternalServerResponseError$inboundSchema), M.jsonErr(502, errors.BadGatewayResponseError$inboundSchema), M.jsonErr(503, errors.ServiceUnavailableResponseError$inboundSchema), M.fail("4XX"), M.fail("5XX"))(response, req, { extraFields: responseFields });
|
|
102
103
|
if (!result.ok) {
|
|
103
104
|
return [result, { status: "complete", request: req, response }];
|
|
104
105
|
}
|
|
@@ -14,5 +14,5 @@ import { Result } from "../types/fp.js";
|
|
|
14
14
|
* @remarks
|
|
15
15
|
* Downloads the raw bytes of a file. Only files created server-side are downloadable; uploaded files return 400.
|
|
16
16
|
*/
|
|
17
|
-
export declare function filesDownload(client: OpenRouterCore, request: operations.DownloadFileContentRequest, options?: RequestOptions): APIPromise<Result<ReadableStream<Uint8Array>, errors.BadRequestResponseError | errors.UnauthorizedResponseError | errors.NotFoundResponseError | errors.TooManyRequestsResponseError | errors.InternalServerResponseError | OpenRouterError | ResponseValidationError | ConnectionError | RequestAbortedError | RequestTimeoutError | InvalidRequestError | UnexpectedClientError | SDKValidationError>>;
|
|
17
|
+
export declare function filesDownload(client: OpenRouterCore, request: operations.DownloadFileContentRequest, options?: RequestOptions): APIPromise<Result<ReadableStream<Uint8Array>, errors.BadRequestResponseError | errors.UnauthorizedResponseError | errors.ForbiddenResponseError | errors.NotFoundResponseError | errors.TooManyRequestsResponseError | errors.InternalServerResponseError | errors.BadGatewayResponseError | errors.ServiceUnavailableResponseError | OpenRouterError | ResponseValidationError | ConnectionError | RequestAbortedError | RequestTimeoutError | InvalidRequestError | UnexpectedClientError | SDKValidationError>>;
|
|
18
18
|
//# sourceMappingURL=filesDownload.d.ts.map
|
|
@@ -37,6 +37,7 @@ async function $do(client, request, options) {
|
|
|
37
37
|
};
|
|
38
38
|
const path = pathToFunc("/files/{file_id}/content")(pathParams);
|
|
39
39
|
const query = encodeFormQuery({
|
|
40
|
+
"provider": payload.provider,
|
|
40
41
|
"workspace_id": payload.workspace_id,
|
|
41
42
|
});
|
|
42
43
|
const headers = new Headers(compactMap({
|
|
@@ -98,7 +99,7 @@ async function $do(client, request, options) {
|
|
|
98
99
|
const responseFields = {
|
|
99
100
|
HttpMeta: { Response: response, Request: req },
|
|
100
101
|
};
|
|
101
|
-
const [result] = await M.match(M.stream(200, z.custom(x => x instanceof ReadableStream)), M.jsonErr(400, errors.BadRequestResponseError$inboundSchema), M.jsonErr(401, errors.UnauthorizedResponseError$inboundSchema), M.jsonErr(404, errors.NotFoundResponseError$inboundSchema), M.jsonErr(429, errors.TooManyRequestsResponseError$inboundSchema), M.jsonErr(500, errors.InternalServerResponseError$inboundSchema), M.fail("4XX"), M.fail("5XX"))(response, req, { extraFields: responseFields });
|
|
102
|
+
const [result] = await M.match(M.stream(200, z.custom(x => x instanceof ReadableStream)), M.jsonErr(400, errors.BadRequestResponseError$inboundSchema), M.jsonErr(401, errors.UnauthorizedResponseError$inboundSchema), M.jsonErr(403, errors.ForbiddenResponseError$inboundSchema), M.jsonErr(404, errors.NotFoundResponseError$inboundSchema), M.jsonErr(429, errors.TooManyRequestsResponseError$inboundSchema), M.jsonErr(500, errors.InternalServerResponseError$inboundSchema), M.jsonErr(502, errors.BadGatewayResponseError$inboundSchema), M.jsonErr(503, errors.ServiceUnavailableResponseError$inboundSchema), M.fail("4XX"), M.fail("5XX"))(response, req, { extraFields: responseFields });
|
|
102
103
|
if (!result.ok) {
|
|
103
104
|
return [result, { status: "complete", request: req, response }];
|
|
104
105
|
}
|
package/esm/funcs/filesList.d.ts
CHANGED
|
@@ -15,7 +15,7 @@ import { PageIterator } from "../types/operations.js";
|
|
|
15
15
|
* @remarks
|
|
16
16
|
* Lists files belonging to the workspace of the authenticating API key.
|
|
17
17
|
*/
|
|
18
|
-
export declare function filesList(client: OpenRouterCore, request?: operations.ListFilesRequest | undefined, options?: RequestOptions): APIPromise<PageIterator<Result<operations.ListFilesResponse, errors.BadRequestResponseError | errors.UnauthorizedResponseError | errors.TooManyRequestsResponseError | errors.InternalServerResponseError | OpenRouterError | ResponseValidationError | ConnectionError | RequestAbortedError | RequestTimeoutError | InvalidRequestError | UnexpectedClientError | SDKValidationError>, {
|
|
18
|
+
export declare function filesList(client: OpenRouterCore, request?: operations.ListFilesRequest | undefined, options?: RequestOptions): APIPromise<PageIterator<Result<operations.ListFilesResponse, errors.BadRequestResponseError | errors.UnauthorizedResponseError | errors.ForbiddenResponseError | errors.TooManyRequestsResponseError | errors.InternalServerResponseError | errors.BadGatewayResponseError | errors.ServiceUnavailableResponseError | OpenRouterError | ResponseValidationError | ConnectionError | RequestAbortedError | RequestTimeoutError | InvalidRequestError | UnexpectedClientError | SDKValidationError>, {
|
|
19
19
|
cursor: string;
|
|
20
20
|
}>>;
|
|
21
21
|
//# sourceMappingURL=filesList.d.ts.map
|
package/esm/funcs/filesList.js
CHANGED
|
@@ -31,8 +31,13 @@ async function $do(client, request, options) {
|
|
|
31
31
|
const body = null;
|
|
32
32
|
const path = pathToFunc("/files")();
|
|
33
33
|
const query = encodeFormQuery({
|
|
34
|
+
"after": payload?.after,
|
|
35
|
+
"after_id": payload?.after_id,
|
|
36
|
+
"before_id": payload?.before_id,
|
|
34
37
|
"cursor": payload?.cursor,
|
|
35
38
|
"limit": payload?.limit,
|
|
39
|
+
"order": payload?.order,
|
|
40
|
+
"provider": payload?.provider,
|
|
36
41
|
"workspace_id": payload?.workspace_id,
|
|
37
42
|
});
|
|
38
43
|
const headers = new Headers(compactMap({
|
|
@@ -94,7 +99,7 @@ async function $do(client, request, options) {
|
|
|
94
99
|
const responseFields = {
|
|
95
100
|
HttpMeta: { Response: response, Request: req },
|
|
96
101
|
};
|
|
97
|
-
const [result, raw] = await M.match(M.json(200, operations.ListFilesResponse$inboundSchema, { key: "Result" }), M.jsonErr(400, errors.BadRequestResponseError$inboundSchema), M.jsonErr(401, errors.UnauthorizedResponseError$inboundSchema), M.jsonErr(429, errors.TooManyRequestsResponseError$inboundSchema), M.jsonErr(500, errors.InternalServerResponseError$inboundSchema), M.fail("4XX"), M.fail("5XX"))(response, req, { extraFields: responseFields });
|
|
102
|
+
const [result, raw] = await M.match(M.json(200, operations.ListFilesResponse$inboundSchema, { key: "Result" }), M.jsonErr(400, errors.BadRequestResponseError$inboundSchema), M.jsonErr(401, errors.UnauthorizedResponseError$inboundSchema), M.jsonErr(403, errors.ForbiddenResponseError$inboundSchema), M.jsonErr(429, errors.TooManyRequestsResponseError$inboundSchema), M.jsonErr(500, errors.InternalServerResponseError$inboundSchema), M.jsonErr(502, errors.BadGatewayResponseError$inboundSchema), M.jsonErr(503, errors.ServiceUnavailableResponseError$inboundSchema), M.fail("4XX"), M.fail("5XX"))(response, req, { extraFields: responseFields });
|
|
98
103
|
if (!result.ok) {
|
|
99
104
|
return [haltIterator(result), {
|
|
100
105
|
status: "complete",
|
|
@@ -103,14 +108,16 @@ async function $do(client, request, options) {
|
|
|
103
108
|
}];
|
|
104
109
|
}
|
|
105
110
|
const nextFunc = (responseData) => {
|
|
106
|
-
const nextCursor = responseData
|
|
111
|
+
const nextCursor = responseData
|
|
112
|
+
?.cursor;
|
|
107
113
|
if (typeof nextCursor !== "string") {
|
|
108
114
|
return { next: () => null };
|
|
109
115
|
}
|
|
110
116
|
if (nextCursor.trim() === "") {
|
|
111
117
|
return { next: () => null };
|
|
112
118
|
}
|
|
113
|
-
const results = responseData
|
|
119
|
+
const results = responseData
|
|
120
|
+
?.data;
|
|
114
121
|
if (!Array.isArray(results) || !results.length) {
|
|
115
122
|
return { next: () => null };
|
|
116
123
|
}
|
|
@@ -15,5 +15,5 @@ import { Result } from "../types/fp.js";
|
|
|
15
15
|
* @remarks
|
|
16
16
|
* Retrieves metadata for a single file owned by the requesting workspace.
|
|
17
17
|
*/
|
|
18
|
-
export declare function filesRetrieve(client: OpenRouterCore, request: operations.GetFileMetadataRequest, options?: RequestOptions): APIPromise<Result<models.
|
|
18
|
+
export declare function filesRetrieve(client: OpenRouterCore, request: operations.GetFileMetadataRequest, options?: RequestOptions): APIPromise<Result<models.FileResponse, errors.UnauthorizedResponseError | errors.ForbiddenResponseError | errors.NotFoundResponseError | errors.TooManyRequestsResponseError | errors.InternalServerResponseError | errors.BadGatewayResponseError | errors.ServiceUnavailableResponseError | OpenRouterError | ResponseValidationError | ConnectionError | RequestAbortedError | RequestTimeoutError | InvalidRequestError | UnexpectedClientError | SDKValidationError>>;
|
|
19
19
|
//# sourceMappingURL=filesRetrieve.d.ts.map
|
|
@@ -37,6 +37,7 @@ async function $do(client, request, options) {
|
|
|
37
37
|
};
|
|
38
38
|
const path = pathToFunc("/files/{file_id}")(pathParams);
|
|
39
39
|
const query = encodeFormQuery({
|
|
40
|
+
"provider": payload.provider,
|
|
40
41
|
"workspace_id": payload.workspace_id,
|
|
41
42
|
});
|
|
42
43
|
const headers = new Headers(compactMap({
|
|
@@ -98,7 +99,7 @@ async function $do(client, request, options) {
|
|
|
98
99
|
const responseFields = {
|
|
99
100
|
HttpMeta: { Response: response, Request: req },
|
|
100
101
|
};
|
|
101
|
-
const [result] = await M.match(M.json(200, models.
|
|
102
|
+
const [result] = await M.match(M.json(200, models.FileResponse$inboundSchema), M.jsonErr(401, errors.UnauthorizedResponseError$inboundSchema), M.jsonErr(403, errors.ForbiddenResponseError$inboundSchema), M.jsonErr(404, errors.NotFoundResponseError$inboundSchema), M.jsonErr(429, errors.TooManyRequestsResponseError$inboundSchema), M.jsonErr(500, errors.InternalServerResponseError$inboundSchema), M.jsonErr(502, errors.BadGatewayResponseError$inboundSchema), M.jsonErr(503, errors.ServiceUnavailableResponseError$inboundSchema), M.fail("4XX"), M.fail("5XX"))(response, req, { extraFields: responseFields });
|
|
102
103
|
if (!result.ok) {
|
|
103
104
|
return [result, { status: "complete", request: req, response }];
|
|
104
105
|
}
|
|
@@ -15,5 +15,5 @@ import { Result } from "../types/fp.js";
|
|
|
15
15
|
* @remarks
|
|
16
16
|
* Uploads a file to be referenced in future API calls. The file is stored under the workspace of the authenticating API key. Maximum file size: 100 MB.
|
|
17
17
|
*/
|
|
18
|
-
export declare function filesUpload(client: OpenRouterCore, request: operations.UploadFileRequest, options?: RequestOptions): APIPromise<Result<models.
|
|
18
|
+
export declare function filesUpload(client: OpenRouterCore, request: operations.UploadFileRequest, options?: RequestOptions): APIPromise<Result<models.FileResponse, errors.BadRequestResponseError | errors.UnauthorizedResponseError | errors.ForbiddenResponseError | errors.PayloadTooLargeResponseError | errors.TooManyRequestsResponseError | errors.InternalServerResponseError | errors.BadGatewayResponseError | errors.ServiceUnavailableResponseError | OpenRouterError | ResponseValidationError | ConnectionError | RequestAbortedError | RequestTimeoutError | InvalidRequestError | UnexpectedClientError | SDKValidationError>>;
|
|
19
19
|
//# sourceMappingURL=filesUpload.d.ts.map
|
package/esm/funcs/filesUpload.js
CHANGED
|
@@ -51,6 +51,7 @@ async function $do(client, request, options) {
|
|
|
51
51
|
}
|
|
52
52
|
const path = pathToFunc("/files")();
|
|
53
53
|
const query = encodeFormQuery({
|
|
54
|
+
"provider": payload.provider,
|
|
54
55
|
"workspace_id": payload.workspace_id,
|
|
55
56
|
});
|
|
56
57
|
const headers = new Headers(compactMap({
|
|
@@ -112,7 +113,7 @@ async function $do(client, request, options) {
|
|
|
112
113
|
const responseFields = {
|
|
113
114
|
HttpMeta: { Response: response, Request: req },
|
|
114
115
|
};
|
|
115
|
-
const [result] = await M.match(M.json(200, models.
|
|
116
|
+
const [result] = await M.match(M.json(200, models.FileResponse$inboundSchema), M.jsonErr(400, errors.BadRequestResponseError$inboundSchema), M.jsonErr(401, errors.UnauthorizedResponseError$inboundSchema), M.jsonErr(403, errors.ForbiddenResponseError$inboundSchema), M.jsonErr(413, errors.PayloadTooLargeResponseError$inboundSchema), M.jsonErr(429, errors.TooManyRequestsResponseError$inboundSchema), M.jsonErr(500, errors.InternalServerResponseError$inboundSchema), M.jsonErr(502, errors.BadGatewayResponseError$inboundSchema), M.jsonErr(503, errors.ServiceUnavailableResponseError$inboundSchema), M.fail("4XX"), M.fail("5XX"))(response, req, { extraFields: responseFields });
|
|
116
117
|
if (!result.ok) {
|
|
117
118
|
return [result, { status: "complete", request: req, response }];
|
|
118
119
|
}
|
package/esm/lib/config.d.ts
CHANGED
|
@@ -49,8 +49,8 @@ export declare function serverURLFromOptions(options: SDKOptions): URL | null;
|
|
|
49
49
|
export declare const SDK_METADATA: {
|
|
50
50
|
readonly language: "typescript";
|
|
51
51
|
readonly openapiDocVersion: "1.0.0";
|
|
52
|
-
readonly sdkVersion: "1.1.
|
|
52
|
+
readonly sdkVersion: "1.1.19";
|
|
53
53
|
readonly genVersion: "2.914.0";
|
|
54
|
-
readonly userAgent: "speakeasy-sdk/typescript 1.1.
|
|
54
|
+
readonly userAgent: "speakeasy-sdk/typescript 1.1.19 2.914.0 1.0.0 @openrouter/sdk";
|
|
55
55
|
};
|
|
56
56
|
//# sourceMappingURL=config.d.ts.map
|
package/esm/lib/config.js
CHANGED
|
@@ -26,8 +26,8 @@ export function serverURLFromOptions(options) {
|
|
|
26
26
|
export const SDK_METADATA = {
|
|
27
27
|
language: "typescript",
|
|
28
28
|
openapiDocVersion: "1.0.0",
|
|
29
|
-
sdkVersion: "1.1.
|
|
29
|
+
sdkVersion: "1.1.19",
|
|
30
30
|
genVersion: "2.914.0",
|
|
31
|
-
userAgent: "speakeasy-sdk/typescript 1.1.
|
|
31
|
+
userAgent: "speakeasy-sdk/typescript 1.1.19 2.914.0 1.0.0 @openrouter/sdk",
|
|
32
32
|
};
|
|
33
33
|
//# sourceMappingURL=config.js.map
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import * as z from "zod/v4";
|
|
2
|
+
import { ClosedEnum } from "../types/enums.js";
|
|
3
|
+
import { Result as SafeParseResult } from "../types/fp.js";
|
|
4
|
+
import { SDKValidationError } from "./errors/sdkvalidationerror.js";
|
|
5
|
+
export declare const AnthropicFileShape: {
|
|
6
|
+
readonly Anthropic: "anthropic";
|
|
7
|
+
};
|
|
8
|
+
export type AnthropicFileShape = ClosedEnum<typeof AnthropicFileShape>;
|
|
9
|
+
export declare const AnthropicFileType: {
|
|
10
|
+
readonly File: "file";
|
|
11
|
+
};
|
|
12
|
+
export type AnthropicFileType = ClosedEnum<typeof AnthropicFileType>;
|
|
13
|
+
/**
|
|
14
|
+
* A stored file in Anthropic's Files API shape.
|
|
15
|
+
*/
|
|
16
|
+
export type AnthropicFile = {
|
|
17
|
+
shape: AnthropicFileShape;
|
|
18
|
+
createdAt: string;
|
|
19
|
+
downloadable: boolean;
|
|
20
|
+
filename: string;
|
|
21
|
+
id: string;
|
|
22
|
+
mimeType: string;
|
|
23
|
+
sizeBytes: number;
|
|
24
|
+
type: AnthropicFileType;
|
|
25
|
+
};
|
|
26
|
+
/** @internal */
|
|
27
|
+
export declare const AnthropicFileShape$inboundSchema: z.ZodEnum<typeof AnthropicFileShape>;
|
|
28
|
+
/** @internal */
|
|
29
|
+
export declare const AnthropicFileType$inboundSchema: z.ZodEnum<typeof AnthropicFileType>;
|
|
30
|
+
/** @internal */
|
|
31
|
+
export declare const AnthropicFile$inboundSchema: z.ZodType<AnthropicFile, unknown>;
|
|
32
|
+
export declare function anthropicFileFromJSON(jsonString: string): SafeParseResult<AnthropicFile, SDKValidationError>;
|
|
33
|
+
//# sourceMappingURL=anthropicfile.d.ts.map
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
+
* @generated-id: ef320fa3557d
|
|
4
|
+
*/
|
|
5
|
+
import * as z from "zod/v4";
|
|
6
|
+
import { remap as remap$ } from "../lib/primitives.js";
|
|
7
|
+
import { safeParse } from "../lib/schemas.js";
|
|
8
|
+
export const AnthropicFileShape = {
|
|
9
|
+
Anthropic: "anthropic",
|
|
10
|
+
};
|
|
11
|
+
export const AnthropicFileType = {
|
|
12
|
+
File: "file",
|
|
13
|
+
};
|
|
14
|
+
/** @internal */
|
|
15
|
+
export const AnthropicFileShape$inboundSchema = z.enum(AnthropicFileShape);
|
|
16
|
+
/** @internal */
|
|
17
|
+
export const AnthropicFileType$inboundSchema = z.enum(AnthropicFileType);
|
|
18
|
+
/** @internal */
|
|
19
|
+
export const AnthropicFile$inboundSchema = z
|
|
20
|
+
.object({
|
|
21
|
+
_shape: AnthropicFileShape$inboundSchema,
|
|
22
|
+
created_at: z.string(),
|
|
23
|
+
downloadable: z.boolean(),
|
|
24
|
+
filename: z.string(),
|
|
25
|
+
id: z.string(),
|
|
26
|
+
mime_type: z.string(),
|
|
27
|
+
size_bytes: z.int(),
|
|
28
|
+
type: AnthropicFileType$inboundSchema,
|
|
29
|
+
}).transform((v) => {
|
|
30
|
+
return remap$(v, {
|
|
31
|
+
"_shape": "shape",
|
|
32
|
+
"created_at": "createdAt",
|
|
33
|
+
"mime_type": "mimeType",
|
|
34
|
+
"size_bytes": "sizeBytes",
|
|
35
|
+
});
|
|
36
|
+
});
|
|
37
|
+
export function anthropicFileFromJSON(jsonString) {
|
|
38
|
+
return safeParse(jsonString, (x) => AnthropicFile$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'AnthropicFile' from JSON`);
|
|
39
|
+
}
|
|
40
|
+
//# sourceMappingURL=anthropicfile.js.map
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import * as z from "zod/v4";
|
|
2
|
+
import { ClosedEnum } from "../types/enums.js";
|
|
3
|
+
import { Result as SafeParseResult } from "../types/fp.js";
|
|
4
|
+
import { SDKValidationError } from "./errors/sdkvalidationerror.js";
|
|
5
|
+
export declare const AnthropicFileDeletedType: {
|
|
6
|
+
readonly FileDeleted: "file_deleted";
|
|
7
|
+
};
|
|
8
|
+
export type AnthropicFileDeletedType = ClosedEnum<typeof AnthropicFileDeletedType>;
|
|
9
|
+
/**
|
|
10
|
+
* Deletion result in Anthropic's shape.
|
|
11
|
+
*/
|
|
12
|
+
export type AnthropicFileDeleted = {
|
|
13
|
+
shape: "anthropic";
|
|
14
|
+
id: string;
|
|
15
|
+
type: AnthropicFileDeletedType;
|
|
16
|
+
};
|
|
17
|
+
/** @internal */
|
|
18
|
+
export declare const AnthropicFileDeletedType$inboundSchema: z.ZodEnum<typeof AnthropicFileDeletedType>;
|
|
19
|
+
/** @internal */
|
|
20
|
+
export declare const AnthropicFileDeleted$inboundSchema: z.ZodType<AnthropicFileDeleted, unknown>;
|
|
21
|
+
export declare function anthropicFileDeletedFromJSON(jsonString: string): SafeParseResult<AnthropicFileDeleted, SDKValidationError>;
|
|
22
|
+
//# sourceMappingURL=anthropicfiledeleted.d.ts.map
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
+
* @generated-id: 37177e6e8a12
|
|
4
|
+
*/
|
|
5
|
+
import * as z from "zod/v4";
|
|
6
|
+
import { remap as remap$ } from "../lib/primitives.js";
|
|
7
|
+
import { safeParse } from "../lib/schemas.js";
|
|
8
|
+
export const AnthropicFileDeletedType = {
|
|
9
|
+
FileDeleted: "file_deleted",
|
|
10
|
+
};
|
|
11
|
+
/** @internal */
|
|
12
|
+
export const AnthropicFileDeletedType$inboundSchema = z.enum(AnthropicFileDeletedType);
|
|
13
|
+
/** @internal */
|
|
14
|
+
export const AnthropicFileDeleted$inboundSchema = z.object({
|
|
15
|
+
_shape: z.literal("anthropic"),
|
|
16
|
+
id: z.string(),
|
|
17
|
+
type: AnthropicFileDeletedType$inboundSchema,
|
|
18
|
+
}).transform((v) => {
|
|
19
|
+
return remap$(v, {
|
|
20
|
+
"_shape": "shape",
|
|
21
|
+
});
|
|
22
|
+
});
|
|
23
|
+
export function anthropicFileDeletedFromJSON(jsonString) {
|
|
24
|
+
return safeParse(jsonString, (x) => AnthropicFileDeleted$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'AnthropicFileDeleted' from JSON`);
|
|
25
|
+
}
|
|
26
|
+
//# sourceMappingURL=anthropicfiledeleted.js.map
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import * as z from "zod/v4";
|
|
2
|
+
import { Result as SafeParseResult } from "../types/fp.js";
|
|
3
|
+
import { AnthropicFile } from "./anthropicfile.js";
|
|
4
|
+
import { SDKValidationError } from "./errors/sdkvalidationerror.js";
|
|
5
|
+
/**
|
|
6
|
+
* A page of files in Anthropic's shape.
|
|
7
|
+
*/
|
|
8
|
+
export type AnthropicFileList = {
|
|
9
|
+
shape: "anthropic";
|
|
10
|
+
data: Array<AnthropicFile>;
|
|
11
|
+
firstId: string | null;
|
|
12
|
+
hasMore: boolean;
|
|
13
|
+
lastId: string | null;
|
|
14
|
+
};
|
|
15
|
+
/** @internal */
|
|
16
|
+
export declare const AnthropicFileList$inboundSchema: z.ZodType<AnthropicFileList, unknown>;
|
|
17
|
+
export declare function anthropicFileListFromJSON(jsonString: string): SafeParseResult<AnthropicFileList, SDKValidationError>;
|
|
18
|
+
//# sourceMappingURL=anthropicfilelist.d.ts.map
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
+
* @generated-id: 7ef7b8e43b6c
|
|
4
|
+
*/
|
|
5
|
+
import * as z from "zod/v4";
|
|
6
|
+
import { remap as remap$ } from "../lib/primitives.js";
|
|
7
|
+
import { safeParse } from "../lib/schemas.js";
|
|
8
|
+
import { AnthropicFile$inboundSchema } from "./anthropicfile.js";
|
|
9
|
+
/** @internal */
|
|
10
|
+
export const AnthropicFileList$inboundSchema = z.object({
|
|
11
|
+
_shape: z.literal("anthropic"),
|
|
12
|
+
data: z.array(AnthropicFile$inboundSchema),
|
|
13
|
+
first_id: z.nullable(z.string()),
|
|
14
|
+
has_more: z.boolean(),
|
|
15
|
+
last_id: z.nullable(z.string()),
|
|
16
|
+
}).transform((v) => {
|
|
17
|
+
return remap$(v, {
|
|
18
|
+
"_shape": "shape",
|
|
19
|
+
"first_id": "firstId",
|
|
20
|
+
"has_more": "hasMore",
|
|
21
|
+
"last_id": "lastId",
|
|
22
|
+
});
|
|
23
|
+
});
|
|
24
|
+
export function anthropicFileListFromJSON(jsonString) {
|
|
25
|
+
return safeParse(jsonString, (x) => AnthropicFileList$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'AnthropicFileList' from JSON`);
|
|
26
|
+
}
|
|
27
|
+
//# sourceMappingURL=anthropicfilelist.js.map
|
|
@@ -1,20 +1,14 @@
|
|
|
1
1
|
import * as z from "zod/v4";
|
|
2
|
-
import
|
|
2
|
+
import * as discriminatedUnionTypes from "../types/discriminatedUnion.js";
|
|
3
3
|
import { Result as SafeParseResult } from "../types/fp.js";
|
|
4
|
+
import { AnthropicFileDeleted } from "./anthropicfiledeleted.js";
|
|
4
5
|
import { SDKValidationError } from "./errors/sdkvalidationerror.js";
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
};
|
|
8
|
-
export type FileDeleteResponseType = ClosedEnum<typeof FileDeleteResponseType>;
|
|
6
|
+
import { OpenAIFileDeleted } from "./openaifiledeleted.js";
|
|
7
|
+
import { OpenRouterFileDeleted } from "./openrouterfiledeleted.js";
|
|
9
8
|
/**
|
|
10
|
-
* Confirmation that a file was deleted.
|
|
9
|
+
* Confirmation that a file was deleted, in the negotiated shape.
|
|
11
10
|
*/
|
|
12
|
-
export type FileDeleteResponse =
|
|
13
|
-
id: string;
|
|
14
|
-
type: FileDeleteResponseType;
|
|
15
|
-
};
|
|
16
|
-
/** @internal */
|
|
17
|
-
export declare const FileDeleteResponseType$inboundSchema: z.ZodEnum<typeof FileDeleteResponseType>;
|
|
11
|
+
export type FileDeleteResponse = AnthropicFileDeleted | OpenAIFileDeleted | OpenRouterFileDeleted | discriminatedUnionTypes.Unknown<"shape">;
|
|
18
12
|
/** @internal */
|
|
19
13
|
export declare const FileDeleteResponse$inboundSchema: z.ZodType<FileDeleteResponse, unknown>;
|
|
20
14
|
export declare function fileDeleteResponseFromJSON(jsonString: string): SafeParseResult<FileDeleteResponse, SDKValidationError>;
|
|
@@ -2,18 +2,17 @@
|
|
|
2
2
|
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
3
|
* @generated-id: 2464f2b51ee5
|
|
4
4
|
*/
|
|
5
|
-
import * as z from "zod/v4";
|
|
6
5
|
import { safeParse } from "../lib/schemas.js";
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
};
|
|
6
|
+
import { discriminatedUnion } from "../types/discriminatedUnion.js";
|
|
7
|
+
import { AnthropicFileDeleted$inboundSchema, } from "./anthropicfiledeleted.js";
|
|
8
|
+
import { OpenAIFileDeleted$inboundSchema, } from "./openaifiledeleted.js";
|
|
9
|
+
import { OpenRouterFileDeleted$inboundSchema, } from "./openrouterfiledeleted.js";
|
|
10
10
|
/** @internal */
|
|
11
|
-
export const
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
});
|
|
11
|
+
export const FileDeleteResponse$inboundSchema = discriminatedUnion("_shape", {
|
|
12
|
+
anthropic: AnthropicFileDeleted$inboundSchema,
|
|
13
|
+
openai: OpenAIFileDeleted$inboundSchema,
|
|
14
|
+
openrouter: OpenRouterFileDeleted$inboundSchema,
|
|
15
|
+
}, { outputPropertyName: "shape" });
|
|
17
16
|
export function fileDeleteResponseFromJSON(jsonString) {
|
|
18
17
|
return safeParse(jsonString, (x) => FileDeleteResponse$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'FileDeleteResponse' from JSON`);
|
|
19
18
|
}
|
|
@@ -1,20 +1,14 @@
|
|
|
1
1
|
import * as z from "zod/v4";
|
|
2
|
+
import * as discriminatedUnionTypes from "../types/discriminatedUnion.js";
|
|
2
3
|
import { Result as SafeParseResult } from "../types/fp.js";
|
|
4
|
+
import { AnthropicFileList } from "./anthropicfilelist.js";
|
|
3
5
|
import { SDKValidationError } from "./errors/sdkvalidationerror.js";
|
|
4
|
-
import {
|
|
6
|
+
import { OpenAIFileList } from "./openaifilelist.js";
|
|
7
|
+
import { OpenRouterFileList } from "./openrouterfilelist.js";
|
|
5
8
|
/**
|
|
6
|
-
* A page of files
|
|
9
|
+
* A page of files, in the negotiated shape.
|
|
7
10
|
*/
|
|
8
|
-
export type FileListResponse =
|
|
9
|
-
/**
|
|
10
|
-
* Opaque cursor for the next page; null when there are no more results.
|
|
11
|
-
*/
|
|
12
|
-
cursor: string | null;
|
|
13
|
-
data: Array<FileMetadata>;
|
|
14
|
-
firstId: string | null;
|
|
15
|
-
hasMore: boolean;
|
|
16
|
-
lastId: string | null;
|
|
17
|
-
};
|
|
11
|
+
export type FileListResponse = AnthropicFileList | OpenAIFileList | OpenRouterFileList | discriminatedUnionTypes.Unknown<"shape">;
|
|
18
12
|
/** @internal */
|
|
19
13
|
export declare const FileListResponse$inboundSchema: z.ZodType<FileListResponse, unknown>;
|
|
20
14
|
export declare function fileListResponseFromJSON(jsonString: string): SafeParseResult<FileListResponse, SDKValidationError>;
|
|
@@ -2,24 +2,17 @@
|
|
|
2
2
|
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
3
|
* @generated-id: e4978ed568c7
|
|
4
4
|
*/
|
|
5
|
-
import * as z from "zod/v4";
|
|
6
|
-
import { remap as remap$ } from "../lib/primitives.js";
|
|
7
5
|
import { safeParse } from "../lib/schemas.js";
|
|
8
|
-
import {
|
|
6
|
+
import { discriminatedUnion } from "../types/discriminatedUnion.js";
|
|
7
|
+
import { AnthropicFileList$inboundSchema, } from "./anthropicfilelist.js";
|
|
8
|
+
import { OpenAIFileList$inboundSchema, } from "./openaifilelist.js";
|
|
9
|
+
import { OpenRouterFileList$inboundSchema, } from "./openrouterfilelist.js";
|
|
9
10
|
/** @internal */
|
|
10
|
-
export const FileListResponse$inboundSchema =
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
last_id: z.nullable(z.string()),
|
|
16
|
-
}).transform((v) => {
|
|
17
|
-
return remap$(v, {
|
|
18
|
-
"first_id": "firstId",
|
|
19
|
-
"has_more": "hasMore",
|
|
20
|
-
"last_id": "lastId",
|
|
21
|
-
});
|
|
22
|
-
});
|
|
11
|
+
export const FileListResponse$inboundSchema = discriminatedUnion("_shape", {
|
|
12
|
+
anthropic: AnthropicFileList$inboundSchema,
|
|
13
|
+
openai: OpenAIFileList$inboundSchema,
|
|
14
|
+
openrouter: OpenRouterFileList$inboundSchema,
|
|
15
|
+
}, { outputPropertyName: "shape" });
|
|
23
16
|
export function fileListResponseFromJSON(jsonString) {
|
|
24
17
|
return safeParse(jsonString, (x) => FileListResponse$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'FileListResponse' from JSON`);
|
|
25
18
|
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import * as z from "zod/v4";
|
|
2
|
+
import { OpenEnum } from "../types/enums.js";
|
|
3
|
+
/**
|
|
4
|
+
* Store or read this file on the named provider using your own API key for it. Omit to use OpenRouter storage.
|
|
5
|
+
*/
|
|
6
|
+
export declare const FileProvider: {
|
|
7
|
+
readonly Openai: "openai";
|
|
8
|
+
readonly Anthropic: "anthropic";
|
|
9
|
+
};
|
|
10
|
+
/**
|
|
11
|
+
* Store or read this file on the named provider using your own API key for it. Omit to use OpenRouter storage.
|
|
12
|
+
*/
|
|
13
|
+
export type FileProvider = OpenEnum<typeof FileProvider>;
|
|
14
|
+
/** @internal */
|
|
15
|
+
export declare const FileProvider$outboundSchema: z.ZodType<string, FileProvider>;
|
|
16
|
+
//# sourceMappingURL=fileprovider.d.ts.map
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
+
* @generated-id: f319a1008f4d
|
|
4
|
+
*/
|
|
5
|
+
import * as openEnums from "../types/enums.js";
|
|
6
|
+
/**
|
|
7
|
+
* Store or read this file on the named provider using your own API key for it. Omit to use OpenRouter storage.
|
|
8
|
+
*/
|
|
9
|
+
export const FileProvider = {
|
|
10
|
+
Openai: "openai",
|
|
11
|
+
Anthropic: "anthropic",
|
|
12
|
+
};
|
|
13
|
+
/** @internal */
|
|
14
|
+
export const FileProvider$outboundSchema = openEnums.outboundSchema(FileProvider);
|
|
15
|
+
//# sourceMappingURL=fileprovider.js.map
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import * as z from "zod/v4";
|
|
2
|
+
import * as discriminatedUnionTypes from "../types/discriminatedUnion.js";
|
|
3
|
+
import { Result as SafeParseResult } from "../types/fp.js";
|
|
4
|
+
import { AnthropicFile } from "./anthropicfile.js";
|
|
5
|
+
import { SDKValidationError } from "./errors/sdkvalidationerror.js";
|
|
6
|
+
import { OpenAIFile } from "./openaifile.js";
|
|
7
|
+
import { OpenRouterFile } from "./openrouterfile.js";
|
|
8
|
+
/**
|
|
9
|
+
* A stored file. The shape is negotiated per request — see the endpoint description.
|
|
10
|
+
*/
|
|
11
|
+
export type FileResponse = (AnthropicFile & {
|
|
12
|
+
shape: "anthropic";
|
|
13
|
+
}) | (OpenAIFile & {
|
|
14
|
+
shape: "openai";
|
|
15
|
+
}) | (OpenRouterFile & {
|
|
16
|
+
shape: "openrouter";
|
|
17
|
+
}) | discriminatedUnionTypes.Unknown<"shape">;
|
|
18
|
+
/** @internal */
|
|
19
|
+
export declare const FileResponse$inboundSchema: z.ZodType<FileResponse, unknown>;
|
|
20
|
+
export declare function fileResponseFromJSON(jsonString: string): SafeParseResult<FileResponse, SDKValidationError>;
|
|
21
|
+
//# sourceMappingURL=fileresponse.d.ts.map
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
+
* @generated-id: f1edf3b92523
|
|
4
|
+
*/
|
|
5
|
+
import * as z from "zod/v4";
|
|
6
|
+
import { safeParse } from "../lib/schemas.js";
|
|
7
|
+
import { discriminatedUnion } from "../types/discriminatedUnion.js";
|
|
8
|
+
import { AnthropicFile$inboundSchema } from "./anthropicfile.js";
|
|
9
|
+
import { OpenAIFile$inboundSchema } from "./openaifile.js";
|
|
10
|
+
import { OpenRouterFile$inboundSchema, } from "./openrouterfile.js";
|
|
11
|
+
/** @internal */
|
|
12
|
+
export const FileResponse$inboundSchema = discriminatedUnion("_shape", {
|
|
13
|
+
anthropic: AnthropicFile$inboundSchema.and(z.object({ _shape: z.literal("anthropic") }).transform((v) => ({
|
|
14
|
+
shape: v._shape,
|
|
15
|
+
}))),
|
|
16
|
+
openai: OpenAIFile$inboundSchema.and(z.object({ _shape: z.literal("openai") }).transform((v) => ({
|
|
17
|
+
shape: v._shape,
|
|
18
|
+
}))),
|
|
19
|
+
openrouter: OpenRouterFile$inboundSchema.and(z.object({ _shape: z.literal("openrouter") }).transform((v) => ({
|
|
20
|
+
shape: v._shape,
|
|
21
|
+
}))),
|
|
22
|
+
}, { outputPropertyName: "shape" });
|
|
23
|
+
export function fileResponseFromJSON(jsonString) {
|
|
24
|
+
return safeParse(jsonString, (x) => FileResponse$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'FileResponse' from JSON`);
|
|
25
|
+
}
|
|
26
|
+
//# sourceMappingURL=fileresponse.js.map
|