@openrouter/sdk 0.3.12 → 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/anthropic-compat.test.js +3 -0
- package/esm/lib/async-params.d.ts +46 -6
- package/esm/lib/async-params.js +10 -2
- package/esm/lib/chat-compat.test.js +3 -0
- 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 +109 -1
- 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/chatgenerationparams.d.ts +93 -12
- package/esm/models/chatgenerationparams.js +75 -6
- package/esm/models/chatgenerationtokenusage.d.ts +1 -0
- package/esm/models/chatgenerationtokenusage.js +2 -0
- package/esm/models/chatmessagecontentitemimage.d.ts +8 -8
- package/esm/models/chatmessagecontentitemimage.js +8 -9
- package/esm/models/chatmessagetokenlogprob.d.ts +4 -4
- package/esm/models/chatmessagetokenlogprob.js +4 -5
- 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 +8 -1
- package/esm/models/index.js +8 -1
- package/esm/models/model.d.ts +4 -0
- package/esm/models/model.js +2 -0
- package/esm/models/openairesponsesinputunion.d.ts +15 -5
- package/esm/models/openairesponsesinputunion.js +5 -5
- package/esm/models/openresponseseasyinputmessage.d.ts +41 -16
- package/esm/models/openresponseseasyinputmessage.js +38 -13
- package/esm/models/openresponsesinputmessageitem.d.ts +37 -12
- package/esm/models/openresponsesinputmessageitem.js +33 -9
- package/esm/models/openresponsesnonstreamingresponse.d.ts +5 -2
- package/esm/models/openresponsesnonstreamingresponse.js +8 -2
- package/esm/models/openresponsesreasoning.d.ts +1 -0
- package/esm/models/openresponsesreasoning.js +1 -0
- package/esm/models/openresponsesrequest.d.ts +61 -24
- package/esm/models/openresponsesrequest.js +39 -6
- 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/getgeneration.d.ts +4 -0
- package/esm/models/operations/getgeneration.js +1 -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.d.ts +33 -0
- package/esm/models/percentilelatencycutoffs.js +16 -0
- package/esm/models/percentilestats.d.ts +28 -0
- package/esm/models/percentilestats.js +17 -0
- package/esm/models/percentilethroughputcutoffs.d.ts +33 -0
- package/esm/models/percentilethroughputcutoffs.js +16 -0
- package/esm/models/preferredmaxlatency.d.ts +12 -0
- package/esm/models/preferredmaxlatency.js +12 -0
- package/esm/models/preferredminthroughput.d.ts +12 -0
- package/esm/models/preferredminthroughput.js +12 -0
- package/esm/models/providername.d.ts +3 -2
- package/esm/models/providername.js +3 -2
- package/esm/models/providerpreferences.d.ts +8 -20
- package/esm/models/providerpreferences.js +6 -6
- package/esm/models/publicendpoint.d.ts +6 -0
- package/esm/models/publicendpoint.js +5 -0
- package/esm/models/responseinputimage.d.ts +11 -3
- package/esm/models/responseinputimage.js +9 -2
- package/esm/models/responseinputvideo.d.ts +20 -0
- package/esm/models/responseinputvideo.js +19 -0
- package/esm/models/responseoutputtext.d.ts +38 -0
- package/esm/models/responseoutputtext.js +50 -0
- package/esm/models/responsesoutputitemreasoning.d.ts +30 -1
- package/esm/models/responsesoutputitemreasoning.js +22 -0
- package/esm/models/responsesoutputmodality.d.ts +10 -0
- package/esm/models/responsesoutputmodality.js +12 -0
- package/esm/models/schema0.d.ts +3 -2
- package/esm/models/schema0.js +3 -2
- 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 -50
- package/esm/models/schema3.js +0 -61
- package/esm/sdk/parameters.d.ts +0 -9
- package/esm/sdk/parameters.js +0 -16
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
+
* @generated-id: 5878dd40f5cd
|
|
4
|
+
*/
|
|
5
|
+
import { encodeJSON } 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
|
+
* Create a guardrail
|
|
16
|
+
*
|
|
17
|
+
* @remarks
|
|
18
|
+
* Create a new guardrail for the authenticated user. [Provisioning key](/docs/guides/overview/auth/provisioning-api-keys) required.
|
|
19
|
+
*/
|
|
20
|
+
export function guardrailsCreate(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.CreateGuardrailRequest$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, { explode: true });
|
|
30
|
+
const path = pathToFunc("/guardrails")();
|
|
31
|
+
const headers = new Headers(compactMap({
|
|
32
|
+
"Content-Type": "application/json",
|
|
33
|
+
Accept: "application/json",
|
|
34
|
+
}));
|
|
35
|
+
const secConfig = await extractSecurity(client._options.apiKey);
|
|
36
|
+
const securityInput = secConfig == null ? {} : { apiKey: secConfig };
|
|
37
|
+
const requestSecurity = resolveGlobalSecurity(securityInput);
|
|
38
|
+
const context = {
|
|
39
|
+
options: client._options,
|
|
40
|
+
baseURL: options?.serverURL ?? client._baseURL ?? "",
|
|
41
|
+
operationID: "createGuardrail",
|
|
42
|
+
oAuth2Scopes: null,
|
|
43
|
+
resolvedSecurity: requestSecurity,
|
|
44
|
+
securitySource: client._options.apiKey,
|
|
45
|
+
retryConfig: options?.retries
|
|
46
|
+
|| client._options.retryConfig
|
|
47
|
+
|| { strategy: "none" },
|
|
48
|
+
retryCodes: options?.retryCodes || ["429", "500", "502", "503", "504"],
|
|
49
|
+
};
|
|
50
|
+
const requestRes = client._createRequest(context, {
|
|
51
|
+
security: requestSecurity,
|
|
52
|
+
method: "POST",
|
|
53
|
+
baseURL: options?.serverURL,
|
|
54
|
+
path: path,
|
|
55
|
+
headers: headers,
|
|
56
|
+
body: body,
|
|
57
|
+
userAgent: client._options.userAgent,
|
|
58
|
+
timeoutMs: options?.timeoutMs || client._options.timeoutMs || -1,
|
|
59
|
+
}, options);
|
|
60
|
+
if (!requestRes.ok) {
|
|
61
|
+
return [requestRes, { status: "invalid" }];
|
|
62
|
+
}
|
|
63
|
+
const req = requestRes.value;
|
|
64
|
+
const doResult = await client._do(req, {
|
|
65
|
+
context,
|
|
66
|
+
errorCodes: ["400", "401", "4XX", "500", "5XX"],
|
|
67
|
+
retryConfig: context.retryConfig,
|
|
68
|
+
retryCodes: context.retryCodes,
|
|
69
|
+
});
|
|
70
|
+
if (!doResult.ok) {
|
|
71
|
+
return [doResult, { status: "request-error", request: req }];
|
|
72
|
+
}
|
|
73
|
+
const response = doResult.value;
|
|
74
|
+
const responseFields = {
|
|
75
|
+
HttpMeta: { Response: response, Request: req },
|
|
76
|
+
};
|
|
77
|
+
const [result] = await M.match(M.json(201, operations.CreateGuardrailResponse$inboundSchema), M.jsonErr(400, errors.BadRequestResponseError$inboundSchema), M.jsonErr(401, errors.UnauthorizedResponseError$inboundSchema), M.jsonErr(500, errors.InternalServerResponseError$inboundSchema), M.fail("4XX"), M.fail("5XX"))(response, req, { extraFields: responseFields });
|
|
78
|
+
if (!result.ok) {
|
|
79
|
+
return [result, { status: "complete", request: req, response }];
|
|
80
|
+
}
|
|
81
|
+
return [result, { status: "complete", request: req, response }];
|
|
82
|
+
}
|
|
83
|
+
//# sourceMappingURL=guardrailsCreate.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
|
+
* Delete a guardrail
|
|
13
|
+
*
|
|
14
|
+
* @remarks
|
|
15
|
+
* Delete an existing guardrail. [Provisioning key](/docs/guides/overview/auth/provisioning-api-keys) required.
|
|
16
|
+
*/
|
|
17
|
+
export declare function guardrailsDelete(client: OpenRouterCore, request: operations.DeleteGuardrailRequest, options?: RequestOptions): APIPromise<Result<operations.DeleteGuardrailResponse, errors.UnauthorizedResponseError | errors.NotFoundResponseError | errors.InternalServerResponseError | OpenRouterError | ResponseValidationError | ConnectionError | RequestAbortedError | RequestTimeoutError | InvalidRequestError | UnexpectedClientError | SDKValidationError>>;
|
|
18
|
+
//# sourceMappingURL=guardrailsDelete.d.ts.map
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
+
* @generated-id: 3be996456efc
|
|
4
|
+
*/
|
|
5
|
+
import { 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
|
+
* Delete a guardrail
|
|
16
|
+
*
|
|
17
|
+
* @remarks
|
|
18
|
+
* Delete an existing guardrail. [Provisioning key](/docs/guides/overview/auth/provisioning-api-keys) required.
|
|
19
|
+
*/
|
|
20
|
+
export function guardrailsDelete(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.DeleteGuardrailRequest$outboundSchema.parse(value), "Input validation failed");
|
|
25
|
+
if (!parsed.ok) {
|
|
26
|
+
return [parsed, { status: "invalid" }];
|
|
27
|
+
}
|
|
28
|
+
const payload = parsed.value;
|
|
29
|
+
const body = null;
|
|
30
|
+
const pathParams = {
|
|
31
|
+
id: encodeSimple("id", payload.id, {
|
|
32
|
+
explode: false,
|
|
33
|
+
charEncoding: "percent",
|
|
34
|
+
}),
|
|
35
|
+
};
|
|
36
|
+
const path = pathToFunc("/guardrails/{id}")(pathParams);
|
|
37
|
+
const headers = new Headers(compactMap({
|
|
38
|
+
Accept: "application/json",
|
|
39
|
+
}));
|
|
40
|
+
const secConfig = await extractSecurity(client._options.apiKey);
|
|
41
|
+
const securityInput = secConfig == null ? {} : { apiKey: secConfig };
|
|
42
|
+
const requestSecurity = resolveGlobalSecurity(securityInput);
|
|
43
|
+
const context = {
|
|
44
|
+
options: client._options,
|
|
45
|
+
baseURL: options?.serverURL ?? client._baseURL ?? "",
|
|
46
|
+
operationID: "deleteGuardrail",
|
|
47
|
+
oAuth2Scopes: null,
|
|
48
|
+
resolvedSecurity: requestSecurity,
|
|
49
|
+
securitySource: client._options.apiKey,
|
|
50
|
+
retryConfig: options?.retries
|
|
51
|
+
|| client._options.retryConfig
|
|
52
|
+
|| { strategy: "none" },
|
|
53
|
+
retryCodes: options?.retryCodes || ["429", "500", "502", "503", "504"],
|
|
54
|
+
};
|
|
55
|
+
const requestRes = client._createRequest(context, {
|
|
56
|
+
security: requestSecurity,
|
|
57
|
+
method: "DELETE",
|
|
58
|
+
baseURL: options?.serverURL,
|
|
59
|
+
path: path,
|
|
60
|
+
headers: headers,
|
|
61
|
+
body: body,
|
|
62
|
+
userAgent: client._options.userAgent,
|
|
63
|
+
timeoutMs: options?.timeoutMs || client._options.timeoutMs || -1,
|
|
64
|
+
}, options);
|
|
65
|
+
if (!requestRes.ok) {
|
|
66
|
+
return [requestRes, { status: "invalid" }];
|
|
67
|
+
}
|
|
68
|
+
const req = requestRes.value;
|
|
69
|
+
const doResult = await client._do(req, {
|
|
70
|
+
context,
|
|
71
|
+
errorCodes: ["401", "404", "4XX", "500", "5XX"],
|
|
72
|
+
retryConfig: context.retryConfig,
|
|
73
|
+
retryCodes: context.retryCodes,
|
|
74
|
+
});
|
|
75
|
+
if (!doResult.ok) {
|
|
76
|
+
return [doResult, { status: "request-error", request: req }];
|
|
77
|
+
}
|
|
78
|
+
const response = doResult.value;
|
|
79
|
+
const responseFields = {
|
|
80
|
+
HttpMeta: { Response: response, Request: req },
|
|
81
|
+
};
|
|
82
|
+
const [result] = await M.match(M.json(200, operations.DeleteGuardrailResponse$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 });
|
|
83
|
+
if (!result.ok) {
|
|
84
|
+
return [result, { status: "complete", request: req, response }];
|
|
85
|
+
}
|
|
86
|
+
return [result, { status: "complete", request: req, response }];
|
|
87
|
+
}
|
|
88
|
+
//# sourceMappingURL=guardrailsDelete.js.map
|
|
@@ -9,7 +9,10 @@ import * as operations from "../models/operations/index.js";
|
|
|
9
9
|
import { APIPromise } from "../types/async.js";
|
|
10
10
|
import { Result } from "../types/fp.js";
|
|
11
11
|
/**
|
|
12
|
-
* Get a
|
|
12
|
+
* Get a guardrail
|
|
13
|
+
*
|
|
14
|
+
* @remarks
|
|
15
|
+
* Get a single guardrail by ID. [Provisioning key](/docs/guides/overview/auth/provisioning-api-keys) required.
|
|
13
16
|
*/
|
|
14
|
-
export declare function
|
|
15
|
-
//# sourceMappingURL=
|
|
17
|
+
export declare function guardrailsGet(client: OpenRouterCore, request: operations.GetGuardrailRequest, options?: RequestOptions): APIPromise<Result<operations.GetGuardrailResponse, errors.UnauthorizedResponseError | errors.NotFoundResponseError | errors.InternalServerResponseError | OpenRouterError | ResponseValidationError | ConnectionError | RequestAbortedError | RequestTimeoutError | InvalidRequestError | UnexpectedClientError | SDKValidationError>>;
|
|
18
|
+
//# sourceMappingURL=guardrailsGet.d.ts.map
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
+
* @generated-id: d045f0f3c9d1
|
|
4
|
+
*/
|
|
5
|
+
import { 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
|
+
* Get a guardrail
|
|
16
|
+
*
|
|
17
|
+
* @remarks
|
|
18
|
+
* Get a single guardrail by ID. [Provisioning key](/docs/guides/overview/auth/provisioning-api-keys) required.
|
|
19
|
+
*/
|
|
20
|
+
export function guardrailsGet(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.GetGuardrailRequest$outboundSchema.parse(value), "Input validation failed");
|
|
25
|
+
if (!parsed.ok) {
|
|
26
|
+
return [parsed, { status: "invalid" }];
|
|
27
|
+
}
|
|
28
|
+
const payload = parsed.value;
|
|
29
|
+
const body = null;
|
|
30
|
+
const pathParams = {
|
|
31
|
+
id: encodeSimple("id", payload.id, {
|
|
32
|
+
explode: false,
|
|
33
|
+
charEncoding: "percent",
|
|
34
|
+
}),
|
|
35
|
+
};
|
|
36
|
+
const path = pathToFunc("/guardrails/{id}")(pathParams);
|
|
37
|
+
const headers = new Headers(compactMap({
|
|
38
|
+
Accept: "application/json",
|
|
39
|
+
}));
|
|
40
|
+
const secConfig = await extractSecurity(client._options.apiKey);
|
|
41
|
+
const securityInput = secConfig == null ? {} : { apiKey: secConfig };
|
|
42
|
+
const requestSecurity = resolveGlobalSecurity(securityInput);
|
|
43
|
+
const context = {
|
|
44
|
+
options: client._options,
|
|
45
|
+
baseURL: options?.serverURL ?? client._baseURL ?? "",
|
|
46
|
+
operationID: "getGuardrail",
|
|
47
|
+
oAuth2Scopes: null,
|
|
48
|
+
resolvedSecurity: requestSecurity,
|
|
49
|
+
securitySource: client._options.apiKey,
|
|
50
|
+
retryConfig: options?.retries
|
|
51
|
+
|| client._options.retryConfig
|
|
52
|
+
|| { strategy: "none" },
|
|
53
|
+
retryCodes: options?.retryCodes || ["429", "500", "502", "503", "504"],
|
|
54
|
+
};
|
|
55
|
+
const requestRes = client._createRequest(context, {
|
|
56
|
+
security: requestSecurity,
|
|
57
|
+
method: "GET",
|
|
58
|
+
baseURL: options?.serverURL,
|
|
59
|
+
path: path,
|
|
60
|
+
headers: headers,
|
|
61
|
+
body: body,
|
|
62
|
+
userAgent: client._options.userAgent,
|
|
63
|
+
timeoutMs: options?.timeoutMs || client._options.timeoutMs || -1,
|
|
64
|
+
}, options);
|
|
65
|
+
if (!requestRes.ok) {
|
|
66
|
+
return [requestRes, { status: "invalid" }];
|
|
67
|
+
}
|
|
68
|
+
const req = requestRes.value;
|
|
69
|
+
const doResult = await client._do(req, {
|
|
70
|
+
context,
|
|
71
|
+
errorCodes: ["401", "404", "4XX", "500", "5XX"],
|
|
72
|
+
retryConfig: context.retryConfig,
|
|
73
|
+
retryCodes: context.retryCodes,
|
|
74
|
+
});
|
|
75
|
+
if (!doResult.ok) {
|
|
76
|
+
return [doResult, { status: "request-error", request: req }];
|
|
77
|
+
}
|
|
78
|
+
const response = doResult.value;
|
|
79
|
+
const responseFields = {
|
|
80
|
+
HttpMeta: { Response: response, Request: req },
|
|
81
|
+
};
|
|
82
|
+
const [result] = await M.match(M.json(200, operations.GetGuardrailResponse$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 });
|
|
83
|
+
if (!result.ok) {
|
|
84
|
+
return [result, { status: "complete", request: req, response }];
|
|
85
|
+
}
|
|
86
|
+
return [result, { status: "complete", request: req, response }];
|
|
87
|
+
}
|
|
88
|
+
//# sourceMappingURL=guardrailsGet.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
|
+
* List guardrails
|
|
13
|
+
*
|
|
14
|
+
* @remarks
|
|
15
|
+
* List all guardrails for the authenticated user. [Provisioning key](/docs/guides/overview/auth/provisioning-api-keys) required.
|
|
16
|
+
*/
|
|
17
|
+
export declare function guardrailsList(client: OpenRouterCore, request?: operations.ListGuardrailsRequest | undefined, options?: RequestOptions): APIPromise<Result<operations.ListGuardrailsResponse, errors.UnauthorizedResponseError | errors.InternalServerResponseError | OpenRouterError | ResponseValidationError | ConnectionError | RequestAbortedError | RequestTimeoutError | InvalidRequestError | UnexpectedClientError | SDKValidationError>>;
|
|
18
|
+
//# sourceMappingURL=guardrailsList.d.ts.map
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
+
* @generated-id: 4c066e741cd8
|
|
4
|
+
*/
|
|
5
|
+
import { encodeFormQuery } 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
|
+
* List guardrails
|
|
16
|
+
*
|
|
17
|
+
* @remarks
|
|
18
|
+
* List all guardrails for the authenticated user. [Provisioning key](/docs/guides/overview/auth/provisioning-api-keys) required.
|
|
19
|
+
*/
|
|
20
|
+
export function guardrailsList(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.ListGuardrailsRequest$outboundSchema.optional().parse(value), "Input validation failed");
|
|
25
|
+
if (!parsed.ok) {
|
|
26
|
+
return [parsed, { status: "invalid" }];
|
|
27
|
+
}
|
|
28
|
+
const payload = parsed.value;
|
|
29
|
+
const body = null;
|
|
30
|
+
const path = pathToFunc("/guardrails")();
|
|
31
|
+
const query = encodeFormQuery({
|
|
32
|
+
"limit": payload?.limit,
|
|
33
|
+
"offset": payload?.offset,
|
|
34
|
+
});
|
|
35
|
+
const headers = new Headers(compactMap({
|
|
36
|
+
Accept: "application/json",
|
|
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: "listGuardrails",
|
|
45
|
+
oAuth2Scopes: null,
|
|
46
|
+
resolvedSecurity: requestSecurity,
|
|
47
|
+
securitySource: client._options.apiKey,
|
|
48
|
+
retryConfig: options?.retries
|
|
49
|
+
|| client._options.retryConfig
|
|
50
|
+
|| { strategy: "none" },
|
|
51
|
+
retryCodes: options?.retryCodes || ["429", "500", "502", "503", "504"],
|
|
52
|
+
};
|
|
53
|
+
const requestRes = client._createRequest(context, {
|
|
54
|
+
security: requestSecurity,
|
|
55
|
+
method: "GET",
|
|
56
|
+
baseURL: options?.serverURL,
|
|
57
|
+
path: path,
|
|
58
|
+
headers: headers,
|
|
59
|
+
query: query,
|
|
60
|
+
body: body,
|
|
61
|
+
userAgent: client._options.userAgent,
|
|
62
|
+
timeoutMs: options?.timeoutMs || client._options.timeoutMs || -1,
|
|
63
|
+
}, options);
|
|
64
|
+
if (!requestRes.ok) {
|
|
65
|
+
return [requestRes, { status: "invalid" }];
|
|
66
|
+
}
|
|
67
|
+
const req = requestRes.value;
|
|
68
|
+
const doResult = await client._do(req, {
|
|
69
|
+
context,
|
|
70
|
+
errorCodes: ["401", "4XX", "500", "5XX"],
|
|
71
|
+
retryConfig: context.retryConfig,
|
|
72
|
+
retryCodes: context.retryCodes,
|
|
73
|
+
});
|
|
74
|
+
if (!doResult.ok) {
|
|
75
|
+
return [doResult, { status: "request-error", request: req }];
|
|
76
|
+
}
|
|
77
|
+
const response = doResult.value;
|
|
78
|
+
const responseFields = {
|
|
79
|
+
HttpMeta: { Response: response, Request: req },
|
|
80
|
+
};
|
|
81
|
+
const [result] = await M.match(M.json(200, operations.ListGuardrailsResponse$inboundSchema), M.jsonErr(401, errors.UnauthorizedResponseError$inboundSchema), M.jsonErr(500, errors.InternalServerResponseError$inboundSchema), M.fail("4XX"), M.fail("5XX"))(response, req, { extraFields: responseFields });
|
|
82
|
+
if (!result.ok) {
|
|
83
|
+
return [result, { status: "complete", request: req, response }];
|
|
84
|
+
}
|
|
85
|
+
return [result, { status: "complete", request: req, response }];
|
|
86
|
+
}
|
|
87
|
+
//# sourceMappingURL=guardrailsList.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
|
+
* List key assignments for a guardrail
|
|
13
|
+
*
|
|
14
|
+
* @remarks
|
|
15
|
+
* List all API key assignments for a specific guardrail. [Provisioning key](/docs/guides/overview/auth/provisioning-api-keys) required.
|
|
16
|
+
*/
|
|
17
|
+
export declare function guardrailsListGuardrailKeyAssignments(client: OpenRouterCore, request: operations.ListGuardrailKeyAssignmentsRequest, options?: RequestOptions): APIPromise<Result<operations.ListGuardrailKeyAssignmentsResponse, errors.UnauthorizedResponseError | errors.NotFoundResponseError | errors.InternalServerResponseError | OpenRouterError | ResponseValidationError | ConnectionError | RequestAbortedError | RequestTimeoutError | InvalidRequestError | UnexpectedClientError | SDKValidationError>>;
|
|
18
|
+
//# sourceMappingURL=guardrailsListGuardrailKeyAssignments.d.ts.map
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
+
* @generated-id: e0b13763f920
|
|
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 operations from "../models/operations/index.js";
|
|
13
|
+
import { APIPromise } from "../types/async.js";
|
|
14
|
+
/**
|
|
15
|
+
* List key assignments for a guardrail
|
|
16
|
+
*
|
|
17
|
+
* @remarks
|
|
18
|
+
* List all API key assignments for a specific guardrail. [Provisioning key](/docs/guides/overview/auth/provisioning-api-keys) required.
|
|
19
|
+
*/
|
|
20
|
+
export function guardrailsListGuardrailKeyAssignments(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.ListGuardrailKeyAssignmentsRequest$outboundSchema.parse(value), "Input validation failed");
|
|
25
|
+
if (!parsed.ok) {
|
|
26
|
+
return [parsed, { status: "invalid" }];
|
|
27
|
+
}
|
|
28
|
+
const payload = parsed.value;
|
|
29
|
+
const body = null;
|
|
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 query = encodeFormQuery({
|
|
38
|
+
"limit": payload.limit,
|
|
39
|
+
"offset": payload.offset,
|
|
40
|
+
});
|
|
41
|
+
const headers = new Headers(compactMap({
|
|
42
|
+
Accept: "application/json",
|
|
43
|
+
}));
|
|
44
|
+
const secConfig = await extractSecurity(client._options.apiKey);
|
|
45
|
+
const securityInput = secConfig == null ? {} : { apiKey: secConfig };
|
|
46
|
+
const requestSecurity = resolveGlobalSecurity(securityInput);
|
|
47
|
+
const context = {
|
|
48
|
+
options: client._options,
|
|
49
|
+
baseURL: options?.serverURL ?? client._baseURL ?? "",
|
|
50
|
+
operationID: "listGuardrailKeyAssignments",
|
|
51
|
+
oAuth2Scopes: null,
|
|
52
|
+
resolvedSecurity: requestSecurity,
|
|
53
|
+
securitySource: client._options.apiKey,
|
|
54
|
+
retryConfig: options?.retries
|
|
55
|
+
|| client._options.retryConfig
|
|
56
|
+
|| { strategy: "none" },
|
|
57
|
+
retryCodes: options?.retryCodes || ["429", "500", "502", "503", "504"],
|
|
58
|
+
};
|
|
59
|
+
const requestRes = client._createRequest(context, {
|
|
60
|
+
security: requestSecurity,
|
|
61
|
+
method: "GET",
|
|
62
|
+
baseURL: options?.serverURL,
|
|
63
|
+
path: path,
|
|
64
|
+
headers: headers,
|
|
65
|
+
query: query,
|
|
66
|
+
body: body,
|
|
67
|
+
userAgent: client._options.userAgent,
|
|
68
|
+
timeoutMs: options?.timeoutMs || client._options.timeoutMs || -1,
|
|
69
|
+
}, options);
|
|
70
|
+
if (!requestRes.ok) {
|
|
71
|
+
return [requestRes, { status: "invalid" }];
|
|
72
|
+
}
|
|
73
|
+
const req = requestRes.value;
|
|
74
|
+
const doResult = await client._do(req, {
|
|
75
|
+
context,
|
|
76
|
+
errorCodes: ["401", "404", "4XX", "500", "5XX"],
|
|
77
|
+
retryConfig: context.retryConfig,
|
|
78
|
+
retryCodes: context.retryCodes,
|
|
79
|
+
});
|
|
80
|
+
if (!doResult.ok) {
|
|
81
|
+
return [doResult, { status: "request-error", request: req }];
|
|
82
|
+
}
|
|
83
|
+
const response = doResult.value;
|
|
84
|
+
const responseFields = {
|
|
85
|
+
HttpMeta: { Response: response, Request: req },
|
|
86
|
+
};
|
|
87
|
+
const [result] = await M.match(M.json(200, operations.ListGuardrailKeyAssignmentsResponse$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 });
|
|
88
|
+
if (!result.ok) {
|
|
89
|
+
return [result, { status: "complete", request: req, response }];
|
|
90
|
+
}
|
|
91
|
+
return [result, { status: "complete", request: req, response }];
|
|
92
|
+
}
|
|
93
|
+
//# sourceMappingURL=guardrailsListGuardrailKeyAssignments.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
|
+
* List member assignments for a guardrail
|
|
13
|
+
*
|
|
14
|
+
* @remarks
|
|
15
|
+
* List all organization member assignments for a specific guardrail. [Provisioning key](/docs/guides/overview/auth/provisioning-api-keys) required.
|
|
16
|
+
*/
|
|
17
|
+
export declare function guardrailsListGuardrailMemberAssignments(client: OpenRouterCore, request: operations.ListGuardrailMemberAssignmentsRequest, options?: RequestOptions): APIPromise<Result<operations.ListGuardrailMemberAssignmentsResponse, errors.UnauthorizedResponseError | errors.NotFoundResponseError | errors.InternalServerResponseError | OpenRouterError | ResponseValidationError | ConnectionError | RequestAbortedError | RequestTimeoutError | InvalidRequestError | UnexpectedClientError | SDKValidationError>>;
|
|
18
|
+
//# sourceMappingURL=guardrailsListGuardrailMemberAssignments.d.ts.map
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
+
* @generated-id: f89f2416fbd5
|
|
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 operations from "../models/operations/index.js";
|
|
13
|
+
import { APIPromise } from "../types/async.js";
|
|
14
|
+
/**
|
|
15
|
+
* List member assignments for a guardrail
|
|
16
|
+
*
|
|
17
|
+
* @remarks
|
|
18
|
+
* List all organization member assignments for a specific guardrail. [Provisioning key](/docs/guides/overview/auth/provisioning-api-keys) required.
|
|
19
|
+
*/
|
|
20
|
+
export function guardrailsListGuardrailMemberAssignments(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.ListGuardrailMemberAssignmentsRequest$outboundSchema.parse(value), "Input validation failed");
|
|
25
|
+
if (!parsed.ok) {
|
|
26
|
+
return [parsed, { status: "invalid" }];
|
|
27
|
+
}
|
|
28
|
+
const payload = parsed.value;
|
|
29
|
+
const body = null;
|
|
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 query = encodeFormQuery({
|
|
38
|
+
"limit": payload.limit,
|
|
39
|
+
"offset": payload.offset,
|
|
40
|
+
});
|
|
41
|
+
const headers = new Headers(compactMap({
|
|
42
|
+
Accept: "application/json",
|
|
43
|
+
}));
|
|
44
|
+
const secConfig = await extractSecurity(client._options.apiKey);
|
|
45
|
+
const securityInput = secConfig == null ? {} : { apiKey: secConfig };
|
|
46
|
+
const requestSecurity = resolveGlobalSecurity(securityInput);
|
|
47
|
+
const context = {
|
|
48
|
+
options: client._options,
|
|
49
|
+
baseURL: options?.serverURL ?? client._baseURL ?? "",
|
|
50
|
+
operationID: "listGuardrailMemberAssignments",
|
|
51
|
+
oAuth2Scopes: null,
|
|
52
|
+
resolvedSecurity: requestSecurity,
|
|
53
|
+
securitySource: client._options.apiKey,
|
|
54
|
+
retryConfig: options?.retries
|
|
55
|
+
|| client._options.retryConfig
|
|
56
|
+
|| { strategy: "none" },
|
|
57
|
+
retryCodes: options?.retryCodes || ["429", "500", "502", "503", "504"],
|
|
58
|
+
};
|
|
59
|
+
const requestRes = client._createRequest(context, {
|
|
60
|
+
security: requestSecurity,
|
|
61
|
+
method: "GET",
|
|
62
|
+
baseURL: options?.serverURL,
|
|
63
|
+
path: path,
|
|
64
|
+
headers: headers,
|
|
65
|
+
query: query,
|
|
66
|
+
body: body,
|
|
67
|
+
userAgent: client._options.userAgent,
|
|
68
|
+
timeoutMs: options?.timeoutMs || client._options.timeoutMs || -1,
|
|
69
|
+
}, options);
|
|
70
|
+
if (!requestRes.ok) {
|
|
71
|
+
return [requestRes, { status: "invalid" }];
|
|
72
|
+
}
|
|
73
|
+
const req = requestRes.value;
|
|
74
|
+
const doResult = await client._do(req, {
|
|
75
|
+
context,
|
|
76
|
+
errorCodes: ["401", "404", "4XX", "500", "5XX"],
|
|
77
|
+
retryConfig: context.retryConfig,
|
|
78
|
+
retryCodes: context.retryCodes,
|
|
79
|
+
});
|
|
80
|
+
if (!doResult.ok) {
|
|
81
|
+
return [doResult, { status: "request-error", request: req }];
|
|
82
|
+
}
|
|
83
|
+
const response = doResult.value;
|
|
84
|
+
const responseFields = {
|
|
85
|
+
HttpMeta: { Response: response, Request: req },
|
|
86
|
+
};
|
|
87
|
+
const [result] = await M.match(M.json(200, operations.ListGuardrailMemberAssignmentsResponse$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 });
|
|
88
|
+
if (!result.ok) {
|
|
89
|
+
return [result, { status: "complete", request: req, response }];
|
|
90
|
+
}
|
|
91
|
+
return [result, { status: "complete", request: req, response }];
|
|
92
|
+
}
|
|
93
|
+
//# sourceMappingURL=guardrailsListGuardrailMemberAssignments.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
|
+
* List all key assignments
|
|
13
|
+
*
|
|
14
|
+
* @remarks
|
|
15
|
+
* List all API key guardrail assignments for the authenticated user. [Provisioning key](/docs/guides/overview/auth/provisioning-api-keys) required.
|
|
16
|
+
*/
|
|
17
|
+
export declare function guardrailsListKeyAssignments(client: OpenRouterCore, request?: operations.ListKeyAssignmentsRequest | undefined, options?: RequestOptions): APIPromise<Result<operations.ListKeyAssignmentsResponse, errors.UnauthorizedResponseError | errors.InternalServerResponseError | OpenRouterError | ResponseValidationError | ConnectionError | RequestAbortedError | RequestTimeoutError | InvalidRequestError | UnexpectedClientError | SDKValidationError>>;
|
|
18
|
+
//# sourceMappingURL=guardrailsListKeyAssignments.d.ts.map
|