@openrouter/sdk 1.2.54 → 1.2.55
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/containersDownloadContainerFileContent.d.ts +18 -0
- package/esm/funcs/containersDownloadContainerFileContent.js +107 -0
- package/esm/funcs/containersGetContainerFile.d.ts +19 -0
- package/esm/funcs/containersGetContainerFile.js +107 -0
- package/esm/funcs/containersListContainerFiles.d.ts +19 -0
- package/esm/funcs/containersListContainerFiles.js +108 -0
- package/esm/lib/config.d.ts +2 -2
- package/esm/lib/config.js +2 -2
- package/esm/models/containerfile.d.ts +53 -0
- package/esm/models/containerfile.js +40 -0
- package/esm/models/containerfilelistresponse.d.ts +25 -0
- package/esm/models/containerfilelistresponse.js +31 -0
- package/esm/models/index.d.ts +2 -0
- package/esm/models/index.js +2 -0
- package/esm/models/operations/downloadcontainerfilecontent.d.ts +63 -0
- package/esm/models/operations/downloadcontainerfilecontent.js +24 -0
- package/esm/models/operations/getcontainerfile.d.ts +63 -0
- package/esm/models/operations/getcontainerfile.js +24 -0
- package/esm/models/operations/index.d.ts +3 -0
- package/esm/models/operations/index.js +3 -0
- package/esm/models/operations/listcontainerfiles.d.ts +68 -0
- package/esm/models/operations/listcontainerfiles.js +24 -0
- package/esm/sdk/containers.d.ts +27 -0
- package/esm/sdk/containers.js +39 -0
- package/esm/sdk/sdk.d.ts +3 -0
- package/esm/sdk/sdk.js +4 -0
- package/jsr.json +1 -1
- package/package.json +4 -4
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { OpenRouterCore } from "../core.js";
|
|
2
|
+
import { RequestOptions } from "../lib/sdks.js";
|
|
3
|
+
import { ConnectionError, InvalidRequestError, RequestAbortedError, RequestTimeoutError, UnexpectedClientError } from "../models/errors/httpclienterrors.js";
|
|
4
|
+
import * as errors from "../models/errors/index.js";
|
|
5
|
+
import { OpenRouterError } from "../models/errors/openroutererror.js";
|
|
6
|
+
import { ResponseValidationError } from "../models/errors/responsevalidationerror.js";
|
|
7
|
+
import { SDKValidationError } from "../models/errors/sdkvalidationerror.js";
|
|
8
|
+
import * as operations from "../models/operations/index.js";
|
|
9
|
+
import { APIPromise } from "../types/async.js";
|
|
10
|
+
import { Result } from "../types/fp.js";
|
|
11
|
+
/**
|
|
12
|
+
* Download container file content
|
|
13
|
+
*
|
|
14
|
+
* @remarks
|
|
15
|
+
* Streams the raw bytes of a file under a sandbox session prefix.
|
|
16
|
+
*/
|
|
17
|
+
export declare function containersDownloadContainerFileContent(client: OpenRouterCore, request: operations.DownloadContainerFileContentRequest, options?: RequestOptions): APIPromise<Result<ReadableStream<Uint8Array>, errors.BadRequestResponseError | errors.UnauthorizedResponseError | errors.ForbiddenResponseError | errors.NotFoundResponseError | errors.TooManyRequestsResponseError | errors.InternalServerResponseError | errors.ServiceUnavailableResponseError | OpenRouterError | ResponseValidationError | ConnectionError | RequestAbortedError | RequestTimeoutError | InvalidRequestError | UnexpectedClientError | SDKValidationError>>;
|
|
18
|
+
//# sourceMappingURL=containersDownloadContainerFileContent.d.ts.map
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
+
* @generated-id: 5c9b66d827d2
|
|
4
|
+
*/
|
|
5
|
+
import * as z from "zod/v4";
|
|
6
|
+
import { encodeSimple } from "../lib/encodings.js";
|
|
7
|
+
import { matchStatusCode } from "../lib/http.js";
|
|
8
|
+
import * as M from "../lib/matchers.js";
|
|
9
|
+
import { compactMap } from "../lib/primitives.js";
|
|
10
|
+
import { safeParse } from "../lib/schemas.js";
|
|
11
|
+
import { extractSecurity, resolveGlobalSecurity } from "../lib/security.js";
|
|
12
|
+
import { pathToFunc } from "../lib/url.js";
|
|
13
|
+
import * as errors from "../models/errors/index.js";
|
|
14
|
+
import * as operations from "../models/operations/index.js";
|
|
15
|
+
import { APIPromise } from "../types/async.js";
|
|
16
|
+
/**
|
|
17
|
+
* Download container file content
|
|
18
|
+
*
|
|
19
|
+
* @remarks
|
|
20
|
+
* Streams the raw bytes of a file under a sandbox session prefix.
|
|
21
|
+
*/
|
|
22
|
+
export function containersDownloadContainerFileContent(client, request, options) {
|
|
23
|
+
return new APIPromise($do(client, request, options));
|
|
24
|
+
}
|
|
25
|
+
async function $do(client, request, options) {
|
|
26
|
+
const parsed = safeParse(request, (value) => operations.DownloadContainerFileContentRequest$outboundSchema.parse(value), "Input validation failed");
|
|
27
|
+
if (!parsed.ok) {
|
|
28
|
+
return [parsed, { status: "invalid" }];
|
|
29
|
+
}
|
|
30
|
+
const payload = parsed.value;
|
|
31
|
+
const body = null;
|
|
32
|
+
const pathParams = {
|
|
33
|
+
file_id: encodeSimple("file_id", payload.file_id, {
|
|
34
|
+
explode: false,
|
|
35
|
+
charEncoding: "percent",
|
|
36
|
+
}),
|
|
37
|
+
session_id: encodeSimple("session_id", payload.session_id, {
|
|
38
|
+
explode: false,
|
|
39
|
+
charEncoding: "percent",
|
|
40
|
+
}),
|
|
41
|
+
};
|
|
42
|
+
const path = pathToFunc("/containers/{session_id}/files/{file_id}/content")(pathParams);
|
|
43
|
+
const headers = new Headers(compactMap({
|
|
44
|
+
Accept: "application/octet-stream",
|
|
45
|
+
"HTTP-Referer": encodeSimple("HTTP-Referer", payload["HTTP-Referer"] ?? client._options.httpReferer, { explode: false, charEncoding: "none" }),
|
|
46
|
+
"X-OpenRouter-Categories": encodeSimple("X-OpenRouter-Categories", payload.appCategories ?? client._options.appCategories, { explode: false, charEncoding: "none" }),
|
|
47
|
+
"X-OpenRouter-Title": encodeSimple("X-OpenRouter-Title", payload.appTitle ?? client._options.appTitle, { explode: false, charEncoding: "none" }),
|
|
48
|
+
}));
|
|
49
|
+
const secConfig = await extractSecurity(client._options.apiKey);
|
|
50
|
+
const securityInput = secConfig == null ? {} : { apiKey: secConfig };
|
|
51
|
+
const requestSecurity = resolveGlobalSecurity(securityInput);
|
|
52
|
+
const context = {
|
|
53
|
+
options: client._options,
|
|
54
|
+
baseURL: options?.serverURL ?? client._baseURL ?? "",
|
|
55
|
+
operationID: "downloadContainerFileContent",
|
|
56
|
+
oAuth2Scopes: null,
|
|
57
|
+
resolvedSecurity: requestSecurity,
|
|
58
|
+
securitySource: client._options.apiKey,
|
|
59
|
+
retryConfig: options?.retries
|
|
60
|
+
|| client._options.retryConfig
|
|
61
|
+
|| {
|
|
62
|
+
strategy: "backoff",
|
|
63
|
+
backoff: {
|
|
64
|
+
initialInterval: 500,
|
|
65
|
+
maxInterval: 60000,
|
|
66
|
+
exponent: 1.5,
|
|
67
|
+
maxElapsedTime: 3600000,
|
|
68
|
+
},
|
|
69
|
+
retryConnectionErrors: true,
|
|
70
|
+
}
|
|
71
|
+
|| { strategy: "none" },
|
|
72
|
+
retryCodes: options?.retryCodes || ["5XX"],
|
|
73
|
+
};
|
|
74
|
+
const requestRes = client._createRequest(context, {
|
|
75
|
+
security: requestSecurity,
|
|
76
|
+
method: "GET",
|
|
77
|
+
baseURL: options?.serverURL,
|
|
78
|
+
path: path,
|
|
79
|
+
headers: headers,
|
|
80
|
+
body: body,
|
|
81
|
+
userAgent: client._options.userAgent,
|
|
82
|
+
timeoutMs: options?.timeoutMs || client._options.timeoutMs || -1,
|
|
83
|
+
}, options);
|
|
84
|
+
if (!requestRes.ok) {
|
|
85
|
+
return [requestRes, { status: "invalid" }];
|
|
86
|
+
}
|
|
87
|
+
const req = requestRes.value;
|
|
88
|
+
const doResult = await client._do(req, {
|
|
89
|
+
context,
|
|
90
|
+
isErrorStatusCode: (statusCode) => matchStatusCode({ status: statusCode }, ["4XX", "5XX"]),
|
|
91
|
+
retryConfig: context.retryConfig,
|
|
92
|
+
retryCodes: context.retryCodes,
|
|
93
|
+
});
|
|
94
|
+
if (!doResult.ok) {
|
|
95
|
+
return [doResult, { status: "request-error", request: req }];
|
|
96
|
+
}
|
|
97
|
+
const response = doResult.value;
|
|
98
|
+
const responseFields = {
|
|
99
|
+
HttpMeta: { Response: response, Request: req },
|
|
100
|
+
};
|
|
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(403, errors.ForbiddenResponseError$inboundSchema), M.jsonErr(404, errors.NotFoundResponseError$inboundSchema), M.jsonErr(429, errors.TooManyRequestsResponseError$inboundSchema), M.jsonErr(500, errors.InternalServerResponseError$inboundSchema), M.jsonErr(503, errors.ServiceUnavailableResponseError$inboundSchema), M.fail("4XX"), M.fail("5XX"))(response, req, { extraFields: responseFields });
|
|
102
|
+
if (!result.ok) {
|
|
103
|
+
return [result, { status: "complete", request: req, response }];
|
|
104
|
+
}
|
|
105
|
+
return [result, { status: "complete", request: req, response }];
|
|
106
|
+
}
|
|
107
|
+
//# sourceMappingURL=containersDownloadContainerFileContent.js.map
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { OpenRouterCore } from "../core.js";
|
|
2
|
+
import { RequestOptions } from "../lib/sdks.js";
|
|
3
|
+
import { ConnectionError, InvalidRequestError, RequestAbortedError, RequestTimeoutError, UnexpectedClientError } from "../models/errors/httpclienterrors.js";
|
|
4
|
+
import * as errors from "../models/errors/index.js";
|
|
5
|
+
import { OpenRouterError } from "../models/errors/openroutererror.js";
|
|
6
|
+
import { ResponseValidationError } from "../models/errors/responsevalidationerror.js";
|
|
7
|
+
import { SDKValidationError } from "../models/errors/sdkvalidationerror.js";
|
|
8
|
+
import * as models from "../models/index.js";
|
|
9
|
+
import * as operations from "../models/operations/index.js";
|
|
10
|
+
import { APIPromise } from "../types/async.js";
|
|
11
|
+
import { Result } from "../types/fp.js";
|
|
12
|
+
/**
|
|
13
|
+
* Retrieve a container file
|
|
14
|
+
*
|
|
15
|
+
* @remarks
|
|
16
|
+
* Returns the metadata of a single file under a sandbox session prefix.
|
|
17
|
+
*/
|
|
18
|
+
export declare function containersGetContainerFile(client: OpenRouterCore, request: operations.GetContainerFileRequest, options?: RequestOptions): APIPromise<Result<models.ContainerFile, errors.BadRequestResponseError | errors.UnauthorizedResponseError | errors.ForbiddenResponseError | errors.NotFoundResponseError | errors.TooManyRequestsResponseError | errors.InternalServerResponseError | errors.ServiceUnavailableResponseError | OpenRouterError | ResponseValidationError | ConnectionError | RequestAbortedError | RequestTimeoutError | InvalidRequestError | UnexpectedClientError | SDKValidationError>>;
|
|
19
|
+
//# sourceMappingURL=containersGetContainerFile.d.ts.map
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
+
* @generated-id: 9450910db6e6
|
|
4
|
+
*/
|
|
5
|
+
import { encodeSimple } from "../lib/encodings.js";
|
|
6
|
+
import { matchStatusCode } from "../lib/http.js";
|
|
7
|
+
import * as M from "../lib/matchers.js";
|
|
8
|
+
import { compactMap } from "../lib/primitives.js";
|
|
9
|
+
import { safeParse } from "../lib/schemas.js";
|
|
10
|
+
import { extractSecurity, resolveGlobalSecurity } from "../lib/security.js";
|
|
11
|
+
import { pathToFunc } from "../lib/url.js";
|
|
12
|
+
import * as errors from "../models/errors/index.js";
|
|
13
|
+
import * as models from "../models/index.js";
|
|
14
|
+
import * as operations from "../models/operations/index.js";
|
|
15
|
+
import { APIPromise } from "../types/async.js";
|
|
16
|
+
/**
|
|
17
|
+
* Retrieve a container file
|
|
18
|
+
*
|
|
19
|
+
* @remarks
|
|
20
|
+
* Returns the metadata of a single file under a sandbox session prefix.
|
|
21
|
+
*/
|
|
22
|
+
export function containersGetContainerFile(client, request, options) {
|
|
23
|
+
return new APIPromise($do(client, request, options));
|
|
24
|
+
}
|
|
25
|
+
async function $do(client, request, options) {
|
|
26
|
+
const parsed = safeParse(request, (value) => operations.GetContainerFileRequest$outboundSchema.parse(value), "Input validation failed");
|
|
27
|
+
if (!parsed.ok) {
|
|
28
|
+
return [parsed, { status: "invalid" }];
|
|
29
|
+
}
|
|
30
|
+
const payload = parsed.value;
|
|
31
|
+
const body = null;
|
|
32
|
+
const pathParams = {
|
|
33
|
+
file_id: encodeSimple("file_id", payload.file_id, {
|
|
34
|
+
explode: false,
|
|
35
|
+
charEncoding: "percent",
|
|
36
|
+
}),
|
|
37
|
+
session_id: encodeSimple("session_id", payload.session_id, {
|
|
38
|
+
explode: false,
|
|
39
|
+
charEncoding: "percent",
|
|
40
|
+
}),
|
|
41
|
+
};
|
|
42
|
+
const path = pathToFunc("/containers/{session_id}/files/{file_id}")(pathParams);
|
|
43
|
+
const headers = new Headers(compactMap({
|
|
44
|
+
Accept: "application/json",
|
|
45
|
+
"HTTP-Referer": encodeSimple("HTTP-Referer", payload["HTTP-Referer"] ?? client._options.httpReferer, { explode: false, charEncoding: "none" }),
|
|
46
|
+
"X-OpenRouter-Categories": encodeSimple("X-OpenRouter-Categories", payload.appCategories ?? client._options.appCategories, { explode: false, charEncoding: "none" }),
|
|
47
|
+
"X-OpenRouter-Title": encodeSimple("X-OpenRouter-Title", payload.appTitle ?? client._options.appTitle, { explode: false, charEncoding: "none" }),
|
|
48
|
+
}));
|
|
49
|
+
const secConfig = await extractSecurity(client._options.apiKey);
|
|
50
|
+
const securityInput = secConfig == null ? {} : { apiKey: secConfig };
|
|
51
|
+
const requestSecurity = resolveGlobalSecurity(securityInput);
|
|
52
|
+
const context = {
|
|
53
|
+
options: client._options,
|
|
54
|
+
baseURL: options?.serverURL ?? client._baseURL ?? "",
|
|
55
|
+
operationID: "getContainerFile",
|
|
56
|
+
oAuth2Scopes: null,
|
|
57
|
+
resolvedSecurity: requestSecurity,
|
|
58
|
+
securitySource: client._options.apiKey,
|
|
59
|
+
retryConfig: options?.retries
|
|
60
|
+
|| client._options.retryConfig
|
|
61
|
+
|| {
|
|
62
|
+
strategy: "backoff",
|
|
63
|
+
backoff: {
|
|
64
|
+
initialInterval: 500,
|
|
65
|
+
maxInterval: 60000,
|
|
66
|
+
exponent: 1.5,
|
|
67
|
+
maxElapsedTime: 3600000,
|
|
68
|
+
},
|
|
69
|
+
retryConnectionErrors: true,
|
|
70
|
+
}
|
|
71
|
+
|| { strategy: "none" },
|
|
72
|
+
retryCodes: options?.retryCodes || ["5XX"],
|
|
73
|
+
};
|
|
74
|
+
const requestRes = client._createRequest(context, {
|
|
75
|
+
security: requestSecurity,
|
|
76
|
+
method: "GET",
|
|
77
|
+
baseURL: options?.serverURL,
|
|
78
|
+
path: path,
|
|
79
|
+
headers: headers,
|
|
80
|
+
body: body,
|
|
81
|
+
userAgent: client._options.userAgent,
|
|
82
|
+
timeoutMs: options?.timeoutMs || client._options.timeoutMs || -1,
|
|
83
|
+
}, options);
|
|
84
|
+
if (!requestRes.ok) {
|
|
85
|
+
return [requestRes, { status: "invalid" }];
|
|
86
|
+
}
|
|
87
|
+
const req = requestRes.value;
|
|
88
|
+
const doResult = await client._do(req, {
|
|
89
|
+
context,
|
|
90
|
+
isErrorStatusCode: (statusCode) => matchStatusCode({ status: statusCode }, ["4XX", "5XX"]),
|
|
91
|
+
retryConfig: context.retryConfig,
|
|
92
|
+
retryCodes: context.retryCodes,
|
|
93
|
+
});
|
|
94
|
+
if (!doResult.ok) {
|
|
95
|
+
return [doResult, { status: "request-error", request: req }];
|
|
96
|
+
}
|
|
97
|
+
const response = doResult.value;
|
|
98
|
+
const responseFields = {
|
|
99
|
+
HttpMeta: { Response: response, Request: req },
|
|
100
|
+
};
|
|
101
|
+
const [result] = await M.match(M.json(200, models.ContainerFile$inboundSchema), 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(503, errors.ServiceUnavailableResponseError$inboundSchema), M.fail("4XX"), M.fail("5XX"))(response, req, { extraFields: responseFields });
|
|
102
|
+
if (!result.ok) {
|
|
103
|
+
return [result, { status: "complete", request: req, response }];
|
|
104
|
+
}
|
|
105
|
+
return [result, { status: "complete", request: req, response }];
|
|
106
|
+
}
|
|
107
|
+
//# sourceMappingURL=containersGetContainerFile.js.map
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { OpenRouterCore } from "../core.js";
|
|
2
|
+
import { RequestOptions } from "../lib/sdks.js";
|
|
3
|
+
import { ConnectionError, InvalidRequestError, RequestAbortedError, RequestTimeoutError, UnexpectedClientError } from "../models/errors/httpclienterrors.js";
|
|
4
|
+
import * as errors from "../models/errors/index.js";
|
|
5
|
+
import { OpenRouterError } from "../models/errors/openroutererror.js";
|
|
6
|
+
import { ResponseValidationError } from "../models/errors/responsevalidationerror.js";
|
|
7
|
+
import { SDKValidationError } from "../models/errors/sdkvalidationerror.js";
|
|
8
|
+
import * as models from "../models/index.js";
|
|
9
|
+
import * as operations from "../models/operations/index.js";
|
|
10
|
+
import { APIPromise } from "../types/async.js";
|
|
11
|
+
import { Result } from "../types/fp.js";
|
|
12
|
+
/**
|
|
13
|
+
* List container files
|
|
14
|
+
*
|
|
15
|
+
* @remarks
|
|
16
|
+
* Lists the files under a sandbox session prefix, in lexicographic path order. A restarted session is a separate container with its own session id. Paginate with `limit` and `after` (pass the previous page’s `last_id`); `has_more: true` always means the next page is fetchable that way.
|
|
17
|
+
*/
|
|
18
|
+
export declare function containersListContainerFiles(client: OpenRouterCore, request: operations.ListContainerFilesRequest, options?: RequestOptions): APIPromise<Result<models.ContainerFileListResponse, errors.BadRequestResponseError | errors.UnauthorizedResponseError | errors.ForbiddenResponseError | errors.TooManyRequestsResponseError | errors.InternalServerResponseError | errors.ServiceUnavailableResponseError | OpenRouterError | ResponseValidationError | ConnectionError | RequestAbortedError | RequestTimeoutError | InvalidRequestError | UnexpectedClientError | SDKValidationError>>;
|
|
19
|
+
//# sourceMappingURL=containersListContainerFiles.d.ts.map
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
+
* @generated-id: a5b09a82f065
|
|
4
|
+
*/
|
|
5
|
+
import { encodeFormQuery, encodeSimple } from "../lib/encodings.js";
|
|
6
|
+
import { matchStatusCode } from "../lib/http.js";
|
|
7
|
+
import * as M from "../lib/matchers.js";
|
|
8
|
+
import { compactMap } from "../lib/primitives.js";
|
|
9
|
+
import { safeParse } from "../lib/schemas.js";
|
|
10
|
+
import { extractSecurity, resolveGlobalSecurity } from "../lib/security.js";
|
|
11
|
+
import { pathToFunc } from "../lib/url.js";
|
|
12
|
+
import * as errors from "../models/errors/index.js";
|
|
13
|
+
import * as models from "../models/index.js";
|
|
14
|
+
import * as operations from "../models/operations/index.js";
|
|
15
|
+
import { APIPromise } from "../types/async.js";
|
|
16
|
+
/**
|
|
17
|
+
* List container files
|
|
18
|
+
*
|
|
19
|
+
* @remarks
|
|
20
|
+
* Lists the files under a sandbox session prefix, in lexicographic path order. A restarted session is a separate container with its own session id. Paginate with `limit` and `after` (pass the previous page’s `last_id`); `has_more: true` always means the next page is fetchable that way.
|
|
21
|
+
*/
|
|
22
|
+
export function containersListContainerFiles(client, request, options) {
|
|
23
|
+
return new APIPromise($do(client, request, options));
|
|
24
|
+
}
|
|
25
|
+
async function $do(client, request, options) {
|
|
26
|
+
const parsed = safeParse(request, (value) => operations.ListContainerFilesRequest$outboundSchema.parse(value), "Input validation failed");
|
|
27
|
+
if (!parsed.ok) {
|
|
28
|
+
return [parsed, { status: "invalid" }];
|
|
29
|
+
}
|
|
30
|
+
const payload = parsed.value;
|
|
31
|
+
const body = null;
|
|
32
|
+
const pathParams = {
|
|
33
|
+
session_id: encodeSimple("session_id", payload.session_id, {
|
|
34
|
+
explode: false,
|
|
35
|
+
charEncoding: "percent",
|
|
36
|
+
}),
|
|
37
|
+
};
|
|
38
|
+
const path = pathToFunc("/containers/{session_id}/files")(pathParams);
|
|
39
|
+
const query = encodeFormQuery({
|
|
40
|
+
"after": payload.after,
|
|
41
|
+
"limit": payload.limit,
|
|
42
|
+
});
|
|
43
|
+
const headers = new Headers(compactMap({
|
|
44
|
+
Accept: "application/json",
|
|
45
|
+
"HTTP-Referer": encodeSimple("HTTP-Referer", payload["HTTP-Referer"] ?? client._options.httpReferer, { explode: false, charEncoding: "none" }),
|
|
46
|
+
"X-OpenRouter-Categories": encodeSimple("X-OpenRouter-Categories", payload.appCategories ?? client._options.appCategories, { explode: false, charEncoding: "none" }),
|
|
47
|
+
"X-OpenRouter-Title": encodeSimple("X-OpenRouter-Title", payload.appTitle ?? client._options.appTitle, { explode: false, charEncoding: "none" }),
|
|
48
|
+
}));
|
|
49
|
+
const secConfig = await extractSecurity(client._options.apiKey);
|
|
50
|
+
const securityInput = secConfig == null ? {} : { apiKey: secConfig };
|
|
51
|
+
const requestSecurity = resolveGlobalSecurity(securityInput);
|
|
52
|
+
const context = {
|
|
53
|
+
options: client._options,
|
|
54
|
+
baseURL: options?.serverURL ?? client._baseURL ?? "",
|
|
55
|
+
operationID: "listContainerFiles",
|
|
56
|
+
oAuth2Scopes: null,
|
|
57
|
+
resolvedSecurity: requestSecurity,
|
|
58
|
+
securitySource: client._options.apiKey,
|
|
59
|
+
retryConfig: options?.retries
|
|
60
|
+
|| client._options.retryConfig
|
|
61
|
+
|| {
|
|
62
|
+
strategy: "backoff",
|
|
63
|
+
backoff: {
|
|
64
|
+
initialInterval: 500,
|
|
65
|
+
maxInterval: 60000,
|
|
66
|
+
exponent: 1.5,
|
|
67
|
+
maxElapsedTime: 3600000,
|
|
68
|
+
},
|
|
69
|
+
retryConnectionErrors: true,
|
|
70
|
+
}
|
|
71
|
+
|| { strategy: "none" },
|
|
72
|
+
retryCodes: options?.retryCodes || ["5XX"],
|
|
73
|
+
};
|
|
74
|
+
const requestRes = client._createRequest(context, {
|
|
75
|
+
security: requestSecurity,
|
|
76
|
+
method: "GET",
|
|
77
|
+
baseURL: options?.serverURL,
|
|
78
|
+
path: path,
|
|
79
|
+
headers: headers,
|
|
80
|
+
query: query,
|
|
81
|
+
body: body,
|
|
82
|
+
userAgent: client._options.userAgent,
|
|
83
|
+
timeoutMs: options?.timeoutMs || client._options.timeoutMs || -1,
|
|
84
|
+
}, options);
|
|
85
|
+
if (!requestRes.ok) {
|
|
86
|
+
return [requestRes, { status: "invalid" }];
|
|
87
|
+
}
|
|
88
|
+
const req = requestRes.value;
|
|
89
|
+
const doResult = await client._do(req, {
|
|
90
|
+
context,
|
|
91
|
+
isErrorStatusCode: (statusCode) => matchStatusCode({ status: statusCode }, ["4XX", "5XX"]),
|
|
92
|
+
retryConfig: context.retryConfig,
|
|
93
|
+
retryCodes: context.retryCodes,
|
|
94
|
+
});
|
|
95
|
+
if (!doResult.ok) {
|
|
96
|
+
return [doResult, { status: "request-error", request: req }];
|
|
97
|
+
}
|
|
98
|
+
const response = doResult.value;
|
|
99
|
+
const responseFields = {
|
|
100
|
+
HttpMeta: { Response: response, Request: req },
|
|
101
|
+
};
|
|
102
|
+
const [result] = await M.match(M.json(200, models.ContainerFileListResponse$inboundSchema), 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(503, errors.ServiceUnavailableResponseError$inboundSchema), M.fail("4XX"), M.fail("5XX"))(response, req, { extraFields: responseFields });
|
|
103
|
+
if (!result.ok) {
|
|
104
|
+
return [result, { status: "complete", request: req, response }];
|
|
105
|
+
}
|
|
106
|
+
return [result, { status: "complete", request: req, response }];
|
|
107
|
+
}
|
|
108
|
+
//# sourceMappingURL=containersListContainerFiles.js.map
|
package/esm/lib/config.d.ts
CHANGED
|
@@ -50,8 +50,8 @@ export declare function serverURLFromOptions(options: SDKOptions): URL | null;
|
|
|
50
50
|
export declare const SDK_METADATA: {
|
|
51
51
|
readonly language: "typescript";
|
|
52
52
|
readonly openapiDocVersion: "1.0.0";
|
|
53
|
-
readonly sdkVersion: "1.2.
|
|
53
|
+
readonly sdkVersion: "1.2.55";
|
|
54
54
|
readonly genVersion: "2.914.0";
|
|
55
|
-
readonly userAgent: "speakeasy-sdk/typescript 1.2.
|
|
55
|
+
readonly userAgent: "speakeasy-sdk/typescript 1.2.55 2.914.0 1.0.0 @openrouter/sdk";
|
|
56
56
|
};
|
|
57
57
|
//# sourceMappingURL=config.d.ts.map
|
package/esm/lib/config.js
CHANGED
|
@@ -29,8 +29,8 @@ export function serverURLFromOptions(options) {
|
|
|
29
29
|
export const SDK_METADATA = {
|
|
30
30
|
language: "typescript",
|
|
31
31
|
openapiDocVersion: "1.0.0",
|
|
32
|
-
sdkVersion: "1.2.
|
|
32
|
+
sdkVersion: "1.2.55",
|
|
33
33
|
genVersion: "2.914.0",
|
|
34
|
-
userAgent: "speakeasy-sdk/typescript 1.2.
|
|
34
|
+
userAgent: "speakeasy-sdk/typescript 1.2.55 2.914.0 1.0.0 @openrouter/sdk",
|
|
35
35
|
};
|
|
36
36
|
//# sourceMappingURL=config.js.map
|
|
@@ -0,0 +1,53 @@
|
|
|
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 ContainerFileObject: {
|
|
6
|
+
readonly ContainerFile: "container.file";
|
|
7
|
+
};
|
|
8
|
+
export type ContainerFileObject = ClosedEnum<typeof ContainerFileObject>;
|
|
9
|
+
/**
|
|
10
|
+
* Container files are always produced by the assistant sandbox.
|
|
11
|
+
*/
|
|
12
|
+
export declare const ContainerFileSource: {
|
|
13
|
+
readonly Assistant: "assistant";
|
|
14
|
+
};
|
|
15
|
+
/**
|
|
16
|
+
* Container files are always produced by the assistant sandbox.
|
|
17
|
+
*/
|
|
18
|
+
export type ContainerFileSource = ClosedEnum<typeof ContainerFileSource>;
|
|
19
|
+
export type ContainerFile = {
|
|
20
|
+
/**
|
|
21
|
+
* File size in bytes.
|
|
22
|
+
*/
|
|
23
|
+
bytes: number;
|
|
24
|
+
/**
|
|
25
|
+
* The container the file belongs to — echoes the `session_id` path parameter (OpenAI field name).
|
|
26
|
+
*/
|
|
27
|
+
containerId: string;
|
|
28
|
+
/**
|
|
29
|
+
* Unix timestamp (seconds) when the file was last synced.
|
|
30
|
+
*/
|
|
31
|
+
createdAt: number;
|
|
32
|
+
/**
|
|
33
|
+
* Container file id: `cfile_` + base64url of the file path.
|
|
34
|
+
*/
|
|
35
|
+
id: string;
|
|
36
|
+
object: ContainerFileObject;
|
|
37
|
+
/**
|
|
38
|
+
* Session-relative file path inside the container.
|
|
39
|
+
*/
|
|
40
|
+
path: string;
|
|
41
|
+
/**
|
|
42
|
+
* Container files are always produced by the assistant sandbox.
|
|
43
|
+
*/
|
|
44
|
+
source: ContainerFileSource;
|
|
45
|
+
};
|
|
46
|
+
/** @internal */
|
|
47
|
+
export declare const ContainerFileObject$inboundSchema: z.ZodEnum<typeof ContainerFileObject>;
|
|
48
|
+
/** @internal */
|
|
49
|
+
export declare const ContainerFileSource$inboundSchema: z.ZodEnum<typeof ContainerFileSource>;
|
|
50
|
+
/** @internal */
|
|
51
|
+
export declare const ContainerFile$inboundSchema: z.ZodType<ContainerFile, unknown>;
|
|
52
|
+
export declare function containerFileFromJSON(jsonString: string): SafeParseResult<ContainerFile, SDKValidationError>;
|
|
53
|
+
//# sourceMappingURL=containerfile.d.ts.map
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
+
* @generated-id: ece4a8ddc017
|
|
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 ContainerFileObject = {
|
|
9
|
+
ContainerFile: "container.file",
|
|
10
|
+
};
|
|
11
|
+
/**
|
|
12
|
+
* Container files are always produced by the assistant sandbox.
|
|
13
|
+
*/
|
|
14
|
+
export const ContainerFileSource = {
|
|
15
|
+
Assistant: "assistant",
|
|
16
|
+
};
|
|
17
|
+
/** @internal */
|
|
18
|
+
export const ContainerFileObject$inboundSchema = z.enum(ContainerFileObject);
|
|
19
|
+
/** @internal */
|
|
20
|
+
export const ContainerFileSource$inboundSchema = z.enum(ContainerFileSource);
|
|
21
|
+
/** @internal */
|
|
22
|
+
export const ContainerFile$inboundSchema = z
|
|
23
|
+
.object({
|
|
24
|
+
bytes: z.int(),
|
|
25
|
+
container_id: z.string(),
|
|
26
|
+
created_at: z.int(),
|
|
27
|
+
id: z.string(),
|
|
28
|
+
object: ContainerFileObject$inboundSchema,
|
|
29
|
+
path: z.string(),
|
|
30
|
+
source: ContainerFileSource$inboundSchema,
|
|
31
|
+
}).transform((v) => {
|
|
32
|
+
return remap$(v, {
|
|
33
|
+
"container_id": "containerId",
|
|
34
|
+
"created_at": "createdAt",
|
|
35
|
+
});
|
|
36
|
+
});
|
|
37
|
+
export function containerFileFromJSON(jsonString) {
|
|
38
|
+
return safeParse(jsonString, (x) => ContainerFile$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'ContainerFile' from JSON`);
|
|
39
|
+
}
|
|
40
|
+
//# sourceMappingURL=containerfile.js.map
|
|
@@ -0,0 +1,25 @@
|
|
|
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 { ContainerFile } from "./containerfile.js";
|
|
5
|
+
import { SDKValidationError } from "./errors/sdkvalidationerror.js";
|
|
6
|
+
export declare const ContainerFileListResponseObject: {
|
|
7
|
+
readonly List: "list";
|
|
8
|
+
};
|
|
9
|
+
export type ContainerFileListResponseObject = ClosedEnum<typeof ContainerFileListResponseObject>;
|
|
10
|
+
export type ContainerFileListResponse = {
|
|
11
|
+
data: Array<ContainerFile>;
|
|
12
|
+
firstId: string | null;
|
|
13
|
+
/**
|
|
14
|
+
* True when another page can be fetched by passing `after=last_id`.
|
|
15
|
+
*/
|
|
16
|
+
hasMore: boolean;
|
|
17
|
+
lastId: string | null;
|
|
18
|
+
object: ContainerFileListResponseObject;
|
|
19
|
+
};
|
|
20
|
+
/** @internal */
|
|
21
|
+
export declare const ContainerFileListResponseObject$inboundSchema: z.ZodEnum<typeof ContainerFileListResponseObject>;
|
|
22
|
+
/** @internal */
|
|
23
|
+
export declare const ContainerFileListResponse$inboundSchema: z.ZodType<ContainerFileListResponse, unknown>;
|
|
24
|
+
export declare function containerFileListResponseFromJSON(jsonString: string): SafeParseResult<ContainerFileListResponse, SDKValidationError>;
|
|
25
|
+
//# sourceMappingURL=containerfilelistresponse.d.ts.map
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
+
* @generated-id: 74b945b6c8e1
|
|
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 { ContainerFile$inboundSchema } from "./containerfile.js";
|
|
9
|
+
export const ContainerFileListResponseObject = {
|
|
10
|
+
List: "list",
|
|
11
|
+
};
|
|
12
|
+
/** @internal */
|
|
13
|
+
export const ContainerFileListResponseObject$inboundSchema = z.enum(ContainerFileListResponseObject);
|
|
14
|
+
/** @internal */
|
|
15
|
+
export const ContainerFileListResponse$inboundSchema = z.object({
|
|
16
|
+
data: z.array(ContainerFile$inboundSchema),
|
|
17
|
+
first_id: z.nullable(z.string()),
|
|
18
|
+
has_more: z.boolean(),
|
|
19
|
+
last_id: z.nullable(z.string()),
|
|
20
|
+
object: ContainerFileListResponseObject$inboundSchema,
|
|
21
|
+
}).transform((v) => {
|
|
22
|
+
return remap$(v, {
|
|
23
|
+
"first_id": "firstId",
|
|
24
|
+
"has_more": "hasMore",
|
|
25
|
+
"last_id": "lastId",
|
|
26
|
+
});
|
|
27
|
+
});
|
|
28
|
+
export function containerFileListResponseFromJSON(jsonString) {
|
|
29
|
+
return safeParse(jsonString, (x) => ContainerFileListResponse$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'ContainerFileListResponse' from JSON`);
|
|
30
|
+
}
|
|
31
|
+
//# sourceMappingURL=containerfilelistresponse.js.map
|
package/esm/models/index.d.ts
CHANGED
|
@@ -148,6 +148,8 @@ export * from "./compoundfilter.js";
|
|
|
148
148
|
export * from "./computeruseservertool.js";
|
|
149
149
|
export * from "./conflictresponseerrordata.js";
|
|
150
150
|
export * from "./containerautoenvironment.js";
|
|
151
|
+
export * from "./containerfile.js";
|
|
152
|
+
export * from "./containerfilelistresponse.js";
|
|
151
153
|
export * from "./containerreferenceenvironment.js";
|
|
152
154
|
export * from "./contentfilteraction.js";
|
|
153
155
|
export * from "./contentfilterbuiltinaction.js";
|
package/esm/models/index.js
CHANGED
|
@@ -152,6 +152,8 @@ export * from "./compoundfilter.js";
|
|
|
152
152
|
export * from "./computeruseservertool.js";
|
|
153
153
|
export * from "./conflictresponseerrordata.js";
|
|
154
154
|
export * from "./containerautoenvironment.js";
|
|
155
|
+
export * from "./containerfile.js";
|
|
156
|
+
export * from "./containerfilelistresponse.js";
|
|
155
157
|
export * from "./containerreferenceenvironment.js";
|
|
156
158
|
export * from "./contentfilteraction.js";
|
|
157
159
|
export * from "./contentfilterbuiltinaction.js";
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import * as z from "zod/v4";
|
|
2
|
+
export type DownloadContainerFileContentGlobals = {
|
|
3
|
+
/**
|
|
4
|
+
* The app identifier should be your app's URL and is used as the primary identifier for rankings.
|
|
5
|
+
*
|
|
6
|
+
* @remarks
|
|
7
|
+
* This is used to track API usage per application.
|
|
8
|
+
*/
|
|
9
|
+
httpReferer?: string | undefined;
|
|
10
|
+
/**
|
|
11
|
+
* The app display name allows you to customize how your app appears in OpenRouter's dashboard.
|
|
12
|
+
*
|
|
13
|
+
* @remarks
|
|
14
|
+
*/
|
|
15
|
+
appTitle?: string | undefined;
|
|
16
|
+
/**
|
|
17
|
+
* Comma-separated list of app categories (e.g. "cli-agent,cloud-agent"). Used for marketplace rankings.
|
|
18
|
+
*
|
|
19
|
+
* @remarks
|
|
20
|
+
*/
|
|
21
|
+
appCategories?: string | undefined;
|
|
22
|
+
};
|
|
23
|
+
export type DownloadContainerFileContentRequest = {
|
|
24
|
+
/**
|
|
25
|
+
* The app identifier should be your app's URL and is used as the primary identifier for rankings.
|
|
26
|
+
*
|
|
27
|
+
* @remarks
|
|
28
|
+
* This is used to track API usage per application.
|
|
29
|
+
*/
|
|
30
|
+
httpReferer?: string | undefined;
|
|
31
|
+
/**
|
|
32
|
+
* The app display name allows you to customize how your app appears in OpenRouter's dashboard.
|
|
33
|
+
*
|
|
34
|
+
* @remarks
|
|
35
|
+
*/
|
|
36
|
+
appTitle?: string | undefined;
|
|
37
|
+
/**
|
|
38
|
+
* Comma-separated list of app categories (e.g. "cli-agent,cloud-agent"). Used for marketplace rankings.
|
|
39
|
+
*
|
|
40
|
+
* @remarks
|
|
41
|
+
*/
|
|
42
|
+
appCategories?: string | undefined;
|
|
43
|
+
/**
|
|
44
|
+
* The sandbox session id, exactly as stored — a restarted session has its own `-r<nonce>`-suffixed id.
|
|
45
|
+
*/
|
|
46
|
+
sessionId: string;
|
|
47
|
+
/**
|
|
48
|
+
* Container file id (`cfile_` + base64url of the file path).
|
|
49
|
+
*/
|
|
50
|
+
fileId: string;
|
|
51
|
+
};
|
|
52
|
+
/** @internal */
|
|
53
|
+
export type DownloadContainerFileContentRequest$Outbound = {
|
|
54
|
+
"HTTP-Referer"?: string | undefined;
|
|
55
|
+
appTitle?: string | undefined;
|
|
56
|
+
appCategories?: string | undefined;
|
|
57
|
+
session_id: string;
|
|
58
|
+
file_id: string;
|
|
59
|
+
};
|
|
60
|
+
/** @internal */
|
|
61
|
+
export declare const DownloadContainerFileContentRequest$outboundSchema: z.ZodType<DownloadContainerFileContentRequest$Outbound, DownloadContainerFileContentRequest>;
|
|
62
|
+
export declare function downloadContainerFileContentRequestToJSON(downloadContainerFileContentRequest: DownloadContainerFileContentRequest): string;
|
|
63
|
+
//# sourceMappingURL=downloadcontainerfilecontent.d.ts.map
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
+
* @generated-id: 0bc1bd778769
|
|
4
|
+
*/
|
|
5
|
+
import * as z from "zod/v4";
|
|
6
|
+
import { remap as remap$ } from "../../lib/primitives.js";
|
|
7
|
+
/** @internal */
|
|
8
|
+
export const DownloadContainerFileContentRequest$outboundSchema = z.object({
|
|
9
|
+
httpReferer: z.string().optional(),
|
|
10
|
+
appTitle: z.string().optional(),
|
|
11
|
+
appCategories: z.string().optional(),
|
|
12
|
+
sessionId: z.string(),
|
|
13
|
+
fileId: z.string(),
|
|
14
|
+
}).transform((v) => {
|
|
15
|
+
return remap$(v, {
|
|
16
|
+
httpReferer: "HTTP-Referer",
|
|
17
|
+
sessionId: "session_id",
|
|
18
|
+
fileId: "file_id",
|
|
19
|
+
});
|
|
20
|
+
});
|
|
21
|
+
export function downloadContainerFileContentRequestToJSON(downloadContainerFileContentRequest) {
|
|
22
|
+
return JSON.stringify(DownloadContainerFileContentRequest$outboundSchema.parse(downloadContainerFileContentRequest));
|
|
23
|
+
}
|
|
24
|
+
//# sourceMappingURL=downloadcontainerfilecontent.js.map
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import * as z from "zod/v4";
|
|
2
|
+
export type GetContainerFileGlobals = {
|
|
3
|
+
/**
|
|
4
|
+
* The app identifier should be your app's URL and is used as the primary identifier for rankings.
|
|
5
|
+
*
|
|
6
|
+
* @remarks
|
|
7
|
+
* This is used to track API usage per application.
|
|
8
|
+
*/
|
|
9
|
+
httpReferer?: string | undefined;
|
|
10
|
+
/**
|
|
11
|
+
* The app display name allows you to customize how your app appears in OpenRouter's dashboard.
|
|
12
|
+
*
|
|
13
|
+
* @remarks
|
|
14
|
+
*/
|
|
15
|
+
appTitle?: string | undefined;
|
|
16
|
+
/**
|
|
17
|
+
* Comma-separated list of app categories (e.g. "cli-agent,cloud-agent"). Used for marketplace rankings.
|
|
18
|
+
*
|
|
19
|
+
* @remarks
|
|
20
|
+
*/
|
|
21
|
+
appCategories?: string | undefined;
|
|
22
|
+
};
|
|
23
|
+
export type GetContainerFileRequest = {
|
|
24
|
+
/**
|
|
25
|
+
* The app identifier should be your app's URL and is used as the primary identifier for rankings.
|
|
26
|
+
*
|
|
27
|
+
* @remarks
|
|
28
|
+
* This is used to track API usage per application.
|
|
29
|
+
*/
|
|
30
|
+
httpReferer?: string | undefined;
|
|
31
|
+
/**
|
|
32
|
+
* The app display name allows you to customize how your app appears in OpenRouter's dashboard.
|
|
33
|
+
*
|
|
34
|
+
* @remarks
|
|
35
|
+
*/
|
|
36
|
+
appTitle?: string | undefined;
|
|
37
|
+
/**
|
|
38
|
+
* Comma-separated list of app categories (e.g. "cli-agent,cloud-agent"). Used for marketplace rankings.
|
|
39
|
+
*
|
|
40
|
+
* @remarks
|
|
41
|
+
*/
|
|
42
|
+
appCategories?: string | undefined;
|
|
43
|
+
/**
|
|
44
|
+
* The sandbox session id, exactly as stored — a restarted session has its own `-r<nonce>`-suffixed id.
|
|
45
|
+
*/
|
|
46
|
+
sessionId: string;
|
|
47
|
+
/**
|
|
48
|
+
* Container file id (`cfile_` + base64url of the file path).
|
|
49
|
+
*/
|
|
50
|
+
fileId: string;
|
|
51
|
+
};
|
|
52
|
+
/** @internal */
|
|
53
|
+
export type GetContainerFileRequest$Outbound = {
|
|
54
|
+
"HTTP-Referer"?: string | undefined;
|
|
55
|
+
appTitle?: string | undefined;
|
|
56
|
+
appCategories?: string | undefined;
|
|
57
|
+
session_id: string;
|
|
58
|
+
file_id: string;
|
|
59
|
+
};
|
|
60
|
+
/** @internal */
|
|
61
|
+
export declare const GetContainerFileRequest$outboundSchema: z.ZodType<GetContainerFileRequest$Outbound, GetContainerFileRequest>;
|
|
62
|
+
export declare function getContainerFileRequestToJSON(getContainerFileRequest: GetContainerFileRequest): string;
|
|
63
|
+
//# sourceMappingURL=getcontainerfile.d.ts.map
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
+
* @generated-id: 2fb4120bb6ff
|
|
4
|
+
*/
|
|
5
|
+
import * as z from "zod/v4";
|
|
6
|
+
import { remap as remap$ } from "../../lib/primitives.js";
|
|
7
|
+
/** @internal */
|
|
8
|
+
export const GetContainerFileRequest$outboundSchema = z.object({
|
|
9
|
+
httpReferer: z.string().optional(),
|
|
10
|
+
appTitle: z.string().optional(),
|
|
11
|
+
appCategories: z.string().optional(),
|
|
12
|
+
sessionId: z.string(),
|
|
13
|
+
fileId: z.string(),
|
|
14
|
+
}).transform((v) => {
|
|
15
|
+
return remap$(v, {
|
|
16
|
+
httpReferer: "HTTP-Referer",
|
|
17
|
+
sessionId: "session_id",
|
|
18
|
+
fileId: "file_id",
|
|
19
|
+
});
|
|
20
|
+
});
|
|
21
|
+
export function getContainerFileRequestToJSON(getContainerFileRequest) {
|
|
22
|
+
return JSON.stringify(GetContainerFileRequest$outboundSchema.parse(getContainerFileRequest));
|
|
23
|
+
}
|
|
24
|
+
//# sourceMappingURL=getcontainerfile.js.map
|
|
@@ -30,12 +30,14 @@ export * from "./deleteobservabilitydestination.js";
|
|
|
30
30
|
export * from "./deletescimgroupmapping.js";
|
|
31
31
|
export * from "./deleteworkspace.js";
|
|
32
32
|
export * from "./deleteworkspacebudget.js";
|
|
33
|
+
export * from "./downloadcontainerfilecontent.js";
|
|
33
34
|
export * from "./downloadfilecontent.js";
|
|
34
35
|
export * from "./exchangeauthcodeforapikey.js";
|
|
35
36
|
export * from "./getanalyticsmeta.js";
|
|
36
37
|
export * from "./getapprankings.js";
|
|
37
38
|
export * from "./getbenchmarks.js";
|
|
38
39
|
export * from "./getbyokkey.js";
|
|
40
|
+
export * from "./getcontainerfile.js";
|
|
39
41
|
export * from "./getcredits.js";
|
|
40
42
|
export * from "./getcurrentkey.js";
|
|
41
43
|
export * from "./getfilemetadata.js";
|
|
@@ -57,6 +59,7 @@ export * from "./getworkspace.js";
|
|
|
57
59
|
export * from "./getworkspacebudget.js";
|
|
58
60
|
export * from "./list.js";
|
|
59
61
|
export * from "./listbyokkeys.js";
|
|
62
|
+
export * from "./listcontainerfiles.js";
|
|
60
63
|
export * from "./listembeddingsmodels.js";
|
|
61
64
|
export * from "./listendpoints.js";
|
|
62
65
|
export * from "./listendpointszdr.js";
|
|
@@ -34,12 +34,14 @@ export * from "./deleteobservabilitydestination.js";
|
|
|
34
34
|
export * from "./deletescimgroupmapping.js";
|
|
35
35
|
export * from "./deleteworkspace.js";
|
|
36
36
|
export * from "./deleteworkspacebudget.js";
|
|
37
|
+
export * from "./downloadcontainerfilecontent.js";
|
|
37
38
|
export * from "./downloadfilecontent.js";
|
|
38
39
|
export * from "./exchangeauthcodeforapikey.js";
|
|
39
40
|
export * from "./getanalyticsmeta.js";
|
|
40
41
|
export * from "./getapprankings.js";
|
|
41
42
|
export * from "./getbenchmarks.js";
|
|
42
43
|
export * from "./getbyokkey.js";
|
|
44
|
+
export * from "./getcontainerfile.js";
|
|
43
45
|
export * from "./getcredits.js";
|
|
44
46
|
export * from "./getcurrentkey.js";
|
|
45
47
|
export * from "./getfilemetadata.js";
|
|
@@ -61,6 +63,7 @@ export * from "./getworkspace.js";
|
|
|
61
63
|
export * from "./getworkspacebudget.js";
|
|
62
64
|
export * from "./list.js";
|
|
63
65
|
export * from "./listbyokkeys.js";
|
|
66
|
+
export * from "./listcontainerfiles.js";
|
|
64
67
|
export * from "./listembeddingsmodels.js";
|
|
65
68
|
export * from "./listendpoints.js";
|
|
66
69
|
export * from "./listendpointszdr.js";
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import * as z from "zod/v4";
|
|
2
|
+
export type ListContainerFilesGlobals = {
|
|
3
|
+
/**
|
|
4
|
+
* The app identifier should be your app's URL and is used as the primary identifier for rankings.
|
|
5
|
+
*
|
|
6
|
+
* @remarks
|
|
7
|
+
* This is used to track API usage per application.
|
|
8
|
+
*/
|
|
9
|
+
httpReferer?: string | undefined;
|
|
10
|
+
/**
|
|
11
|
+
* The app display name allows you to customize how your app appears in OpenRouter's dashboard.
|
|
12
|
+
*
|
|
13
|
+
* @remarks
|
|
14
|
+
*/
|
|
15
|
+
appTitle?: string | undefined;
|
|
16
|
+
/**
|
|
17
|
+
* Comma-separated list of app categories (e.g. "cli-agent,cloud-agent"). Used for marketplace rankings.
|
|
18
|
+
*
|
|
19
|
+
* @remarks
|
|
20
|
+
*/
|
|
21
|
+
appCategories?: string | undefined;
|
|
22
|
+
};
|
|
23
|
+
export type ListContainerFilesRequest = {
|
|
24
|
+
/**
|
|
25
|
+
* The app identifier should be your app's URL and is used as the primary identifier for rankings.
|
|
26
|
+
*
|
|
27
|
+
* @remarks
|
|
28
|
+
* This is used to track API usage per application.
|
|
29
|
+
*/
|
|
30
|
+
httpReferer?: string | undefined;
|
|
31
|
+
/**
|
|
32
|
+
* The app display name allows you to customize how your app appears in OpenRouter's dashboard.
|
|
33
|
+
*
|
|
34
|
+
* @remarks
|
|
35
|
+
*/
|
|
36
|
+
appTitle?: string | undefined;
|
|
37
|
+
/**
|
|
38
|
+
* Comma-separated list of app categories (e.g. "cli-agent,cloud-agent"). Used for marketplace rankings.
|
|
39
|
+
*
|
|
40
|
+
* @remarks
|
|
41
|
+
*/
|
|
42
|
+
appCategories?: string | undefined;
|
|
43
|
+
/**
|
|
44
|
+
* The sandbox session id, exactly as stored — a restarted session has its own `-r<nonce>`-suffixed id.
|
|
45
|
+
*/
|
|
46
|
+
sessionId: string;
|
|
47
|
+
/**
|
|
48
|
+
* Maximum number of files to return (1-1000). Defaults to 100 when absent.
|
|
49
|
+
*/
|
|
50
|
+
limit?: number | undefined;
|
|
51
|
+
/**
|
|
52
|
+
* Forward cursor: a container file id from a previous page (typically `last_id`); listing resumes strictly after that file.
|
|
53
|
+
*/
|
|
54
|
+
after?: string | undefined;
|
|
55
|
+
};
|
|
56
|
+
/** @internal */
|
|
57
|
+
export type ListContainerFilesRequest$Outbound = {
|
|
58
|
+
"HTTP-Referer"?: string | undefined;
|
|
59
|
+
appTitle?: string | undefined;
|
|
60
|
+
appCategories?: string | undefined;
|
|
61
|
+
session_id: string;
|
|
62
|
+
limit: number;
|
|
63
|
+
after?: string | undefined;
|
|
64
|
+
};
|
|
65
|
+
/** @internal */
|
|
66
|
+
export declare const ListContainerFilesRequest$outboundSchema: z.ZodType<ListContainerFilesRequest$Outbound, ListContainerFilesRequest>;
|
|
67
|
+
export declare function listContainerFilesRequestToJSON(listContainerFilesRequest: ListContainerFilesRequest): string;
|
|
68
|
+
//# sourceMappingURL=listcontainerfiles.d.ts.map
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
+
* @generated-id: 833ac1772f55
|
|
4
|
+
*/
|
|
5
|
+
import * as z from "zod/v4";
|
|
6
|
+
import { remap as remap$ } from "../../lib/primitives.js";
|
|
7
|
+
/** @internal */
|
|
8
|
+
export const ListContainerFilesRequest$outboundSchema = z.object({
|
|
9
|
+
httpReferer: z.string().optional(),
|
|
10
|
+
appTitle: z.string().optional(),
|
|
11
|
+
appCategories: z.string().optional(),
|
|
12
|
+
sessionId: z.string(),
|
|
13
|
+
limit: z.int().default(100),
|
|
14
|
+
after: z.string().optional(),
|
|
15
|
+
}).transform((v) => {
|
|
16
|
+
return remap$(v, {
|
|
17
|
+
httpReferer: "HTTP-Referer",
|
|
18
|
+
sessionId: "session_id",
|
|
19
|
+
});
|
|
20
|
+
});
|
|
21
|
+
export function listContainerFilesRequestToJSON(listContainerFilesRequest) {
|
|
22
|
+
return JSON.stringify(ListContainerFilesRequest$outboundSchema.parse(listContainerFilesRequest));
|
|
23
|
+
}
|
|
24
|
+
//# sourceMappingURL=listcontainerfiles.js.map
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { ClientSDK, RequestOptions } from "../lib/sdks.js";
|
|
2
|
+
import * as models from "../models/index.js";
|
|
3
|
+
import * as operations from "../models/operations/index.js";
|
|
4
|
+
export declare class Containers extends ClientSDK {
|
|
5
|
+
/**
|
|
6
|
+
* List container files
|
|
7
|
+
*
|
|
8
|
+
* @remarks
|
|
9
|
+
* Lists the files under a sandbox session prefix, in lexicographic path order. A restarted session is a separate container with its own session id. Paginate with `limit` and `after` (pass the previous page’s `last_id`); `has_more: true` always means the next page is fetchable that way.
|
|
10
|
+
*/
|
|
11
|
+
listContainerFiles(request: operations.ListContainerFilesRequest, options?: RequestOptions): Promise<models.ContainerFileListResponse>;
|
|
12
|
+
/**
|
|
13
|
+
* Retrieve a container file
|
|
14
|
+
*
|
|
15
|
+
* @remarks
|
|
16
|
+
* Returns the metadata of a single file under a sandbox session prefix.
|
|
17
|
+
*/
|
|
18
|
+
getContainerFile(request: operations.GetContainerFileRequest, options?: RequestOptions): Promise<models.ContainerFile>;
|
|
19
|
+
/**
|
|
20
|
+
* Download container file content
|
|
21
|
+
*
|
|
22
|
+
* @remarks
|
|
23
|
+
* Streams the raw bytes of a file under a sandbox session prefix.
|
|
24
|
+
*/
|
|
25
|
+
downloadContainerFileContent(request: operations.DownloadContainerFileContentRequest, options?: RequestOptions): Promise<ReadableStream<Uint8Array>>;
|
|
26
|
+
}
|
|
27
|
+
//# sourceMappingURL=containers.d.ts.map
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
+
* @generated-id: f772470024e6
|
|
4
|
+
*/
|
|
5
|
+
import { containersDownloadContainerFileContent } from "../funcs/containersDownloadContainerFileContent.js";
|
|
6
|
+
import { containersGetContainerFile } from "../funcs/containersGetContainerFile.js";
|
|
7
|
+
import { containersListContainerFiles } from "../funcs/containersListContainerFiles.js";
|
|
8
|
+
import { ClientSDK } from "../lib/sdks.js";
|
|
9
|
+
import { unwrapAsync } from "../types/fp.js";
|
|
10
|
+
export class Containers extends ClientSDK {
|
|
11
|
+
/**
|
|
12
|
+
* List container files
|
|
13
|
+
*
|
|
14
|
+
* @remarks
|
|
15
|
+
* Lists the files under a sandbox session prefix, in lexicographic path order. A restarted session is a separate container with its own session id. Paginate with `limit` and `after` (pass the previous page’s `last_id`); `has_more: true` always means the next page is fetchable that way.
|
|
16
|
+
*/
|
|
17
|
+
async listContainerFiles(request, options) {
|
|
18
|
+
return unwrapAsync(containersListContainerFiles(this, request, options));
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Retrieve a container file
|
|
22
|
+
*
|
|
23
|
+
* @remarks
|
|
24
|
+
* Returns the metadata of a single file under a sandbox session prefix.
|
|
25
|
+
*/
|
|
26
|
+
async getContainerFile(request, options) {
|
|
27
|
+
return unwrapAsync(containersGetContainerFile(this, request, options));
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Download container file content
|
|
31
|
+
*
|
|
32
|
+
* @remarks
|
|
33
|
+
* Streams the raw bytes of a file under a sandbox session prefix.
|
|
34
|
+
*/
|
|
35
|
+
async downloadContainerFileContent(request, options) {
|
|
36
|
+
return unwrapAsync(containersDownloadContainerFileContent(this, request, options));
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
//# sourceMappingURL=containers.js.map
|
package/esm/sdk/sdk.d.ts
CHANGED
|
@@ -6,6 +6,7 @@ import { Beta } from "./beta.js";
|
|
|
6
6
|
import { BYOK } from "./byok.js";
|
|
7
7
|
import { Chat } from "./chat.js";
|
|
8
8
|
import { Classifications } from "./classifications.js";
|
|
9
|
+
import { Containers } from "./containers.js";
|
|
9
10
|
import { Credits } from "./credits.js";
|
|
10
11
|
import { Datasets } from "./datasets.js";
|
|
11
12
|
import { Embeddings } from "./embeddings.js";
|
|
@@ -50,6 +51,8 @@ export declare class OpenRouter extends ClientSDK {
|
|
|
50
51
|
get chat(): Chat;
|
|
51
52
|
private _classifications?;
|
|
52
53
|
get classifications(): Classifications;
|
|
54
|
+
private _containers?;
|
|
55
|
+
get containers(): Containers;
|
|
53
56
|
private _credits?;
|
|
54
57
|
get credits(): Credits;
|
|
55
58
|
private _datasets?;
|
package/esm/sdk/sdk.js
CHANGED
|
@@ -10,6 +10,7 @@ import { Beta } from "./beta.js";
|
|
|
10
10
|
import { BYOK } from "./byok.js";
|
|
11
11
|
import { Chat } from "./chat.js";
|
|
12
12
|
import { Classifications } from "./classifications.js";
|
|
13
|
+
import { Containers } from "./containers.js";
|
|
13
14
|
import { Credits } from "./credits.js";
|
|
14
15
|
import { Datasets } from "./datasets.js";
|
|
15
16
|
import { Embeddings } from "./embeddings.js";
|
|
@@ -60,6 +61,9 @@ export class OpenRouter extends ClientSDK {
|
|
|
60
61
|
get classifications() {
|
|
61
62
|
return (this._classifications ?? (this._classifications = new Classifications(this._options)));
|
|
62
63
|
}
|
|
64
|
+
get containers() {
|
|
65
|
+
return (this._containers ?? (this._containers = new Containers(this._options)));
|
|
66
|
+
}
|
|
63
67
|
get credits() {
|
|
64
68
|
return (this._credits ?? (this._credits = new Credits(this._options)));
|
|
65
69
|
}
|
package/jsr.json
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@openrouter/sdk",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.55",
|
|
4
4
|
"author": "OpenRouter",
|
|
5
5
|
"description": "The OpenRouter TypeScript SDK is a type-safe toolkit for building AI applications with access to 400+ language models through a unified API.",
|
|
6
6
|
"keywords": [
|
|
@@ -74,14 +74,14 @@
|
|
|
74
74
|
"build": "tsc",
|
|
75
75
|
"prepublishOnly": "npm run build",
|
|
76
76
|
"postinstall": "node scripts/check-types.js || true",
|
|
77
|
+
"prepare": "npm run build",
|
|
77
78
|
"test": "vitest --run --project unit",
|
|
78
|
-
"test:e2e": "vitest --run --project e2e",
|
|
79
79
|
"test:transit": "exit 0",
|
|
80
80
|
"test:watch": "vitest --watch --project unit",
|
|
81
|
+
"typecheck": "tsc --noEmit",
|
|
81
82
|
"typecheck:transit": "exit 0",
|
|
82
83
|
"compile": "tsc",
|
|
83
|
-
"
|
|
84
|
-
"typecheck": "tsc --noEmit"
|
|
84
|
+
"test:e2e": "vitest --run --project e2e"
|
|
85
85
|
},
|
|
86
86
|
"peerDependencies": {},
|
|
87
87
|
"devDependencies": {
|