@openrouter/sdk 0.12.16 → 0.12.18
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/generationsGetGeneration.d.ts +2 -1
- package/esm/funcs/generationsGetGeneration.js +2 -1
- package/esm/funcs/generationsListGenerationContent.d.ts +16 -0
- package/esm/funcs/generationsListGenerationContent.js +108 -0
- package/esm/funcs/ttsCreateSpeech.d.ts +1 -1
- package/esm/funcs/ttsCreateSpeech.js +6 -6
- package/esm/funcs/workspacesBulkAddMembers.d.ts +19 -0
- package/esm/funcs/workspacesBulkAddMembers.js +105 -0
- package/esm/funcs/workspacesBulkRemoveMembers.d.ts +19 -0
- package/esm/funcs/workspacesBulkRemoveMembers.js +105 -0
- package/esm/funcs/workspacesCreate.d.ts +19 -0
- package/esm/funcs/workspacesCreate.js +99 -0
- package/esm/funcs/workspacesDelete.d.ts +19 -0
- package/esm/funcs/workspacesDelete.js +102 -0
- package/esm/funcs/workspacesGet.d.ts +19 -0
- package/esm/funcs/workspacesGet.js +102 -0
- package/esm/funcs/workspacesList.d.ts +21 -0
- package/esm/funcs/workspacesList.js +133 -0
- package/esm/funcs/workspacesUpdate.d.ts +19 -0
- package/esm/funcs/workspacesUpdate.js +105 -0
- package/esm/lib/config.d.ts +2 -2
- package/esm/lib/config.js +2 -2
- package/esm/models/bulkaddworkspacemembersrequest.d.ts +15 -0
- package/esm/models/bulkaddworkspacemembersrequest.js +18 -0
- package/esm/models/bulkaddworkspacemembersresponse.d.ts +18 -0
- package/esm/models/bulkaddworkspacemembersresponse.js +21 -0
- package/esm/models/bulkremoveworkspacemembersrequest.d.ts +15 -0
- package/esm/models/bulkremoveworkspacemembersrequest.js +18 -0
- package/esm/models/bulkremoveworkspacemembersresponse.d.ts +13 -0
- package/esm/models/bulkremoveworkspacemembersresponse.js +19 -0
- package/esm/models/chatrequest.d.ts +5 -4
- package/esm/models/chatrequest.js +3 -0
- package/esm/models/createworkspacerequest.d.ts +55 -0
- package/esm/models/createworkspacerequest.js +31 -0
- package/esm/models/createworkspaceresponse.d.ts +11 -0
- package/esm/models/createworkspaceresponse.js +15 -0
- package/esm/models/deleteworkspaceresponse.d.ts +13 -0
- package/esm/models/deleteworkspaceresponse.js +14 -0
- package/esm/models/generationcontentdata.d.ts +55 -0
- package/esm/models/generationcontentdata.js +45 -0
- package/esm/models/generationcontentresponse.d.ts +17 -0
- package/esm/models/generationcontentresponse.js +15 -0
- package/esm/models/generationresponse.d.ts +198 -0
- package/esm/models/generationresponse.js +109 -0
- package/esm/models/getworkspaceresponse.d.ts +11 -0
- package/esm/models/getworkspaceresponse.js +15 -0
- package/esm/models/index.d.ts +18 -0
- package/esm/models/index.js +18 -0
- package/esm/models/listworkspacesresponse.d.ts +18 -0
- package/esm/models/listworkspacesresponse.js +21 -0
- package/esm/models/modelscountresponse.d.ts +4 -4
- package/esm/models/modelscountresponse.js +4 -4
- package/esm/models/operations/bulkaddworkspacemembers.d.ts +61 -0
- package/esm/models/operations/bulkaddworkspacemembers.js +24 -0
- package/esm/models/operations/bulkremoveworkspacemembers.d.ts +61 -0
- package/esm/models/operations/bulkremoveworkspacemembers.js +24 -0
- package/esm/models/operations/createaudiospeech.d.ts +56 -0
- package/esm/models/operations/createaudiospeech.js +23 -0
- package/esm/models/operations/createworkspace.d.ts +56 -0
- package/esm/models/operations/createworkspace.js +23 -0
- package/esm/models/operations/deleteworkspace.d.ts +58 -0
- package/esm/models/operations/deleteworkspace.js +21 -0
- package/esm/models/operations/getgeneration.d.ts +0 -196
- package/esm/models/operations/getgeneration.js +0 -102
- package/esm/models/operations/getworkspace.d.ts +58 -0
- package/esm/models/operations/getworkspace.js +21 -0
- package/esm/models/operations/index.d.ts +9 -1
- package/esm/models/operations/index.js +9 -1
- package/esm/models/operations/listgenerationcontent.d.ts +58 -0
- package/esm/models/operations/listgenerationcontent.js +21 -0
- package/esm/models/operations/listworkspaces.d.ts +72 -0
- package/esm/models/operations/listworkspaces.js +35 -0
- package/esm/models/operations/updateworkspace.d.ts +61 -0
- package/esm/models/operations/updateworkspace.js +24 -0
- package/esm/models/paretorouterplugin.d.ts +22 -0
- package/esm/models/paretorouterplugin.js +20 -0
- package/esm/models/responsesrequest.d.ts +5 -4
- package/esm/models/responsesrequest.js +3 -0
- package/esm/models/{operations/createtts.d.ts → speechrequest.d.ts} +23 -76
- package/esm/models/{operations/createtts.js → speechrequest.js} +18 -35
- package/esm/models/updateworkspacerequest.d.ts +55 -0
- package/esm/models/updateworkspacerequest.js +31 -0
- package/esm/models/updateworkspaceresponse.d.ts +11 -0
- package/esm/models/updateworkspaceresponse.js +15 -0
- package/esm/models/videogenerationrequest.d.ts +12 -12
- package/esm/models/videogenerationrequest.js +10 -10
- package/esm/models/workspace.d.ts +61 -0
- package/esm/models/workspace.js +39 -0
- package/esm/models/workspacemember.d.ts +43 -0
- package/esm/models/workspacemember.js +35 -0
- package/esm/sdk/generations.d.ts +6 -1
- package/esm/sdk/generations.js +7 -0
- package/esm/sdk/sdk.d.ts +5 -2
- package/esm/sdk/sdk.js +7 -3
- package/esm/sdk/tts.d.ts +1 -1
- package/esm/sdk/workspaces.d.ts +58 -0
- package/esm/sdk/workspaces.js +80 -0
- package/jsr.json +1 -1
- package/package.json +5 -5
|
@@ -5,11 +5,12 @@ import * as errors from "../models/errors/index.js";
|
|
|
5
5
|
import { OpenRouterError } from "../models/errors/openroutererror.js";
|
|
6
6
|
import { ResponseValidationError } from "../models/errors/responsevalidationerror.js";
|
|
7
7
|
import { SDKValidationError } from "../models/errors/sdkvalidationerror.js";
|
|
8
|
+
import * as models from "../models/index.js";
|
|
8
9
|
import * as operations from "../models/operations/index.js";
|
|
9
10
|
import { APIPromise } from "../types/async.js";
|
|
10
11
|
import { Result } from "../types/fp.js";
|
|
11
12
|
/**
|
|
12
13
|
* Get request & usage metadata for a generation
|
|
13
14
|
*/
|
|
14
|
-
export declare function generationsGetGeneration(client: OpenRouterCore, request: operations.GetGenerationRequest, options?: RequestOptions): APIPromise<Result<
|
|
15
|
+
export declare function generationsGetGeneration(client: OpenRouterCore, request: operations.GetGenerationRequest, options?: RequestOptions): APIPromise<Result<models.GenerationResponse, errors.UnauthorizedResponseError | errors.PaymentRequiredResponseError | errors.NotFoundResponseError | errors.TooManyRequestsResponseError | errors.InternalServerResponseError | errors.BadGatewayResponseError | errors.EdgeNetworkTimeoutResponseError | errors.ProviderOverloadedResponseError | OpenRouterError | ResponseValidationError | ConnectionError | RequestAbortedError | RequestTimeoutError | InvalidRequestError | UnexpectedClientError | SDKValidationError>>;
|
|
15
16
|
//# sourceMappingURL=generationsGetGeneration.d.ts.map
|
|
@@ -9,6 +9,7 @@ import { safeParse } from "../lib/schemas.js";
|
|
|
9
9
|
import { extractSecurity, resolveGlobalSecurity } from "../lib/security.js";
|
|
10
10
|
import { pathToFunc } from "../lib/url.js";
|
|
11
11
|
import * as errors from "../models/errors/index.js";
|
|
12
|
+
import * as models from "../models/index.js";
|
|
12
13
|
import * as operations from "../models/operations/index.js";
|
|
13
14
|
import { APIPromise } from "../types/async.js";
|
|
14
15
|
/**
|
|
@@ -98,7 +99,7 @@ async function $do(client, request, options) {
|
|
|
98
99
|
const responseFields = {
|
|
99
100
|
HttpMeta: { Response: response, Request: req },
|
|
100
101
|
};
|
|
101
|
-
const [result] = await M.match(M.json(200,
|
|
102
|
+
const [result] = await M.match(M.json(200, models.GenerationResponse$inboundSchema), M.jsonErr(401, errors.UnauthorizedResponseError$inboundSchema), M.jsonErr(402, errors.PaymentRequiredResponseError$inboundSchema), M.jsonErr(404, errors.NotFoundResponseError$inboundSchema), M.jsonErr(429, errors.TooManyRequestsResponseError$inboundSchema), M.jsonErr(500, errors.InternalServerResponseError$inboundSchema), M.jsonErr(502, errors.BadGatewayResponseError$inboundSchema), M.jsonErr(524, errors.EdgeNetworkTimeoutResponseError$inboundSchema), M.jsonErr(529, errors.ProviderOverloadedResponseError$inboundSchema), M.fail("4XX"), M.fail("5XX"))(response, req, { extraFields: responseFields });
|
|
102
103
|
if (!result.ok) {
|
|
103
104
|
return [result, { status: "complete", request: req, response }];
|
|
104
105
|
}
|
|
@@ -0,0 +1,16 @@
|
|
|
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
|
+
* Get stored prompt and completion content for a generation
|
|
14
|
+
*/
|
|
15
|
+
export declare function generationsListGenerationContent(client: OpenRouterCore, request: operations.ListGenerationContentRequest, options?: RequestOptions): APIPromise<Result<models.GenerationContentResponse, errors.UnauthorizedResponseError | errors.ForbiddenResponseError | errors.NotFoundResponseError | errors.TooManyRequestsResponseError | errors.InternalServerResponseError | errors.BadGatewayResponseError | errors.EdgeNetworkTimeoutResponseError | errors.ProviderOverloadedResponseError | OpenRouterError | ResponseValidationError | ConnectionError | RequestAbortedError | RequestTimeoutError | InvalidRequestError | UnexpectedClientError | SDKValidationError>>;
|
|
16
|
+
//# sourceMappingURL=generationsListGenerationContent.d.ts.map
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
+
* @generated-id: 6528b91d944c
|
|
4
|
+
*/
|
|
5
|
+
import { encodeFormQuery, encodeSimple } from "../lib/encodings.js";
|
|
6
|
+
import * as M from "../lib/matchers.js";
|
|
7
|
+
import { compactMap } from "../lib/primitives.js";
|
|
8
|
+
import { safeParse } from "../lib/schemas.js";
|
|
9
|
+
import { extractSecurity, resolveGlobalSecurity } from "../lib/security.js";
|
|
10
|
+
import { pathToFunc } from "../lib/url.js";
|
|
11
|
+
import * as errors from "../models/errors/index.js";
|
|
12
|
+
import * as models from "../models/index.js";
|
|
13
|
+
import * as operations from "../models/operations/index.js";
|
|
14
|
+
import { APIPromise } from "../types/async.js";
|
|
15
|
+
/**
|
|
16
|
+
* Get stored prompt and completion content for a generation
|
|
17
|
+
*/
|
|
18
|
+
export function generationsListGenerationContent(client, request, options) {
|
|
19
|
+
return new APIPromise($do(client, request, options));
|
|
20
|
+
}
|
|
21
|
+
async function $do(client, request, options) {
|
|
22
|
+
const parsed = safeParse(request, (value) => operations.ListGenerationContentRequest$outboundSchema.parse(value), "Input validation failed");
|
|
23
|
+
if (!parsed.ok) {
|
|
24
|
+
return [parsed, { status: "invalid" }];
|
|
25
|
+
}
|
|
26
|
+
const payload = parsed.value;
|
|
27
|
+
const body = null;
|
|
28
|
+
const path = pathToFunc("/generation/content")();
|
|
29
|
+
const query = encodeFormQuery({
|
|
30
|
+
"id": payload.id,
|
|
31
|
+
});
|
|
32
|
+
const headers = new Headers(compactMap({
|
|
33
|
+
Accept: "application/json",
|
|
34
|
+
"HTTP-Referer": encodeSimple("HTTP-Referer", payload["HTTP-Referer"] ?? client._options.httpReferer, { explode: false, charEncoding: "none" }),
|
|
35
|
+
"X-OpenRouter-Categories": encodeSimple("X-OpenRouter-Categories", payload.appCategories ?? client._options.appCategories, { explode: false, charEncoding: "none" }),
|
|
36
|
+
"X-OpenRouter-Title": encodeSimple("X-OpenRouter-Title", payload.appTitle ?? client._options.appTitle, { explode: false, charEncoding: "none" }),
|
|
37
|
+
}));
|
|
38
|
+
const secConfig = await extractSecurity(client._options.apiKey);
|
|
39
|
+
const securityInput = secConfig == null ? {} : { apiKey: secConfig };
|
|
40
|
+
const requestSecurity = resolveGlobalSecurity(securityInput);
|
|
41
|
+
const context = {
|
|
42
|
+
options: client._options,
|
|
43
|
+
baseURL: options?.serverURL ?? client._baseURL ?? "",
|
|
44
|
+
operationID: "listGenerationContent",
|
|
45
|
+
oAuth2Scopes: null,
|
|
46
|
+
resolvedSecurity: requestSecurity,
|
|
47
|
+
securitySource: client._options.apiKey,
|
|
48
|
+
retryConfig: options?.retries
|
|
49
|
+
|| client._options.retryConfig
|
|
50
|
+
|| {
|
|
51
|
+
strategy: "backoff",
|
|
52
|
+
backoff: {
|
|
53
|
+
initialInterval: 500,
|
|
54
|
+
maxInterval: 60000,
|
|
55
|
+
exponent: 1.5,
|
|
56
|
+
maxElapsedTime: 3600000,
|
|
57
|
+
},
|
|
58
|
+
retryConnectionErrors: true,
|
|
59
|
+
}
|
|
60
|
+
|| { strategy: "none" },
|
|
61
|
+
retryCodes: options?.retryCodes || ["5XX"],
|
|
62
|
+
};
|
|
63
|
+
const requestRes = client._createRequest(context, {
|
|
64
|
+
security: requestSecurity,
|
|
65
|
+
method: "GET",
|
|
66
|
+
baseURL: options?.serverURL,
|
|
67
|
+
path: path,
|
|
68
|
+
headers: headers,
|
|
69
|
+
query: query,
|
|
70
|
+
body: body,
|
|
71
|
+
userAgent: client._options.userAgent,
|
|
72
|
+
timeoutMs: options?.timeoutMs || client._options.timeoutMs || -1,
|
|
73
|
+
}, options);
|
|
74
|
+
if (!requestRes.ok) {
|
|
75
|
+
return [requestRes, { status: "invalid" }];
|
|
76
|
+
}
|
|
77
|
+
const req = requestRes.value;
|
|
78
|
+
const doResult = await client._do(req, {
|
|
79
|
+
context,
|
|
80
|
+
errorCodes: [
|
|
81
|
+
"401",
|
|
82
|
+
"403",
|
|
83
|
+
"404",
|
|
84
|
+
"429",
|
|
85
|
+
"4XX",
|
|
86
|
+
"500",
|
|
87
|
+
"502",
|
|
88
|
+
"524",
|
|
89
|
+
"529",
|
|
90
|
+
"5XX",
|
|
91
|
+
],
|
|
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.GenerationContentResponse$inboundSchema), M.jsonErr(401, errors.UnauthorizedResponseError$inboundSchema), M.jsonErr(403, errors.ForbiddenResponseError$inboundSchema), M.jsonErr(404, errors.NotFoundResponseError$inboundSchema), M.jsonErr(429, errors.TooManyRequestsResponseError$inboundSchema), M.jsonErr(500, errors.InternalServerResponseError$inboundSchema), M.jsonErr(502, errors.BadGatewayResponseError$inboundSchema), M.jsonErr(524, errors.EdgeNetworkTimeoutResponseError$inboundSchema), M.jsonErr(529, errors.ProviderOverloadedResponseError$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=generationsListGenerationContent.js.map
|
|
@@ -14,5 +14,5 @@ import { Result } from "../types/fp.js";
|
|
|
14
14
|
* @remarks
|
|
15
15
|
* Synthesizes audio from the input text
|
|
16
16
|
*/
|
|
17
|
-
export declare function ttsCreateSpeech(client: OpenRouterCore, request: operations.
|
|
17
|
+
export declare function ttsCreateSpeech(client: OpenRouterCore, request: operations.CreateAudioSpeechRequest, options?: RequestOptions): APIPromise<Result<ReadableStream<Uint8Array>, errors.BadRequestResponseError | errors.UnauthorizedResponseError | errors.PaymentRequiredResponseError | errors.NotFoundResponseError | errors.TooManyRequestsResponseError | errors.InternalServerResponseError | errors.BadGatewayResponseError | errors.ServiceUnavailableResponseError | errors.EdgeNetworkTimeoutResponseError | errors.ProviderOverloadedResponseError | OpenRouterError | ResponseValidationError | ConnectionError | RequestAbortedError | RequestTimeoutError | InvalidRequestError | UnexpectedClientError | SDKValidationError>>;
|
|
18
18
|
//# sourceMappingURL=ttsCreateSpeech.d.ts.map
|
|
@@ -22,16 +22,16 @@ export function ttsCreateSpeech(client, request, options) {
|
|
|
22
22
|
return new APIPromise($do(client, request, options));
|
|
23
23
|
}
|
|
24
24
|
async function $do(client, request, options) {
|
|
25
|
-
const parsed = safeParse(request, (value) => operations.
|
|
25
|
+
const parsed = safeParse(request, (value) => operations.CreateAudioSpeechRequest$outboundSchema.parse(value), "Input validation failed");
|
|
26
26
|
if (!parsed.ok) {
|
|
27
27
|
return [parsed, { status: "invalid" }];
|
|
28
28
|
}
|
|
29
29
|
const payload = parsed.value;
|
|
30
|
-
const body = encodeJSON("body", payload.
|
|
31
|
-
const path = pathToFunc("/
|
|
30
|
+
const body = encodeJSON("body", payload.SpeechRequest, { explode: true });
|
|
31
|
+
const path = pathToFunc("/audio/speech")();
|
|
32
32
|
const headers = new Headers(compactMap({
|
|
33
33
|
"Content-Type": "application/json",
|
|
34
|
-
Accept: "
|
|
34
|
+
Accept: "audio/*",
|
|
35
35
|
"HTTP-Referer": encodeSimple("HTTP-Referer", payload["HTTP-Referer"] ?? client._options.httpReferer, { explode: false, charEncoding: "none" }),
|
|
36
36
|
"X-OpenRouter-Categories": encodeSimple("X-OpenRouter-Categories", payload.appCategories ?? client._options.appCategories, { explode: false, charEncoding: "none" }),
|
|
37
37
|
"X-OpenRouter-Title": encodeSimple("X-OpenRouter-Title", payload.appTitle ?? client._options.appTitle, { explode: false, charEncoding: "none" }),
|
|
@@ -42,7 +42,7 @@ async function $do(client, request, options) {
|
|
|
42
42
|
const context = {
|
|
43
43
|
options: client._options,
|
|
44
44
|
baseURL: options?.serverURL ?? client._baseURL ?? "",
|
|
45
|
-
operationID: "
|
|
45
|
+
operationID: "createAudioSpeech",
|
|
46
46
|
oAuth2Scopes: null,
|
|
47
47
|
resolvedSecurity: requestSecurity,
|
|
48
48
|
securitySource: client._options.apiKey,
|
|
@@ -101,7 +101,7 @@ async function $do(client, request, options) {
|
|
|
101
101
|
const responseFields = {
|
|
102
102
|
HttpMeta: { Response: response, Request: req },
|
|
103
103
|
};
|
|
104
|
-
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(402, errors.PaymentRequiredResponseError$inboundSchema), M.jsonErr(404, errors.NotFoundResponseError$inboundSchema), M.jsonErr(429, errors.TooManyRequestsResponseError$inboundSchema), M.jsonErr(500, errors.InternalServerResponseError$inboundSchema), M.jsonErr(502, errors.BadGatewayResponseError$inboundSchema), M.jsonErr(503, errors.ServiceUnavailableResponseError$inboundSchema), M.jsonErr(524, errors.EdgeNetworkTimeoutResponseError$inboundSchema), M.jsonErr(529, errors.ProviderOverloadedResponseError$inboundSchema), M.fail("4XX"), M.fail("5XX"))(response, req, { extraFields: responseFields });
|
|
104
|
+
const [result] = await M.match(M.stream(200, z.custom(x => x instanceof ReadableStream), { ctype: "audio/*" }), M.jsonErr(400, errors.BadRequestResponseError$inboundSchema), M.jsonErr(401, errors.UnauthorizedResponseError$inboundSchema), M.jsonErr(402, errors.PaymentRequiredResponseError$inboundSchema), M.jsonErr(404, errors.NotFoundResponseError$inboundSchema), M.jsonErr(429, errors.TooManyRequestsResponseError$inboundSchema), M.jsonErr(500, errors.InternalServerResponseError$inboundSchema), M.jsonErr(502, errors.BadGatewayResponseError$inboundSchema), M.jsonErr(503, errors.ServiceUnavailableResponseError$inboundSchema), M.jsonErr(524, errors.EdgeNetworkTimeoutResponseError$inboundSchema), M.jsonErr(529, errors.ProviderOverloadedResponseError$inboundSchema), M.fail("4XX"), M.fail("5XX"))(response, req, { extraFields: responseFields });
|
|
105
105
|
if (!result.ok) {
|
|
106
106
|
return [result, { status: "complete", request: req, response }];
|
|
107
107
|
}
|
|
@@ -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
|
+
* Bulk add members to a workspace
|
|
14
|
+
*
|
|
15
|
+
* @remarks
|
|
16
|
+
* Add multiple organization members to a workspace. Members are assigned the same role they hold in the organization. [Management key](/docs/guides/overview/auth/management-api-keys) required.
|
|
17
|
+
*/
|
|
18
|
+
export declare function workspacesBulkAddMembers(client: OpenRouterCore, request: operations.BulkAddWorkspaceMembersRequest, options?: RequestOptions): APIPromise<Result<models.BulkAddWorkspaceMembersResponse, errors.BadRequestResponseError | errors.UnauthorizedResponseError | errors.ForbiddenResponseError | errors.NotFoundResponseError | errors.InternalServerResponseError | OpenRouterError | ResponseValidationError | ConnectionError | RequestAbortedError | RequestTimeoutError | InvalidRequestError | UnexpectedClientError | SDKValidationError>>;
|
|
19
|
+
//# sourceMappingURL=workspacesBulkAddMembers.d.ts.map
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
+
* @generated-id: e3a7d4fe9fce
|
|
4
|
+
*/
|
|
5
|
+
import { encodeJSON, encodeSimple } from "../lib/encodings.js";
|
|
6
|
+
import * as M from "../lib/matchers.js";
|
|
7
|
+
import { compactMap } from "../lib/primitives.js";
|
|
8
|
+
import { safeParse } from "../lib/schemas.js";
|
|
9
|
+
import { extractSecurity, resolveGlobalSecurity } from "../lib/security.js";
|
|
10
|
+
import { pathToFunc } from "../lib/url.js";
|
|
11
|
+
import * as errors from "../models/errors/index.js";
|
|
12
|
+
import * as models from "../models/index.js";
|
|
13
|
+
import * as operations from "../models/operations/index.js";
|
|
14
|
+
import { APIPromise } from "../types/async.js";
|
|
15
|
+
/**
|
|
16
|
+
* Bulk add members to a workspace
|
|
17
|
+
*
|
|
18
|
+
* @remarks
|
|
19
|
+
* Add multiple organization members to a workspace. Members are assigned the same role they hold in the organization. [Management key](/docs/guides/overview/auth/management-api-keys) required.
|
|
20
|
+
*/
|
|
21
|
+
export function workspacesBulkAddMembers(client, request, options) {
|
|
22
|
+
return new APIPromise($do(client, request, options));
|
|
23
|
+
}
|
|
24
|
+
async function $do(client, request, options) {
|
|
25
|
+
const parsed = safeParse(request, (value) => operations.BulkAddWorkspaceMembersRequest$outboundSchema.parse(value), "Input validation failed");
|
|
26
|
+
if (!parsed.ok) {
|
|
27
|
+
return [parsed, { status: "invalid" }];
|
|
28
|
+
}
|
|
29
|
+
const payload = parsed.value;
|
|
30
|
+
const body = encodeJSON("body", payload.BulkAddWorkspaceMembersRequest, {
|
|
31
|
+
explode: true,
|
|
32
|
+
});
|
|
33
|
+
const pathParams = {
|
|
34
|
+
id: encodeSimple("id", payload.id, {
|
|
35
|
+
explode: false,
|
|
36
|
+
charEncoding: "percent",
|
|
37
|
+
}),
|
|
38
|
+
};
|
|
39
|
+
const path = pathToFunc("/workspaces/{id}/members/add")(pathParams);
|
|
40
|
+
const headers = new Headers(compactMap({
|
|
41
|
+
"Content-Type": "application/json",
|
|
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);
|
|
50
|
+
const context = {
|
|
51
|
+
options: client._options,
|
|
52
|
+
baseURL: options?.serverURL ?? client._baseURL ?? "",
|
|
53
|
+
operationID: "bulkAddWorkspaceMembers",
|
|
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
|
+
errorCodes: ["400", "401", "403", "404", "4XX", "500", "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(200, models.BulkAddWorkspaceMembersResponse$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(500, errors.InternalServerResponseError$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=workspacesBulkAddMembers.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
|
+
* Bulk remove members from a workspace
|
|
14
|
+
*
|
|
15
|
+
* @remarks
|
|
16
|
+
* Remove multiple members from a workspace. Members with active API keys in the workspace cannot be removed. [Management key](/docs/guides/overview/auth/management-api-keys) required.
|
|
17
|
+
*/
|
|
18
|
+
export declare function workspacesBulkRemoveMembers(client: OpenRouterCore, request: operations.BulkRemoveWorkspaceMembersRequest, options?: RequestOptions): APIPromise<Result<models.BulkRemoveWorkspaceMembersResponse, errors.BadRequestResponseError | errors.UnauthorizedResponseError | errors.ForbiddenResponseError | errors.NotFoundResponseError | errors.InternalServerResponseError | OpenRouterError | ResponseValidationError | ConnectionError | RequestAbortedError | RequestTimeoutError | InvalidRequestError | UnexpectedClientError | SDKValidationError>>;
|
|
19
|
+
//# sourceMappingURL=workspacesBulkRemoveMembers.d.ts.map
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
+
* @generated-id: 19d95ede0636
|
|
4
|
+
*/
|
|
5
|
+
import { encodeJSON, encodeSimple } from "../lib/encodings.js";
|
|
6
|
+
import * as M from "../lib/matchers.js";
|
|
7
|
+
import { compactMap } from "../lib/primitives.js";
|
|
8
|
+
import { safeParse } from "../lib/schemas.js";
|
|
9
|
+
import { extractSecurity, resolveGlobalSecurity } from "../lib/security.js";
|
|
10
|
+
import { pathToFunc } from "../lib/url.js";
|
|
11
|
+
import * as errors from "../models/errors/index.js";
|
|
12
|
+
import * as models from "../models/index.js";
|
|
13
|
+
import * as operations from "../models/operations/index.js";
|
|
14
|
+
import { APIPromise } from "../types/async.js";
|
|
15
|
+
/**
|
|
16
|
+
* Bulk remove members from a workspace
|
|
17
|
+
*
|
|
18
|
+
* @remarks
|
|
19
|
+
* Remove multiple members from a workspace. Members with active API keys in the workspace cannot be removed. [Management key](/docs/guides/overview/auth/management-api-keys) required.
|
|
20
|
+
*/
|
|
21
|
+
export function workspacesBulkRemoveMembers(client, request, options) {
|
|
22
|
+
return new APIPromise($do(client, request, options));
|
|
23
|
+
}
|
|
24
|
+
async function $do(client, request, options) {
|
|
25
|
+
const parsed = safeParse(request, (value) => operations.BulkRemoveWorkspaceMembersRequest$outboundSchema.parse(value), "Input validation failed");
|
|
26
|
+
if (!parsed.ok) {
|
|
27
|
+
return [parsed, { status: "invalid" }];
|
|
28
|
+
}
|
|
29
|
+
const payload = parsed.value;
|
|
30
|
+
const body = encodeJSON("body", payload.BulkRemoveWorkspaceMembersRequest, {
|
|
31
|
+
explode: true,
|
|
32
|
+
});
|
|
33
|
+
const pathParams = {
|
|
34
|
+
id: encodeSimple("id", payload.id, {
|
|
35
|
+
explode: false,
|
|
36
|
+
charEncoding: "percent",
|
|
37
|
+
}),
|
|
38
|
+
};
|
|
39
|
+
const path = pathToFunc("/workspaces/{id}/members/remove")(pathParams);
|
|
40
|
+
const headers = new Headers(compactMap({
|
|
41
|
+
"Content-Type": "application/json",
|
|
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);
|
|
50
|
+
const context = {
|
|
51
|
+
options: client._options,
|
|
52
|
+
baseURL: options?.serverURL ?? client._baseURL ?? "",
|
|
53
|
+
operationID: "bulkRemoveWorkspaceMembers",
|
|
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
|
+
errorCodes: ["400", "401", "403", "404", "4XX", "500", "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(200, models.BulkRemoveWorkspaceMembersResponse$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(500, errors.InternalServerResponseError$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=workspacesBulkRemoveMembers.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
|
+
* Create a workspace
|
|
14
|
+
*
|
|
15
|
+
* @remarks
|
|
16
|
+
* Create a new workspace for the authenticated user. [Management key](/docs/guides/overview/auth/management-api-keys) required.
|
|
17
|
+
*/
|
|
18
|
+
export declare function workspacesCreate(client: OpenRouterCore, request: operations.CreateWorkspaceRequest, options?: RequestOptions): APIPromise<Result<models.CreateWorkspaceResponse, errors.BadRequestResponseError | errors.UnauthorizedResponseError | errors.ForbiddenResponseError | errors.InternalServerResponseError | OpenRouterError | ResponseValidationError | ConnectionError | RequestAbortedError | RequestTimeoutError | InvalidRequestError | UnexpectedClientError | SDKValidationError>>;
|
|
19
|
+
//# sourceMappingURL=workspacesCreate.d.ts.map
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
+
* @generated-id: 151342b46246
|
|
4
|
+
*/
|
|
5
|
+
import { encodeJSON, encodeSimple } from "../lib/encodings.js";
|
|
6
|
+
import * as M from "../lib/matchers.js";
|
|
7
|
+
import { compactMap } from "../lib/primitives.js";
|
|
8
|
+
import { safeParse } from "../lib/schemas.js";
|
|
9
|
+
import { extractSecurity, resolveGlobalSecurity } from "../lib/security.js";
|
|
10
|
+
import { pathToFunc } from "../lib/url.js";
|
|
11
|
+
import * as errors from "../models/errors/index.js";
|
|
12
|
+
import * as models from "../models/index.js";
|
|
13
|
+
import * as operations from "../models/operations/index.js";
|
|
14
|
+
import { APIPromise } from "../types/async.js";
|
|
15
|
+
/**
|
|
16
|
+
* Create a workspace
|
|
17
|
+
*
|
|
18
|
+
* @remarks
|
|
19
|
+
* Create a new workspace for the authenticated user. [Management key](/docs/guides/overview/auth/management-api-keys) required.
|
|
20
|
+
*/
|
|
21
|
+
export function workspacesCreate(client, request, options) {
|
|
22
|
+
return new APIPromise($do(client, request, options));
|
|
23
|
+
}
|
|
24
|
+
async function $do(client, request, options) {
|
|
25
|
+
const parsed = safeParse(request, (value) => operations.CreateWorkspaceRequest$outboundSchema.parse(value), "Input validation failed");
|
|
26
|
+
if (!parsed.ok) {
|
|
27
|
+
return [parsed, { status: "invalid" }];
|
|
28
|
+
}
|
|
29
|
+
const payload = parsed.value;
|
|
30
|
+
const body = encodeJSON("body", payload.CreateWorkspaceRequest, {
|
|
31
|
+
explode: true,
|
|
32
|
+
});
|
|
33
|
+
const path = pathToFunc("/workspaces")();
|
|
34
|
+
const headers = new Headers(compactMap({
|
|
35
|
+
"Content-Type": "application/json",
|
|
36
|
+
Accept: "application/json",
|
|
37
|
+
"HTTP-Referer": encodeSimple("HTTP-Referer", payload["HTTP-Referer"] ?? client._options.httpReferer, { explode: false, charEncoding: "none" }),
|
|
38
|
+
"X-OpenRouter-Categories": encodeSimple("X-OpenRouter-Categories", payload.appCategories ?? client._options.appCategories, { explode: false, charEncoding: "none" }),
|
|
39
|
+
"X-OpenRouter-Title": encodeSimple("X-OpenRouter-Title", payload.appTitle ?? client._options.appTitle, { explode: false, charEncoding: "none" }),
|
|
40
|
+
}));
|
|
41
|
+
const secConfig = await extractSecurity(client._options.apiKey);
|
|
42
|
+
const securityInput = secConfig == null ? {} : { apiKey: secConfig };
|
|
43
|
+
const requestSecurity = resolveGlobalSecurity(securityInput);
|
|
44
|
+
const context = {
|
|
45
|
+
options: client._options,
|
|
46
|
+
baseURL: options?.serverURL ?? client._baseURL ?? "",
|
|
47
|
+
operationID: "createWorkspace",
|
|
48
|
+
oAuth2Scopes: null,
|
|
49
|
+
resolvedSecurity: requestSecurity,
|
|
50
|
+
securitySource: client._options.apiKey,
|
|
51
|
+
retryConfig: options?.retries
|
|
52
|
+
|| client._options.retryConfig
|
|
53
|
+
|| {
|
|
54
|
+
strategy: "backoff",
|
|
55
|
+
backoff: {
|
|
56
|
+
initialInterval: 500,
|
|
57
|
+
maxInterval: 60000,
|
|
58
|
+
exponent: 1.5,
|
|
59
|
+
maxElapsedTime: 3600000,
|
|
60
|
+
},
|
|
61
|
+
retryConnectionErrors: true,
|
|
62
|
+
}
|
|
63
|
+
|| { strategy: "none" },
|
|
64
|
+
retryCodes: options?.retryCodes || ["5XX"],
|
|
65
|
+
};
|
|
66
|
+
const requestRes = client._createRequest(context, {
|
|
67
|
+
security: requestSecurity,
|
|
68
|
+
method: "POST",
|
|
69
|
+
baseURL: options?.serverURL,
|
|
70
|
+
path: path,
|
|
71
|
+
headers: headers,
|
|
72
|
+
body: body,
|
|
73
|
+
userAgent: client._options.userAgent,
|
|
74
|
+
timeoutMs: options?.timeoutMs || client._options.timeoutMs || -1,
|
|
75
|
+
}, options);
|
|
76
|
+
if (!requestRes.ok) {
|
|
77
|
+
return [requestRes, { status: "invalid" }];
|
|
78
|
+
}
|
|
79
|
+
const req = requestRes.value;
|
|
80
|
+
const doResult = await client._do(req, {
|
|
81
|
+
context,
|
|
82
|
+
errorCodes: ["400", "401", "403", "4XX", "500", "5XX"],
|
|
83
|
+
retryConfig: context.retryConfig,
|
|
84
|
+
retryCodes: context.retryCodes,
|
|
85
|
+
});
|
|
86
|
+
if (!doResult.ok) {
|
|
87
|
+
return [doResult, { status: "request-error", request: req }];
|
|
88
|
+
}
|
|
89
|
+
const response = doResult.value;
|
|
90
|
+
const responseFields = {
|
|
91
|
+
HttpMeta: { Response: response, Request: req },
|
|
92
|
+
};
|
|
93
|
+
const [result] = await M.match(M.json(201, models.CreateWorkspaceResponse$inboundSchema), M.jsonErr(400, errors.BadRequestResponseError$inboundSchema), M.jsonErr(401, errors.UnauthorizedResponseError$inboundSchema), M.jsonErr(403, errors.ForbiddenResponseError$inboundSchema), M.jsonErr(500, errors.InternalServerResponseError$inboundSchema), M.fail("4XX"), M.fail("5XX"))(response, req, { extraFields: responseFields });
|
|
94
|
+
if (!result.ok) {
|
|
95
|
+
return [result, { status: "complete", request: req, response }];
|
|
96
|
+
}
|
|
97
|
+
return [result, { status: "complete", request: req, response }];
|
|
98
|
+
}
|
|
99
|
+
//# sourceMappingURL=workspacesCreate.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
|
+
* Delete a workspace
|
|
14
|
+
*
|
|
15
|
+
* @remarks
|
|
16
|
+
* Delete an existing workspace. The default workspace cannot be deleted. Workspaces with active API keys cannot be deleted. [Management key](/docs/guides/overview/auth/management-api-keys) required.
|
|
17
|
+
*/
|
|
18
|
+
export declare function workspacesDelete(client: OpenRouterCore, request: operations.DeleteWorkspaceRequest, options?: RequestOptions): APIPromise<Result<models.DeleteWorkspaceResponse, errors.BadRequestResponseError | errors.UnauthorizedResponseError | errors.ForbiddenResponseError | errors.NotFoundResponseError | errors.InternalServerResponseError | OpenRouterError | ResponseValidationError | ConnectionError | RequestAbortedError | RequestTimeoutError | InvalidRequestError | UnexpectedClientError | SDKValidationError>>;
|
|
19
|
+
//# sourceMappingURL=workspacesDelete.d.ts.map
|