@openrouter/sdk 1.2.64 → 1.2.65
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/containersPromoteContainerFile.d.ts +19 -0
- package/esm/funcs/containersPromoteContainerFile.js +107 -0
- package/esm/lib/config.d.ts +2 -2
- package/esm/lib/config.js +2 -2
- package/esm/models/operations/index.d.ts +1 -0
- package/esm/models/operations/index.js +1 -0
- package/esm/models/operations/promotecontainerfile.d.ts +63 -0
- package/esm/models/operations/promotecontainerfile.js +24 -0
- package/esm/sdk/containers.d.ts +7 -0
- package/esm/sdk/containers.js +10 -0
- package/jsr.json +1 -1
- package/package.json +7 -7
|
@@ -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
|
+
* Promote a container file into workspace documents
|
|
14
|
+
*
|
|
15
|
+
* @remarks
|
|
16
|
+
* Copies a file from the container's sandbox prefix into the workspace's durable document storage, so it outlives the container. Returns the new document in the Files API shape, with a durable file id in the documents namespace. The copy counts against the workspace's storage quota exactly like an upload.
|
|
17
|
+
*/
|
|
18
|
+
export declare function containersPromoteContainerFile(client: OpenRouterCore, request: operations.PromoteContainerFileRequest, options?: RequestOptions): APIPromise<Result<models.FileResponse, errors.BadRequestResponseError | errors.UnauthorizedResponseError | errors.ForbiddenResponseError | errors.NotFoundResponseError | errors.PayloadTooLargeResponseError | errors.TooManyRequestsResponseError | errors.InternalServerResponseError | errors.ServiceUnavailableResponseError | OpenRouterError | ResponseValidationError | ConnectionError | RequestAbortedError | RequestTimeoutError | InvalidRequestError | UnexpectedClientError | SDKValidationError>>;
|
|
19
|
+
//# sourceMappingURL=containersPromoteContainerFile.d.ts.map
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
+
* @generated-id: b1e9dfab640d
|
|
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
|
+
* Promote a container file into workspace documents
|
|
18
|
+
*
|
|
19
|
+
* @remarks
|
|
20
|
+
* Copies a file from the container's sandbox prefix into the workspace's durable document storage, so it outlives the container. Returns the new document in the Files API shape, with a durable file id in the documents namespace. The copy counts against the workspace's storage quota exactly like an upload.
|
|
21
|
+
*/
|
|
22
|
+
export function containersPromoteContainerFile(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.PromoteContainerFileRequest$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
|
+
container_id: encodeSimple("container_id", payload.container_id, {
|
|
34
|
+
explode: false,
|
|
35
|
+
charEncoding: "percent",
|
|
36
|
+
}),
|
|
37
|
+
file_id: encodeSimple("file_id", payload.file_id, {
|
|
38
|
+
explode: false,
|
|
39
|
+
charEncoding: "percent",
|
|
40
|
+
}),
|
|
41
|
+
};
|
|
42
|
+
const path = pathToFunc("/containers/{container_id}/files/{file_id}/promote")(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: "promoteContainerFile",
|
|
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: "POST",
|
|
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.FileResponse$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(413, errors.PayloadTooLargeResponseError$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=containersPromoteContainerFile.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.65";
|
|
54
54
|
readonly genVersion: "2.914.0";
|
|
55
|
-
readonly userAgent: "speakeasy-sdk/typescript 1.2.
|
|
55
|
+
readonly userAgent: "speakeasy-sdk/typescript 1.2.65 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.65",
|
|
33
33
|
genVersion: "2.914.0",
|
|
34
|
-
userAgent: "speakeasy-sdk/typescript 1.2.
|
|
34
|
+
userAgent: "speakeasy-sdk/typescript 1.2.65 2.914.0 1.0.0 @openrouter/sdk",
|
|
35
35
|
};
|
|
36
36
|
//# sourceMappingURL=config.js.map
|
|
@@ -86,6 +86,7 @@ export * from "./listvideosmodels.js";
|
|
|
86
86
|
export * from "./listworkspacebudgets.js";
|
|
87
87
|
export * from "./listworkspacemembers.js";
|
|
88
88
|
export * from "./listworkspaces.js";
|
|
89
|
+
export * from "./promotecontainerfile.js";
|
|
89
90
|
export * from "./queryanalytics.js";
|
|
90
91
|
export * from "./sendchatcompletionrequest.js";
|
|
91
92
|
export * from "./submitgenerationfeedback.js";
|
|
@@ -90,6 +90,7 @@ export * from "./listvideosmodels.js";
|
|
|
90
90
|
export * from "./listworkspacebudgets.js";
|
|
91
91
|
export * from "./listworkspacemembers.js";
|
|
92
92
|
export * from "./listworkspaces.js";
|
|
93
|
+
export * from "./promotecontainerfile.js";
|
|
93
94
|
export * from "./queryanalytics.js";
|
|
94
95
|
export * from "./sendchatcompletionrequest.js";
|
|
95
96
|
export * from "./submitgenerationfeedback.js";
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import * as z from "zod/v4";
|
|
2
|
+
export type PromoteContainerFileGlobals = {
|
|
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 PromoteContainerFileRequest = {
|
|
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 canonical container id, exactly as returned in a bash/shell tool result — a restarted session has its own `-r<nonce>`-suffixed id. A session-derived id is always `sess_` + the sanitized session key, which is not necessarily the raw session id that was sent.
|
|
45
|
+
*/
|
|
46
|
+
containerId: string;
|
|
47
|
+
/**
|
|
48
|
+
* Container file id (`cfile_` + base64url of the file path).
|
|
49
|
+
*/
|
|
50
|
+
fileId: string;
|
|
51
|
+
};
|
|
52
|
+
/** @internal */
|
|
53
|
+
export type PromoteContainerFileRequest$Outbound = {
|
|
54
|
+
"HTTP-Referer"?: string | undefined;
|
|
55
|
+
appTitle?: string | undefined;
|
|
56
|
+
appCategories?: string | undefined;
|
|
57
|
+
container_id: string;
|
|
58
|
+
file_id: string;
|
|
59
|
+
};
|
|
60
|
+
/** @internal */
|
|
61
|
+
export declare const PromoteContainerFileRequest$outboundSchema: z.ZodType<PromoteContainerFileRequest$Outbound, PromoteContainerFileRequest>;
|
|
62
|
+
export declare function promoteContainerFileRequestToJSON(promoteContainerFileRequest: PromoteContainerFileRequest): string;
|
|
63
|
+
//# sourceMappingURL=promotecontainerfile.d.ts.map
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
+
* @generated-id: 83724b6f486c
|
|
4
|
+
*/
|
|
5
|
+
import * as z from "zod/v4";
|
|
6
|
+
import { remap as remap$ } from "../../lib/primitives.js";
|
|
7
|
+
/** @internal */
|
|
8
|
+
export const PromoteContainerFileRequest$outboundSchema = z.object({
|
|
9
|
+
httpReferer: z.string().optional(),
|
|
10
|
+
appTitle: z.string().optional(),
|
|
11
|
+
appCategories: z.string().optional(),
|
|
12
|
+
containerId: z.string(),
|
|
13
|
+
fileId: z.string(),
|
|
14
|
+
}).transform((v) => {
|
|
15
|
+
return remap$(v, {
|
|
16
|
+
httpReferer: "HTTP-Referer",
|
|
17
|
+
containerId: "container_id",
|
|
18
|
+
fileId: "file_id",
|
|
19
|
+
});
|
|
20
|
+
});
|
|
21
|
+
export function promoteContainerFileRequestToJSON(promoteContainerFileRequest) {
|
|
22
|
+
return JSON.stringify(PromoteContainerFileRequest$outboundSchema.parse(promoteContainerFileRequest));
|
|
23
|
+
}
|
|
24
|
+
//# sourceMappingURL=promotecontainerfile.js.map
|
package/esm/sdk/containers.d.ts
CHANGED
|
@@ -23,5 +23,12 @@ export declare class Containers extends ClientSDK {
|
|
|
23
23
|
* Streams the raw bytes of a file in a container.
|
|
24
24
|
*/
|
|
25
25
|
downloadContainerFileContent(request: operations.DownloadContainerFileContentRequest, options?: RequestOptions): Promise<ReadableStream<Uint8Array>>;
|
|
26
|
+
/**
|
|
27
|
+
* Promote a container file into workspace documents
|
|
28
|
+
*
|
|
29
|
+
* @remarks
|
|
30
|
+
* Copies a file from the container's sandbox prefix into the workspace's durable document storage, so it outlives the container. Returns the new document in the Files API shape, with a durable file id in the documents namespace. The copy counts against the workspace's storage quota exactly like an upload.
|
|
31
|
+
*/
|
|
32
|
+
promoteContainerFile(request: operations.PromoteContainerFileRequest, options?: RequestOptions): Promise<models.FileResponse>;
|
|
26
33
|
}
|
|
27
34
|
//# sourceMappingURL=containers.d.ts.map
|
package/esm/sdk/containers.js
CHANGED
|
@@ -5,6 +5,7 @@
|
|
|
5
5
|
import { containersDownloadContainerFileContent } from "../funcs/containersDownloadContainerFileContent.js";
|
|
6
6
|
import { containersGetContainerFile } from "../funcs/containersGetContainerFile.js";
|
|
7
7
|
import { containersListContainerFiles } from "../funcs/containersListContainerFiles.js";
|
|
8
|
+
import { containersPromoteContainerFile } from "../funcs/containersPromoteContainerFile.js";
|
|
8
9
|
import { ClientSDK } from "../lib/sdks.js";
|
|
9
10
|
import { unwrapAsync } from "../types/fp.js";
|
|
10
11
|
export class Containers extends ClientSDK {
|
|
@@ -35,5 +36,14 @@ export class Containers extends ClientSDK {
|
|
|
35
36
|
async downloadContainerFileContent(request, options) {
|
|
36
37
|
return unwrapAsync(containersDownloadContainerFileContent(this, request, options));
|
|
37
38
|
}
|
|
39
|
+
/**
|
|
40
|
+
* Promote a container file into workspace documents
|
|
41
|
+
*
|
|
42
|
+
* @remarks
|
|
43
|
+
* Copies a file from the container's sandbox prefix into the workspace's durable document storage, so it outlives the container. Returns the new document in the Files API shape, with a durable file id in the documents namespace. The copy counts against the workspace's storage quota exactly like an upload.
|
|
44
|
+
*/
|
|
45
|
+
async promoteContainerFile(request, options) {
|
|
46
|
+
return unwrapAsync(containersPromoteContainerFile(this, request, options));
|
|
47
|
+
}
|
|
38
48
|
}
|
|
39
49
|
//# sourceMappingURL=containers.js.map
|
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.65",
|
|
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": [
|
|
@@ -73,15 +73,15 @@
|
|
|
73
73
|
"lint": "eslint --cache --max-warnings=0 src",
|
|
74
74
|
"build": "tsc",
|
|
75
75
|
"prepublishOnly": "npm run build",
|
|
76
|
-
"test:e2e": "vitest --run --project e2e",
|
|
77
|
-
"compile": "tsc",
|
|
78
|
-
"test:transit": "exit 0",
|
|
79
|
-
"test:watch": "vitest --watch --project unit",
|
|
80
76
|
"typecheck": "tsc --noEmit",
|
|
81
77
|
"typecheck:transit": "exit 0",
|
|
82
|
-
"postinstall": "node scripts/check-types.js || true",
|
|
83
78
|
"prepare": "npm run build",
|
|
84
|
-
"test": "vitest --run --project unit"
|
|
79
|
+
"test": "vitest --run --project unit",
|
|
80
|
+
"test:watch": "vitest --watch --project unit",
|
|
81
|
+
"compile": "tsc",
|
|
82
|
+
"postinstall": "node scripts/check-types.js || true",
|
|
83
|
+
"test:e2e": "vitest --run --project e2e",
|
|
84
|
+
"test:transit": "exit 0"
|
|
85
85
|
},
|
|
86
86
|
"peerDependencies": {},
|
|
87
87
|
"devDependencies": {
|