@openrouter/sdk 0.3.14 → 0.3.15
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/analyticsGetUserActivity.d.ts +1 -1
- package/esm/funcs/analyticsGetUserActivity.js +1 -1
- package/esm/funcs/apiKeysCreate.d.ts +3 -0
- package/esm/funcs/apiKeysCreate.js +3 -0
- package/esm/funcs/apiKeysDelete.d.ts +3 -0
- package/esm/funcs/apiKeysDelete.js +3 -0
- package/esm/funcs/apiKeysGet.d.ts +3 -0
- package/esm/funcs/apiKeysGet.js +3 -0
- package/esm/funcs/apiKeysList.d.ts +3 -0
- package/esm/funcs/apiKeysList.js +3 -0
- package/esm/funcs/apiKeysUpdate.d.ts +3 -0
- package/esm/funcs/apiKeysUpdate.js +3 -0
- package/esm/funcs/call-model.js +9 -6
- package/esm/funcs/creditsGetCredits.d.ts +1 -1
- package/esm/funcs/creditsGetCredits.js +1 -1
- package/esm/funcs/guardrailsBulkAssignKeys.d.ts +18 -0
- package/esm/funcs/guardrailsBulkAssignKeys.js +89 -0
- package/esm/funcs/guardrailsBulkAssignMembers.d.ts +18 -0
- package/esm/funcs/guardrailsBulkAssignMembers.js +89 -0
- package/esm/funcs/guardrailsBulkUnassignKeys.d.ts +18 -0
- package/esm/funcs/guardrailsBulkUnassignKeys.js +89 -0
- package/esm/funcs/guardrailsBulkUnassignMembers.d.ts +18 -0
- package/esm/funcs/guardrailsBulkUnassignMembers.js +89 -0
- package/esm/funcs/guardrailsCreate.d.ts +18 -0
- package/esm/funcs/guardrailsCreate.js +83 -0
- package/esm/funcs/guardrailsDelete.d.ts +18 -0
- package/esm/funcs/guardrailsDelete.js +88 -0
- package/esm/funcs/{parametersGetParameters.d.ts → guardrailsGet.d.ts} +6 -3
- package/esm/funcs/guardrailsGet.js +88 -0
- package/esm/funcs/guardrailsList.d.ts +18 -0
- package/esm/funcs/guardrailsList.js +87 -0
- package/esm/funcs/guardrailsListGuardrailKeyAssignments.d.ts +18 -0
- package/esm/funcs/guardrailsListGuardrailKeyAssignments.js +93 -0
- package/esm/funcs/guardrailsListGuardrailMemberAssignments.d.ts +18 -0
- package/esm/funcs/guardrailsListGuardrailMemberAssignments.js +93 -0
- package/esm/funcs/guardrailsListKeyAssignments.d.ts +18 -0
- package/esm/funcs/guardrailsListKeyAssignments.js +87 -0
- package/esm/funcs/guardrailsListMemberAssignments.d.ts +18 -0
- package/esm/funcs/guardrailsListMemberAssignments.js +87 -0
- package/esm/funcs/guardrailsUpdate.d.ts +18 -0
- package/esm/funcs/{parametersGetParameters.js → guardrailsUpdate.js} +24 -32
- package/esm/index.d.ts +4 -3
- package/esm/index.js +3 -1
- package/esm/lib/async-params.d.ts +46 -6
- package/esm/lib/async-params.js +10 -2
- package/esm/lib/config.d.ts +2 -4
- package/esm/lib/config.js +2 -2
- package/esm/lib/conversation-state.d.ts +61 -0
- package/esm/lib/conversation-state.js +207 -0
- package/esm/lib/model-result.d.ts +175 -2
- package/esm/lib/model-result.js +678 -181
- package/esm/lib/tool-types.d.ts +108 -0
- package/esm/lib/tool-types.js +13 -0
- package/esm/lib/tool.d.ts +21 -1
- package/esm/lib/tool.js +7 -0
- package/esm/models/assistantmessage.d.ts +31 -0
- package/esm/models/assistantmessage.js +43 -0
- package/esm/models/chatmessagecontentitemimage.d.ts +8 -8
- package/esm/models/chatmessagecontentitemimage.js +8 -9
- package/esm/models/chatresponsechoice.d.ts +0 -2
- package/esm/models/chatresponsechoice.js +0 -3
- package/esm/models/chatstreamingmessagechunk.d.ts +2 -2
- package/esm/models/chatstreamingmessagechunk.js +2 -2
- package/esm/models/index.d.ts +1 -1
- package/esm/models/index.js +1 -1
- package/esm/models/model.d.ts +4 -0
- package/esm/models/model.js +2 -0
- package/esm/models/operations/bulkassignkeystoguardrail.d.ts +44 -0
- package/esm/models/operations/bulkassignkeystoguardrail.js +42 -0
- package/esm/models/operations/bulkassignmemberstoguardrail.d.ts +44 -0
- package/esm/models/operations/bulkassignmemberstoguardrail.js +42 -0
- package/esm/models/operations/bulkunassignkeysfromguardrail.d.ts +44 -0
- package/esm/models/operations/bulkunassignkeysfromguardrail.js +42 -0
- package/esm/models/operations/bulkunassignmembersfromguardrail.d.ts +44 -0
- package/esm/models/operations/bulkunassignmembersfromguardrail.js +42 -0
- package/esm/models/operations/createguardrail.d.ts +136 -0
- package/esm/models/operations/createguardrail.js +85 -0
- package/esm/models/operations/deleteguardrail.d.ts +29 -0
- package/esm/models/operations/deleteguardrail.js +21 -0
- package/esm/models/operations/getguardrail.d.ts +92 -0
- package/esm/models/operations/getguardrail.js +60 -0
- package/esm/models/operations/getmodels.d.ts +28 -1
- package/esm/models/operations/getmodels.js +22 -1
- package/esm/models/operations/index.d.ts +13 -1
- package/esm/models/operations/index.js +13 -1
- package/esm/models/operations/listguardrailkeyassignments.d.ts +76 -0
- package/esm/models/operations/listguardrailkeyassignments.js +51 -0
- package/esm/models/operations/listguardrailmemberassignments.d.ts +72 -0
- package/esm/models/operations/listguardrailmemberassignments.js +49 -0
- package/esm/models/operations/listguardrails.d.ts +98 -0
- package/esm/models/operations/listguardrails.js +66 -0
- package/esm/models/operations/listkeyassignments.d.ts +71 -0
- package/esm/models/operations/listkeyassignments.js +50 -0
- package/esm/models/operations/listmemberassignments.d.ts +67 -0
- package/esm/models/operations/listmemberassignments.js +48 -0
- package/esm/models/operations/updateguardrail.d.ts +151 -0
- package/esm/models/operations/updateguardrail.js +97 -0
- package/esm/models/percentilelatencycutoffs.js +1 -1
- package/esm/models/percentilestats.js +1 -1
- package/esm/models/percentilethroughputcutoffs.js +1 -1
- package/esm/models/preferredmaxlatency.js +1 -1
- package/esm/models/preferredminthroughput.js +1 -1
- package/esm/models/responseinputvideo.js +1 -1
- package/esm/models/responsesoutputmodality.js +1 -1
- package/esm/models/schema2.d.ts +92 -0
- package/esm/models/schema2.js +109 -0
- package/esm/sdk/analytics.d.ts +1 -1
- package/esm/sdk/analytics.js +1 -1
- package/esm/sdk/apikeys.d.ts +15 -0
- package/esm/sdk/apikeys.js +15 -0
- package/esm/sdk/credits.d.ts +1 -1
- package/esm/sdk/credits.js +1 -1
- package/esm/sdk/guardrails.d.ts +96 -0
- package/esm/sdk/guardrails.js +139 -0
- package/esm/sdk/sdk.d.ts +3 -3
- package/esm/sdk/sdk.js +4 -4
- package/esm/types/index.d.ts +2 -0
- package/esm/types/index.js +1 -0
- package/esm/types/models.d.ts +25 -0
- package/esm/types/models.js +10 -0
- package/jsr.json +1 -1
- package/package.json +12 -10
- package/scripts/check-types.js +127 -0
- package/esm/models/operations/getparameters.d.ts +0 -87
- package/esm/models/operations/getparameters.js +0 -73
- package/esm/models/schema3.d.ts +0 -51
- package/esm/models/schema3.js +0 -62
- package/esm/sdk/parameters.d.ts +0 -9
- package/esm/sdk/parameters.js +0 -16
|
@@ -12,7 +12,7 @@ import { Result } from "../types/fp.js";
|
|
|
12
12
|
* Get user activity grouped by endpoint
|
|
13
13
|
*
|
|
14
14
|
* @remarks
|
|
15
|
-
* Returns user activity data grouped by endpoint for the last 30 (completed) UTC days
|
|
15
|
+
* Returns user activity data grouped by endpoint for the last 30 (completed) UTC days. [Provisioning key](/docs/guides/overview/auth/provisioning-api-keys) required.
|
|
16
16
|
*/
|
|
17
17
|
export declare function analyticsGetUserActivity(client: OpenRouterCore, request?: operations.GetUserActivityRequest | undefined, options?: RequestOptions): APIPromise<Result<operations.GetUserActivityResponse, errors.BadRequestResponseError | errors.UnauthorizedResponseError | errors.ForbiddenResponseError | errors.InternalServerResponseError | OpenRouterError | ResponseValidationError | ConnectionError | RequestAbortedError | RequestTimeoutError | InvalidRequestError | UnexpectedClientError | SDKValidationError>>;
|
|
18
18
|
//# sourceMappingURL=analyticsGetUserActivity.d.ts.map
|
|
@@ -15,7 +15,7 @@ import { APIPromise } from "../types/async.js";
|
|
|
15
15
|
* Get user activity grouped by endpoint
|
|
16
16
|
*
|
|
17
17
|
* @remarks
|
|
18
|
-
* Returns user activity data grouped by endpoint for the last 30 (completed) UTC days
|
|
18
|
+
* Returns user activity data grouped by endpoint for the last 30 (completed) UTC days. [Provisioning key](/docs/guides/overview/auth/provisioning-api-keys) required.
|
|
19
19
|
*/
|
|
20
20
|
export function analyticsGetUserActivity(client, request, options) {
|
|
21
21
|
return new APIPromise($do(client, request, options));
|
|
@@ -10,6 +10,9 @@ import { APIPromise } from "../types/async.js";
|
|
|
10
10
|
import { Result } from "../types/fp.js";
|
|
11
11
|
/**
|
|
12
12
|
* Create a new API key
|
|
13
|
+
*
|
|
14
|
+
* @remarks
|
|
15
|
+
* Create a new API key for the authenticated user. [Provisioning key](/docs/guides/overview/auth/provisioning-api-keys) required.
|
|
13
16
|
*/
|
|
14
17
|
export declare function apiKeysCreate(client: OpenRouterCore, request: operations.CreateKeysRequest, options?: RequestOptions): APIPromise<Result<operations.CreateKeysResponse, errors.BadRequestResponseError | errors.UnauthorizedResponseError | errors.TooManyRequestsResponseError | errors.InternalServerResponseError | OpenRouterError | ResponseValidationError | ConnectionError | RequestAbortedError | RequestTimeoutError | InvalidRequestError | UnexpectedClientError | SDKValidationError>>;
|
|
15
18
|
//# sourceMappingURL=apiKeysCreate.d.ts.map
|
|
@@ -13,6 +13,9 @@ import * as operations from "../models/operations/index.js";
|
|
|
13
13
|
import { APIPromise } from "../types/async.js";
|
|
14
14
|
/**
|
|
15
15
|
* Create a new API key
|
|
16
|
+
*
|
|
17
|
+
* @remarks
|
|
18
|
+
* Create a new API key for the authenticated user. [Provisioning key](/docs/guides/overview/auth/provisioning-api-keys) required.
|
|
16
19
|
*/
|
|
17
20
|
export function apiKeysCreate(client, request, options) {
|
|
18
21
|
return new APIPromise($do(client, request, options));
|
|
@@ -10,6 +10,9 @@ import { APIPromise } from "../types/async.js";
|
|
|
10
10
|
import { Result } from "../types/fp.js";
|
|
11
11
|
/**
|
|
12
12
|
* Delete an API key
|
|
13
|
+
*
|
|
14
|
+
* @remarks
|
|
15
|
+
* Delete an existing API key. [Provisioning key](/docs/guides/overview/auth/provisioning-api-keys) required.
|
|
13
16
|
*/
|
|
14
17
|
export declare function apiKeysDelete(client: OpenRouterCore, request: operations.DeleteKeysRequest, options?: RequestOptions): APIPromise<Result<operations.DeleteKeysResponse, errors.UnauthorizedResponseError | errors.NotFoundResponseError | errors.TooManyRequestsResponseError | errors.InternalServerResponseError | OpenRouterError | ResponseValidationError | ConnectionError | RequestAbortedError | RequestTimeoutError | InvalidRequestError | UnexpectedClientError | SDKValidationError>>;
|
|
15
18
|
//# sourceMappingURL=apiKeysDelete.d.ts.map
|
|
@@ -13,6 +13,9 @@ import * as operations from "../models/operations/index.js";
|
|
|
13
13
|
import { APIPromise } from "../types/async.js";
|
|
14
14
|
/**
|
|
15
15
|
* Delete an API key
|
|
16
|
+
*
|
|
17
|
+
* @remarks
|
|
18
|
+
* Delete an existing API key. [Provisioning key](/docs/guides/overview/auth/provisioning-api-keys) required.
|
|
16
19
|
*/
|
|
17
20
|
export function apiKeysDelete(client, request, options) {
|
|
18
21
|
return new APIPromise($do(client, request, options));
|
|
@@ -10,6 +10,9 @@ import { APIPromise } from "../types/async.js";
|
|
|
10
10
|
import { Result } from "../types/fp.js";
|
|
11
11
|
/**
|
|
12
12
|
* Get a single API key
|
|
13
|
+
*
|
|
14
|
+
* @remarks
|
|
15
|
+
* Get a single API key by hash. [Provisioning key](/docs/guides/overview/auth/provisioning-api-keys) required.
|
|
13
16
|
*/
|
|
14
17
|
export declare function apiKeysGet(client: OpenRouterCore, request: operations.GetKeyRequest, options?: RequestOptions): APIPromise<Result<operations.GetKeyResponse, errors.UnauthorizedResponseError | errors.NotFoundResponseError | errors.TooManyRequestsResponseError | errors.InternalServerResponseError | OpenRouterError | ResponseValidationError | ConnectionError | RequestAbortedError | RequestTimeoutError | InvalidRequestError | UnexpectedClientError | SDKValidationError>>;
|
|
15
18
|
//# sourceMappingURL=apiKeysGet.d.ts.map
|
package/esm/funcs/apiKeysGet.js
CHANGED
|
@@ -13,6 +13,9 @@ import * as operations from "../models/operations/index.js";
|
|
|
13
13
|
import { APIPromise } from "../types/async.js";
|
|
14
14
|
/**
|
|
15
15
|
* Get a single API key
|
|
16
|
+
*
|
|
17
|
+
* @remarks
|
|
18
|
+
* Get a single API key by hash. [Provisioning key](/docs/guides/overview/auth/provisioning-api-keys) required.
|
|
16
19
|
*/
|
|
17
20
|
export function apiKeysGet(client, request, options) {
|
|
18
21
|
return new APIPromise($do(client, request, options));
|
|
@@ -10,6 +10,9 @@ import { APIPromise } from "../types/async.js";
|
|
|
10
10
|
import { Result } from "../types/fp.js";
|
|
11
11
|
/**
|
|
12
12
|
* List API keys
|
|
13
|
+
*
|
|
14
|
+
* @remarks
|
|
15
|
+
* List all API keys for the authenticated user. [Provisioning key](/docs/guides/overview/auth/provisioning-api-keys) required.
|
|
13
16
|
*/
|
|
14
17
|
export declare function apiKeysList(client: OpenRouterCore, request?: operations.ListRequest | undefined, options?: RequestOptions): APIPromise<Result<operations.ListResponse, errors.UnauthorizedResponseError | errors.TooManyRequestsResponseError | errors.InternalServerResponseError | OpenRouterError | ResponseValidationError | ConnectionError | RequestAbortedError | RequestTimeoutError | InvalidRequestError | UnexpectedClientError | SDKValidationError>>;
|
|
15
18
|
//# sourceMappingURL=apiKeysList.d.ts.map
|
package/esm/funcs/apiKeysList.js
CHANGED
|
@@ -13,6 +13,9 @@ import * as operations from "../models/operations/index.js";
|
|
|
13
13
|
import { APIPromise } from "../types/async.js";
|
|
14
14
|
/**
|
|
15
15
|
* List API keys
|
|
16
|
+
*
|
|
17
|
+
* @remarks
|
|
18
|
+
* List all API keys for the authenticated user. [Provisioning key](/docs/guides/overview/auth/provisioning-api-keys) required.
|
|
16
19
|
*/
|
|
17
20
|
export function apiKeysList(client, request, options) {
|
|
18
21
|
return new APIPromise($do(client, request, options));
|
|
@@ -10,6 +10,9 @@ import { APIPromise } from "../types/async.js";
|
|
|
10
10
|
import { Result } from "../types/fp.js";
|
|
11
11
|
/**
|
|
12
12
|
* Update an API key
|
|
13
|
+
*
|
|
14
|
+
* @remarks
|
|
15
|
+
* Update an existing API key. [Provisioning key](/docs/guides/overview/auth/provisioning-api-keys) required.
|
|
13
16
|
*/
|
|
14
17
|
export declare function apiKeysUpdate(client: OpenRouterCore, request: operations.UpdateKeysRequest, options?: RequestOptions): APIPromise<Result<operations.UpdateKeysResponse, errors.BadRequestResponseError | errors.UnauthorizedResponseError | errors.NotFoundResponseError | errors.TooManyRequestsResponseError | errors.InternalServerResponseError | OpenRouterError | ResponseValidationError | ConnectionError | RequestAbortedError | RequestTimeoutError | InvalidRequestError | UnexpectedClientError | SDKValidationError>>;
|
|
15
18
|
//# sourceMappingURL=apiKeysUpdate.d.ts.map
|
|
@@ -13,6 +13,9 @@ import * as operations from "../models/operations/index.js";
|
|
|
13
13
|
import { APIPromise } from "../types/async.js";
|
|
14
14
|
/**
|
|
15
15
|
* Update an API key
|
|
16
|
+
*
|
|
17
|
+
* @remarks
|
|
18
|
+
* Update an existing API key. [Provisioning key](/docs/guides/overview/auth/provisioning-api-keys) required.
|
|
16
19
|
*/
|
|
17
20
|
export function apiKeysUpdate(client, request, options) {
|
|
18
21
|
return new APIPromise($do(client, request, options));
|
package/esm/funcs/call-model.js
CHANGED
|
@@ -111,7 +111,8 @@ import { convertToolsToAPIFormat } from '../lib/tool-executor.js';
|
|
|
111
111
|
* Default: `stepCountIs(5)` if not specified
|
|
112
112
|
*/
|
|
113
113
|
export function callModel(client, request, options) {
|
|
114
|
-
|
|
114
|
+
// Destructure state management options along with tools and stopWhen
|
|
115
|
+
const { tools, stopWhen, state, requireApproval, approveToolCalls, rejectToolCalls, ...apiRequest } = request;
|
|
115
116
|
// Convert tools to API format - no cast needed now that convertToolsToAPIFormat accepts readonly
|
|
116
117
|
const apiTools = tools ? convertToolsToAPIFormat(tools) : undefined;
|
|
117
118
|
// Build the request with converted tools
|
|
@@ -127,11 +128,13 @@ export function callModel(client, request, options) {
|
|
|
127
128
|
client,
|
|
128
129
|
request: finalRequest,
|
|
129
130
|
options: options ?? {},
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
}),
|
|
131
|
+
tools,
|
|
132
|
+
...(stopWhen !== undefined && { stopWhen }),
|
|
133
|
+
// Pass state management options
|
|
134
|
+
...(state !== undefined && { state }),
|
|
135
|
+
...(requireApproval !== undefined && { requireApproval }),
|
|
136
|
+
...(approveToolCalls !== undefined && { approveToolCalls }),
|
|
137
|
+
...(rejectToolCalls !== undefined && { rejectToolCalls }),
|
|
135
138
|
});
|
|
136
139
|
}
|
|
137
140
|
//# sourceMappingURL=call-model.js.map
|
|
@@ -12,7 +12,7 @@ import { Result } from "../types/fp.js";
|
|
|
12
12
|
* Get remaining credits
|
|
13
13
|
*
|
|
14
14
|
* @remarks
|
|
15
|
-
* Get total credits purchased and used for the authenticated user
|
|
15
|
+
* Get total credits purchased and used for the authenticated user. [Provisioning key](/docs/guides/overview/auth/provisioning-api-keys) required.
|
|
16
16
|
*/
|
|
17
17
|
export declare function creditsGetCredits(client: OpenRouterCore, options?: RequestOptions): APIPromise<Result<operations.GetCreditsResponse, errors.UnauthorizedResponseError | errors.ForbiddenResponseError | errors.InternalServerResponseError | OpenRouterError | ResponseValidationError | ConnectionError | RequestAbortedError | RequestTimeoutError | InvalidRequestError | UnexpectedClientError | SDKValidationError>>;
|
|
18
18
|
//# sourceMappingURL=creditsGetCredits.d.ts.map
|
|
@@ -13,7 +13,7 @@ import { APIPromise } from "../types/async.js";
|
|
|
13
13
|
* Get remaining credits
|
|
14
14
|
*
|
|
15
15
|
* @remarks
|
|
16
|
-
* Get total credits purchased and used for the authenticated user
|
|
16
|
+
* Get total credits purchased and used for the authenticated user. [Provisioning key](/docs/guides/overview/auth/provisioning-api-keys) required.
|
|
17
17
|
*/
|
|
18
18
|
export function creditsGetCredits(client, options) {
|
|
19
19
|
return new APIPromise($do(client, options));
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { OpenRouterCore } from "../core.js";
|
|
2
|
+
import { RequestOptions } from "../lib/sdks.js";
|
|
3
|
+
import { ConnectionError, InvalidRequestError, RequestAbortedError, RequestTimeoutError, UnexpectedClientError } from "../models/errors/httpclienterrors.js";
|
|
4
|
+
import * as errors from "../models/errors/index.js";
|
|
5
|
+
import { OpenRouterError } from "../models/errors/openroutererror.js";
|
|
6
|
+
import { ResponseValidationError } from "../models/errors/responsevalidationerror.js";
|
|
7
|
+
import { SDKValidationError } from "../models/errors/sdkvalidationerror.js";
|
|
8
|
+
import * as operations from "../models/operations/index.js";
|
|
9
|
+
import { APIPromise } from "../types/async.js";
|
|
10
|
+
import { Result } from "../types/fp.js";
|
|
11
|
+
/**
|
|
12
|
+
* Bulk assign keys to a guardrail
|
|
13
|
+
*
|
|
14
|
+
* @remarks
|
|
15
|
+
* Assign multiple API keys to a specific guardrail. [Provisioning key](/docs/guides/overview/auth/provisioning-api-keys) required.
|
|
16
|
+
*/
|
|
17
|
+
export declare function guardrailsBulkAssignKeys(client: OpenRouterCore, request: operations.BulkAssignKeysToGuardrailRequest, options?: RequestOptions): APIPromise<Result<operations.BulkAssignKeysToGuardrailResponse, errors.BadRequestResponseError | errors.UnauthorizedResponseError | errors.NotFoundResponseError | errors.InternalServerResponseError | OpenRouterError | ResponseValidationError | ConnectionError | RequestAbortedError | RequestTimeoutError | InvalidRequestError | UnexpectedClientError | SDKValidationError>>;
|
|
18
|
+
//# sourceMappingURL=guardrailsBulkAssignKeys.d.ts.map
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
+
* @generated-id: 76294a9da792
|
|
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 operations from "../models/operations/index.js";
|
|
13
|
+
import { APIPromise } from "../types/async.js";
|
|
14
|
+
/**
|
|
15
|
+
* Bulk assign keys to a guardrail
|
|
16
|
+
*
|
|
17
|
+
* @remarks
|
|
18
|
+
* Assign multiple API keys to a specific guardrail. [Provisioning key](/docs/guides/overview/auth/provisioning-api-keys) required.
|
|
19
|
+
*/
|
|
20
|
+
export function guardrailsBulkAssignKeys(client, request, options) {
|
|
21
|
+
return new APIPromise($do(client, request, options));
|
|
22
|
+
}
|
|
23
|
+
async function $do(client, request, options) {
|
|
24
|
+
const parsed = safeParse(request, (value) => operations.BulkAssignKeysToGuardrailRequest$outboundSchema.parse(value), "Input validation failed");
|
|
25
|
+
if (!parsed.ok) {
|
|
26
|
+
return [parsed, { status: "invalid" }];
|
|
27
|
+
}
|
|
28
|
+
const payload = parsed.value;
|
|
29
|
+
const body = encodeJSON("body", payload.RequestBody, { explode: true });
|
|
30
|
+
const pathParams = {
|
|
31
|
+
id: encodeSimple("id", payload.id, {
|
|
32
|
+
explode: false,
|
|
33
|
+
charEncoding: "percent",
|
|
34
|
+
}),
|
|
35
|
+
};
|
|
36
|
+
const path = pathToFunc("/guardrails/{id}/assignments/keys")(pathParams);
|
|
37
|
+
const headers = new Headers(compactMap({
|
|
38
|
+
"Content-Type": "application/json",
|
|
39
|
+
Accept: "application/json",
|
|
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: "bulkAssignKeysToGuardrail",
|
|
48
|
+
oAuth2Scopes: null,
|
|
49
|
+
resolvedSecurity: requestSecurity,
|
|
50
|
+
securitySource: client._options.apiKey,
|
|
51
|
+
retryConfig: options?.retries
|
|
52
|
+
|| client._options.retryConfig
|
|
53
|
+
|| { strategy: "none" },
|
|
54
|
+
retryCodes: options?.retryCodes || ["429", "500", "502", "503", "504"],
|
|
55
|
+
};
|
|
56
|
+
const requestRes = client._createRequest(context, {
|
|
57
|
+
security: requestSecurity,
|
|
58
|
+
method: "POST",
|
|
59
|
+
baseURL: options?.serverURL,
|
|
60
|
+
path: path,
|
|
61
|
+
headers: headers,
|
|
62
|
+
body: body,
|
|
63
|
+
userAgent: client._options.userAgent,
|
|
64
|
+
timeoutMs: options?.timeoutMs || client._options.timeoutMs || -1,
|
|
65
|
+
}, options);
|
|
66
|
+
if (!requestRes.ok) {
|
|
67
|
+
return [requestRes, { status: "invalid" }];
|
|
68
|
+
}
|
|
69
|
+
const req = requestRes.value;
|
|
70
|
+
const doResult = await client._do(req, {
|
|
71
|
+
context,
|
|
72
|
+
errorCodes: ["400", "401", "404", "4XX", "500", "5XX"],
|
|
73
|
+
retryConfig: context.retryConfig,
|
|
74
|
+
retryCodes: context.retryCodes,
|
|
75
|
+
});
|
|
76
|
+
if (!doResult.ok) {
|
|
77
|
+
return [doResult, { status: "request-error", request: req }];
|
|
78
|
+
}
|
|
79
|
+
const response = doResult.value;
|
|
80
|
+
const responseFields = {
|
|
81
|
+
HttpMeta: { Response: response, Request: req },
|
|
82
|
+
};
|
|
83
|
+
const [result] = await M.match(M.json(200, operations.BulkAssignKeysToGuardrailResponse$inboundSchema), M.jsonErr(400, errors.BadRequestResponseError$inboundSchema), M.jsonErr(401, errors.UnauthorizedResponseError$inboundSchema), M.jsonErr(404, errors.NotFoundResponseError$inboundSchema), M.jsonErr(500, errors.InternalServerResponseError$inboundSchema), M.fail("4XX"), M.fail("5XX"))(response, req, { extraFields: responseFields });
|
|
84
|
+
if (!result.ok) {
|
|
85
|
+
return [result, { status: "complete", request: req, response }];
|
|
86
|
+
}
|
|
87
|
+
return [result, { status: "complete", request: req, response }];
|
|
88
|
+
}
|
|
89
|
+
//# sourceMappingURL=guardrailsBulkAssignKeys.js.map
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { OpenRouterCore } from "../core.js";
|
|
2
|
+
import { RequestOptions } from "../lib/sdks.js";
|
|
3
|
+
import { ConnectionError, InvalidRequestError, RequestAbortedError, RequestTimeoutError, UnexpectedClientError } from "../models/errors/httpclienterrors.js";
|
|
4
|
+
import * as errors from "../models/errors/index.js";
|
|
5
|
+
import { OpenRouterError } from "../models/errors/openroutererror.js";
|
|
6
|
+
import { ResponseValidationError } from "../models/errors/responsevalidationerror.js";
|
|
7
|
+
import { SDKValidationError } from "../models/errors/sdkvalidationerror.js";
|
|
8
|
+
import * as operations from "../models/operations/index.js";
|
|
9
|
+
import { APIPromise } from "../types/async.js";
|
|
10
|
+
import { Result } from "../types/fp.js";
|
|
11
|
+
/**
|
|
12
|
+
* Bulk assign members to a guardrail
|
|
13
|
+
*
|
|
14
|
+
* @remarks
|
|
15
|
+
* Assign multiple organization members to a specific guardrail. [Provisioning key](/docs/guides/overview/auth/provisioning-api-keys) required.
|
|
16
|
+
*/
|
|
17
|
+
export declare function guardrailsBulkAssignMembers(client: OpenRouterCore, request: operations.BulkAssignMembersToGuardrailRequest, options?: RequestOptions): APIPromise<Result<operations.BulkAssignMembersToGuardrailResponse, errors.BadRequestResponseError | errors.UnauthorizedResponseError | errors.NotFoundResponseError | errors.InternalServerResponseError | OpenRouterError | ResponseValidationError | ConnectionError | RequestAbortedError | RequestTimeoutError | InvalidRequestError | UnexpectedClientError | SDKValidationError>>;
|
|
18
|
+
//# sourceMappingURL=guardrailsBulkAssignMembers.d.ts.map
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
+
* @generated-id: 64be234e5295
|
|
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 operations from "../models/operations/index.js";
|
|
13
|
+
import { APIPromise } from "../types/async.js";
|
|
14
|
+
/**
|
|
15
|
+
* Bulk assign members to a guardrail
|
|
16
|
+
*
|
|
17
|
+
* @remarks
|
|
18
|
+
* Assign multiple organization members to a specific guardrail. [Provisioning key](/docs/guides/overview/auth/provisioning-api-keys) required.
|
|
19
|
+
*/
|
|
20
|
+
export function guardrailsBulkAssignMembers(client, request, options) {
|
|
21
|
+
return new APIPromise($do(client, request, options));
|
|
22
|
+
}
|
|
23
|
+
async function $do(client, request, options) {
|
|
24
|
+
const parsed = safeParse(request, (value) => operations.BulkAssignMembersToGuardrailRequest$outboundSchema.parse(value), "Input validation failed");
|
|
25
|
+
if (!parsed.ok) {
|
|
26
|
+
return [parsed, { status: "invalid" }];
|
|
27
|
+
}
|
|
28
|
+
const payload = parsed.value;
|
|
29
|
+
const body = encodeJSON("body", payload.RequestBody, { explode: true });
|
|
30
|
+
const pathParams = {
|
|
31
|
+
id: encodeSimple("id", payload.id, {
|
|
32
|
+
explode: false,
|
|
33
|
+
charEncoding: "percent",
|
|
34
|
+
}),
|
|
35
|
+
};
|
|
36
|
+
const path = pathToFunc("/guardrails/{id}/assignments/members")(pathParams);
|
|
37
|
+
const headers = new Headers(compactMap({
|
|
38
|
+
"Content-Type": "application/json",
|
|
39
|
+
Accept: "application/json",
|
|
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: "bulkAssignMembersToGuardrail",
|
|
48
|
+
oAuth2Scopes: null,
|
|
49
|
+
resolvedSecurity: requestSecurity,
|
|
50
|
+
securitySource: client._options.apiKey,
|
|
51
|
+
retryConfig: options?.retries
|
|
52
|
+
|| client._options.retryConfig
|
|
53
|
+
|| { strategy: "none" },
|
|
54
|
+
retryCodes: options?.retryCodes || ["429", "500", "502", "503", "504"],
|
|
55
|
+
};
|
|
56
|
+
const requestRes = client._createRequest(context, {
|
|
57
|
+
security: requestSecurity,
|
|
58
|
+
method: "POST",
|
|
59
|
+
baseURL: options?.serverURL,
|
|
60
|
+
path: path,
|
|
61
|
+
headers: headers,
|
|
62
|
+
body: body,
|
|
63
|
+
userAgent: client._options.userAgent,
|
|
64
|
+
timeoutMs: options?.timeoutMs || client._options.timeoutMs || -1,
|
|
65
|
+
}, options);
|
|
66
|
+
if (!requestRes.ok) {
|
|
67
|
+
return [requestRes, { status: "invalid" }];
|
|
68
|
+
}
|
|
69
|
+
const req = requestRes.value;
|
|
70
|
+
const doResult = await client._do(req, {
|
|
71
|
+
context,
|
|
72
|
+
errorCodes: ["400", "401", "404", "4XX", "500", "5XX"],
|
|
73
|
+
retryConfig: context.retryConfig,
|
|
74
|
+
retryCodes: context.retryCodes,
|
|
75
|
+
});
|
|
76
|
+
if (!doResult.ok) {
|
|
77
|
+
return [doResult, { status: "request-error", request: req }];
|
|
78
|
+
}
|
|
79
|
+
const response = doResult.value;
|
|
80
|
+
const responseFields = {
|
|
81
|
+
HttpMeta: { Response: response, Request: req },
|
|
82
|
+
};
|
|
83
|
+
const [result] = await M.match(M.json(200, operations.BulkAssignMembersToGuardrailResponse$inboundSchema), M.jsonErr(400, errors.BadRequestResponseError$inboundSchema), M.jsonErr(401, errors.UnauthorizedResponseError$inboundSchema), M.jsonErr(404, errors.NotFoundResponseError$inboundSchema), M.jsonErr(500, errors.InternalServerResponseError$inboundSchema), M.fail("4XX"), M.fail("5XX"))(response, req, { extraFields: responseFields });
|
|
84
|
+
if (!result.ok) {
|
|
85
|
+
return [result, { status: "complete", request: req, response }];
|
|
86
|
+
}
|
|
87
|
+
return [result, { status: "complete", request: req, response }];
|
|
88
|
+
}
|
|
89
|
+
//# sourceMappingURL=guardrailsBulkAssignMembers.js.map
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { OpenRouterCore } from "../core.js";
|
|
2
|
+
import { RequestOptions } from "../lib/sdks.js";
|
|
3
|
+
import { ConnectionError, InvalidRequestError, RequestAbortedError, RequestTimeoutError, UnexpectedClientError } from "../models/errors/httpclienterrors.js";
|
|
4
|
+
import * as errors from "../models/errors/index.js";
|
|
5
|
+
import { OpenRouterError } from "../models/errors/openroutererror.js";
|
|
6
|
+
import { ResponseValidationError } from "../models/errors/responsevalidationerror.js";
|
|
7
|
+
import { SDKValidationError } from "../models/errors/sdkvalidationerror.js";
|
|
8
|
+
import * as operations from "../models/operations/index.js";
|
|
9
|
+
import { APIPromise } from "../types/async.js";
|
|
10
|
+
import { Result } from "../types/fp.js";
|
|
11
|
+
/**
|
|
12
|
+
* Bulk unassign keys from a guardrail
|
|
13
|
+
*
|
|
14
|
+
* @remarks
|
|
15
|
+
* Unassign multiple API keys from a specific guardrail. [Provisioning key](/docs/guides/overview/auth/provisioning-api-keys) required.
|
|
16
|
+
*/
|
|
17
|
+
export declare function guardrailsBulkUnassignKeys(client: OpenRouterCore, request: operations.BulkUnassignKeysFromGuardrailRequest, options?: RequestOptions): APIPromise<Result<operations.BulkUnassignKeysFromGuardrailResponse, errors.BadRequestResponseError | errors.UnauthorizedResponseError | errors.NotFoundResponseError | errors.InternalServerResponseError | OpenRouterError | ResponseValidationError | ConnectionError | RequestAbortedError | RequestTimeoutError | InvalidRequestError | UnexpectedClientError | SDKValidationError>>;
|
|
18
|
+
//# sourceMappingURL=guardrailsBulkUnassignKeys.d.ts.map
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
+
* @generated-id: fd19b36e897d
|
|
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 operations from "../models/operations/index.js";
|
|
13
|
+
import { APIPromise } from "../types/async.js";
|
|
14
|
+
/**
|
|
15
|
+
* Bulk unassign keys from a guardrail
|
|
16
|
+
*
|
|
17
|
+
* @remarks
|
|
18
|
+
* Unassign multiple API keys from a specific guardrail. [Provisioning key](/docs/guides/overview/auth/provisioning-api-keys) required.
|
|
19
|
+
*/
|
|
20
|
+
export function guardrailsBulkUnassignKeys(client, request, options) {
|
|
21
|
+
return new APIPromise($do(client, request, options));
|
|
22
|
+
}
|
|
23
|
+
async function $do(client, request, options) {
|
|
24
|
+
const parsed = safeParse(request, (value) => operations.BulkUnassignKeysFromGuardrailRequest$outboundSchema.parse(value), "Input validation failed");
|
|
25
|
+
if (!parsed.ok) {
|
|
26
|
+
return [parsed, { status: "invalid" }];
|
|
27
|
+
}
|
|
28
|
+
const payload = parsed.value;
|
|
29
|
+
const body = encodeJSON("body", payload.RequestBody, { explode: true });
|
|
30
|
+
const pathParams = {
|
|
31
|
+
id: encodeSimple("id", payload.id, {
|
|
32
|
+
explode: false,
|
|
33
|
+
charEncoding: "percent",
|
|
34
|
+
}),
|
|
35
|
+
};
|
|
36
|
+
const path = pathToFunc("/guardrails/{id}/assignments/keys/remove")(pathParams);
|
|
37
|
+
const headers = new Headers(compactMap({
|
|
38
|
+
"Content-Type": "application/json",
|
|
39
|
+
Accept: "application/json",
|
|
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: "bulkUnassignKeysFromGuardrail",
|
|
48
|
+
oAuth2Scopes: null,
|
|
49
|
+
resolvedSecurity: requestSecurity,
|
|
50
|
+
securitySource: client._options.apiKey,
|
|
51
|
+
retryConfig: options?.retries
|
|
52
|
+
|| client._options.retryConfig
|
|
53
|
+
|| { strategy: "none" },
|
|
54
|
+
retryCodes: options?.retryCodes || ["429", "500", "502", "503", "504"],
|
|
55
|
+
};
|
|
56
|
+
const requestRes = client._createRequest(context, {
|
|
57
|
+
security: requestSecurity,
|
|
58
|
+
method: "POST",
|
|
59
|
+
baseURL: options?.serverURL,
|
|
60
|
+
path: path,
|
|
61
|
+
headers: headers,
|
|
62
|
+
body: body,
|
|
63
|
+
userAgent: client._options.userAgent,
|
|
64
|
+
timeoutMs: options?.timeoutMs || client._options.timeoutMs || -1,
|
|
65
|
+
}, options);
|
|
66
|
+
if (!requestRes.ok) {
|
|
67
|
+
return [requestRes, { status: "invalid" }];
|
|
68
|
+
}
|
|
69
|
+
const req = requestRes.value;
|
|
70
|
+
const doResult = await client._do(req, {
|
|
71
|
+
context,
|
|
72
|
+
errorCodes: ["400", "401", "404", "4XX", "500", "5XX"],
|
|
73
|
+
retryConfig: context.retryConfig,
|
|
74
|
+
retryCodes: context.retryCodes,
|
|
75
|
+
});
|
|
76
|
+
if (!doResult.ok) {
|
|
77
|
+
return [doResult, { status: "request-error", request: req }];
|
|
78
|
+
}
|
|
79
|
+
const response = doResult.value;
|
|
80
|
+
const responseFields = {
|
|
81
|
+
HttpMeta: { Response: response, Request: req },
|
|
82
|
+
};
|
|
83
|
+
const [result] = await M.match(M.json(200, operations.BulkUnassignKeysFromGuardrailResponse$inboundSchema), M.jsonErr(400, errors.BadRequestResponseError$inboundSchema), M.jsonErr(401, errors.UnauthorizedResponseError$inboundSchema), M.jsonErr(404, errors.NotFoundResponseError$inboundSchema), M.jsonErr(500, errors.InternalServerResponseError$inboundSchema), M.fail("4XX"), M.fail("5XX"))(response, req, { extraFields: responseFields });
|
|
84
|
+
if (!result.ok) {
|
|
85
|
+
return [result, { status: "complete", request: req, response }];
|
|
86
|
+
}
|
|
87
|
+
return [result, { status: "complete", request: req, response }];
|
|
88
|
+
}
|
|
89
|
+
//# sourceMappingURL=guardrailsBulkUnassignKeys.js.map
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { OpenRouterCore } from "../core.js";
|
|
2
|
+
import { RequestOptions } from "../lib/sdks.js";
|
|
3
|
+
import { ConnectionError, InvalidRequestError, RequestAbortedError, RequestTimeoutError, UnexpectedClientError } from "../models/errors/httpclienterrors.js";
|
|
4
|
+
import * as errors from "../models/errors/index.js";
|
|
5
|
+
import { OpenRouterError } from "../models/errors/openroutererror.js";
|
|
6
|
+
import { ResponseValidationError } from "../models/errors/responsevalidationerror.js";
|
|
7
|
+
import { SDKValidationError } from "../models/errors/sdkvalidationerror.js";
|
|
8
|
+
import * as operations from "../models/operations/index.js";
|
|
9
|
+
import { APIPromise } from "../types/async.js";
|
|
10
|
+
import { Result } from "../types/fp.js";
|
|
11
|
+
/**
|
|
12
|
+
* Bulk unassign members from a guardrail
|
|
13
|
+
*
|
|
14
|
+
* @remarks
|
|
15
|
+
* Unassign multiple organization members from a specific guardrail. [Provisioning key](/docs/guides/overview/auth/provisioning-api-keys) required.
|
|
16
|
+
*/
|
|
17
|
+
export declare function guardrailsBulkUnassignMembers(client: OpenRouterCore, request: operations.BulkUnassignMembersFromGuardrailRequest, options?: RequestOptions): APIPromise<Result<operations.BulkUnassignMembersFromGuardrailResponse, errors.BadRequestResponseError | errors.UnauthorizedResponseError | errors.NotFoundResponseError | errors.InternalServerResponseError | OpenRouterError | ResponseValidationError | ConnectionError | RequestAbortedError | RequestTimeoutError | InvalidRequestError | UnexpectedClientError | SDKValidationError>>;
|
|
18
|
+
//# sourceMappingURL=guardrailsBulkUnassignMembers.d.ts.map
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
+
* @generated-id: 807705779557
|
|
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 operations from "../models/operations/index.js";
|
|
13
|
+
import { APIPromise } from "../types/async.js";
|
|
14
|
+
/**
|
|
15
|
+
* Bulk unassign members from a guardrail
|
|
16
|
+
*
|
|
17
|
+
* @remarks
|
|
18
|
+
* Unassign multiple organization members from a specific guardrail. [Provisioning key](/docs/guides/overview/auth/provisioning-api-keys) required.
|
|
19
|
+
*/
|
|
20
|
+
export function guardrailsBulkUnassignMembers(client, request, options) {
|
|
21
|
+
return new APIPromise($do(client, request, options));
|
|
22
|
+
}
|
|
23
|
+
async function $do(client, request, options) {
|
|
24
|
+
const parsed = safeParse(request, (value) => operations.BulkUnassignMembersFromGuardrailRequest$outboundSchema.parse(value), "Input validation failed");
|
|
25
|
+
if (!parsed.ok) {
|
|
26
|
+
return [parsed, { status: "invalid" }];
|
|
27
|
+
}
|
|
28
|
+
const payload = parsed.value;
|
|
29
|
+
const body = encodeJSON("body", payload.RequestBody, { explode: true });
|
|
30
|
+
const pathParams = {
|
|
31
|
+
id: encodeSimple("id", payload.id, {
|
|
32
|
+
explode: false,
|
|
33
|
+
charEncoding: "percent",
|
|
34
|
+
}),
|
|
35
|
+
};
|
|
36
|
+
const path = pathToFunc("/guardrails/{id}/assignments/members/remove")(pathParams);
|
|
37
|
+
const headers = new Headers(compactMap({
|
|
38
|
+
"Content-Type": "application/json",
|
|
39
|
+
Accept: "application/json",
|
|
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: "bulkUnassignMembersFromGuardrail",
|
|
48
|
+
oAuth2Scopes: null,
|
|
49
|
+
resolvedSecurity: requestSecurity,
|
|
50
|
+
securitySource: client._options.apiKey,
|
|
51
|
+
retryConfig: options?.retries
|
|
52
|
+
|| client._options.retryConfig
|
|
53
|
+
|| { strategy: "none" },
|
|
54
|
+
retryCodes: options?.retryCodes || ["429", "500", "502", "503", "504"],
|
|
55
|
+
};
|
|
56
|
+
const requestRes = client._createRequest(context, {
|
|
57
|
+
security: requestSecurity,
|
|
58
|
+
method: "POST",
|
|
59
|
+
baseURL: options?.serverURL,
|
|
60
|
+
path: path,
|
|
61
|
+
headers: headers,
|
|
62
|
+
body: body,
|
|
63
|
+
userAgent: client._options.userAgent,
|
|
64
|
+
timeoutMs: options?.timeoutMs || client._options.timeoutMs || -1,
|
|
65
|
+
}, options);
|
|
66
|
+
if (!requestRes.ok) {
|
|
67
|
+
return [requestRes, { status: "invalid" }];
|
|
68
|
+
}
|
|
69
|
+
const req = requestRes.value;
|
|
70
|
+
const doResult = await client._do(req, {
|
|
71
|
+
context,
|
|
72
|
+
errorCodes: ["400", "401", "404", "4XX", "500", "5XX"],
|
|
73
|
+
retryConfig: context.retryConfig,
|
|
74
|
+
retryCodes: context.retryCodes,
|
|
75
|
+
});
|
|
76
|
+
if (!doResult.ok) {
|
|
77
|
+
return [doResult, { status: "request-error", request: req }];
|
|
78
|
+
}
|
|
79
|
+
const response = doResult.value;
|
|
80
|
+
const responseFields = {
|
|
81
|
+
HttpMeta: { Response: response, Request: req },
|
|
82
|
+
};
|
|
83
|
+
const [result] = await M.match(M.json(200, operations.BulkUnassignMembersFromGuardrailResponse$inboundSchema), M.jsonErr(400, errors.BadRequestResponseError$inboundSchema), M.jsonErr(401, errors.UnauthorizedResponseError$inboundSchema), M.jsonErr(404, errors.NotFoundResponseError$inboundSchema), M.jsonErr(500, errors.InternalServerResponseError$inboundSchema), M.fail("4XX"), M.fail("5XX"))(response, req, { extraFields: responseFields });
|
|
84
|
+
if (!result.ok) {
|
|
85
|
+
return [result, { status: "complete", request: req, response }];
|
|
86
|
+
}
|
|
87
|
+
return [result, { status: "complete", request: req, response }];
|
|
88
|
+
}
|
|
89
|
+
//# sourceMappingURL=guardrailsBulkUnassignMembers.js.map
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { OpenRouterCore } from "../core.js";
|
|
2
|
+
import { RequestOptions } from "../lib/sdks.js";
|
|
3
|
+
import { ConnectionError, InvalidRequestError, RequestAbortedError, RequestTimeoutError, UnexpectedClientError } from "../models/errors/httpclienterrors.js";
|
|
4
|
+
import * as errors from "../models/errors/index.js";
|
|
5
|
+
import { OpenRouterError } from "../models/errors/openroutererror.js";
|
|
6
|
+
import { ResponseValidationError } from "../models/errors/responsevalidationerror.js";
|
|
7
|
+
import { SDKValidationError } from "../models/errors/sdkvalidationerror.js";
|
|
8
|
+
import * as operations from "../models/operations/index.js";
|
|
9
|
+
import { APIPromise } from "../types/async.js";
|
|
10
|
+
import { Result } from "../types/fp.js";
|
|
11
|
+
/**
|
|
12
|
+
* Create a guardrail
|
|
13
|
+
*
|
|
14
|
+
* @remarks
|
|
15
|
+
* Create a new guardrail for the authenticated user. [Provisioning key](/docs/guides/overview/auth/provisioning-api-keys) required.
|
|
16
|
+
*/
|
|
17
|
+
export declare function guardrailsCreate(client: OpenRouterCore, request: operations.CreateGuardrailRequest, options?: RequestOptions): APIPromise<Result<operations.CreateGuardrailResponse, errors.BadRequestResponseError | errors.UnauthorizedResponseError | errors.InternalServerResponseError | OpenRouterError | ResponseValidationError | ConnectionError | RequestAbortedError | RequestTimeoutError | InvalidRequestError | UnexpectedClientError | SDKValidationError>>;
|
|
18
|
+
//# sourceMappingURL=guardrailsCreate.d.ts.map
|