@unkey/api 2.0.4 → 2.0.6
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 +4 -7
- package/RUNTIMES.md +6 -6
- package/bin/mcp-server.js +160 -68
- package/bin/mcp-server.js.map +53 -50
- package/dist/commonjs/funcs/apisCreateApi.js +1 -1
- package/dist/commonjs/funcs/apisCreateApi.js.map +1 -1
- package/dist/commonjs/funcs/apisDeleteApi.js +1 -1
- package/dist/commonjs/funcs/apisDeleteApi.js.map +1 -1
- package/dist/commonjs/funcs/apisGetApi.js +1 -1
- package/dist/commonjs/funcs/apisGetApi.js.map +1 -1
- package/dist/commonjs/funcs/apisListKeys.js +1 -1
- package/dist/commonjs/funcs/apisListKeys.js.map +1 -1
- package/dist/commonjs/funcs/identitiesCreateIdentity.js +1 -1
- package/dist/commonjs/funcs/identitiesCreateIdentity.js.map +1 -1
- package/dist/commonjs/funcs/identitiesDeleteIdentity.js +1 -1
- package/dist/commonjs/funcs/identitiesDeleteIdentity.js.map +1 -1
- package/dist/commonjs/funcs/identitiesGetIdentity.js +1 -1
- package/dist/commonjs/funcs/identitiesGetIdentity.js.map +1 -1
- package/dist/commonjs/funcs/identitiesListIdentities.js +4 -1
- package/dist/commonjs/funcs/identitiesListIdentities.js.map +1 -1
- package/dist/commonjs/funcs/identitiesUpdateIdentity.js +1 -1
- package/dist/commonjs/funcs/identitiesUpdateIdentity.js.map +1 -1
- package/dist/commonjs/funcs/keysAddPermissions.js +1 -1
- package/dist/commonjs/funcs/keysAddPermissions.js.map +1 -1
- package/dist/commonjs/funcs/keysAddRoles.js +1 -1
- package/dist/commonjs/funcs/keysAddRoles.js.map +1 -1
- package/dist/commonjs/funcs/keysCreateKey.js +1 -1
- package/dist/commonjs/funcs/keysCreateKey.js.map +1 -1
- package/dist/commonjs/funcs/keysDeleteKey.js +1 -1
- package/dist/commonjs/funcs/keysDeleteKey.js.map +1 -1
- package/dist/commonjs/funcs/keysGetKey.js +1 -1
- package/dist/commonjs/funcs/keysGetKey.js.map +1 -1
- package/dist/commonjs/funcs/keysRemovePermissions.js +1 -1
- package/dist/commonjs/funcs/keysRemovePermissions.js.map +1 -1
- package/dist/commonjs/funcs/keysRemoveRoles.js +1 -1
- package/dist/commonjs/funcs/keysRemoveRoles.js.map +1 -1
- package/dist/commonjs/funcs/keysRerollKey.js +1 -1
- package/dist/commonjs/funcs/keysRerollKey.js.map +1 -1
- package/dist/commonjs/funcs/keysSetPermissions.js +1 -1
- package/dist/commonjs/funcs/keysSetPermissions.js.map +1 -1
- package/dist/commonjs/funcs/keysSetRoles.js +1 -1
- package/dist/commonjs/funcs/keysSetRoles.js.map +1 -1
- package/dist/commonjs/funcs/keysUpdateCredits.js +1 -1
- package/dist/commonjs/funcs/keysUpdateCredits.js.map +1 -1
- package/dist/commonjs/funcs/keysUpdateKey.js +1 -1
- package/dist/commonjs/funcs/keysUpdateKey.js.map +1 -1
- package/dist/commonjs/funcs/keysVerifyKey.js +1 -1
- package/dist/commonjs/funcs/keysVerifyKey.js.map +1 -1
- package/dist/commonjs/funcs/keysWhoami.js +1 -1
- package/dist/commonjs/funcs/keysWhoami.js.map +1 -1
- package/dist/commonjs/funcs/permissionsCreatePermission.js +1 -1
- package/dist/commonjs/funcs/permissionsCreatePermission.js.map +1 -1
- package/dist/commonjs/funcs/permissionsCreateRole.js +1 -1
- package/dist/commonjs/funcs/permissionsCreateRole.js.map +1 -1
- package/dist/commonjs/funcs/permissionsDeletePermission.js +1 -1
- package/dist/commonjs/funcs/permissionsDeletePermission.js.map +1 -1
- package/dist/commonjs/funcs/permissionsDeleteRole.js +1 -1
- package/dist/commonjs/funcs/permissionsDeleteRole.js.map +1 -1
- package/dist/commonjs/funcs/permissionsGetPermission.js +1 -1
- package/dist/commonjs/funcs/permissionsGetPermission.js.map +1 -1
- package/dist/commonjs/funcs/permissionsGetRole.js +1 -1
- package/dist/commonjs/funcs/permissionsGetRole.js.map +1 -1
- package/dist/commonjs/funcs/permissionsListPermissions.js +1 -1
- package/dist/commonjs/funcs/permissionsListPermissions.js.map +1 -1
- package/dist/commonjs/funcs/permissionsListRoles.js +1 -1
- package/dist/commonjs/funcs/permissionsListRoles.js.map +1 -1
- package/dist/commonjs/funcs/ratelimitDeleteOverride.js +1 -1
- package/dist/commonjs/funcs/ratelimitDeleteOverride.js.map +1 -1
- package/dist/commonjs/funcs/ratelimitGetOverride.js +1 -1
- package/dist/commonjs/funcs/ratelimitGetOverride.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 +4 -4
- package/dist/commonjs/funcs/ratelimitLimit.js.map +1 -1
- package/dist/commonjs/funcs/ratelimitListOverrides.js +1 -1
- package/dist/commonjs/funcs/ratelimitListOverrides.js.map +1 -1
- package/dist/commonjs/funcs/ratelimitSetOverride.js +1 -1
- package/dist/commonjs/funcs/ratelimitSetOverride.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/config.js.map +1 -1
- package/dist/commonjs/lib/security.d.ts.map +1 -1
- package/dist/commonjs/lib/security.js.map +1 -1
- package/dist/commonjs/lib/url.js +1 -1
- package/dist/commonjs/lib/url.js.map +1 -1
- package/dist/commonjs/mcp-server/mcp-server.js +1 -1
- package/dist/commonjs/mcp-server/server.js +1 -1
- package/dist/commonjs/mcp-server/tools/ratelimitLimit.js +1 -1
- package/dist/commonjs/models/components/identity.d.ts +6 -26
- package/dist/commonjs/models/components/identity.d.ts.map +1 -1
- package/dist/commonjs/models/components/identity.js +3 -26
- package/dist/commonjs/models/components/identity.js.map +1 -1
- package/dist/commonjs/models/components/index.d.ts +2 -0
- package/dist/commonjs/models/components/index.d.ts.map +1 -1
- package/dist/commonjs/models/components/index.js +2 -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/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 +2 -0
- package/dist/commonjs/models/errors/index.d.ts.map +1 -1
- package/dist/commonjs/models/errors/index.js +2 -0
- package/dist/commonjs/models/errors/index.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/apisCreateApi.js +1 -1
- package/dist/esm/funcs/apisCreateApi.js.map +1 -1
- package/dist/esm/funcs/apisDeleteApi.js +1 -1
- package/dist/esm/funcs/apisDeleteApi.js.map +1 -1
- package/dist/esm/funcs/apisGetApi.js +1 -1
- package/dist/esm/funcs/apisGetApi.js.map +1 -1
- package/dist/esm/funcs/apisListKeys.js +1 -1
- package/dist/esm/funcs/apisListKeys.js.map +1 -1
- package/dist/esm/funcs/identitiesCreateIdentity.js +1 -1
- package/dist/esm/funcs/identitiesCreateIdentity.js.map +1 -1
- package/dist/esm/funcs/identitiesDeleteIdentity.js +1 -1
- package/dist/esm/funcs/identitiesDeleteIdentity.js.map +1 -1
- package/dist/esm/funcs/identitiesGetIdentity.js +1 -1
- package/dist/esm/funcs/identitiesGetIdentity.js.map +1 -1
- package/dist/esm/funcs/identitiesListIdentities.js +4 -1
- package/dist/esm/funcs/identitiesListIdentities.js.map +1 -1
- package/dist/esm/funcs/identitiesUpdateIdentity.js +1 -1
- package/dist/esm/funcs/identitiesUpdateIdentity.js.map +1 -1
- package/dist/esm/funcs/keysAddPermissions.js +1 -1
- package/dist/esm/funcs/keysAddPermissions.js.map +1 -1
- package/dist/esm/funcs/keysAddRoles.js +1 -1
- package/dist/esm/funcs/keysAddRoles.js.map +1 -1
- package/dist/esm/funcs/keysCreateKey.js +1 -1
- package/dist/esm/funcs/keysCreateKey.js.map +1 -1
- package/dist/esm/funcs/keysDeleteKey.js +1 -1
- package/dist/esm/funcs/keysDeleteKey.js.map +1 -1
- package/dist/esm/funcs/keysGetKey.js +1 -1
- package/dist/esm/funcs/keysGetKey.js.map +1 -1
- package/dist/esm/funcs/keysRemovePermissions.js +1 -1
- package/dist/esm/funcs/keysRemovePermissions.js.map +1 -1
- package/dist/esm/funcs/keysRemoveRoles.js +1 -1
- package/dist/esm/funcs/keysRemoveRoles.js.map +1 -1
- package/dist/esm/funcs/keysRerollKey.js +1 -1
- package/dist/esm/funcs/keysRerollKey.js.map +1 -1
- package/dist/esm/funcs/keysSetPermissions.js +1 -1
- package/dist/esm/funcs/keysSetPermissions.js.map +1 -1
- package/dist/esm/funcs/keysSetRoles.js +1 -1
- package/dist/esm/funcs/keysSetRoles.js.map +1 -1
- package/dist/esm/funcs/keysUpdateCredits.js +1 -1
- package/dist/esm/funcs/keysUpdateCredits.js.map +1 -1
- package/dist/esm/funcs/keysUpdateKey.js +1 -1
- package/dist/esm/funcs/keysUpdateKey.js.map +1 -1
- package/dist/esm/funcs/keysVerifyKey.js +1 -1
- package/dist/esm/funcs/keysVerifyKey.js.map +1 -1
- package/dist/esm/funcs/keysWhoami.js +1 -1
- package/dist/esm/funcs/keysWhoami.js.map +1 -1
- package/dist/esm/funcs/permissionsCreatePermission.js +1 -1
- package/dist/esm/funcs/permissionsCreatePermission.js.map +1 -1
- package/dist/esm/funcs/permissionsCreateRole.js +1 -1
- package/dist/esm/funcs/permissionsCreateRole.js.map +1 -1
- package/dist/esm/funcs/permissionsDeletePermission.js +1 -1
- package/dist/esm/funcs/permissionsDeletePermission.js.map +1 -1
- package/dist/esm/funcs/permissionsDeleteRole.js +1 -1
- package/dist/esm/funcs/permissionsDeleteRole.js.map +1 -1
- package/dist/esm/funcs/permissionsGetPermission.js +1 -1
- package/dist/esm/funcs/permissionsGetPermission.js.map +1 -1
- package/dist/esm/funcs/permissionsGetRole.js +1 -1
- package/dist/esm/funcs/permissionsGetRole.js.map +1 -1
- package/dist/esm/funcs/permissionsListPermissions.js +1 -1
- package/dist/esm/funcs/permissionsListPermissions.js.map +1 -1
- package/dist/esm/funcs/permissionsListRoles.js +1 -1
- package/dist/esm/funcs/permissionsListRoles.js.map +1 -1
- package/dist/esm/funcs/ratelimitDeleteOverride.js +1 -1
- package/dist/esm/funcs/ratelimitDeleteOverride.js.map +1 -1
- package/dist/esm/funcs/ratelimitGetOverride.js +1 -1
- package/dist/esm/funcs/ratelimitGetOverride.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 +4 -4
- package/dist/esm/funcs/ratelimitLimit.js.map +1 -1
- package/dist/esm/funcs/ratelimitListOverrides.js +1 -1
- package/dist/esm/funcs/ratelimitListOverrides.js.map +1 -1
- package/dist/esm/funcs/ratelimitSetOverride.js +1 -1
- package/dist/esm/funcs/ratelimitSetOverride.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/config.js.map +1 -1
- package/dist/esm/lib/security.d.ts.map +1 -1
- package/dist/esm/lib/security.js.map +1 -1
- package/dist/esm/lib/url.js +1 -1
- package/dist/esm/lib/url.js.map +1 -1
- package/dist/esm/mcp-server/mcp-server.js +1 -1
- package/dist/esm/mcp-server/server.js +1 -1
- package/dist/esm/mcp-server/tools/ratelimitLimit.js +1 -1
- package/dist/esm/models/components/identity.d.ts +6 -26
- package/dist/esm/models/components/identity.d.ts.map +1 -1
- package/dist/esm/models/components/identity.js +2 -23
- package/dist/esm/models/components/identity.js.map +1 -1
- package/dist/esm/models/components/index.d.ts +2 -0
- package/dist/esm/models/components/index.d.ts.map +1 -1
- package/dist/esm/models/components/index.js +2 -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/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 +2 -0
- package/dist/esm/models/errors/index.d.ts.map +1 -1
- package/dist/esm/models/errors/index.js +2 -0
- package/dist/esm/models/errors/index.js.map +1 -1
- package/dist/esm/sdk/ratelimit.d.ts +1 -1
- package/dist/esm/sdk/ratelimit.js +1 -1
- package/docs/sdks/ratelimit/README.md +2 -1
- package/examples/apisCreateApi.example.ts +1 -1
- package/examples/package-lock.json +1 -1
- package/jsr.json +1 -1
- package/package.json +1 -1
- package/src/funcs/apisCreateApi.ts +1 -1
- package/src/funcs/apisDeleteApi.ts +1 -1
- package/src/funcs/apisGetApi.ts +1 -1
- package/src/funcs/apisListKeys.ts +1 -1
- package/src/funcs/identitiesCreateIdentity.ts +1 -1
- package/src/funcs/identitiesDeleteIdentity.ts +1 -1
- package/src/funcs/identitiesGetIdentity.ts +1 -1
- package/src/funcs/identitiesListIdentities.ts +4 -1
- package/src/funcs/identitiesUpdateIdentity.ts +1 -1
- package/src/funcs/keysAddPermissions.ts +1 -1
- package/src/funcs/keysAddRoles.ts +1 -1
- package/src/funcs/keysCreateKey.ts +1 -1
- package/src/funcs/keysDeleteKey.ts +1 -1
- package/src/funcs/keysGetKey.ts +1 -1
- package/src/funcs/keysRemovePermissions.ts +1 -1
- package/src/funcs/keysRemoveRoles.ts +1 -1
- package/src/funcs/keysRerollKey.ts +1 -1
- package/src/funcs/keysSetPermissions.ts +1 -1
- package/src/funcs/keysSetRoles.ts +1 -1
- package/src/funcs/keysUpdateCredits.ts +1 -1
- package/src/funcs/keysUpdateKey.ts +1 -1
- package/src/funcs/keysVerifyKey.ts +1 -1
- package/src/funcs/keysWhoami.ts +1 -1
- package/src/funcs/permissionsCreatePermission.ts +1 -1
- package/src/funcs/permissionsCreateRole.ts +1 -1
- package/src/funcs/permissionsDeletePermission.ts +1 -1
- package/src/funcs/permissionsDeleteRole.ts +1 -1
- package/src/funcs/permissionsGetPermission.ts +1 -1
- package/src/funcs/permissionsGetRole.ts +1 -1
- package/src/funcs/permissionsListPermissions.ts +1 -1
- package/src/funcs/permissionsListRoles.ts +1 -1
- package/src/funcs/ratelimitDeleteOverride.ts +1 -1
- package/src/funcs/ratelimitGetOverride.ts +1 -1
- package/src/funcs/ratelimitLimit.ts +7 -3
- package/src/funcs/ratelimitListOverrides.ts +1 -1
- package/src/funcs/ratelimitSetOverride.ts +1 -1
- package/src/lib/config.ts +3 -3
- package/src/lib/security.ts +4 -1
- package/src/lib/url.ts +1 -1
- package/src/mcp-server/mcp-server.ts +1 -1
- package/src/mcp-server/server.ts +1 -1
- package/src/mcp-server/tools/ratelimitLimit.ts +1 -1
- package/src/models/components/identity.ts +4 -53
- package/src/models/components/index.ts +2 -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/v2keysupdatekeyrequestbody.ts +10 -10
- package/src/models/errors/goneerrorresponse.ts +118 -0
- package/src/models/errors/index.ts +2 -0
- package/src/sdk/ratelimit.ts +1 -1
- package/docs/sdks/unkey/README.md +0 -82
|
@@ -33,7 +33,7 @@ import { Result } from "../types/fp.js";
|
|
|
33
33
|
*
|
|
34
34
|
* 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.
|
|
35
35
|
*
|
|
36
|
-
* **
|
|
36
|
+
* **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.
|
|
37
37
|
*
|
|
38
38
|
* **Required Permissions**
|
|
39
39
|
*
|
|
@@ -56,6 +56,7 @@ export function ratelimitLimit(
|
|
|
56
56
|
| errors.UnauthorizedErrorResponse
|
|
57
57
|
| errors.ForbiddenErrorResponse
|
|
58
58
|
| errors.NotFoundErrorResponse
|
|
59
|
+
| errors.GoneErrorResponse
|
|
59
60
|
| errors.InternalServerErrorResponse
|
|
60
61
|
| UnkeyError
|
|
61
62
|
| ResponseValidationError
|
|
@@ -86,6 +87,7 @@ async function $do(
|
|
|
86
87
|
| errors.UnauthorizedErrorResponse
|
|
87
88
|
| errors.ForbiddenErrorResponse
|
|
88
89
|
| errors.NotFoundErrorResponse
|
|
90
|
+
| errors.GoneErrorResponse
|
|
89
91
|
| errors.InternalServerErrorResponse
|
|
90
92
|
| UnkeyError
|
|
91
93
|
| ResponseValidationError
|
|
@@ -126,7 +128,7 @@ async function $do(
|
|
|
126
128
|
options: client._options,
|
|
127
129
|
baseURL: options?.serverURL ?? client._baseURL ?? "",
|
|
128
130
|
operationID: "ratelimit.limit",
|
|
129
|
-
oAuth2Scopes:
|
|
131
|
+
oAuth2Scopes: null,
|
|
130
132
|
|
|
131
133
|
resolvedSecurity: requestSecurity,
|
|
132
134
|
|
|
@@ -164,7 +166,7 @@ async function $do(
|
|
|
164
166
|
|
|
165
167
|
const doResult = await client._do(req, {
|
|
166
168
|
context,
|
|
167
|
-
errorCodes: ["400", "401", "403", "404", "4XX", "500", "5XX"],
|
|
169
|
+
errorCodes: ["400", "401", "403", "404", "410", "4XX", "500", "5XX"],
|
|
168
170
|
retryConfig: context.retryConfig,
|
|
169
171
|
retryCodes: context.retryCodes,
|
|
170
172
|
});
|
|
@@ -183,6 +185,7 @@ async function $do(
|
|
|
183
185
|
| errors.UnauthorizedErrorResponse
|
|
184
186
|
| errors.ForbiddenErrorResponse
|
|
185
187
|
| errors.NotFoundErrorResponse
|
|
188
|
+
| errors.GoneErrorResponse
|
|
186
189
|
| errors.InternalServerErrorResponse
|
|
187
190
|
| UnkeyError
|
|
188
191
|
| ResponseValidationError
|
|
@@ -198,6 +201,7 @@ async function $do(
|
|
|
198
201
|
M.jsonErr(401, errors.UnauthorizedErrorResponse$inboundSchema),
|
|
199
202
|
M.jsonErr(403, errors.ForbiddenErrorResponse$inboundSchema),
|
|
200
203
|
M.jsonErr(404, errors.NotFoundErrorResponse$inboundSchema),
|
|
204
|
+
M.jsonErr(410, errors.GoneErrorResponse$inboundSchema),
|
|
201
205
|
M.jsonErr(500, errors.InternalServerErrorResponse$inboundSchema),
|
|
202
206
|
M.fail("4XX"),
|
|
203
207
|
M.fail("5XX"),
|
package/src/lib/config.ts
CHANGED
|
@@ -58,7 +58,7 @@ export function serverURLFromOptions(options: SDKOptions): URL | null {
|
|
|
58
58
|
export const SDK_METADATA = {
|
|
59
59
|
language: "typescript",
|
|
60
60
|
openapiDocVersion: "2.0.0",
|
|
61
|
-
sdkVersion: "2.0.
|
|
62
|
-
genVersion: "2.
|
|
63
|
-
userAgent: "speakeasy-sdk/typescript 2.0.
|
|
61
|
+
sdkVersion: "2.0.6",
|
|
62
|
+
genVersion: "2.723.11",
|
|
63
|
+
userAgent: "speakeasy-sdk/typescript 2.0.6 2.723.11 2.0.0 @unkey/api",
|
|
64
64
|
} as const;
|
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/lib/url.ts
CHANGED
|
@@ -10,7 +10,7 @@ export function pathToFunc(
|
|
|
10
10
|
pathPattern: string,
|
|
11
11
|
options?: { charEncoding?: "percent" | "none" },
|
|
12
12
|
): (params?: Params) => string {
|
|
13
|
-
const paramRE = /\{([a-zA-Z0-9_]
|
|
13
|
+
const paramRE = /\{([a-zA-Z0-9_][a-zA-Z0-9_-]*?)\}/g;
|
|
14
14
|
|
|
15
15
|
return function buildURLPath(params: Record<string, unknown> = {}): string {
|
|
16
16
|
return pathPattern.replace(paramRE, function (_, placeholder) {
|
package/src/mcp-server/server.ts
CHANGED
|
@@ -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
|
|
|
@@ -13,11 +13,6 @@ import {
|
|
|
13
13
|
RatelimitResponse$outboundSchema,
|
|
14
14
|
} from "./ratelimitresponse.js";
|
|
15
15
|
|
|
16
|
-
/**
|
|
17
|
-
* Identity metadata
|
|
18
|
-
*/
|
|
19
|
-
export type IdentityMeta = {};
|
|
20
|
-
|
|
21
16
|
export type Identity = {
|
|
22
17
|
/**
|
|
23
18
|
* Identity ID
|
|
@@ -30,57 +25,13 @@ export type Identity = {
|
|
|
30
25
|
/**
|
|
31
26
|
* Identity metadata
|
|
32
27
|
*/
|
|
33
|
-
meta?:
|
|
28
|
+
meta?: { [k: string]: any } | undefined;
|
|
34
29
|
/**
|
|
35
30
|
* Identity ratelimits
|
|
36
31
|
*/
|
|
37
32
|
ratelimits?: Array<RatelimitResponse> | undefined;
|
|
38
33
|
};
|
|
39
34
|
|
|
40
|
-
/** @internal */
|
|
41
|
-
export const IdentityMeta$inboundSchema: z.ZodType<
|
|
42
|
-
IdentityMeta,
|
|
43
|
-
z.ZodTypeDef,
|
|
44
|
-
unknown
|
|
45
|
-
> = z.object({});
|
|
46
|
-
|
|
47
|
-
/** @internal */
|
|
48
|
-
export type IdentityMeta$Outbound = {};
|
|
49
|
-
|
|
50
|
-
/** @internal */
|
|
51
|
-
export const IdentityMeta$outboundSchema: z.ZodType<
|
|
52
|
-
IdentityMeta$Outbound,
|
|
53
|
-
z.ZodTypeDef,
|
|
54
|
-
IdentityMeta
|
|
55
|
-
> = z.object({});
|
|
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 IdentityMeta$ {
|
|
62
|
-
/** @deprecated use `IdentityMeta$inboundSchema` instead. */
|
|
63
|
-
export const inboundSchema = IdentityMeta$inboundSchema;
|
|
64
|
-
/** @deprecated use `IdentityMeta$outboundSchema` instead. */
|
|
65
|
-
export const outboundSchema = IdentityMeta$outboundSchema;
|
|
66
|
-
/** @deprecated use `IdentityMeta$Outbound` instead. */
|
|
67
|
-
export type Outbound = IdentityMeta$Outbound;
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
export function identityMetaToJSON(identityMeta: IdentityMeta): string {
|
|
71
|
-
return JSON.stringify(IdentityMeta$outboundSchema.parse(identityMeta));
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
export function identityMetaFromJSON(
|
|
75
|
-
jsonString: string,
|
|
76
|
-
): SafeParseResult<IdentityMeta, SDKValidationError> {
|
|
77
|
-
return safeParse(
|
|
78
|
-
jsonString,
|
|
79
|
-
(x) => IdentityMeta$inboundSchema.parse(JSON.parse(x)),
|
|
80
|
-
`Failed to parse 'IdentityMeta' from JSON`,
|
|
81
|
-
);
|
|
82
|
-
}
|
|
83
|
-
|
|
84
35
|
/** @internal */
|
|
85
36
|
export const Identity$inboundSchema: z.ZodType<
|
|
86
37
|
Identity,
|
|
@@ -89,7 +40,7 @@ export const Identity$inboundSchema: z.ZodType<
|
|
|
89
40
|
> = z.object({
|
|
90
41
|
id: z.string(),
|
|
91
42
|
externalId: z.string(),
|
|
92
|
-
meta: z.
|
|
43
|
+
meta: z.record(z.any()).optional(),
|
|
93
44
|
ratelimits: z.array(RatelimitResponse$inboundSchema).optional(),
|
|
94
45
|
});
|
|
95
46
|
|
|
@@ -97,7 +48,7 @@ export const Identity$inboundSchema: z.ZodType<
|
|
|
97
48
|
export type Identity$Outbound = {
|
|
98
49
|
id: string;
|
|
99
50
|
externalId: string;
|
|
100
|
-
meta?:
|
|
51
|
+
meta?: { [k: string]: any } | undefined;
|
|
101
52
|
ratelimits?: Array<RatelimitResponse$Outbound> | undefined;
|
|
102
53
|
};
|
|
103
54
|
|
|
@@ -109,7 +60,7 @@ export const Identity$outboundSchema: z.ZodType<
|
|
|
109
60
|
> = z.object({
|
|
110
61
|
id: z.string(),
|
|
111
62
|
externalId: z.string(),
|
|
112
|
-
meta: z.
|
|
63
|
+
meta: z.record(z.any()).optional(),
|
|
113
64
|
ratelimits: z.array(RatelimitResponse$outboundSchema).optional(),
|
|
114
65
|
});
|
|
115
66
|
|
|
@@ -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";
|
|
@@ -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
|
+
}
|
|
@@ -6,18 +6,18 @@ import * as z from "zod";
|
|
|
6
6
|
import { safeParse } from "../../lib/schemas.js";
|
|
7
7
|
import { Result as SafeParseResult } from "../../types/fp.js";
|
|
8
8
|
import { SDKValidationError } from "../errors/sdkvalidationerror.js";
|
|
9
|
-
import {
|
|
10
|
-
KeyCreditsData,
|
|
11
|
-
KeyCreditsData$inboundSchema,
|
|
12
|
-
KeyCreditsData$Outbound,
|
|
13
|
-
KeyCreditsData$outboundSchema,
|
|
14
|
-
} from "./keycreditsdata.js";
|
|
15
9
|
import {
|
|
16
10
|
RatelimitRequest,
|
|
17
11
|
RatelimitRequest$inboundSchema,
|
|
18
12
|
RatelimitRequest$Outbound,
|
|
19
13
|
RatelimitRequest$outboundSchema,
|
|
20
14
|
} from "./ratelimitrequest.js";
|
|
15
|
+
import {
|
|
16
|
+
UpdateKeyCreditsData,
|
|
17
|
+
UpdateKeyCreditsData$inboundSchema,
|
|
18
|
+
UpdateKeyCreditsData$Outbound,
|
|
19
|
+
UpdateKeyCreditsData$outboundSchema,
|
|
20
|
+
} from "./updatekeycreditsdata.js";
|
|
21
21
|
|
|
22
22
|
export type V2KeysUpdateKeyRequestBody = {
|
|
23
23
|
/**
|
|
@@ -68,7 +68,7 @@ export type V2KeysUpdateKeyRequestBody = {
|
|
|
68
68
|
/**
|
|
69
69
|
* Credit configuration and remaining balance for this key.
|
|
70
70
|
*/
|
|
71
|
-
credits?:
|
|
71
|
+
credits?: UpdateKeyCreditsData | null | undefined;
|
|
72
72
|
/**
|
|
73
73
|
* Defines time-based rate limits that protect against abuse by controlling request frequency.
|
|
74
74
|
*
|
|
@@ -102,7 +102,7 @@ export const V2KeysUpdateKeyRequestBody$inboundSchema: z.ZodType<
|
|
|
102
102
|
externalId: z.nullable(z.string()).optional(),
|
|
103
103
|
meta: z.nullable(z.record(z.any())).optional(),
|
|
104
104
|
expires: z.nullable(z.number().int()).optional(),
|
|
105
|
-
credits:
|
|
105
|
+
credits: z.nullable(UpdateKeyCreditsData$inboundSchema).optional(),
|
|
106
106
|
ratelimits: z.array(RatelimitRequest$inboundSchema).optional(),
|
|
107
107
|
enabled: z.boolean().optional(),
|
|
108
108
|
roles: z.array(z.string()).optional(),
|
|
@@ -116,7 +116,7 @@ export type V2KeysUpdateKeyRequestBody$Outbound = {
|
|
|
116
116
|
externalId?: string | null | undefined;
|
|
117
117
|
meta?: { [k: string]: any } | null | undefined;
|
|
118
118
|
expires?: number | null | undefined;
|
|
119
|
-
credits?:
|
|
119
|
+
credits?: UpdateKeyCreditsData$Outbound | null | undefined;
|
|
120
120
|
ratelimits?: Array<RatelimitRequest$Outbound> | undefined;
|
|
121
121
|
enabled?: boolean | undefined;
|
|
122
122
|
roles?: Array<string> | undefined;
|
|
@@ -134,7 +134,7 @@ export const V2KeysUpdateKeyRequestBody$outboundSchema: z.ZodType<
|
|
|
134
134
|
externalId: z.nullable(z.string()).optional(),
|
|
135
135
|
meta: z.nullable(z.record(z.any())).optional(),
|
|
136
136
|
expires: z.nullable(z.number().int()).optional(),
|
|
137
|
-
credits:
|
|
137
|
+
credits: z.nullable(UpdateKeyCreditsData$outboundSchema).optional(),
|
|
138
138
|
ratelimits: z.array(RatelimitRequest$outboundSchema).optional(),
|
|
139
139
|
enabled: z.boolean().optional(),
|
|
140
140
|
roles: z.array(z.string()).optional(),
|