@openrouter/sdk 1.2.131 → 1.2.132

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.
Files changed (52) hide show
  1. package/esm/funcs/vaultCopyVaultSecretsToIntern.d.ts +21 -0
  2. package/esm/funcs/vaultCopyVaultSecretsToIntern.js +108 -0
  3. package/esm/funcs/vaultDeleteInternVaultSecret.d.ts +20 -0
  4. package/esm/funcs/vaultDeleteInternVaultSecret.js +109 -0
  5. package/esm/funcs/vaultDeleteVaultSecret.d.ts +20 -0
  6. package/esm/funcs/vaultDeleteVaultSecret.js +105 -0
  7. package/esm/funcs/vaultListInternVaultSecrets.d.ts +21 -0
  8. package/esm/funcs/vaultListInternVaultSecrets.js +110 -0
  9. package/esm/funcs/vaultListVaultSecrets.d.ts +21 -0
  10. package/esm/funcs/vaultListVaultSecrets.js +104 -0
  11. package/esm/funcs/vaultStoreInternVaultSecret.d.ts +21 -0
  12. package/esm/funcs/vaultStoreInternVaultSecret.js +112 -0
  13. package/esm/funcs/vaultStoreVaultSecret.d.ts +21 -0
  14. package/esm/funcs/vaultStoreVaultSecret.js +108 -0
  15. package/esm/lib/config.d.ts +2 -2
  16. package/esm/lib/config.js +2 -2
  17. package/esm/models/index.d.ts +6 -0
  18. package/esm/models/index.js +6 -0
  19. package/esm/models/operations/copyvaultsecretstointern.d.ts +61 -0
  20. package/esm/models/operations/copyvaultsecretstointern.js +24 -0
  21. package/esm/models/operations/deleteinternvaultsecret.d.ts +63 -0
  22. package/esm/models/operations/deleteinternvaultsecret.js +22 -0
  23. package/esm/models/operations/deletevaultsecret.d.ts +58 -0
  24. package/esm/models/operations/deletevaultsecret.js +21 -0
  25. package/esm/models/operations/index.d.ts +7 -0
  26. package/esm/models/operations/index.js +7 -0
  27. package/esm/models/operations/listinternvaultsecrets.d.ts +68 -0
  28. package/esm/models/operations/listinternvaultsecrets.js +23 -0
  29. package/esm/models/operations/listvaultsecrets.d.ts +63 -0
  30. package/esm/models/operations/listvaultsecrets.js +22 -0
  31. package/esm/models/operations/storeinternvaultsecret.d.ts +66 -0
  32. package/esm/models/operations/storeinternvaultsecret.js +25 -0
  33. package/esm/models/operations/storevaultsecret.d.ts +61 -0
  34. package/esm/models/operations/storevaultsecret.js +24 -0
  35. package/esm/models/vaultsecret.d.ts +16 -0
  36. package/esm/models/vaultsecret.js +23 -0
  37. package/esm/models/vaultsecretcopyrequest.d.ts +18 -0
  38. package/esm/models/vaultsecretcopyrequest.js +13 -0
  39. package/esm/models/vaultsecretcopyresponse.d.ts +14 -0
  40. package/esm/models/vaultsecretcopyresponse.js +15 -0
  41. package/esm/models/vaultsecretlistresponse.d.ts +18 -0
  42. package/esm/models/vaultsecretlistresponse.js +21 -0
  43. package/esm/models/vaultsecretresponse.d.ts +17 -0
  44. package/esm/models/vaultsecretresponse.js +15 -0
  45. package/esm/models/vaultsecretwriterequest.d.ts +23 -0
  46. package/esm/models/vaultsecretwriterequest.js +14 -0
  47. package/esm/sdk/sdk.d.ts +3 -0
  48. package/esm/sdk/sdk.js +4 -0
  49. package/esm/sdk/vault.d.ts +55 -0
  50. package/esm/sdk/vault.js +79 -0
  51. package/jsr.json +1 -1
  52. package/package.json +4 -4
@@ -0,0 +1,21 @@
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
+ * Copy workspace secrets to an intern
14
+ *
15
+ * @remarks
16
+ * Copies the named workspace secrets into one intern's scope, replacing any intern secret with the same name. Each copy keeps the source value and host bindings. Every name must exist in the workspace scope or the request fails with 404 and nothing is copied. A workspace secret whose `hosts` is `null` cannot be copied: the request fails with 409 and nothing is copied until that secret is stored again with hosts. The response carries metadata only. Writes return 503 while vault writes are disabled for the caller. The scope is selected by the API key: workspace routes act on the key's active workspace and intern routes act on one intern inside that workspace. There is no default workspace and no fallback to another scope. Every vault route, including reads, requires access to the Intern API programme and returns 404 outside it. Requests on regional hostnames such as `eu.openrouter.ai` are refused. [API key](/docs/api-reference/authentication) required.
17
+ *
18
+ * If set, this operation will use {@link Security.apiKey} from the global security.
19
+ */
20
+ export declare function vaultCopyVaultSecretsToIntern(client: OpenRouterCore, request: operations.CopyVaultSecretsToInternRequest, options?: RequestOptions): APIPromise<Result<models.VaultSecretCopyResponse, errors.BadRequestResponseError | errors.UnauthorizedResponseError | errors.ForbiddenResponseError | errors.NotFoundResponseError | errors.RequestTimeoutResponseError | errors.ConflictResponseError | errors.PayloadTooLargeResponseError | errors.TooManyRequestsResponseError | errors.InternalServerResponseError | errors.BadGatewayResponseError | errors.ServiceUnavailableResponseError | errors.GatewayTimeoutResponseError | OpenRouterError | ResponseValidationError | ConnectionError | RequestAbortedError | RequestTimeoutError | InvalidRequestError | UnexpectedClientError | SDKValidationError>>;
21
+ //# sourceMappingURL=vaultCopyVaultSecretsToIntern.d.ts.map
@@ -0,0 +1,108 @@
1
+ /*
2
+ * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
3
+ * @generated-id: 5f2c033bee20
4
+ */
5
+ import { encodeJSON, encodeSimple } from "../lib/encodings.js";
6
+ import { matchStatusCode } from "../lib/http.js";
7
+ import * as M from "../lib/matchers.js";
8
+ import { compactMap } from "../lib/primitives.js";
9
+ import { safeParse } from "../lib/schemas.js";
10
+ import { extractSecurity, resolveGlobalSecurity } from "../lib/security.js";
11
+ import { pathToFunc } from "../lib/url.js";
12
+ import * as errors from "../models/errors/index.js";
13
+ import * as models from "../models/index.js";
14
+ import * as operations from "../models/operations/index.js";
15
+ import { APIPromise } from "../types/async.js";
16
+ /**
17
+ * Copy workspace secrets to an intern
18
+ *
19
+ * @remarks
20
+ * Copies the named workspace secrets into one intern's scope, replacing any intern secret with the same name. Each copy keeps the source value and host bindings. Every name must exist in the workspace scope or the request fails with 404 and nothing is copied. A workspace secret whose `hosts` is `null` cannot be copied: the request fails with 409 and nothing is copied until that secret is stored again with hosts. The response carries metadata only. Writes return 503 while vault writes are disabled for the caller. The scope is selected by the API key: workspace routes act on the key's active workspace and intern routes act on one intern inside that workspace. There is no default workspace and no fallback to another scope. Every vault route, including reads, requires access to the Intern API programme and returns 404 outside it. Requests on regional hostnames such as `eu.openrouter.ai` are refused. [API key](/docs/api-reference/authentication) required.
21
+ *
22
+ * If set, this operation will use {@link Security.apiKey} from the global security.
23
+ */
24
+ export function vaultCopyVaultSecretsToIntern(client, request, options) {
25
+ return new APIPromise($do(client, request, options));
26
+ }
27
+ async function $do(client, request, options) {
28
+ const parsed = safeParse(request, (value) => operations.CopyVaultSecretsToInternRequest$outboundSchema.parse(value), "Input validation failed");
29
+ if (!parsed.ok) {
30
+ return [parsed, { status: "invalid" }];
31
+ }
32
+ const payload = parsed.value;
33
+ const body = encodeJSON("body", payload.VaultSecretCopyRequest, {
34
+ explode: true,
35
+ });
36
+ const pathParams = {
37
+ internId: encodeSimple("internId", payload.internId, {
38
+ explode: false,
39
+ charEncoding: "percent",
40
+ }),
41
+ };
42
+ const path = pathToFunc("/vault/interns/{internId}/secrets/copy")(pathParams);
43
+ const headers = new Headers(compactMap({
44
+ "Content-Type": "application/json",
45
+ Accept: "application/json",
46
+ "HTTP-Referer": encodeSimple("HTTP-Referer", payload["HTTP-Referer"] ?? client._options.httpReferer, { explode: false, charEncoding: "none" }),
47
+ "X-OpenRouter-Categories": encodeSimple("X-OpenRouter-Categories", payload.appCategories ?? client._options.appCategories, { explode: false, charEncoding: "none" }),
48
+ "X-OpenRouter-Title": encodeSimple("X-OpenRouter-Title", payload.appTitle ?? client._options.appTitle, { explode: false, charEncoding: "none" }),
49
+ }));
50
+ const secConfig = await extractSecurity(client._options.apiKey);
51
+ const securityInput = secConfig == null ? {} : { apiKey: secConfig };
52
+ const requestSecurity = resolveGlobalSecurity(securityInput, [0]);
53
+ const context = {
54
+ options: client._options,
55
+ baseURL: options?.serverURL ?? client._baseURL ?? "",
56
+ operationID: "copyVaultSecretsToIntern",
57
+ oAuth2Scopes: null,
58
+ resolvedSecurity: requestSecurity,
59
+ securitySource: client._options.apiKey,
60
+ retryConfig: options?.retries
61
+ || client._options.retryConfig
62
+ || {
63
+ strategy: "backoff",
64
+ backoff: {
65
+ initialInterval: 500,
66
+ maxInterval: 60000,
67
+ exponent: 1.5,
68
+ maxElapsedTime: 3600000,
69
+ },
70
+ retryConnectionErrors: true,
71
+ }
72
+ || { strategy: "none" },
73
+ retryCodes: options?.retryCodes || ["5XX"],
74
+ };
75
+ const requestRes = client._createRequest(context, {
76
+ security: requestSecurity,
77
+ method: "POST",
78
+ baseURL: options?.serverURL,
79
+ path: path,
80
+ headers: headers,
81
+ body: body,
82
+ userAgent: client._options.userAgent,
83
+ timeoutMs: options?.timeoutMs || client._options.timeoutMs || -1,
84
+ }, options);
85
+ if (!requestRes.ok) {
86
+ return [requestRes, { status: "invalid" }];
87
+ }
88
+ const req = requestRes.value;
89
+ const doResult = await client._do(req, {
90
+ context,
91
+ isErrorStatusCode: (statusCode) => matchStatusCode({ status: statusCode }, ["4XX", "5XX"]),
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.VaultSecretCopyResponse$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(408, errors.RequestTimeoutResponseError$inboundSchema), M.jsonErr(409, errors.ConflictResponseError$inboundSchema), M.jsonErr(413, errors.PayloadTooLargeResponseError$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(504, errors.GatewayTimeoutResponseError$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=vaultCopyVaultSecretsToIntern.js.map
@@ -0,0 +1,20 @@
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 an intern secret
13
+ *
14
+ * @remarks
15
+ * Deletes a secret stored for one intern. Returns 204 with no body on success and 404 when the secret does not exist in the selected scope. Writes return 503 while vault writes are disabled for the caller. The scope is selected by the API key: workspace routes act on the key's active workspace and intern routes act on one intern inside that workspace. There is no default workspace and no fallback to another scope. Every vault route, including reads, requires access to the Intern API programme and returns 404 outside it. Requests on regional hostnames such as `eu.openrouter.ai` are refused. [API key](/docs/api-reference/authentication) required.
16
+ *
17
+ * If set, this operation will use {@link Security.apiKey} from the global security.
18
+ */
19
+ export declare function vaultDeleteInternVaultSecret(client: OpenRouterCore, request: operations.DeleteInternVaultSecretRequest, options?: RequestOptions): APIPromise<Result<void, errors.BadRequestResponseError | errors.UnauthorizedResponseError | errors.ForbiddenResponseError | errors.NotFoundResponseError | errors.RequestTimeoutResponseError | errors.TooManyRequestsResponseError | errors.InternalServerResponseError | errors.BadGatewayResponseError | errors.ServiceUnavailableResponseError | errors.GatewayTimeoutResponseError | OpenRouterError | ResponseValidationError | ConnectionError | RequestAbortedError | RequestTimeoutError | InvalidRequestError | UnexpectedClientError | SDKValidationError>>;
20
+ //# sourceMappingURL=vaultDeleteInternVaultSecret.d.ts.map
@@ -0,0 +1,109 @@
1
+ /*
2
+ * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
3
+ * @generated-id: b714b9bd8f2a
4
+ */
5
+ import * as z from "zod/v4";
6
+ import { encodeSimple } from "../lib/encodings.js";
7
+ import { matchStatusCode } from "../lib/http.js";
8
+ import * as M from "../lib/matchers.js";
9
+ import { compactMap } from "../lib/primitives.js";
10
+ import { safeParse } from "../lib/schemas.js";
11
+ import { extractSecurity, resolveGlobalSecurity } from "../lib/security.js";
12
+ import { pathToFunc } from "../lib/url.js";
13
+ import * as errors from "../models/errors/index.js";
14
+ import * as operations from "../models/operations/index.js";
15
+ import { APIPromise } from "../types/async.js";
16
+ /**
17
+ * Delete an intern secret
18
+ *
19
+ * @remarks
20
+ * Deletes a secret stored for one intern. Returns 204 with no body on success and 404 when the secret does not exist in the selected scope. Writes return 503 while vault writes are disabled for the caller. The scope is selected by the API key: workspace routes act on the key's active workspace and intern routes act on one intern inside that workspace. There is no default workspace and no fallback to another scope. Every vault route, including reads, requires access to the Intern API programme and returns 404 outside it. Requests on regional hostnames such as `eu.openrouter.ai` are refused. [API key](/docs/api-reference/authentication) required.
21
+ *
22
+ * If set, this operation will use {@link Security.apiKey} from the global security.
23
+ */
24
+ export function vaultDeleteInternVaultSecret(client, request, options) {
25
+ return new APIPromise($do(client, request, options));
26
+ }
27
+ async function $do(client, request, options) {
28
+ const parsed = safeParse(request, (value) => operations.DeleteInternVaultSecretRequest$outboundSchema.parse(value), "Input validation failed");
29
+ if (!parsed.ok) {
30
+ return [parsed, { status: "invalid" }];
31
+ }
32
+ const payload = parsed.value;
33
+ const body = null;
34
+ const pathParams = {
35
+ internId: encodeSimple("internId", payload.internId, {
36
+ explode: false,
37
+ charEncoding: "percent",
38
+ }),
39
+ name: encodeSimple("name", payload.name, {
40
+ explode: false,
41
+ charEncoding: "percent",
42
+ }),
43
+ };
44
+ const path = pathToFunc("/vault/interns/{internId}/secrets/{name}")(pathParams);
45
+ const headers = new Headers(compactMap({
46
+ Accept: "application/json",
47
+ "HTTP-Referer": encodeSimple("HTTP-Referer", payload["HTTP-Referer"] ?? client._options.httpReferer, { explode: false, charEncoding: "none" }),
48
+ "X-OpenRouter-Categories": encodeSimple("X-OpenRouter-Categories", payload.appCategories ?? client._options.appCategories, { explode: false, charEncoding: "none" }),
49
+ "X-OpenRouter-Title": encodeSimple("X-OpenRouter-Title", payload.appTitle ?? client._options.appTitle, { explode: false, charEncoding: "none" }),
50
+ }));
51
+ const secConfig = await extractSecurity(client._options.apiKey);
52
+ const securityInput = secConfig == null ? {} : { apiKey: secConfig };
53
+ const requestSecurity = resolveGlobalSecurity(securityInput, [0]);
54
+ const context = {
55
+ options: client._options,
56
+ baseURL: options?.serverURL ?? client._baseURL ?? "",
57
+ operationID: "deleteInternVaultSecret",
58
+ oAuth2Scopes: null,
59
+ resolvedSecurity: requestSecurity,
60
+ securitySource: client._options.apiKey,
61
+ retryConfig: options?.retries
62
+ || client._options.retryConfig
63
+ || {
64
+ strategy: "backoff",
65
+ backoff: {
66
+ initialInterval: 500,
67
+ maxInterval: 60000,
68
+ exponent: 1.5,
69
+ maxElapsedTime: 3600000,
70
+ },
71
+ retryConnectionErrors: true,
72
+ }
73
+ || { strategy: "none" },
74
+ retryCodes: options?.retryCodes || ["5XX"],
75
+ };
76
+ const requestRes = client._createRequest(context, {
77
+ security: requestSecurity,
78
+ method: "DELETE",
79
+ baseURL: options?.serverURL,
80
+ path: path,
81
+ headers: headers,
82
+ body: body,
83
+ userAgent: client._options.userAgent,
84
+ timeoutMs: options?.timeoutMs || client._options.timeoutMs || -1,
85
+ }, options);
86
+ if (!requestRes.ok) {
87
+ return [requestRes, { status: "invalid" }];
88
+ }
89
+ const req = requestRes.value;
90
+ const doResult = await client._do(req, {
91
+ context,
92
+ isErrorStatusCode: (statusCode) => matchStatusCode({ status: statusCode }, ["4XX", "5XX"]),
93
+ retryConfig: context.retryConfig,
94
+ retryCodes: context.retryCodes,
95
+ });
96
+ if (!doResult.ok) {
97
+ return [doResult, { status: "request-error", request: req }];
98
+ }
99
+ const response = doResult.value;
100
+ const responseFields = {
101
+ HttpMeta: { Response: response, Request: req },
102
+ };
103
+ const [result] = await M.match(M.nil(204, z.void()), 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(408, errors.RequestTimeoutResponseError$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(504, errors.GatewayTimeoutResponseError$inboundSchema), M.fail("4XX"), M.fail("5XX"))(response, req, { extraFields: responseFields });
104
+ if (!result.ok) {
105
+ return [result, { status: "complete", request: req, response }];
106
+ }
107
+ return [result, { status: "complete", request: req, response }];
108
+ }
109
+ //# sourceMappingURL=vaultDeleteInternVaultSecret.js.map
@@ -0,0 +1,20 @@
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 workspace secret
13
+ *
14
+ * @remarks
15
+ * Deletes a secret from the workspace of the authenticated API key. Returns 204 with no body on success and 404 when the secret does not exist in the selected scope. Writes return 503 while vault writes are disabled for the caller. The scope is selected by the API key: workspace routes act on the key's active workspace and intern routes act on one intern inside that workspace. There is no default workspace and no fallback to another scope. Every vault route, including reads, requires access to the Intern API programme and returns 404 outside it. Requests on regional hostnames such as `eu.openrouter.ai` are refused. [API key](/docs/api-reference/authentication) required.
16
+ *
17
+ * If set, this operation will use {@link Security.apiKey} from the global security.
18
+ */
19
+ export declare function vaultDeleteVaultSecret(client: OpenRouterCore, request: operations.DeleteVaultSecretRequest, options?: RequestOptions): APIPromise<Result<void, errors.BadRequestResponseError | errors.UnauthorizedResponseError | errors.ForbiddenResponseError | errors.NotFoundResponseError | errors.RequestTimeoutResponseError | errors.TooManyRequestsResponseError | errors.InternalServerResponseError | errors.BadGatewayResponseError | errors.ServiceUnavailableResponseError | errors.GatewayTimeoutResponseError | OpenRouterError | ResponseValidationError | ConnectionError | RequestAbortedError | RequestTimeoutError | InvalidRequestError | UnexpectedClientError | SDKValidationError>>;
20
+ //# sourceMappingURL=vaultDeleteVaultSecret.d.ts.map
@@ -0,0 +1,105 @@
1
+ /*
2
+ * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
3
+ * @generated-id: 9af36010c726
4
+ */
5
+ import * as z from "zod/v4";
6
+ import { encodeSimple } from "../lib/encodings.js";
7
+ import { matchStatusCode } from "../lib/http.js";
8
+ import * as M from "../lib/matchers.js";
9
+ import { compactMap } from "../lib/primitives.js";
10
+ import { safeParse } from "../lib/schemas.js";
11
+ import { extractSecurity, resolveGlobalSecurity } from "../lib/security.js";
12
+ import { pathToFunc } from "../lib/url.js";
13
+ import * as errors from "../models/errors/index.js";
14
+ import * as operations from "../models/operations/index.js";
15
+ import { APIPromise } from "../types/async.js";
16
+ /**
17
+ * Delete a workspace secret
18
+ *
19
+ * @remarks
20
+ * Deletes a secret from the workspace of the authenticated API key. Returns 204 with no body on success and 404 when the secret does not exist in the selected scope. Writes return 503 while vault writes are disabled for the caller. The scope is selected by the API key: workspace routes act on the key's active workspace and intern routes act on one intern inside that workspace. There is no default workspace and no fallback to another scope. Every vault route, including reads, requires access to the Intern API programme and returns 404 outside it. Requests on regional hostnames such as `eu.openrouter.ai` are refused. [API key](/docs/api-reference/authentication) required.
21
+ *
22
+ * If set, this operation will use {@link Security.apiKey} from the global security.
23
+ */
24
+ export function vaultDeleteVaultSecret(client, request, options) {
25
+ return new APIPromise($do(client, request, options));
26
+ }
27
+ async function $do(client, request, options) {
28
+ const parsed = safeParse(request, (value) => operations.DeleteVaultSecretRequest$outboundSchema.parse(value), "Input validation failed");
29
+ if (!parsed.ok) {
30
+ return [parsed, { status: "invalid" }];
31
+ }
32
+ const payload = parsed.value;
33
+ const body = null;
34
+ const pathParams = {
35
+ name: encodeSimple("name", payload.name, {
36
+ explode: false,
37
+ charEncoding: "percent",
38
+ }),
39
+ };
40
+ const path = pathToFunc("/vault/secrets/{name}")(pathParams);
41
+ const headers = new Headers(compactMap({
42
+ Accept: "application/json",
43
+ "HTTP-Referer": encodeSimple("HTTP-Referer", payload["HTTP-Referer"] ?? client._options.httpReferer, { explode: false, charEncoding: "none" }),
44
+ "X-OpenRouter-Categories": encodeSimple("X-OpenRouter-Categories", payload.appCategories ?? client._options.appCategories, { explode: false, charEncoding: "none" }),
45
+ "X-OpenRouter-Title": encodeSimple("X-OpenRouter-Title", payload.appTitle ?? client._options.appTitle, { explode: false, charEncoding: "none" }),
46
+ }));
47
+ const secConfig = await extractSecurity(client._options.apiKey);
48
+ const securityInput = secConfig == null ? {} : { apiKey: secConfig };
49
+ const requestSecurity = resolveGlobalSecurity(securityInput, [0]);
50
+ const context = {
51
+ options: client._options,
52
+ baseURL: options?.serverURL ?? client._baseURL ?? "",
53
+ operationID: "deleteVaultSecret",
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: "DELETE",
75
+ baseURL: options?.serverURL,
76
+ path: path,
77
+ headers: headers,
78
+ body: body,
79
+ userAgent: client._options.userAgent,
80
+ timeoutMs: options?.timeoutMs || client._options.timeoutMs || -1,
81
+ }, options);
82
+ if (!requestRes.ok) {
83
+ return [requestRes, { status: "invalid" }];
84
+ }
85
+ const req = requestRes.value;
86
+ const doResult = await client._do(req, {
87
+ context,
88
+ isErrorStatusCode: (statusCode) => matchStatusCode({ status: statusCode }, ["4XX", "5XX"]),
89
+ retryConfig: context.retryConfig,
90
+ retryCodes: context.retryCodes,
91
+ });
92
+ if (!doResult.ok) {
93
+ return [doResult, { status: "request-error", request: req }];
94
+ }
95
+ const response = doResult.value;
96
+ const responseFields = {
97
+ HttpMeta: { Response: response, Request: req },
98
+ };
99
+ const [result] = await M.match(M.nil(204, z.void()), 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(408, errors.RequestTimeoutResponseError$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(504, errors.GatewayTimeoutResponseError$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=vaultDeleteVaultSecret.js.map
@@ -0,0 +1,21 @@
1
+ import { OpenRouterCore } from "../core.js";
2
+ import { RequestOptions } from "../lib/sdks.js";
3
+ import { ConnectionError, InvalidRequestError, RequestAbortedError, RequestTimeoutError, UnexpectedClientError } from "../models/errors/httpclienterrors.js";
4
+ import * as errors from "../models/errors/index.js";
5
+ import { OpenRouterError } from "../models/errors/openroutererror.js";
6
+ import { ResponseValidationError } from "../models/errors/responsevalidationerror.js";
7
+ import { SDKValidationError } from "../models/errors/sdkvalidationerror.js";
8
+ import * as models from "../models/index.js";
9
+ import * as operations from "../models/operations/index.js";
10
+ import { APIPromise } from "../types/async.js";
11
+ import { Result } from "../types/fp.js";
12
+ /**
13
+ * List intern secrets
14
+ *
15
+ * @remarks
16
+ * Lists secret metadata stored for one intern. Responses contain names, bound hosts, fingerprints and creation times, never secret values. Results are ordered by name and paginated with `limit` and `offset`. The scope is selected by the API key: workspace routes act on the key's active workspace and intern routes act on one intern inside that workspace. There is no default workspace and no fallback to another scope. Every vault route, including reads, requires access to the Intern API programme and returns 404 outside it. Requests on regional hostnames such as `eu.openrouter.ai` are refused. [API key](/docs/api-reference/authentication) required.
17
+ *
18
+ * If set, this operation will use {@link Security.apiKey} from the global security.
19
+ */
20
+ export declare function vaultListInternVaultSecrets(client: OpenRouterCore, request: operations.ListInternVaultSecretsRequest, options?: RequestOptions): APIPromise<Result<models.VaultSecretListResponse, errors.BadRequestResponseError | errors.UnauthorizedResponseError | errors.ForbiddenResponseError | errors.NotFoundResponseError | errors.RequestTimeoutResponseError | errors.TooManyRequestsResponseError | errors.InternalServerResponseError | errors.BadGatewayResponseError | errors.ServiceUnavailableResponseError | errors.GatewayTimeoutResponseError | OpenRouterError | ResponseValidationError | ConnectionError | RequestAbortedError | RequestTimeoutError | InvalidRequestError | UnexpectedClientError | SDKValidationError>>;
21
+ //# sourceMappingURL=vaultListInternVaultSecrets.d.ts.map
@@ -0,0 +1,110 @@
1
+ /*
2
+ * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
3
+ * @generated-id: 2b49f136fb3f
4
+ */
5
+ import { encodeFormQuery, encodeSimple } from "../lib/encodings.js";
6
+ import { matchStatusCode } from "../lib/http.js";
7
+ import * as M from "../lib/matchers.js";
8
+ import { compactMap } from "../lib/primitives.js";
9
+ import { safeParse } from "../lib/schemas.js";
10
+ import { extractSecurity, resolveGlobalSecurity } from "../lib/security.js";
11
+ import { pathToFunc } from "../lib/url.js";
12
+ import * as errors from "../models/errors/index.js";
13
+ import * as models from "../models/index.js";
14
+ import * as operations from "../models/operations/index.js";
15
+ import { APIPromise } from "../types/async.js";
16
+ /**
17
+ * List intern secrets
18
+ *
19
+ * @remarks
20
+ * Lists secret metadata stored for one intern. Responses contain names, bound hosts, fingerprints and creation times, never secret values. Results are ordered by name and paginated with `limit` and `offset`. The scope is selected by the API key: workspace routes act on the key's active workspace and intern routes act on one intern inside that workspace. There is no default workspace and no fallback to another scope. Every vault route, including reads, requires access to the Intern API programme and returns 404 outside it. Requests on regional hostnames such as `eu.openrouter.ai` are refused. [API key](/docs/api-reference/authentication) required.
21
+ *
22
+ * If set, this operation will use {@link Security.apiKey} from the global security.
23
+ */
24
+ export function vaultListInternVaultSecrets(client, request, options) {
25
+ return new APIPromise($do(client, request, options));
26
+ }
27
+ async function $do(client, request, options) {
28
+ const parsed = safeParse(request, (value) => operations.ListInternVaultSecretsRequest$outboundSchema.parse(value), "Input validation failed");
29
+ if (!parsed.ok) {
30
+ return [parsed, { status: "invalid" }];
31
+ }
32
+ const payload = parsed.value;
33
+ const body = null;
34
+ const pathParams = {
35
+ internId: encodeSimple("internId", payload.internId, {
36
+ explode: false,
37
+ charEncoding: "percent",
38
+ }),
39
+ };
40
+ const path = pathToFunc("/vault/interns/{internId}/secrets")(pathParams);
41
+ const query = encodeFormQuery({
42
+ "limit": payload.limit,
43
+ "offset": payload.offset,
44
+ });
45
+ const headers = new Headers(compactMap({
46
+ Accept: "application/json",
47
+ "HTTP-Referer": encodeSimple("HTTP-Referer", payload["HTTP-Referer"] ?? client._options.httpReferer, { explode: false, charEncoding: "none" }),
48
+ "X-OpenRouter-Categories": encodeSimple("X-OpenRouter-Categories", payload.appCategories ?? client._options.appCategories, { explode: false, charEncoding: "none" }),
49
+ "X-OpenRouter-Title": encodeSimple("X-OpenRouter-Title", payload.appTitle ?? client._options.appTitle, { explode: false, charEncoding: "none" }),
50
+ }));
51
+ const secConfig = await extractSecurity(client._options.apiKey);
52
+ const securityInput = secConfig == null ? {} : { apiKey: secConfig };
53
+ const requestSecurity = resolveGlobalSecurity(securityInput, [0]);
54
+ const context = {
55
+ options: client._options,
56
+ baseURL: options?.serverURL ?? client._baseURL ?? "",
57
+ operationID: "listInternVaultSecrets",
58
+ oAuth2Scopes: null,
59
+ resolvedSecurity: requestSecurity,
60
+ securitySource: client._options.apiKey,
61
+ retryConfig: options?.retries
62
+ || client._options.retryConfig
63
+ || {
64
+ strategy: "backoff",
65
+ backoff: {
66
+ initialInterval: 500,
67
+ maxInterval: 60000,
68
+ exponent: 1.5,
69
+ maxElapsedTime: 3600000,
70
+ },
71
+ retryConnectionErrors: true,
72
+ }
73
+ || { strategy: "none" },
74
+ retryCodes: options?.retryCodes || ["5XX"],
75
+ };
76
+ const requestRes = client._createRequest(context, {
77
+ security: requestSecurity,
78
+ method: "GET",
79
+ baseURL: options?.serverURL,
80
+ path: path,
81
+ headers: headers,
82
+ query: query,
83
+ body: body,
84
+ userAgent: client._options.userAgent,
85
+ timeoutMs: options?.timeoutMs || client._options.timeoutMs || -1,
86
+ }, options);
87
+ if (!requestRes.ok) {
88
+ return [requestRes, { status: "invalid" }];
89
+ }
90
+ const req = requestRes.value;
91
+ const doResult = await client._do(req, {
92
+ context,
93
+ isErrorStatusCode: (statusCode) => matchStatusCode({ status: statusCode }, ["4XX", "5XX"]),
94
+ retryConfig: context.retryConfig,
95
+ retryCodes: context.retryCodes,
96
+ });
97
+ if (!doResult.ok) {
98
+ return [doResult, { status: "request-error", request: req }];
99
+ }
100
+ const response = doResult.value;
101
+ const responseFields = {
102
+ HttpMeta: { Response: response, Request: req },
103
+ };
104
+ const [result] = await M.match(M.json(200, models.VaultSecretListResponse$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(408, errors.RequestTimeoutResponseError$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(504, errors.GatewayTimeoutResponseError$inboundSchema), M.fail("4XX"), M.fail("5XX"))(response, req, { extraFields: responseFields });
105
+ if (!result.ok) {
106
+ return [result, { status: "complete", request: req, response }];
107
+ }
108
+ return [result, { status: "complete", request: req, response }];
109
+ }
110
+ //# sourceMappingURL=vaultListInternVaultSecrets.js.map
@@ -0,0 +1,21 @@
1
+ import { OpenRouterCore } from "../core.js";
2
+ import { RequestOptions } from "../lib/sdks.js";
3
+ import { ConnectionError, InvalidRequestError, RequestAbortedError, RequestTimeoutError, UnexpectedClientError } from "../models/errors/httpclienterrors.js";
4
+ import * as errors from "../models/errors/index.js";
5
+ import { OpenRouterError } from "../models/errors/openroutererror.js";
6
+ import { ResponseValidationError } from "../models/errors/responsevalidationerror.js";
7
+ import { SDKValidationError } from "../models/errors/sdkvalidationerror.js";
8
+ import * as models from "../models/index.js";
9
+ import * as operations from "../models/operations/index.js";
10
+ import { APIPromise } from "../types/async.js";
11
+ import { Result } from "../types/fp.js";
12
+ /**
13
+ * List workspace secrets
14
+ *
15
+ * @remarks
16
+ * Lists secret metadata for the workspace of the authenticated API key. Responses contain names, bound hosts, fingerprints and creation times, never secret values. Results are ordered by name and paginated with `limit` and `offset`. The scope is selected by the API key: workspace routes act on the key's active workspace and intern routes act on one intern inside that workspace. There is no default workspace and no fallback to another scope. Every vault route, including reads, requires access to the Intern API programme and returns 404 outside it. Requests on regional hostnames such as `eu.openrouter.ai` are refused. [API key](/docs/api-reference/authentication) required.
17
+ *
18
+ * If set, this operation will use {@link Security.apiKey} from the global security.
19
+ */
20
+ export declare function vaultListVaultSecrets(client: OpenRouterCore, request?: operations.ListVaultSecretsRequest | undefined, options?: RequestOptions): APIPromise<Result<models.VaultSecretListResponse, errors.BadRequestResponseError | errors.UnauthorizedResponseError | errors.ForbiddenResponseError | errors.NotFoundResponseError | errors.RequestTimeoutResponseError | errors.TooManyRequestsResponseError | errors.InternalServerResponseError | errors.BadGatewayResponseError | errors.ServiceUnavailableResponseError | errors.GatewayTimeoutResponseError | OpenRouterError | ResponseValidationError | ConnectionError | RequestAbortedError | RequestTimeoutError | InvalidRequestError | UnexpectedClientError | SDKValidationError>>;
21
+ //# sourceMappingURL=vaultListVaultSecrets.d.ts.map