@openrouter/sdk 1.5.6 → 1.5.7
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/lib/config.d.ts +2 -2
- package/esm/lib/config.js +2 -2
- package/esm/models/errors/index.d.ts +0 -2
- package/esm/models/errors/index.js +0 -2
- package/esm/models/index.d.ts +0 -40
- package/esm/models/index.js +0 -40
- package/esm/models/operations/index.d.ts +0 -15
- package/esm/models/operations/index.js +0 -15
- package/esm/sdk/sdk.d.ts +0 -3
- package/esm/sdk/sdk.js +0 -4
- package/jsr.json +1 -1
- package/package.json +9 -9
- package/esm/funcs/internsChat.d.ts +0 -42
- package/esm/funcs/internsChat.js +0 -109
- package/esm/funcs/internsCreateIntern.d.ts +0 -21
- package/esm/funcs/internsCreateIntern.js +0 -103
- package/esm/funcs/internsDeleteIntern.d.ts +0 -21
- package/esm/funcs/internsDeleteIntern.js +0 -108
- package/esm/funcs/internsGetIntern.d.ts +0 -21
- package/esm/funcs/internsGetIntern.js +0 -105
- package/esm/funcs/internsGetInternConnections.d.ts +0 -21
- package/esm/funcs/internsGetInternConnections.js +0 -105
- package/esm/funcs/internsGetInternDaemon.d.ts +0 -21
- package/esm/funcs/internsGetInternDaemon.js +0 -105
- package/esm/funcs/internsGetInternDaemonAccess.d.ts +0 -23
- package/esm/funcs/internsGetInternDaemonAccess.js +0 -107
- package/esm/funcs/internsGetInternIcon.d.ts +0 -20
- package/esm/funcs/internsGetInternIcon.js +0 -109
- package/esm/funcs/internsInvoke.d.ts +0 -26
- package/esm/funcs/internsInvoke.js +0 -119
- package/esm/funcs/internsListInterns.d.ts +0 -21
- package/esm/funcs/internsListInterns.js +0 -107
- package/esm/funcs/internsProvisionIntern.d.ts +0 -21
- package/esm/funcs/internsProvisionIntern.js +0 -105
- package/esm/funcs/internsSignInternDaemonAccessRequest.d.ts +0 -22
- package/esm/funcs/internsSignInternDaemonAccessRequest.js +0 -109
- package/esm/funcs/internsSignInternDaemonRequest.d.ts +0 -20
- package/esm/funcs/internsSignInternDaemonRequest.js +0 -109
- package/esm/funcs/internsSuspendIntern.d.ts +0 -21
- package/esm/funcs/internsSuspendIntern.js +0 -105
- package/esm/funcs/internsUpdateIntern.d.ts +0 -21
- package/esm/funcs/internsUpdateIntern.js +0 -108
- package/esm/models/createinternrequest.d.ts +0 -43
- package/esm/models/createinternrequest.js +0 -24
- package/esm/models/deleteinternrequest.d.ts +0 -18
- package/esm/models/deleteinternrequest.js +0 -18
- package/esm/models/deleteinternresponse.d.ts +0 -10
- package/esm/models/deleteinternresponse.js +0 -14
- package/esm/models/errors/internchaterrorresponse.d.ts +0 -31
- package/esm/models/errors/internchaterrorresponse.js +0 -35
- package/esm/models/errors/internlifecycleerror.d.ts +0 -25
- package/esm/models/errors/internlifecycleerror.js +0 -35
- package/esm/models/intern.d.ts +0 -120
- package/esm/models/intern.js +0 -74
- package/esm/models/internapprovalmode.d.ts +0 -16
- package/esm/models/internapprovalmode.js +0 -15
- package/esm/models/internchatassistantmessage.d.ts +0 -24
- package/esm/models/internchatassistantmessage.js +0 -22
- package/esm/models/internchatchoice.d.ts +0 -37
- package/esm/models/internchatchoice.js +0 -33
- package/esm/models/internchatcompletionchunk.d.ts +0 -48
- package/esm/models/internchatcompletionchunk.js +0 -34
- package/esm/models/internchatcompletionrequest.d.ts +0 -40
- package/esm/models/internchatcompletionrequest.js +0 -25
- package/esm/models/internchatdelta.d.ts +0 -24
- package/esm/models/internchatdelta.js +0 -28
- package/esm/models/internchatdevelopermessage.d.ts +0 -21
- package/esm/models/internchatdevelopermessage.js +0 -15
- package/esm/models/internchatechoedtoolcall.d.ts +0 -21
- package/esm/models/internchatechoedtoolcall.js +0 -15
- package/esm/models/internchatechoedtoolcallfunction.d.ts +0 -17
- package/esm/models/internchatechoedtoolcallfunction.js +0 -14
- package/esm/models/internchaterror.d.ts +0 -22
- package/esm/models/internchaterror.js +0 -17
- package/esm/models/internchaterrormetadata.d.ts +0 -48
- package/esm/models/internchaterrormetadata.js +0 -39
- package/esm/models/internchatmessage.d.ts +0 -16
- package/esm/models/internchatmessage.js +0 -22
- package/esm/models/internchatmessagecontent.d.ts +0 -12
- package/esm/models/internchatmessagecontent.js +0 -12
- package/esm/models/internchatprompttokensdetails.d.ts +0 -13
- package/esm/models/internchatprompttokensdetails.js +0 -19
- package/esm/models/internchatsteeredresponse.d.ts +0 -33
- package/esm/models/internchatsteeredresponse.js +0 -28
- package/esm/models/internchatstreamerror.d.ts +0 -22
- package/esm/models/internchatstreamerror.js +0 -17
- package/esm/models/internchatstreamingresponse.d.ts +0 -17
- package/esm/models/internchatstreamingresponse.js +0 -29
- package/esm/models/internchatsystemmessage.d.ts +0 -21
- package/esm/models/internchatsystemmessage.js +0 -15
- package/esm/models/internchattextpart.d.ts +0 -24
- package/esm/models/internchattextpart.js +0 -19
- package/esm/models/internchattoolcall.d.ts +0 -30
- package/esm/models/internchattoolcall.js +0 -23
- package/esm/models/internchattoolcallfunction.d.ts +0 -24
- package/esm/models/internchattoolcallfunction.js +0 -20
- package/esm/models/internchattoolmessage.d.ts +0 -23
- package/esm/models/internchattoolmessage.js +0 -21
- package/esm/models/internchatusage.d.ts +0 -24
- package/esm/models/internchatusage.js +0 -27
- package/esm/models/internchatusermessage.d.ts +0 -21
- package/esm/models/internchatusermessage.js +0 -15
- package/esm/models/internconnection.d.ts +0 -118
- package/esm/models/internconnection.js +0 -105
- package/esm/models/internconnectionlist.d.ts +0 -11
- package/esm/models/internconnectionlist.js +0 -15
- package/esm/models/interndaemonaccess.d.ts +0 -24
- package/esm/models/interndaemonaccess.js +0 -23
- package/esm/models/interninvokeacceptedresponse.d.ts +0 -34
- package/esm/models/interninvokeacceptedresponse.js +0 -30
- package/esm/models/interninvokerequest.d.ts +0 -23
- package/esm/models/interninvokerequest.js +0 -19
- package/esm/models/internlifecycleerror.d.ts +0 -23
- package/esm/models/internlifecycleerror.js +0 -32
- package/esm/models/internlistresponse.d.ts +0 -22
- package/esm/models/internlistresponse.js +0 -23
- package/esm/models/operations/createintern.d.ts +0 -61
- package/esm/models/operations/createintern.js +0 -25
- package/esm/models/operations/createinternchatcompletion.d.ts +0 -77
- package/esm/models/operations/createinternchatcompletion.js +0 -71
- package/esm/models/operations/deleteintern.d.ts +0 -61
- package/esm/models/operations/deleteintern.js +0 -24
- package/esm/models/operations/getintern.d.ts +0 -58
- package/esm/models/operations/getintern.js +0 -21
- package/esm/models/operations/getinternconnections.d.ts +0 -58
- package/esm/models/operations/getinternconnections.js +0 -21
- package/esm/models/operations/getinterndaemon.d.ts +0 -58
- package/esm/models/operations/getinterndaemon.js +0 -21
- package/esm/models/operations/getinterndaemonaccess.d.ts +0 -58
- package/esm/models/operations/getinterndaemonaccess.js +0 -21
- package/esm/models/operations/getinternicon.d.ts +0 -63
- package/esm/models/operations/getinternicon.js +0 -22
- package/esm/models/operations/invokeintern.d.ts +0 -72
- package/esm/models/operations/invokeintern.js +0 -38
- package/esm/models/operations/listinterns.d.ts +0 -87
- package/esm/models/operations/listinterns.js +0 -40
- package/esm/models/operations/provisionintern.d.ts +0 -58
- package/esm/models/operations/provisionintern.js +0 -21
- package/esm/models/operations/signinterndaemonaccessrequest.d.ts +0 -72
- package/esm/models/operations/signinterndaemonaccessrequest.js +0 -38
- package/esm/models/operations/signinterndaemonrequest.d.ts +0 -72
- package/esm/models/operations/signinterndaemonrequest.js +0 -38
- package/esm/models/operations/suspendintern.d.ts +0 -58
- package/esm/models/operations/suspendintern.js +0 -21
- package/esm/models/operations/updateintern.d.ts +0 -61
- package/esm/models/operations/updateintern.js +0 -24
- package/esm/models/provisioninternresponse.d.ts +0 -10
- package/esm/models/provisioninternresponse.js +0 -14
- package/esm/models/signinterndaemonrequest.d.ts +0 -54
- package/esm/models/signinterndaemonrequest.js +0 -30
- package/esm/models/signinterndaemonresponse.d.ts +0 -32
- package/esm/models/signinterndaemonresponse.js +0 -27
- package/esm/models/suspendinternresponse.d.ts +0 -10
- package/esm/models/suspendinternresponse.js +0 -14
- package/esm/models/updateinternrequest.d.ts +0 -33
- package/esm/models/updateinternrequest.js +0 -16
- package/esm/sdk/interns.d.ts +0 -143
- package/esm/sdk/interns.js +0 -163
|
@@ -1,107 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
-
* @generated-id: 464f7f69e2f0
|
|
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 { InternLifecycleError$inboundSchema as errors_InternLifecycleError$inboundSchema } from "../models/errors/internlifecycleerror.js";
|
|
13
|
-
import { InternDaemonAccess$inboundSchema as models_InternDaemonAccess$inboundSchema } from "../models/interndaemonaccess.js";
|
|
14
|
-
import { GetInternDaemonAccessRequest$outboundSchema as operations_GetInternDaemonAccessRequest$outboundSchema } from "../models/operations/getinterndaemonaccess.js";
|
|
15
|
-
import { APIPromise } from "../types/async.js";
|
|
16
|
-
/**
|
|
17
|
-
* Get an intern's daemon access (deprecated alias)
|
|
18
|
-
*
|
|
19
|
-
* @remarks
|
|
20
|
-
* Deprecated alias of `GET /interns/{internId}/daemon` with the same request, response, and errors. The API key selects the caller, workspace and visible interns. An intern's own API key sees only that intern: the collection and every other intern answer 404 to it. There is no default workspace fallback. Requests on regional hostnames such as `eu.openrouter.ai` are refused. [API key](/docs/api-reference/authentication) required.
|
|
21
|
-
*
|
|
22
|
-
* If set, this operation will use {@link Security.apiKey} from the global security.
|
|
23
|
-
*
|
|
24
|
-
* @deprecated method: This will be removed in a future release, please migrate away from it as soon as possible.
|
|
25
|
-
*/
|
|
26
|
-
export function internsGetInternDaemonAccess(client, request, options) {
|
|
27
|
-
return new APIPromise($do(client, request, options));
|
|
28
|
-
}
|
|
29
|
-
async function $do(client, request, options) {
|
|
30
|
-
const parsed = safeParse(request, (value) => operations_GetInternDaemonAccessRequest$outboundSchema.parse(value), "Input validation failed");
|
|
31
|
-
if (!parsed.ok) {
|
|
32
|
-
return [parsed, { status: "invalid" }];
|
|
33
|
-
}
|
|
34
|
-
const payload = parsed.value;
|
|
35
|
-
const body = null;
|
|
36
|
-
const pathParams = {
|
|
37
|
-
internId: encodeSimple("internId", payload.internId, {
|
|
38
|
-
explode: false,
|
|
39
|
-
charEncoding: "percent",
|
|
40
|
-
}),
|
|
41
|
-
};
|
|
42
|
-
const path = pathToFunc("/interns/{internId}/daemon-access")(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, [0]);
|
|
52
|
-
const context = {
|
|
53
|
-
options: client._options,
|
|
54
|
-
baseURL: options?.serverURL ?? client._baseURL ?? "",
|
|
55
|
-
operationID: "getInternDaemonAccess",
|
|
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_InternDaemonAccess$inboundSchema), M.jsonErr([401, 403, 404, 408, 409], errors_InternLifecycleError$inboundSchema), M.jsonErr(500, errors_InternLifecycleError$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=internsGetInternDaemonAccess.js.map
|
|
@@ -1,20 +0,0 @@
|
|
|
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
|
-
* Get an intern's icon
|
|
13
|
-
*
|
|
14
|
-
* @remarks
|
|
15
|
-
* Returns the icon image of one visible intern. Pass the intern's `icon_sha256` as `v` to receive a response that can be cached indefinitely. The API key selects the caller, workspace and visible interns. An intern's own API key sees only that intern: the collection and every other intern answer 404 to it. There is no default workspace fallback. Requests on regional hostnames such as `eu.openrouter.ai` are refused. [API key](/docs/api-reference/authentication) required.
|
|
16
|
-
*
|
|
17
|
-
* If set, this operation will use {@link Security.apiKey} from the global security.
|
|
18
|
-
*/
|
|
19
|
-
export declare function internsGetInternIcon(client: OpenRouterCore, request: operations.GetInternIconRequest, options?: RequestOptions): APIPromise<Result<ReadableStream<Uint8Array>, errors.InternLifecycleError | OpenRouterError | ResponseValidationError | ConnectionError | RequestAbortedError | RequestTimeoutError | InvalidRequestError | UnexpectedClientError | SDKValidationError>>;
|
|
20
|
-
//# sourceMappingURL=internsGetInternIcon.d.ts.map
|
|
@@ -1,109 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
-
* @generated-id: df9f8b537f86
|
|
4
|
-
*/
|
|
5
|
-
import * as z from "zod/v4";
|
|
6
|
-
import { encodeFormQuery, 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 { InternLifecycleError$inboundSchema as errors_InternLifecycleError$inboundSchema } from "../models/errors/internlifecycleerror.js";
|
|
14
|
-
import { GetInternIconRequest$outboundSchema as operations_GetInternIconRequest$outboundSchema } from "../models/operations/getinternicon.js";
|
|
15
|
-
import { APIPromise } from "../types/async.js";
|
|
16
|
-
/**
|
|
17
|
-
* Get an intern's icon
|
|
18
|
-
*
|
|
19
|
-
* @remarks
|
|
20
|
-
* Returns the icon image of one visible intern. Pass the intern's `icon_sha256` as `v` to receive a response that can be cached indefinitely. The API key selects the caller, workspace and visible interns. An intern's own API key sees only that intern: the collection and every other intern answer 404 to it. There is no default workspace fallback. Requests on regional hostnames such as `eu.openrouter.ai` are refused. [API key](/docs/api-reference/authentication) required.
|
|
21
|
-
*
|
|
22
|
-
* If set, this operation will use {@link Security.apiKey} from the global security.
|
|
23
|
-
*/
|
|
24
|
-
export function internsGetInternIcon(client, request, options) {
|
|
25
|
-
return new APIPromise($do(client, request, options));
|
|
26
|
-
}
|
|
27
|
-
async function $do(client, request, options) {
|
|
28
|
-
const parsed = safeParse(request, (value) => operations_GetInternIconRequest$outboundSchema.parse(value), "Input validation failed");
|
|
29
|
-
if (!parsed.ok) {
|
|
30
|
-
return [parsed, { status: "invalid" }];
|
|
31
|
-
}
|
|
32
|
-
const payload = parsed.value;
|
|
33
|
-
const body = null;
|
|
34
|
-
const pathParams = {
|
|
35
|
-
internId: encodeSimple("internId", payload.internId, {
|
|
36
|
-
explode: false,
|
|
37
|
-
charEncoding: "percent",
|
|
38
|
-
}),
|
|
39
|
-
};
|
|
40
|
-
const path = pathToFunc("/interns/{internId}/icon")(pathParams);
|
|
41
|
-
const query = encodeFormQuery({
|
|
42
|
-
"v": payload.v,
|
|
43
|
-
});
|
|
44
|
-
const headers = new Headers(compactMap({
|
|
45
|
-
Accept: "image/*",
|
|
46
|
-
"HTTP-Referer": encodeSimple("HTTP-Referer", payload["HTTP-Referer"] ?? client._options.httpReferer, { explode: false, charEncoding: "none" }),
|
|
47
|
-
"X-OpenRouter-Categories": encodeSimple("X-OpenRouter-Categories", payload.appCategories ?? client._options.appCategories, { explode: false, charEncoding: "none" }),
|
|
48
|
-
"X-OpenRouter-Title": encodeSimple("X-OpenRouter-Title", payload.appTitle ?? client._options.appTitle, { explode: false, charEncoding: "none" }),
|
|
49
|
-
}));
|
|
50
|
-
const secConfig = await extractSecurity(client._options.apiKey);
|
|
51
|
-
const securityInput = secConfig == null ? {} : { apiKey: secConfig };
|
|
52
|
-
const requestSecurity = resolveGlobalSecurity(securityInput, [0]);
|
|
53
|
-
const context = {
|
|
54
|
-
options: client._options,
|
|
55
|
-
baseURL: options?.serverURL ?? client._baseURL ?? "",
|
|
56
|
-
operationID: "getInternIcon",
|
|
57
|
-
oAuth2Scopes: null,
|
|
58
|
-
resolvedSecurity: requestSecurity,
|
|
59
|
-
securitySource: client._options.apiKey,
|
|
60
|
-
retryConfig: options?.retries
|
|
61
|
-
|| client._options.retryConfig
|
|
62
|
-
|| {
|
|
63
|
-
strategy: "backoff",
|
|
64
|
-
backoff: {
|
|
65
|
-
initialInterval: 500,
|
|
66
|
-
maxInterval: 60000,
|
|
67
|
-
exponent: 1.5,
|
|
68
|
-
maxElapsedTime: 3600000,
|
|
69
|
-
},
|
|
70
|
-
retryConnectionErrors: true,
|
|
71
|
-
}
|
|
72
|
-
|| { strategy: "none" },
|
|
73
|
-
retryCodes: options?.retryCodes || ["5XX"],
|
|
74
|
-
};
|
|
75
|
-
const requestRes = client._createRequest(context, {
|
|
76
|
-
security: requestSecurity,
|
|
77
|
-
method: "GET",
|
|
78
|
-
baseURL: options?.serverURL,
|
|
79
|
-
path: path,
|
|
80
|
-
headers: headers,
|
|
81
|
-
query: query,
|
|
82
|
-
body: body,
|
|
83
|
-
userAgent: client._options.userAgent,
|
|
84
|
-
timeoutMs: options?.timeoutMs || client._options.timeoutMs || -1,
|
|
85
|
-
}, options);
|
|
86
|
-
if (!requestRes.ok) {
|
|
87
|
-
return [requestRes, { status: "invalid" }];
|
|
88
|
-
}
|
|
89
|
-
const req = requestRes.value;
|
|
90
|
-
const doResult = await client._do(req, {
|
|
91
|
-
context,
|
|
92
|
-
isErrorStatusCode: (statusCode) => matchStatusCode({ status: statusCode }, ["4XX", "5XX"]),
|
|
93
|
-
retryConfig: context.retryConfig,
|
|
94
|
-
retryCodes: context.retryCodes,
|
|
95
|
-
});
|
|
96
|
-
if (!doResult.ok) {
|
|
97
|
-
return [doResult, { status: "request-error", request: req }];
|
|
98
|
-
}
|
|
99
|
-
const response = doResult.value;
|
|
100
|
-
const responseFields = {
|
|
101
|
-
HttpMeta: { Response: response, Request: req },
|
|
102
|
-
};
|
|
103
|
-
const [result] = await M.match(M.stream(200, z.custom(x => x instanceof ReadableStream), { ctype: "image/*" }), M.jsonErr([401, 403, 404, 408], errors_InternLifecycleError$inboundSchema), M.jsonErr(500, errors_InternLifecycleError$inboundSchema), M.fail("4XX"), M.fail("5XX"))(response, req, { extraFields: responseFields });
|
|
104
|
-
if (!result.ok) {
|
|
105
|
-
return [result, { status: "complete", request: req, response }];
|
|
106
|
-
}
|
|
107
|
-
return [result, { status: "complete", request: req, response }];
|
|
108
|
-
}
|
|
109
|
-
//# sourceMappingURL=internsGetInternIcon.js.map
|
|
@@ -1,26 +0,0 @@
|
|
|
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
|
-
* Start an intern run without waiting for it
|
|
13
|
-
*
|
|
14
|
-
* @remarks
|
|
15
|
-
* Starts a run on one of your interns and answers `202` with the `session_id` as soon as the intern accepts it. The run keeps going on the intern after the response. Nothing about its progress comes back on this request; the intern reports through its own tools, such as Slack.
|
|
16
|
-
*
|
|
17
|
-
* Send the same `session_id` later to continue the conversation, for example to hand the intern a decision on work it started. If that session already has a run going, the prompt is delivered into it and the status is `steered`. A `session_id` is accepted only from the caller it was issued to, on the same intern; any other, including sessions started from Slack or the chat endpoint, is refused with `404`.
|
|
18
|
-
*
|
|
19
|
-
* Runs started here self-drive: the intern consents to its own tool approvals, and a question it asks is answered by its own fallback. A run ends when the intern finishes it or after its execution deadline (1 hour by default).
|
|
20
|
-
*
|
|
21
|
-
* Available to interns programme members. Callers outside the programme receive `404` for every path under `/api/v1/interns`.
|
|
22
|
-
*
|
|
23
|
-
* If set, this operation will use {@link Security.apiKey} from the global security.
|
|
24
|
-
*/
|
|
25
|
-
export declare function internsInvoke(client: OpenRouterCore, request: operations.InvokeInternRequest, options?: RequestOptions): APIPromise<Result<operations.InvokeInternResponse, errors.InternChatErrorResponse | OpenRouterError | ResponseValidationError | ConnectionError | RequestAbortedError | RequestTimeoutError | InvalidRequestError | UnexpectedClientError | SDKValidationError>>;
|
|
26
|
-
//# sourceMappingURL=internsInvoke.d.ts.map
|
|
@@ -1,119 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
-
* @generated-id: d0be40cd89cf
|
|
4
|
-
*/
|
|
5
|
-
import { encodeJSON, 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 { InternChatErrorResponse$inboundSchema as errors_InternChatErrorResponse$inboundSchema } from "../models/errors/internchaterrorresponse.js";
|
|
13
|
-
import { InvokeInternRequest$outboundSchema as operations_InvokeInternRequest$outboundSchema, InvokeInternResponse$inboundSchema as operations_InvokeInternResponse$inboundSchema } from "../models/operations/invokeintern.js";
|
|
14
|
-
import { APIPromise } from "../types/async.js";
|
|
15
|
-
/**
|
|
16
|
-
* Start an intern run without waiting for it
|
|
17
|
-
*
|
|
18
|
-
* @remarks
|
|
19
|
-
* Starts a run on one of your interns and answers `202` with the `session_id` as soon as the intern accepts it. The run keeps going on the intern after the response. Nothing about its progress comes back on this request; the intern reports through its own tools, such as Slack.
|
|
20
|
-
*
|
|
21
|
-
* Send the same `session_id` later to continue the conversation, for example to hand the intern a decision on work it started. If that session already has a run going, the prompt is delivered into it and the status is `steered`. A `session_id` is accepted only from the caller it was issued to, on the same intern; any other, including sessions started from Slack or the chat endpoint, is refused with `404`.
|
|
22
|
-
*
|
|
23
|
-
* Runs started here self-drive: the intern consents to its own tool approvals, and a question it asks is answered by its own fallback. A run ends when the intern finishes it or after its execution deadline (1 hour by default).
|
|
24
|
-
*
|
|
25
|
-
* Available to interns programme members. Callers outside the programme receive `404` for every path under `/api/v1/interns`.
|
|
26
|
-
*
|
|
27
|
-
* If set, this operation will use {@link Security.apiKey} from the global security.
|
|
28
|
-
*/
|
|
29
|
-
export function internsInvoke(client, request, options) {
|
|
30
|
-
return new APIPromise($do(client, request, options));
|
|
31
|
-
}
|
|
32
|
-
async function $do(client, request, options) {
|
|
33
|
-
const parsed = safeParse(request, (value) => operations_InvokeInternRequest$outboundSchema.parse(value), "Input validation failed");
|
|
34
|
-
if (!parsed.ok) {
|
|
35
|
-
return [parsed, { status: "invalid" }];
|
|
36
|
-
}
|
|
37
|
-
const payload = parsed.value;
|
|
38
|
-
const body = encodeJSON("body", payload.InternInvokeRequest, {
|
|
39
|
-
explode: true,
|
|
40
|
-
});
|
|
41
|
-
const pathParams = {
|
|
42
|
-
internId: encodeSimple("internId", payload.internId, {
|
|
43
|
-
explode: false,
|
|
44
|
-
charEncoding: "percent",
|
|
45
|
-
}),
|
|
46
|
-
};
|
|
47
|
-
const path = pathToFunc("/interns/{internId}/invoke")(pathParams);
|
|
48
|
-
const headers = new Headers(compactMap({
|
|
49
|
-
"Content-Type": "application/json",
|
|
50
|
-
Accept: "application/json",
|
|
51
|
-
"HTTP-Referer": encodeSimple("HTTP-Referer", payload["HTTP-Referer"] ?? client._options.httpReferer, { explode: false, charEncoding: "none" }),
|
|
52
|
-
"X-OpenRouter-Categories": encodeSimple("X-OpenRouter-Categories", payload.appCategories ?? client._options.appCategories, { explode: false, charEncoding: "none" }),
|
|
53
|
-
"X-OpenRouter-Title": encodeSimple("X-OpenRouter-Title", payload.appTitle ?? client._options.appTitle, { explode: false, charEncoding: "none" }),
|
|
54
|
-
}));
|
|
55
|
-
const secConfig = await extractSecurity(client._options.apiKey);
|
|
56
|
-
const securityInput = secConfig == null ? {} : { apiKey: secConfig };
|
|
57
|
-
const requestSecurity = resolveGlobalSecurity(securityInput, [0]);
|
|
58
|
-
const context = {
|
|
59
|
-
options: client._options,
|
|
60
|
-
baseURL: options?.serverURL ?? client._baseURL ?? "",
|
|
61
|
-
operationID: "invokeIntern",
|
|
62
|
-
oAuth2Scopes: null,
|
|
63
|
-
resolvedSecurity: requestSecurity,
|
|
64
|
-
securitySource: client._options.apiKey,
|
|
65
|
-
retryConfig: options?.retries
|
|
66
|
-
|| client._options.retryConfig
|
|
67
|
-
|| {
|
|
68
|
-
strategy: "backoff",
|
|
69
|
-
backoff: {
|
|
70
|
-
initialInterval: 500,
|
|
71
|
-
maxInterval: 60000,
|
|
72
|
-
exponent: 1.5,
|
|
73
|
-
maxElapsedTime: 3600000,
|
|
74
|
-
},
|
|
75
|
-
retryConnectionErrors: true,
|
|
76
|
-
}
|
|
77
|
-
|| { strategy: "none" },
|
|
78
|
-
retryCodes: options?.retryCodes || ["5XX"],
|
|
79
|
-
};
|
|
80
|
-
const requestRes = client._createRequest(context, {
|
|
81
|
-
security: requestSecurity,
|
|
82
|
-
method: "POST",
|
|
83
|
-
baseURL: options?.serverURL,
|
|
84
|
-
path: path,
|
|
85
|
-
headers: headers,
|
|
86
|
-
body: body,
|
|
87
|
-
userAgent: client._options.userAgent,
|
|
88
|
-
timeoutMs: options?.timeoutMs || client._options.timeoutMs || -1,
|
|
89
|
-
}, options);
|
|
90
|
-
if (!requestRes.ok) {
|
|
91
|
-
return [requestRes, { status: "invalid" }];
|
|
92
|
-
}
|
|
93
|
-
const req = requestRes.value;
|
|
94
|
-
const doResult = await client._do(req, {
|
|
95
|
-
context,
|
|
96
|
-
isErrorStatusCode: (statusCode) => matchStatusCode({ status: statusCode }, ["4XX", "5XX"]),
|
|
97
|
-
retryConfig: context.retryConfig,
|
|
98
|
-
retryCodes: context.retryCodes,
|
|
99
|
-
});
|
|
100
|
-
if (!doResult.ok) {
|
|
101
|
-
return [doResult, { status: "request-error", request: req }];
|
|
102
|
-
}
|
|
103
|
-
const response = doResult.value;
|
|
104
|
-
const responseFields = {
|
|
105
|
-
HttpMeta: { Response: response, Request: req },
|
|
106
|
-
};
|
|
107
|
-
const [result] = await M.match(M.json(202, operations_InvokeInternResponse$inboundSchema, {
|
|
108
|
-
key: "Result",
|
|
109
|
-
}), M.jsonErr([400, 401, 403, 404, 408, 413], errors_InternChatErrorResponse$inboundSchema), M.jsonErr([409, 429], errors_InternChatErrorResponse$inboundSchema, {
|
|
110
|
-
hdrs: true,
|
|
111
|
-
}), M.jsonErr(503, errors_InternChatErrorResponse$inboundSchema, {
|
|
112
|
-
hdrs: true,
|
|
113
|
-
}), M.jsonErr([500, 502, 504], errors_InternChatErrorResponse$inboundSchema), M.fail("4XX"), M.fail("5XX"))(response, req, { extraFields: responseFields });
|
|
114
|
-
if (!result.ok) {
|
|
115
|
-
return [result, { status: "complete", request: req, response }];
|
|
116
|
-
}
|
|
117
|
-
return [result, { status: "complete", request: req, response }];
|
|
118
|
-
}
|
|
119
|
-
//# sourceMappingURL=internsInvoke.js.map
|
|
@@ -1,21 +0,0 @@
|
|
|
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 interns
|
|
14
|
-
*
|
|
15
|
-
* @remarks
|
|
16
|
-
* Lists interns visible to the authenticated key, newest first. Filter by workspace and one or more lifecycle statuses. The API key selects the caller, workspace and visible interns. An intern's own API key sees only that intern: the collection and every other intern answer 404 to it. There is no default workspace fallback. Requests on regional hostnames such as `eu.openrouter.ai` are refused. [API key](/docs/api-reference/authentication) required.
|
|
17
|
-
*
|
|
18
|
-
* If set, this operation will use {@link Security.apiKey} from the global security.
|
|
19
|
-
*/
|
|
20
|
-
export declare function internsListInterns(client: OpenRouterCore, request?: operations.ListInternsRequest | undefined, options?: RequestOptions): APIPromise<Result<models.InternListResponse, errors.InternLifecycleError | OpenRouterError | ResponseValidationError | ConnectionError | RequestAbortedError | RequestTimeoutError | InvalidRequestError | UnexpectedClientError | SDKValidationError>>;
|
|
21
|
-
//# sourceMappingURL=internsListInterns.d.ts.map
|
|
@@ -1,107 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
-
* @generated-id: eceaf7dad653
|
|
4
|
-
*/
|
|
5
|
-
import { encodeFormQuery, encodeSimple, queryJoin } 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 { InternLifecycleError$inboundSchema as errors_InternLifecycleError$inboundSchema } from "../models/errors/internlifecycleerror.js";
|
|
13
|
-
import { InternListResponse$inboundSchema as models_InternListResponse$inboundSchema } from "../models/internlistresponse.js";
|
|
14
|
-
import { ListInternsRequest$outboundSchema as operations_ListInternsRequest$outboundSchema } from "../models/operations/listinterns.js";
|
|
15
|
-
import { APIPromise } from "../types/async.js";
|
|
16
|
-
/**
|
|
17
|
-
* List interns
|
|
18
|
-
*
|
|
19
|
-
* @remarks
|
|
20
|
-
* Lists interns visible to the authenticated key, newest first. Filter by workspace and one or more lifecycle statuses. The API key selects the caller, workspace and visible interns. An intern's own API key sees only that intern: the collection and every other intern answer 404 to it. There is no default workspace fallback. Requests on regional hostnames such as `eu.openrouter.ai` are refused. [API key](/docs/api-reference/authentication) required.
|
|
21
|
-
*
|
|
22
|
-
* If set, this operation will use {@link Security.apiKey} from the global security.
|
|
23
|
-
*/
|
|
24
|
-
export function internsListInterns(client, request, options) {
|
|
25
|
-
return new APIPromise($do(client, request, options));
|
|
26
|
-
}
|
|
27
|
-
async function $do(client, request, options) {
|
|
28
|
-
const parsed = safeParse(request, (value) => operations_ListInternsRequest$outboundSchema.optional().parse(value), "Input validation failed");
|
|
29
|
-
if (!parsed.ok) {
|
|
30
|
-
return [parsed, { status: "invalid" }];
|
|
31
|
-
}
|
|
32
|
-
const payload = parsed.value;
|
|
33
|
-
const body = null;
|
|
34
|
-
const path = pathToFunc("/interns")();
|
|
35
|
-
const query = queryJoin(encodeFormQuery({
|
|
36
|
-
"status": payload?.status,
|
|
37
|
-
}, { explode: false }), encodeFormQuery({
|
|
38
|
-
"limit": payload?.limit,
|
|
39
|
-
"starting_after": payload?.starting_after,
|
|
40
|
-
"workspace_id": payload?.workspace_id,
|
|
41
|
-
}));
|
|
42
|
-
const headers = new Headers(compactMap({
|
|
43
|
-
Accept: "application/json",
|
|
44
|
-
"HTTP-Referer": encodeSimple("HTTP-Referer", payload?.["HTTP-Referer"] ?? client._options.httpReferer, { explode: false, charEncoding: "none" }),
|
|
45
|
-
"X-OpenRouter-Categories": encodeSimple("X-OpenRouter-Categories", payload?.appCategories ?? client._options.appCategories, { explode: false, charEncoding: "none" }),
|
|
46
|
-
"X-OpenRouter-Title": encodeSimple("X-OpenRouter-Title", payload?.appTitle ?? client._options.appTitle, { explode: false, charEncoding: "none" }),
|
|
47
|
-
}));
|
|
48
|
-
const secConfig = await extractSecurity(client._options.apiKey);
|
|
49
|
-
const securityInput = secConfig == null ? {} : { apiKey: secConfig };
|
|
50
|
-
const requestSecurity = resolveGlobalSecurity(securityInput, [0]);
|
|
51
|
-
const context = {
|
|
52
|
-
options: client._options,
|
|
53
|
-
baseURL: options?.serverURL ?? client._baseURL ?? "",
|
|
54
|
-
operationID: "listInterns",
|
|
55
|
-
oAuth2Scopes: null,
|
|
56
|
-
resolvedSecurity: requestSecurity,
|
|
57
|
-
securitySource: client._options.apiKey,
|
|
58
|
-
retryConfig: options?.retries
|
|
59
|
-
|| client._options.retryConfig
|
|
60
|
-
|| {
|
|
61
|
-
strategy: "backoff",
|
|
62
|
-
backoff: {
|
|
63
|
-
initialInterval: 500,
|
|
64
|
-
maxInterval: 60000,
|
|
65
|
-
exponent: 1.5,
|
|
66
|
-
maxElapsedTime: 3600000,
|
|
67
|
-
},
|
|
68
|
-
retryConnectionErrors: true,
|
|
69
|
-
}
|
|
70
|
-
|| { strategy: "none" },
|
|
71
|
-
retryCodes: options?.retryCodes || ["5XX"],
|
|
72
|
-
};
|
|
73
|
-
const requestRes = client._createRequest(context, {
|
|
74
|
-
security: requestSecurity,
|
|
75
|
-
method: "GET",
|
|
76
|
-
baseURL: options?.serverURL,
|
|
77
|
-
path: path,
|
|
78
|
-
headers: headers,
|
|
79
|
-
query: query,
|
|
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_InternListResponse$inboundSchema), M.jsonErr([400, 401, 403, 404, 408], errors_InternLifecycleError$inboundSchema), M.jsonErr(500, errors_InternLifecycleError$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=internsListInterns.js.map
|
|
@@ -1,21 +0,0 @@
|
|
|
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
|
-
* Provision an intern
|
|
14
|
-
*
|
|
15
|
-
* @remarks
|
|
16
|
-
* Starts the first boot, or resumes an intern after suspension. This operation takes no request body. A body carrying any field is refused with 400 rather than ignored. The API key selects the caller, workspace and visible interns. An intern's own API key sees only that intern: the collection and every other intern answer 404 to it. There is no default workspace fallback. Requests on regional hostnames such as `eu.openrouter.ai` are refused. [API key](/docs/api-reference/authentication) required.
|
|
17
|
-
*
|
|
18
|
-
* If set, this operation will use {@link Security.apiKey} from the global security.
|
|
19
|
-
*/
|
|
20
|
-
export declare function internsProvisionIntern(client: OpenRouterCore, request: operations.ProvisionInternRequest, options?: RequestOptions): APIPromise<Result<models.ProvisionInternResponse, errors.InternLifecycleError | OpenRouterError | ResponseValidationError | ConnectionError | RequestAbortedError | RequestTimeoutError | InvalidRequestError | UnexpectedClientError | SDKValidationError>>;
|
|
21
|
-
//# sourceMappingURL=internsProvisionIntern.d.ts.map
|
|
@@ -1,105 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
-
* @generated-id: 38001699f102
|
|
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 { InternLifecycleError$inboundSchema as errors_InternLifecycleError$inboundSchema } from "../models/errors/internlifecycleerror.js";
|
|
13
|
-
import { ProvisionInternResponse$inboundSchema as models_ProvisionInternResponse$inboundSchema } from "../models/provisioninternresponse.js";
|
|
14
|
-
import { ProvisionInternRequest$outboundSchema as operations_ProvisionInternRequest$outboundSchema } from "../models/operations/provisionintern.js";
|
|
15
|
-
import { APIPromise } from "../types/async.js";
|
|
16
|
-
/**
|
|
17
|
-
* Provision an intern
|
|
18
|
-
*
|
|
19
|
-
* @remarks
|
|
20
|
-
* Starts the first boot, or resumes an intern after suspension. This operation takes no request body. A body carrying any field is refused with 400 rather than ignored. The API key selects the caller, workspace and visible interns. An intern's own API key sees only that intern: the collection and every other intern answer 404 to it. There is no default workspace fallback. Requests on regional hostnames such as `eu.openrouter.ai` are refused. [API key](/docs/api-reference/authentication) required.
|
|
21
|
-
*
|
|
22
|
-
* If set, this operation will use {@link Security.apiKey} from the global security.
|
|
23
|
-
*/
|
|
24
|
-
export function internsProvisionIntern(client, request, options) {
|
|
25
|
-
return new APIPromise($do(client, request, options));
|
|
26
|
-
}
|
|
27
|
-
async function $do(client, request, options) {
|
|
28
|
-
const parsed = safeParse(request, (value) => operations_ProvisionInternRequest$outboundSchema.parse(value), "Input validation failed");
|
|
29
|
-
if (!parsed.ok) {
|
|
30
|
-
return [parsed, { status: "invalid" }];
|
|
31
|
-
}
|
|
32
|
-
const payload = parsed.value;
|
|
33
|
-
const body = null;
|
|
34
|
-
const pathParams = {
|
|
35
|
-
internId: encodeSimple("internId", payload.internId, {
|
|
36
|
-
explode: false,
|
|
37
|
-
charEncoding: "percent",
|
|
38
|
-
}),
|
|
39
|
-
};
|
|
40
|
-
const path = pathToFunc("/interns/{internId}/provision")(pathParams);
|
|
41
|
-
const headers = new Headers(compactMap({
|
|
42
|
-
Accept: "application/json",
|
|
43
|
-
"HTTP-Referer": encodeSimple("HTTP-Referer", payload["HTTP-Referer"] ?? client._options.httpReferer, { explode: false, charEncoding: "none" }),
|
|
44
|
-
"X-OpenRouter-Categories": encodeSimple("X-OpenRouter-Categories", payload.appCategories ?? client._options.appCategories, { explode: false, charEncoding: "none" }),
|
|
45
|
-
"X-OpenRouter-Title": encodeSimple("X-OpenRouter-Title", payload.appTitle ?? client._options.appTitle, { explode: false, charEncoding: "none" }),
|
|
46
|
-
}));
|
|
47
|
-
const secConfig = await extractSecurity(client._options.apiKey);
|
|
48
|
-
const securityInput = secConfig == null ? {} : { apiKey: secConfig };
|
|
49
|
-
const requestSecurity = resolveGlobalSecurity(securityInput, [0]);
|
|
50
|
-
const context = {
|
|
51
|
-
options: client._options,
|
|
52
|
-
baseURL: options?.serverURL ?? client._baseURL ?? "",
|
|
53
|
-
operationID: "provisionIntern",
|
|
54
|
-
oAuth2Scopes: null,
|
|
55
|
-
resolvedSecurity: requestSecurity,
|
|
56
|
-
securitySource: client._options.apiKey,
|
|
57
|
-
retryConfig: options?.retries
|
|
58
|
-
|| client._options.retryConfig
|
|
59
|
-
|| {
|
|
60
|
-
strategy: "backoff",
|
|
61
|
-
backoff: {
|
|
62
|
-
initialInterval: 500,
|
|
63
|
-
maxInterval: 60000,
|
|
64
|
-
exponent: 1.5,
|
|
65
|
-
maxElapsedTime: 3600000,
|
|
66
|
-
},
|
|
67
|
-
retryConnectionErrors: true,
|
|
68
|
-
}
|
|
69
|
-
|| { strategy: "none" },
|
|
70
|
-
retryCodes: options?.retryCodes || ["5XX"],
|
|
71
|
-
};
|
|
72
|
-
const requestRes = client._createRequest(context, {
|
|
73
|
-
security: requestSecurity,
|
|
74
|
-
method: "POST",
|
|
75
|
-
baseURL: options?.serverURL,
|
|
76
|
-
path: path,
|
|
77
|
-
headers: headers,
|
|
78
|
-
body: body,
|
|
79
|
-
userAgent: client._options.userAgent,
|
|
80
|
-
timeoutMs: options?.timeoutMs || client._options.timeoutMs || -1,
|
|
81
|
-
}, options);
|
|
82
|
-
if (!requestRes.ok) {
|
|
83
|
-
return [requestRes, { status: "invalid" }];
|
|
84
|
-
}
|
|
85
|
-
const req = requestRes.value;
|
|
86
|
-
const doResult = await client._do(req, {
|
|
87
|
-
context,
|
|
88
|
-
isErrorStatusCode: (statusCode) => matchStatusCode({ status: statusCode }, ["4XX", "5XX"]),
|
|
89
|
-
retryConfig: context.retryConfig,
|
|
90
|
-
retryCodes: context.retryCodes,
|
|
91
|
-
});
|
|
92
|
-
if (!doResult.ok) {
|
|
93
|
-
return [doResult, { status: "request-error", request: req }];
|
|
94
|
-
}
|
|
95
|
-
const response = doResult.value;
|
|
96
|
-
const responseFields = {
|
|
97
|
-
HttpMeta: { Response: response, Request: req },
|
|
98
|
-
};
|
|
99
|
-
const [result] = await M.match(M.json(202, models_ProvisionInternResponse$inboundSchema), M.jsonErr([400, 401, 403, 404, 408, 409, 413, 415], errors_InternLifecycleError$inboundSchema), M.jsonErr([500, 502], errors_InternLifecycleError$inboundSchema), M.fail("4XX"), M.fail("5XX"))(response, req, { extraFields: responseFields });
|
|
100
|
-
if (!result.ok) {
|
|
101
|
-
return [result, { status: "complete", request: req, response }];
|
|
102
|
-
}
|
|
103
|
-
return [result, { status: "complete", request: req, response }];
|
|
104
|
-
}
|
|
105
|
-
//# sourceMappingURL=internsProvisionIntern.js.map
|