@unkey/api 2.0.3 → 2.0.5
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/README.md +6 -3
- package/bin/mcp-server.js +461 -157
- package/bin/mcp-server.js.map +31 -23
- package/dist/commonjs/funcs/identitiesListIdentities.js +3 -0
- package/dist/commonjs/funcs/identitiesListIdentities.js.map +1 -1
- package/dist/commonjs/funcs/keysRerollKey.d.ts +49 -0
- package/dist/commonjs/funcs/keysRerollKey.d.ts.map +1 -0
- package/dist/commonjs/funcs/keysRerollKey.js +159 -0
- package/dist/commonjs/funcs/keysRerollKey.js.map +1 -0
- package/dist/commonjs/funcs/permissionsListPermissions.d.ts +2 -1
- package/dist/commonjs/funcs/permissionsListPermissions.d.ts.map +1 -1
- package/dist/commonjs/funcs/permissionsListPermissions.js +2 -1
- package/dist/commonjs/funcs/permissionsListPermissions.js.map +1 -1
- package/dist/commonjs/funcs/permissionsListRoles.d.ts +2 -1
- package/dist/commonjs/funcs/permissionsListRoles.d.ts.map +1 -1
- package/dist/commonjs/funcs/permissionsListRoles.js +2 -1
- package/dist/commonjs/funcs/permissionsListRoles.js.map +1 -1
- package/dist/commonjs/funcs/ratelimitLimit.d.ts +2 -2
- package/dist/commonjs/funcs/ratelimitLimit.d.ts.map +1 -1
- package/dist/commonjs/funcs/ratelimitLimit.js +3 -3
- package/dist/commonjs/funcs/ratelimitLimit.js.map +1 -1
- package/dist/commonjs/lib/config.d.ts +3 -3
- package/dist/commonjs/lib/config.js +3 -3
- package/dist/commonjs/lib/security.d.ts.map +1 -1
- package/dist/commonjs/lib/security.js.map +1 -1
- package/dist/commonjs/mcp-server/mcp-server.js +1 -1
- package/dist/commonjs/mcp-server/server.d.ts.map +1 -1
- package/dist/commonjs/mcp-server/server.js +3 -1
- package/dist/commonjs/mcp-server/server.js.map +1 -1
- package/dist/commonjs/mcp-server/tools/keysRerollKey.d.ts +8 -0
- package/dist/commonjs/mcp-server/tools/keysRerollKey.d.ts.map +1 -0
- package/dist/commonjs/mcp-server/tools/keysRerollKey.js +96 -0
- package/dist/commonjs/mcp-server/tools/keysRerollKey.js.map +1 -0
- package/dist/commonjs/mcp-server/tools/permissionsListPermissions.d.ts.map +1 -1
- package/dist/commonjs/mcp-server/tools/permissionsListPermissions.js +2 -1
- package/dist/commonjs/mcp-server/tools/permissionsListPermissions.js.map +1 -1
- package/dist/commonjs/mcp-server/tools/permissionsListRoles.d.ts.map +1 -1
- package/dist/commonjs/mcp-server/tools/permissionsListRoles.js +2 -1
- package/dist/commonjs/mcp-server/tools/permissionsListRoles.js.map +1 -1
- package/dist/commonjs/mcp-server/tools/ratelimitLimit.js +1 -1
- package/dist/commonjs/models/components/index.d.ts +5 -0
- package/dist/commonjs/models/components/index.d.ts.map +1 -1
- package/dist/commonjs/models/components/index.js +5 -0
- package/dist/commonjs/models/components/index.js.map +1 -1
- package/dist/commonjs/models/components/keycreditsrefill.d.ts +8 -8
- package/dist/commonjs/models/components/keycreditsrefill.d.ts.map +1 -1
- package/dist/commonjs/models/components/keycreditsrefill.js +13 -14
- package/dist/commonjs/models/components/keycreditsrefill.js.map +1 -1
- package/dist/commonjs/models/components/updatekeycreditsdata.d.ts +41 -0
- package/dist/commonjs/models/components/updatekeycreditsdata.d.ts.map +1 -0
- package/dist/commonjs/models/components/updatekeycreditsdata.js +72 -0
- package/dist/commonjs/models/components/updatekeycreditsdata.js.map +1 -0
- package/dist/commonjs/models/components/updatekeycreditsrefill.d.ts +81 -0
- package/dist/commonjs/models/components/updatekeycreditsrefill.d.ts.map +1 -0
- package/dist/commonjs/models/components/updatekeycreditsrefill.js +95 -0
- package/dist/commonjs/models/components/updatekeycreditsrefill.js.map +1 -0
- package/dist/commonjs/models/components/v2keysaddpermissionsresponsebody.d.ts +0 -1
- package/dist/commonjs/models/components/v2keysaddpermissionsresponsebody.d.ts.map +1 -1
- package/dist/commonjs/models/components/v2keysaddpermissionsresponsebody.js.map +1 -1
- package/dist/commonjs/models/components/v2keysaddrolesresponsebody.d.ts +0 -1
- package/dist/commonjs/models/components/v2keysaddrolesresponsebody.d.ts.map +1 -1
- package/dist/commonjs/models/components/v2keysaddrolesresponsebody.js.map +1 -1
- package/dist/commonjs/models/components/v2keysremoverolesresponsebody.d.ts +0 -1
- package/dist/commonjs/models/components/v2keysremoverolesresponsebody.d.ts.map +1 -1
- package/dist/commonjs/models/components/v2keysremoverolesresponsebody.js.map +1 -1
- package/dist/commonjs/models/components/v2keysrerollkeyrequestbody.d.ts +60 -0
- package/dist/commonjs/models/components/v2keysrerollkeyrequestbody.d.ts.map +1 -0
- package/dist/commonjs/models/components/v2keysrerollkeyrequestbody.js +71 -0
- package/dist/commonjs/models/components/v2keysrerollkeyrequestbody.js.map +1 -0
- package/dist/commonjs/models/components/v2keysrerollkeyresponsebody.d.ts +36 -0
- package/dist/commonjs/models/components/v2keysrerollkeyresponsebody.d.ts.map +1 -0
- package/dist/commonjs/models/components/v2keysrerollkeyresponsebody.js +73 -0
- package/dist/commonjs/models/components/v2keysrerollkeyresponsebody.js.map +1 -0
- package/dist/commonjs/models/components/v2keysrerollkeyresponsedata.d.ts +62 -0
- package/dist/commonjs/models/components/v2keysrerollkeyresponsedata.d.ts.map +1 -0
- package/dist/commonjs/models/components/v2keysrerollkeyresponsedata.js +71 -0
- package/dist/commonjs/models/components/v2keysrerollkeyresponsedata.js.map +1 -0
- package/dist/commonjs/models/components/v2keyssetpermissionsresponsebody.d.ts +0 -1
- package/dist/commonjs/models/components/v2keyssetpermissionsresponsebody.d.ts.map +1 -1
- package/dist/commonjs/models/components/v2keyssetpermissionsresponsebody.js.map +1 -1
- package/dist/commonjs/models/components/v2keyssetrolesresponsebody.d.ts +0 -1
- package/dist/commonjs/models/components/v2keyssetrolesresponsebody.d.ts.map +1 -1
- package/dist/commonjs/models/components/v2keyssetrolesresponsebody.js.map +1 -1
- package/dist/commonjs/models/components/v2keysupdatekeyrequestbody.d.ts +3 -3
- package/dist/commonjs/models/components/v2keysupdatekeyrequestbody.d.ts.map +1 -1
- package/dist/commonjs/models/components/v2keysupdatekeyrequestbody.js +3 -3
- package/dist/commonjs/models/components/v2keysupdatekeyrequestbody.js.map +1 -1
- package/dist/commonjs/models/errors/goneerrorresponse.d.ts +72 -0
- package/dist/commonjs/models/errors/goneerrorresponse.d.ts.map +1 -0
- package/dist/commonjs/models/errors/goneerrorresponse.js +99 -0
- package/dist/commonjs/models/errors/goneerrorresponse.js.map +1 -0
- package/dist/commonjs/models/errors/index.d.ts +1 -0
- package/dist/commonjs/models/errors/index.d.ts.map +1 -1
- package/dist/commonjs/models/errors/index.js +1 -0
- package/dist/commonjs/models/errors/index.js.map +1 -1
- package/dist/commonjs/sdk/keys.d.ts +38 -0
- package/dist/commonjs/sdk/keys.d.ts.map +1 -1
- package/dist/commonjs/sdk/keys.js +41 -0
- package/dist/commonjs/sdk/keys.js.map +1 -1
- package/dist/commonjs/sdk/permissions.d.ts +4 -2
- package/dist/commonjs/sdk/permissions.d.ts.map +1 -1
- package/dist/commonjs/sdk/permissions.js +4 -2
- package/dist/commonjs/sdk/permissions.js.map +1 -1
- package/dist/commonjs/sdk/ratelimit.d.ts +1 -1
- package/dist/commonjs/sdk/ratelimit.js +1 -1
- package/dist/esm/funcs/identitiesListIdentities.js +3 -0
- package/dist/esm/funcs/identitiesListIdentities.js.map +1 -1
- package/dist/esm/funcs/keysRerollKey.d.ts +49 -0
- package/dist/esm/funcs/keysRerollKey.d.ts.map +1 -0
- package/dist/esm/funcs/keysRerollKey.js +123 -0
- package/dist/esm/funcs/keysRerollKey.js.map +1 -0
- package/dist/esm/funcs/permissionsListPermissions.d.ts +2 -1
- package/dist/esm/funcs/permissionsListPermissions.d.ts.map +1 -1
- package/dist/esm/funcs/permissionsListPermissions.js +2 -1
- package/dist/esm/funcs/permissionsListPermissions.js.map +1 -1
- package/dist/esm/funcs/permissionsListRoles.d.ts +2 -1
- package/dist/esm/funcs/permissionsListRoles.d.ts.map +1 -1
- package/dist/esm/funcs/permissionsListRoles.js +2 -1
- package/dist/esm/funcs/permissionsListRoles.js.map +1 -1
- package/dist/esm/funcs/ratelimitLimit.d.ts +2 -2
- package/dist/esm/funcs/ratelimitLimit.d.ts.map +1 -1
- package/dist/esm/funcs/ratelimitLimit.js +3 -3
- package/dist/esm/funcs/ratelimitLimit.js.map +1 -1
- package/dist/esm/lib/config.d.ts +3 -3
- package/dist/esm/lib/config.js +3 -3
- package/dist/esm/lib/security.d.ts.map +1 -1
- package/dist/esm/lib/security.js.map +1 -1
- package/dist/esm/mcp-server/mcp-server.js +1 -1
- package/dist/esm/mcp-server/server.d.ts.map +1 -1
- package/dist/esm/mcp-server/server.js +3 -1
- package/dist/esm/mcp-server/server.js.map +1 -1
- package/dist/esm/mcp-server/tools/keysRerollKey.d.ts +8 -0
- package/dist/esm/mcp-server/tools/keysRerollKey.d.ts.map +1 -0
- package/dist/esm/mcp-server/tools/keysRerollKey.js +60 -0
- package/dist/esm/mcp-server/tools/keysRerollKey.js.map +1 -0
- package/dist/esm/mcp-server/tools/permissionsListPermissions.d.ts.map +1 -1
- package/dist/esm/mcp-server/tools/permissionsListPermissions.js +2 -1
- package/dist/esm/mcp-server/tools/permissionsListPermissions.js.map +1 -1
- package/dist/esm/mcp-server/tools/permissionsListRoles.d.ts.map +1 -1
- package/dist/esm/mcp-server/tools/permissionsListRoles.js +2 -1
- package/dist/esm/mcp-server/tools/permissionsListRoles.js.map +1 -1
- package/dist/esm/mcp-server/tools/ratelimitLimit.js +1 -1
- package/dist/esm/models/components/index.d.ts +5 -0
- package/dist/esm/models/components/index.d.ts.map +1 -1
- package/dist/esm/models/components/index.js +5 -0
- package/dist/esm/models/components/index.js.map +1 -1
- package/dist/esm/models/components/keycreditsrefill.d.ts +8 -8
- package/dist/esm/models/components/keycreditsrefill.d.ts.map +1 -1
- package/dist/esm/models/components/keycreditsrefill.js +12 -13
- package/dist/esm/models/components/keycreditsrefill.js.map +1 -1
- package/dist/esm/models/components/updatekeycreditsdata.d.ts +41 -0
- package/dist/esm/models/components/updatekeycreditsdata.d.ts.map +1 -0
- package/dist/esm/models/components/updatekeycreditsdata.js +34 -0
- package/dist/esm/models/components/updatekeycreditsdata.js.map +1 -0
- package/dist/esm/models/components/updatekeycreditsrefill.d.ts +81 -0
- package/dist/esm/models/components/updatekeycreditsrefill.d.ts.map +1 -0
- package/dist/esm/models/components/updatekeycreditsrefill.js +57 -0
- package/dist/esm/models/components/updatekeycreditsrefill.js.map +1 -0
- package/dist/esm/models/components/v2keysaddpermissionsresponsebody.d.ts +0 -1
- package/dist/esm/models/components/v2keysaddpermissionsresponsebody.d.ts.map +1 -1
- package/dist/esm/models/components/v2keysaddpermissionsresponsebody.js.map +1 -1
- package/dist/esm/models/components/v2keysaddrolesresponsebody.d.ts +0 -1
- package/dist/esm/models/components/v2keysaddrolesresponsebody.d.ts.map +1 -1
- package/dist/esm/models/components/v2keysaddrolesresponsebody.js.map +1 -1
- package/dist/esm/models/components/v2keysremoverolesresponsebody.d.ts +0 -1
- package/dist/esm/models/components/v2keysremoverolesresponsebody.d.ts.map +1 -1
- package/dist/esm/models/components/v2keysremoverolesresponsebody.js.map +1 -1
- package/dist/esm/models/components/v2keysrerollkeyrequestbody.d.ts +60 -0
- package/dist/esm/models/components/v2keysrerollkeyrequestbody.d.ts.map +1 -0
- package/dist/esm/models/components/v2keysrerollkeyrequestbody.js +33 -0
- package/dist/esm/models/components/v2keysrerollkeyrequestbody.js.map +1 -0
- package/dist/esm/models/components/v2keysrerollkeyresponsebody.d.ts +36 -0
- package/dist/esm/models/components/v2keysrerollkeyresponsebody.d.ts.map +1 -0
- package/dist/esm/models/components/v2keysrerollkeyresponsebody.js +35 -0
- package/dist/esm/models/components/v2keysrerollkeyresponsebody.js.map +1 -0
- package/dist/esm/models/components/v2keysrerollkeyresponsedata.d.ts +62 -0
- package/dist/esm/models/components/v2keysrerollkeyresponsedata.d.ts.map +1 -0
- package/dist/esm/models/components/v2keysrerollkeyresponsedata.js +33 -0
- package/dist/esm/models/components/v2keysrerollkeyresponsedata.js.map +1 -0
- package/dist/esm/models/components/v2keyssetpermissionsresponsebody.d.ts +0 -1
- package/dist/esm/models/components/v2keyssetpermissionsresponsebody.d.ts.map +1 -1
- package/dist/esm/models/components/v2keyssetpermissionsresponsebody.js.map +1 -1
- package/dist/esm/models/components/v2keyssetrolesresponsebody.d.ts +0 -1
- package/dist/esm/models/components/v2keyssetrolesresponsebody.d.ts.map +1 -1
- package/dist/esm/models/components/v2keyssetrolesresponsebody.js.map +1 -1
- package/dist/esm/models/components/v2keysupdatekeyrequestbody.d.ts +3 -3
- package/dist/esm/models/components/v2keysupdatekeyrequestbody.d.ts.map +1 -1
- package/dist/esm/models/components/v2keysupdatekeyrequestbody.js +3 -3
- package/dist/esm/models/components/v2keysupdatekeyrequestbody.js.map +1 -1
- package/dist/esm/models/errors/goneerrorresponse.d.ts +72 -0
- package/dist/esm/models/errors/goneerrorresponse.d.ts.map +1 -0
- package/dist/esm/models/errors/goneerrorresponse.js +62 -0
- package/dist/esm/models/errors/goneerrorresponse.js.map +1 -0
- package/dist/esm/models/errors/index.d.ts +1 -0
- package/dist/esm/models/errors/index.d.ts.map +1 -1
- package/dist/esm/models/errors/index.js +1 -0
- package/dist/esm/models/errors/index.js.map +1 -1
- package/dist/esm/sdk/keys.d.ts +38 -0
- package/dist/esm/sdk/keys.d.ts.map +1 -1
- package/dist/esm/sdk/keys.js +41 -0
- package/dist/esm/sdk/keys.js.map +1 -1
- package/dist/esm/sdk/permissions.d.ts +4 -2
- package/dist/esm/sdk/permissions.d.ts.map +1 -1
- package/dist/esm/sdk/permissions.js +4 -2
- package/dist/esm/sdk/permissions.js.map +1 -1
- package/dist/esm/sdk/ratelimit.d.ts +1 -1
- package/dist/esm/sdk/ratelimit.js +1 -1
- package/docs/sdks/keys/README.md +113 -0
- package/docs/sdks/permissions/README.md +4 -2
- package/docs/sdks/ratelimit/README.md +2 -1
- package/examples/apisCreateApi.example.ts +2 -2
- package/examples/package-lock.json +3 -3
- package/jsr.json +1 -1
- package/package.json +3 -3
- package/src/funcs/identitiesListIdentities.ts +3 -0
- package/src/funcs/keysRerollKey.ts +227 -0
- package/src/funcs/permissionsListPermissions.ts +2 -1
- package/src/funcs/permissionsListRoles.ts +2 -1
- package/src/funcs/ratelimitLimit.ts +6 -2
- package/src/lib/config.ts +3 -3
- package/src/lib/security.ts +4 -1
- package/src/mcp-server/mcp-server.ts +1 -1
- package/src/mcp-server/server.ts +3 -1
- package/src/mcp-server/tools/keysRerollKey.ts +69 -0
- package/src/mcp-server/tools/permissionsListPermissions.ts +2 -1
- package/src/mcp-server/tools/permissionsListRoles.ts +2 -1
- package/src/mcp-server/tools/ratelimitLimit.ts +1 -1
- package/src/models/components/index.ts +5 -0
- package/src/models/components/keycreditsrefill.ts +18 -14
- package/src/models/components/updatekeycreditsdata.ts +85 -0
- package/src/models/components/updatekeycreditsrefill.ts +126 -0
- package/src/models/components/v2keysaddpermissionsresponsebody.ts +0 -1
- package/src/models/components/v2keysaddrolesresponsebody.ts +0 -1
- package/src/models/components/v2keysremoverolesresponsebody.ts +0 -1
- package/src/models/components/v2keysrerollkeyrequestbody.ts +99 -0
- package/src/models/components/v2keysrerollkeyresponsebody.ts +87 -0
- package/src/models/components/v2keysrerollkeyresponsedata.ts +103 -0
- package/src/models/components/v2keyssetpermissionsresponsebody.ts +0 -1
- package/src/models/components/v2keyssetrolesresponsebody.ts +0 -1
- package/src/models/components/v2keysupdatekeyrequestbody.ts +10 -10
- package/src/models/errors/goneerrorresponse.ts +118 -0
- package/src/models/errors/index.ts +1 -0
- package/src/sdk/keys.ts +49 -0
- package/src/sdk/permissions.ts +4 -2
- package/src/sdk/ratelimit.ts +1 -1
package/src/lib/security.ts
CHANGED
|
@@ -84,7 +84,10 @@ type SecurityInputOAuth2 = {
|
|
|
84
84
|
type SecurityInputOAuth2ClientCredentials = {
|
|
85
85
|
type: "oauth2:client_credentials";
|
|
86
86
|
value:
|
|
87
|
-
| {
|
|
87
|
+
| {
|
|
88
|
+
clientID?: string | undefined;
|
|
89
|
+
clientSecret?: string | undefined;
|
|
90
|
+
}
|
|
88
91
|
| null
|
|
89
92
|
| string
|
|
90
93
|
| undefined;
|
package/src/mcp-server/server.ts
CHANGED
|
@@ -29,6 +29,7 @@ import { tool$keysDeleteKey } from "./tools/keysDeleteKey.js";
|
|
|
29
29
|
import { tool$keysGetKey } from "./tools/keysGetKey.js";
|
|
30
30
|
import { tool$keysRemovePermissions } from "./tools/keysRemovePermissions.js";
|
|
31
31
|
import { tool$keysRemoveRoles } from "./tools/keysRemoveRoles.js";
|
|
32
|
+
import { tool$keysRerollKey } from "./tools/keysRerollKey.js";
|
|
32
33
|
import { tool$keysSetPermissions } from "./tools/keysSetPermissions.js";
|
|
33
34
|
import { tool$keysSetRoles } from "./tools/keysSetRoles.js";
|
|
34
35
|
import { tool$keysUpdateCredits } from "./tools/keysUpdateCredits.js";
|
|
@@ -59,7 +60,7 @@ export function createMCPServer(deps: {
|
|
|
59
60
|
}) {
|
|
60
61
|
const server = new McpServer({
|
|
61
62
|
name: "Unkey",
|
|
62
|
-
version: "2.0.
|
|
63
|
+
version: "2.0.5",
|
|
63
64
|
});
|
|
64
65
|
|
|
65
66
|
const client = new UnkeyCore({
|
|
@@ -105,6 +106,7 @@ export function createMCPServer(deps: {
|
|
|
105
106
|
tool(tool$keysGetKey);
|
|
106
107
|
tool(tool$keysRemovePermissions);
|
|
107
108
|
tool(tool$keysRemoveRoles);
|
|
109
|
+
tool(tool$keysRerollKey);
|
|
108
110
|
tool(tool$keysSetPermissions);
|
|
109
111
|
tool(tool$keysSetRoles);
|
|
110
112
|
tool(tool$keysUpdateCredits);
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import { keysRerollKey } from "../../funcs/keysRerollKey.js";
|
|
6
|
+
import * as components from "../../models/components/index.js";
|
|
7
|
+
import { formatResult, ToolDefinition } from "../tools.js";
|
|
8
|
+
|
|
9
|
+
const args = {
|
|
10
|
+
request: components.V2KeysRerollKeyRequestBody$inboundSchema,
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
export const tool$keysRerollKey: ToolDefinition<typeof args> = {
|
|
14
|
+
name: "keys-reroll-key",
|
|
15
|
+
description: `Reroll Key
|
|
16
|
+
|
|
17
|
+
Generate a new API key while preserving the configuration from an existing key.
|
|
18
|
+
|
|
19
|
+
This operation creates a fresh key with a new token while maintaining all settings from the original key:
|
|
20
|
+
- Permissions and roles
|
|
21
|
+
- Custom metadata
|
|
22
|
+
- Rate limit configurations
|
|
23
|
+
- Identity associations
|
|
24
|
+
- Remaining credits
|
|
25
|
+
- Recovery settings
|
|
26
|
+
|
|
27
|
+
**Key Generation:**
|
|
28
|
+
- The system attempts to extract the prefix from the original key
|
|
29
|
+
- If prefix extraction fails, the default API prefix is used
|
|
30
|
+
- Key length follows the API's default byte configuration (or 16 bytes if not specified)
|
|
31
|
+
|
|
32
|
+
**Original Key Handling:**
|
|
33
|
+
- The original key will be revoked after the duration specified in \`expiration\`
|
|
34
|
+
- Set \`expiration\` to 0 to revoke immediately
|
|
35
|
+
- This allows for graceful key rotation with an overlap period
|
|
36
|
+
|
|
37
|
+
Common use cases include:
|
|
38
|
+
- Rotating keys for security compliance
|
|
39
|
+
- Issuing replacement keys for compromised credentials
|
|
40
|
+
- Creating backup keys with identical permissions
|
|
41
|
+
|
|
42
|
+
**Important:** Analytics and usage metrics are tracked at both the key level AND identity level. If the original key has an identity, the new key will inherit it, allowing you to track usage across both individual keys and the overall identity.
|
|
43
|
+
|
|
44
|
+
**Required Permissions**
|
|
45
|
+
|
|
46
|
+
Your root key must have:
|
|
47
|
+
- \`api.*.create_key\` or \`api.<api_id>.create_key\`
|
|
48
|
+
- \`api.*.encrypt_key\` or \`api.<api_id>.encrypt_key\` (only when the original key is recoverable)
|
|
49
|
+
`,
|
|
50
|
+
args,
|
|
51
|
+
tool: async (client, args, ctx) => {
|
|
52
|
+
const [result, apiCall] = await keysRerollKey(
|
|
53
|
+
client,
|
|
54
|
+
args.request,
|
|
55
|
+
{ fetchOptions: { signal: ctx.signal } },
|
|
56
|
+
).$inspect();
|
|
57
|
+
|
|
58
|
+
if (!result.ok) {
|
|
59
|
+
return {
|
|
60
|
+
content: [{ type: "text", text: result.error.message }],
|
|
61
|
+
isError: true,
|
|
62
|
+
};
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
const value = result.value;
|
|
66
|
+
|
|
67
|
+
return formatResult(value, apiCall);
|
|
68
|
+
},
|
|
69
|
+
};
|
|
@@ -14,7 +14,8 @@ export const tool$permissionsListPermissions: ToolDefinition<typeof args> = {
|
|
|
14
14
|
name: "permissions-list-permissions",
|
|
15
15
|
description: `List permissions
|
|
16
16
|
|
|
17
|
-
Retrieve all permissions in your workspace.
|
|
17
|
+
Retrieve all permissions in your workspace.
|
|
18
|
+
Results are paginated and sorted by their id.
|
|
18
19
|
|
|
19
20
|
**Required Permissions**
|
|
20
21
|
|
|
@@ -14,7 +14,8 @@ export const tool$permissionsListRoles: ToolDefinition<typeof args> = {
|
|
|
14
14
|
name: "permissions-list-roles",
|
|
15
15
|
description: `List roles
|
|
16
16
|
|
|
17
|
-
Retrieve all roles in your workspace including their assigned permissions.
|
|
17
|
+
Retrieve all roles in your workspace including their assigned permissions.
|
|
18
|
+
Results are paginated and sorted by their id.
|
|
18
19
|
|
|
19
20
|
**Required Permissions**
|
|
20
21
|
|
|
@@ -18,7 +18,7 @@ Check and enforce rate limits for any identifier (user ID, IP address, API clien
|
|
|
18
18
|
|
|
19
19
|
Use this for rate limiting beyond API keys - limit users by ID, IPs by address, or any custom identifier. Supports namespace organization, variable costs, and custom overrides.
|
|
20
20
|
|
|
21
|
-
**
|
|
21
|
+
**Response Codes**: Rate limit checks return HTTP 200 regardless of whether the limit is exceeded - check the \`success\` field in the response to determine if the request should be allowed. 4xx responses indicate auth, namespace existence/deletion, or validation errors (e.g., 410 Gone for deleted namespaces). 5xx responses indicate server errors.
|
|
22
22
|
|
|
23
23
|
**Required Permissions**
|
|
24
24
|
|
|
@@ -19,6 +19,8 @@ export * from "./ratelimitrequest.js";
|
|
|
19
19
|
export * from "./ratelimitresponse.js";
|
|
20
20
|
export * from "./role.js";
|
|
21
21
|
export * from "./security.js";
|
|
22
|
+
export * from "./updatekeycreditsdata.js";
|
|
23
|
+
export * from "./updatekeycreditsrefill.js";
|
|
22
24
|
export * from "./v2apiscreateapirequestbody.js";
|
|
23
25
|
export * from "./v2apiscreateapiresponsebody.js";
|
|
24
26
|
export * from "./v2apiscreateapiresponsedata.js";
|
|
@@ -55,6 +57,9 @@ export * from "./v2keysremovepermissionsrequestbody.js";
|
|
|
55
57
|
export * from "./v2keysremovepermissionsresponsebody.js";
|
|
56
58
|
export * from "./v2keysremoverolesrequestbody.js";
|
|
57
59
|
export * from "./v2keysremoverolesresponsebody.js";
|
|
60
|
+
export * from "./v2keysrerollkeyrequestbody.js";
|
|
61
|
+
export * from "./v2keysrerollkeyresponsebody.js";
|
|
62
|
+
export * from "./v2keysrerollkeyresponsedata.js";
|
|
58
63
|
export * from "./v2keyssetpermissionsrequestbody.js";
|
|
59
64
|
export * from "./v2keyssetpermissionsresponsebody.js";
|
|
60
65
|
export * from "./v2keyssetrolesrequestbody.js";
|
|
@@ -11,14 +11,16 @@ import { SDKValidationError } from "../errors/sdkvalidationerror.js";
|
|
|
11
11
|
/**
|
|
12
12
|
* How often credits are automatically refilled.
|
|
13
13
|
*/
|
|
14
|
-
export const
|
|
14
|
+
export const KeyCreditsRefillInterval = {
|
|
15
15
|
Daily: "daily",
|
|
16
16
|
Monthly: "monthly",
|
|
17
17
|
} as const;
|
|
18
18
|
/**
|
|
19
19
|
* How often credits are automatically refilled.
|
|
20
20
|
*/
|
|
21
|
-
export type
|
|
21
|
+
export type KeyCreditsRefillInterval = ClosedEnum<
|
|
22
|
+
typeof KeyCreditsRefillInterval
|
|
23
|
+
>;
|
|
22
24
|
|
|
23
25
|
/**
|
|
24
26
|
* Configuration for automatic credit refill behavior.
|
|
@@ -27,7 +29,7 @@ export type KeyCreditsRefill = {
|
|
|
27
29
|
/**
|
|
28
30
|
* How often credits are automatically refilled.
|
|
29
31
|
*/
|
|
30
|
-
interval:
|
|
32
|
+
interval: KeyCreditsRefillInterval;
|
|
31
33
|
/**
|
|
32
34
|
* Number of credits to add during each refill cycle.
|
|
33
35
|
*/
|
|
@@ -43,22 +45,24 @@ export type KeyCreditsRefill = {
|
|
|
43
45
|
};
|
|
44
46
|
|
|
45
47
|
/** @internal */
|
|
46
|
-
export const
|
|
47
|
-
|
|
48
|
+
export const KeyCreditsRefillInterval$inboundSchema: z.ZodNativeEnum<
|
|
49
|
+
typeof KeyCreditsRefillInterval
|
|
50
|
+
> = z.nativeEnum(KeyCreditsRefillInterval);
|
|
48
51
|
|
|
49
52
|
/** @internal */
|
|
50
|
-
export const
|
|
51
|
-
|
|
53
|
+
export const KeyCreditsRefillInterval$outboundSchema: z.ZodNativeEnum<
|
|
54
|
+
typeof KeyCreditsRefillInterval
|
|
55
|
+
> = KeyCreditsRefillInterval$inboundSchema;
|
|
52
56
|
|
|
53
57
|
/**
|
|
54
58
|
* @internal
|
|
55
59
|
* @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
|
|
56
60
|
*/
|
|
57
|
-
export namespace
|
|
58
|
-
/** @deprecated use `
|
|
59
|
-
export const inboundSchema =
|
|
60
|
-
/** @deprecated use `
|
|
61
|
-
export const outboundSchema =
|
|
61
|
+
export namespace KeyCreditsRefillInterval$ {
|
|
62
|
+
/** @deprecated use `KeyCreditsRefillInterval$inboundSchema` instead. */
|
|
63
|
+
export const inboundSchema = KeyCreditsRefillInterval$inboundSchema;
|
|
64
|
+
/** @deprecated use `KeyCreditsRefillInterval$outboundSchema` instead. */
|
|
65
|
+
export const outboundSchema = KeyCreditsRefillInterval$outboundSchema;
|
|
62
66
|
}
|
|
63
67
|
|
|
64
68
|
/** @internal */
|
|
@@ -67,7 +71,7 @@ export const KeyCreditsRefill$inboundSchema: z.ZodType<
|
|
|
67
71
|
z.ZodTypeDef,
|
|
68
72
|
unknown
|
|
69
73
|
> = z.object({
|
|
70
|
-
interval:
|
|
74
|
+
interval: KeyCreditsRefillInterval$inboundSchema,
|
|
71
75
|
amount: z.number().int(),
|
|
72
76
|
refillDay: z.number().int().optional(),
|
|
73
77
|
});
|
|
@@ -85,7 +89,7 @@ export const KeyCreditsRefill$outboundSchema: z.ZodType<
|
|
|
85
89
|
z.ZodTypeDef,
|
|
86
90
|
KeyCreditsRefill
|
|
87
91
|
> = z.object({
|
|
88
|
-
interval:
|
|
92
|
+
interval: KeyCreditsRefillInterval$outboundSchema,
|
|
89
93
|
amount: z.number().int(),
|
|
90
94
|
refillDay: z.number().int().optional(),
|
|
91
95
|
});
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import * as z from "zod";
|
|
6
|
+
import { safeParse } from "../../lib/schemas.js";
|
|
7
|
+
import { Result as SafeParseResult } from "../../types/fp.js";
|
|
8
|
+
import { SDKValidationError } from "../errors/sdkvalidationerror.js";
|
|
9
|
+
import {
|
|
10
|
+
UpdateKeyCreditsRefill,
|
|
11
|
+
UpdateKeyCreditsRefill$inboundSchema,
|
|
12
|
+
UpdateKeyCreditsRefill$Outbound,
|
|
13
|
+
UpdateKeyCreditsRefill$outboundSchema,
|
|
14
|
+
} from "./updatekeycreditsrefill.js";
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* Credit configuration and remaining balance for this key.
|
|
18
|
+
*/
|
|
19
|
+
export type UpdateKeyCreditsData = {
|
|
20
|
+
/**
|
|
21
|
+
* Number of credits remaining (null for unlimited). This also clears the refilling schedule.
|
|
22
|
+
*/
|
|
23
|
+
remaining?: number | null | undefined;
|
|
24
|
+
/**
|
|
25
|
+
* Configuration for automatic credit refill behavior.
|
|
26
|
+
*/
|
|
27
|
+
refill?: UpdateKeyCreditsRefill | null | undefined;
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
/** @internal */
|
|
31
|
+
export const UpdateKeyCreditsData$inboundSchema: z.ZodType<
|
|
32
|
+
UpdateKeyCreditsData,
|
|
33
|
+
z.ZodTypeDef,
|
|
34
|
+
unknown
|
|
35
|
+
> = z.object({
|
|
36
|
+
remaining: z.nullable(z.number().int()).optional(),
|
|
37
|
+
refill: z.nullable(UpdateKeyCreditsRefill$inboundSchema).optional(),
|
|
38
|
+
});
|
|
39
|
+
|
|
40
|
+
/** @internal */
|
|
41
|
+
export type UpdateKeyCreditsData$Outbound = {
|
|
42
|
+
remaining?: number | null | undefined;
|
|
43
|
+
refill?: UpdateKeyCreditsRefill$Outbound | null | undefined;
|
|
44
|
+
};
|
|
45
|
+
|
|
46
|
+
/** @internal */
|
|
47
|
+
export const UpdateKeyCreditsData$outboundSchema: z.ZodType<
|
|
48
|
+
UpdateKeyCreditsData$Outbound,
|
|
49
|
+
z.ZodTypeDef,
|
|
50
|
+
UpdateKeyCreditsData
|
|
51
|
+
> = z.object({
|
|
52
|
+
remaining: z.nullable(z.number().int()).optional(),
|
|
53
|
+
refill: z.nullable(UpdateKeyCreditsRefill$outboundSchema).optional(),
|
|
54
|
+
});
|
|
55
|
+
|
|
56
|
+
/**
|
|
57
|
+
* @internal
|
|
58
|
+
* @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
|
|
59
|
+
*/
|
|
60
|
+
export namespace UpdateKeyCreditsData$ {
|
|
61
|
+
/** @deprecated use `UpdateKeyCreditsData$inboundSchema` instead. */
|
|
62
|
+
export const inboundSchema = UpdateKeyCreditsData$inboundSchema;
|
|
63
|
+
/** @deprecated use `UpdateKeyCreditsData$outboundSchema` instead. */
|
|
64
|
+
export const outboundSchema = UpdateKeyCreditsData$outboundSchema;
|
|
65
|
+
/** @deprecated use `UpdateKeyCreditsData$Outbound` instead. */
|
|
66
|
+
export type Outbound = UpdateKeyCreditsData$Outbound;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
export function updateKeyCreditsDataToJSON(
|
|
70
|
+
updateKeyCreditsData: UpdateKeyCreditsData,
|
|
71
|
+
): string {
|
|
72
|
+
return JSON.stringify(
|
|
73
|
+
UpdateKeyCreditsData$outboundSchema.parse(updateKeyCreditsData),
|
|
74
|
+
);
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
export function updateKeyCreditsDataFromJSON(
|
|
78
|
+
jsonString: string,
|
|
79
|
+
): SafeParseResult<UpdateKeyCreditsData, SDKValidationError> {
|
|
80
|
+
return safeParse(
|
|
81
|
+
jsonString,
|
|
82
|
+
(x) => UpdateKeyCreditsData$inboundSchema.parse(JSON.parse(x)),
|
|
83
|
+
`Failed to parse 'UpdateKeyCreditsData' from JSON`,
|
|
84
|
+
);
|
|
85
|
+
}
|
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import * as z from "zod";
|
|
6
|
+
import { safeParse } from "../../lib/schemas.js";
|
|
7
|
+
import { ClosedEnum } from "../../types/enums.js";
|
|
8
|
+
import { Result as SafeParseResult } from "../../types/fp.js";
|
|
9
|
+
import { SDKValidationError } from "../errors/sdkvalidationerror.js";
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* How often credits are automatically refilled.
|
|
13
|
+
*/
|
|
14
|
+
export const UpdateKeyCreditsRefillInterval = {
|
|
15
|
+
Daily: "daily",
|
|
16
|
+
Monthly: "monthly",
|
|
17
|
+
} as const;
|
|
18
|
+
/**
|
|
19
|
+
* How often credits are automatically refilled.
|
|
20
|
+
*/
|
|
21
|
+
export type UpdateKeyCreditsRefillInterval = ClosedEnum<
|
|
22
|
+
typeof UpdateKeyCreditsRefillInterval
|
|
23
|
+
>;
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* Configuration for automatic credit refill behavior.
|
|
27
|
+
*/
|
|
28
|
+
export type UpdateKeyCreditsRefill = {
|
|
29
|
+
/**
|
|
30
|
+
* How often credits are automatically refilled.
|
|
31
|
+
*/
|
|
32
|
+
interval: UpdateKeyCreditsRefillInterval;
|
|
33
|
+
/**
|
|
34
|
+
* Number of credits to add during each refill cycle.
|
|
35
|
+
*/
|
|
36
|
+
amount: number;
|
|
37
|
+
/**
|
|
38
|
+
* Day of the month for monthly refills (1-31).
|
|
39
|
+
*
|
|
40
|
+
* @remarks
|
|
41
|
+
* Only required when interval is 'monthly'.
|
|
42
|
+
* For days beyond the month's length, refill occurs on the last day of the month.
|
|
43
|
+
*/
|
|
44
|
+
refillDay?: number | undefined;
|
|
45
|
+
};
|
|
46
|
+
|
|
47
|
+
/** @internal */
|
|
48
|
+
export const UpdateKeyCreditsRefillInterval$inboundSchema: z.ZodNativeEnum<
|
|
49
|
+
typeof UpdateKeyCreditsRefillInterval
|
|
50
|
+
> = z.nativeEnum(UpdateKeyCreditsRefillInterval);
|
|
51
|
+
|
|
52
|
+
/** @internal */
|
|
53
|
+
export const UpdateKeyCreditsRefillInterval$outboundSchema: z.ZodNativeEnum<
|
|
54
|
+
typeof UpdateKeyCreditsRefillInterval
|
|
55
|
+
> = UpdateKeyCreditsRefillInterval$inboundSchema;
|
|
56
|
+
|
|
57
|
+
/**
|
|
58
|
+
* @internal
|
|
59
|
+
* @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
|
|
60
|
+
*/
|
|
61
|
+
export namespace UpdateKeyCreditsRefillInterval$ {
|
|
62
|
+
/** @deprecated use `UpdateKeyCreditsRefillInterval$inboundSchema` instead. */
|
|
63
|
+
export const inboundSchema = UpdateKeyCreditsRefillInterval$inboundSchema;
|
|
64
|
+
/** @deprecated use `UpdateKeyCreditsRefillInterval$outboundSchema` instead. */
|
|
65
|
+
export const outboundSchema = UpdateKeyCreditsRefillInterval$outboundSchema;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
/** @internal */
|
|
69
|
+
export const UpdateKeyCreditsRefill$inboundSchema: z.ZodType<
|
|
70
|
+
UpdateKeyCreditsRefill,
|
|
71
|
+
z.ZodTypeDef,
|
|
72
|
+
unknown
|
|
73
|
+
> = z.object({
|
|
74
|
+
interval: UpdateKeyCreditsRefillInterval$inboundSchema,
|
|
75
|
+
amount: z.number().int(),
|
|
76
|
+
refillDay: z.number().int().optional(),
|
|
77
|
+
});
|
|
78
|
+
|
|
79
|
+
/** @internal */
|
|
80
|
+
export type UpdateKeyCreditsRefill$Outbound = {
|
|
81
|
+
interval: string;
|
|
82
|
+
amount: number;
|
|
83
|
+
refillDay?: number | undefined;
|
|
84
|
+
};
|
|
85
|
+
|
|
86
|
+
/** @internal */
|
|
87
|
+
export const UpdateKeyCreditsRefill$outboundSchema: z.ZodType<
|
|
88
|
+
UpdateKeyCreditsRefill$Outbound,
|
|
89
|
+
z.ZodTypeDef,
|
|
90
|
+
UpdateKeyCreditsRefill
|
|
91
|
+
> = z.object({
|
|
92
|
+
interval: UpdateKeyCreditsRefillInterval$outboundSchema,
|
|
93
|
+
amount: z.number().int(),
|
|
94
|
+
refillDay: z.number().int().optional(),
|
|
95
|
+
});
|
|
96
|
+
|
|
97
|
+
/**
|
|
98
|
+
* @internal
|
|
99
|
+
* @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
|
|
100
|
+
*/
|
|
101
|
+
export namespace UpdateKeyCreditsRefill$ {
|
|
102
|
+
/** @deprecated use `UpdateKeyCreditsRefill$inboundSchema` instead. */
|
|
103
|
+
export const inboundSchema = UpdateKeyCreditsRefill$inboundSchema;
|
|
104
|
+
/** @deprecated use `UpdateKeyCreditsRefill$outboundSchema` instead. */
|
|
105
|
+
export const outboundSchema = UpdateKeyCreditsRefill$outboundSchema;
|
|
106
|
+
/** @deprecated use `UpdateKeyCreditsRefill$Outbound` instead. */
|
|
107
|
+
export type Outbound = UpdateKeyCreditsRefill$Outbound;
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
export function updateKeyCreditsRefillToJSON(
|
|
111
|
+
updateKeyCreditsRefill: UpdateKeyCreditsRefill,
|
|
112
|
+
): string {
|
|
113
|
+
return JSON.stringify(
|
|
114
|
+
UpdateKeyCreditsRefill$outboundSchema.parse(updateKeyCreditsRefill),
|
|
115
|
+
);
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
export function updateKeyCreditsRefillFromJSON(
|
|
119
|
+
jsonString: string,
|
|
120
|
+
): SafeParseResult<UpdateKeyCreditsRefill, SDKValidationError> {
|
|
121
|
+
return safeParse(
|
|
122
|
+
jsonString,
|
|
123
|
+
(x) => UpdateKeyCreditsRefill$inboundSchema.parse(JSON.parse(x)),
|
|
124
|
+
`Failed to parse 'UpdateKeyCreditsRefill' from JSON`,
|
|
125
|
+
);
|
|
126
|
+
}
|
|
@@ -31,7 +31,6 @@ export type V2KeysAddPermissionsResponseBody = {
|
|
|
31
31
|
*
|
|
32
32
|
* This response includes:
|
|
33
33
|
* - All direct permissions assigned to the key (both pre-existing and newly added)
|
|
34
|
-
* - Permissions sorted alphabetically by name for consistent response format
|
|
35
34
|
* - Both the permission ID and name for each permission
|
|
36
35
|
*
|
|
37
36
|
* Important notes:
|
|
@@ -32,7 +32,6 @@ export type V2KeysAddRolesResponseBody = {
|
|
|
32
32
|
* The response includes:
|
|
33
33
|
* - All roles now assigned to the key (both pre-existing and newly added)
|
|
34
34
|
* - Both ID and name of each role for easy reference
|
|
35
|
-
* - Roles sorted alphabetically by name for consistent response format
|
|
36
35
|
*
|
|
37
36
|
* Important notes:
|
|
38
37
|
* - The response shows the complete current state after the addition
|
|
@@ -32,7 +32,6 @@ export type V2KeysRemoveRolesResponseBody = {
|
|
|
32
32
|
* The response includes:
|
|
33
33
|
* - The remaining roles still assigned to the key (after removing the specified roles)
|
|
34
34
|
* - Both ID and name for each role for easy reference
|
|
35
|
-
* - Roles sorted alphabetically by name for consistent response format
|
|
36
35
|
*
|
|
37
36
|
* Important notes:
|
|
38
37
|
* - The response reflects the current state after the removal operation
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import * as z from "zod";
|
|
6
|
+
import { safeParse } from "../../lib/schemas.js";
|
|
7
|
+
import { Result as SafeParseResult } from "../../types/fp.js";
|
|
8
|
+
import { SDKValidationError } from "../errors/sdkvalidationerror.js";
|
|
9
|
+
|
|
10
|
+
export type V2KeysRerollKeyRequestBody = {
|
|
11
|
+
/**
|
|
12
|
+
* The database identifier of the key to reroll.
|
|
13
|
+
*
|
|
14
|
+
* @remarks
|
|
15
|
+
*
|
|
16
|
+
* This is the unique ID returned when creating or listing keys, NOT the actual API key token.
|
|
17
|
+
* You can find this ID in:
|
|
18
|
+
* - The response from `keys.createKey`
|
|
19
|
+
* - Key verification responses
|
|
20
|
+
* - The Unkey dashboard
|
|
21
|
+
* - API key listing endpoints
|
|
22
|
+
*/
|
|
23
|
+
keyId: string;
|
|
24
|
+
/**
|
|
25
|
+
* Duration in milliseconds until the ORIGINAL key is revoked, starting from now.
|
|
26
|
+
*
|
|
27
|
+
* @remarks
|
|
28
|
+
*
|
|
29
|
+
* This parameter controls the overlap period for key rotation:
|
|
30
|
+
* - Set to `0` to revoke the original key immediately
|
|
31
|
+
* - Positive values keep the original key active for the specified duration
|
|
32
|
+
* - Allows graceful migration by giving users time to update their credentials
|
|
33
|
+
*
|
|
34
|
+
* Common overlap periods:
|
|
35
|
+
* - Immediate revocation: 0
|
|
36
|
+
* - 1 hour grace period: 3600000
|
|
37
|
+
* - 24 hours grace period: 86400000
|
|
38
|
+
* - 7 days grace period: 604800000
|
|
39
|
+
* - 30 days grace period: 2592000000
|
|
40
|
+
*/
|
|
41
|
+
expiration: number;
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
/** @internal */
|
|
45
|
+
export const V2KeysRerollKeyRequestBody$inboundSchema: z.ZodType<
|
|
46
|
+
V2KeysRerollKeyRequestBody,
|
|
47
|
+
z.ZodTypeDef,
|
|
48
|
+
unknown
|
|
49
|
+
> = z.object({
|
|
50
|
+
keyId: z.string(),
|
|
51
|
+
expiration: z.number().int(),
|
|
52
|
+
});
|
|
53
|
+
|
|
54
|
+
/** @internal */
|
|
55
|
+
export type V2KeysRerollKeyRequestBody$Outbound = {
|
|
56
|
+
keyId: string;
|
|
57
|
+
expiration: number;
|
|
58
|
+
};
|
|
59
|
+
|
|
60
|
+
/** @internal */
|
|
61
|
+
export const V2KeysRerollKeyRequestBody$outboundSchema: z.ZodType<
|
|
62
|
+
V2KeysRerollKeyRequestBody$Outbound,
|
|
63
|
+
z.ZodTypeDef,
|
|
64
|
+
V2KeysRerollKeyRequestBody
|
|
65
|
+
> = z.object({
|
|
66
|
+
keyId: z.string(),
|
|
67
|
+
expiration: z.number().int(),
|
|
68
|
+
});
|
|
69
|
+
|
|
70
|
+
/**
|
|
71
|
+
* @internal
|
|
72
|
+
* @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
|
|
73
|
+
*/
|
|
74
|
+
export namespace V2KeysRerollKeyRequestBody$ {
|
|
75
|
+
/** @deprecated use `V2KeysRerollKeyRequestBody$inboundSchema` instead. */
|
|
76
|
+
export const inboundSchema = V2KeysRerollKeyRequestBody$inboundSchema;
|
|
77
|
+
/** @deprecated use `V2KeysRerollKeyRequestBody$outboundSchema` instead. */
|
|
78
|
+
export const outboundSchema = V2KeysRerollKeyRequestBody$outboundSchema;
|
|
79
|
+
/** @deprecated use `V2KeysRerollKeyRequestBody$Outbound` instead. */
|
|
80
|
+
export type Outbound = V2KeysRerollKeyRequestBody$Outbound;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
export function v2KeysRerollKeyRequestBodyToJSON(
|
|
84
|
+
v2KeysRerollKeyRequestBody: V2KeysRerollKeyRequestBody,
|
|
85
|
+
): string {
|
|
86
|
+
return JSON.stringify(
|
|
87
|
+
V2KeysRerollKeyRequestBody$outboundSchema.parse(v2KeysRerollKeyRequestBody),
|
|
88
|
+
);
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
export function v2KeysRerollKeyRequestBodyFromJSON(
|
|
92
|
+
jsonString: string,
|
|
93
|
+
): SafeParseResult<V2KeysRerollKeyRequestBody, SDKValidationError> {
|
|
94
|
+
return safeParse(
|
|
95
|
+
jsonString,
|
|
96
|
+
(x) => V2KeysRerollKeyRequestBody$inboundSchema.parse(JSON.parse(x)),
|
|
97
|
+
`Failed to parse 'V2KeysRerollKeyRequestBody' from JSON`,
|
|
98
|
+
);
|
|
99
|
+
}
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import * as z from "zod";
|
|
6
|
+
import { safeParse } from "../../lib/schemas.js";
|
|
7
|
+
import { Result as SafeParseResult } from "../../types/fp.js";
|
|
8
|
+
import { SDKValidationError } from "../errors/sdkvalidationerror.js";
|
|
9
|
+
import {
|
|
10
|
+
Meta,
|
|
11
|
+
Meta$inboundSchema,
|
|
12
|
+
Meta$Outbound,
|
|
13
|
+
Meta$outboundSchema,
|
|
14
|
+
} from "./meta.js";
|
|
15
|
+
import {
|
|
16
|
+
V2KeysRerollKeyResponseData,
|
|
17
|
+
V2KeysRerollKeyResponseData$inboundSchema,
|
|
18
|
+
V2KeysRerollKeyResponseData$Outbound,
|
|
19
|
+
V2KeysRerollKeyResponseData$outboundSchema,
|
|
20
|
+
} from "./v2keysrerollkeyresponsedata.js";
|
|
21
|
+
|
|
22
|
+
export type V2KeysRerollKeyResponseBody = {
|
|
23
|
+
/**
|
|
24
|
+
* Metadata object included in every API response. This provides context about the request and is essential for debugging, audit trails, and support inquiries. The `requestId` is particularly important when troubleshooting issues with the Unkey support team.
|
|
25
|
+
*/
|
|
26
|
+
meta: Meta;
|
|
27
|
+
data: V2KeysRerollKeyResponseData;
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
/** @internal */
|
|
31
|
+
export const V2KeysRerollKeyResponseBody$inboundSchema: z.ZodType<
|
|
32
|
+
V2KeysRerollKeyResponseBody,
|
|
33
|
+
z.ZodTypeDef,
|
|
34
|
+
unknown
|
|
35
|
+
> = z.object({
|
|
36
|
+
meta: Meta$inboundSchema,
|
|
37
|
+
data: V2KeysRerollKeyResponseData$inboundSchema,
|
|
38
|
+
});
|
|
39
|
+
|
|
40
|
+
/** @internal */
|
|
41
|
+
export type V2KeysRerollKeyResponseBody$Outbound = {
|
|
42
|
+
meta: Meta$Outbound;
|
|
43
|
+
data: V2KeysRerollKeyResponseData$Outbound;
|
|
44
|
+
};
|
|
45
|
+
|
|
46
|
+
/** @internal */
|
|
47
|
+
export const V2KeysRerollKeyResponseBody$outboundSchema: z.ZodType<
|
|
48
|
+
V2KeysRerollKeyResponseBody$Outbound,
|
|
49
|
+
z.ZodTypeDef,
|
|
50
|
+
V2KeysRerollKeyResponseBody
|
|
51
|
+
> = z.object({
|
|
52
|
+
meta: Meta$outboundSchema,
|
|
53
|
+
data: V2KeysRerollKeyResponseData$outboundSchema,
|
|
54
|
+
});
|
|
55
|
+
|
|
56
|
+
/**
|
|
57
|
+
* @internal
|
|
58
|
+
* @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
|
|
59
|
+
*/
|
|
60
|
+
export namespace V2KeysRerollKeyResponseBody$ {
|
|
61
|
+
/** @deprecated use `V2KeysRerollKeyResponseBody$inboundSchema` instead. */
|
|
62
|
+
export const inboundSchema = V2KeysRerollKeyResponseBody$inboundSchema;
|
|
63
|
+
/** @deprecated use `V2KeysRerollKeyResponseBody$outboundSchema` instead. */
|
|
64
|
+
export const outboundSchema = V2KeysRerollKeyResponseBody$outboundSchema;
|
|
65
|
+
/** @deprecated use `V2KeysRerollKeyResponseBody$Outbound` instead. */
|
|
66
|
+
export type Outbound = V2KeysRerollKeyResponseBody$Outbound;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
export function v2KeysRerollKeyResponseBodyToJSON(
|
|
70
|
+
v2KeysRerollKeyResponseBody: V2KeysRerollKeyResponseBody,
|
|
71
|
+
): string {
|
|
72
|
+
return JSON.stringify(
|
|
73
|
+
V2KeysRerollKeyResponseBody$outboundSchema.parse(
|
|
74
|
+
v2KeysRerollKeyResponseBody,
|
|
75
|
+
),
|
|
76
|
+
);
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
export function v2KeysRerollKeyResponseBodyFromJSON(
|
|
80
|
+
jsonString: string,
|
|
81
|
+
): SafeParseResult<V2KeysRerollKeyResponseBody, SDKValidationError> {
|
|
82
|
+
return safeParse(
|
|
83
|
+
jsonString,
|
|
84
|
+
(x) => V2KeysRerollKeyResponseBody$inboundSchema.parse(JSON.parse(x)),
|
|
85
|
+
`Failed to parse 'V2KeysRerollKeyResponseBody' from JSON`,
|
|
86
|
+
);
|
|
87
|
+
}
|