@unkey/api 2.1.0 → 2.1.1
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 +10 -6
- package/bin/mcp-server.js +568 -166
- package/bin/mcp-server.js.map +23 -11
- package/dist/commonjs/funcs/keysMigrateKeys.d.ts +23 -0
- package/dist/commonjs/funcs/keysMigrateKeys.d.ts.map +1 -0
- package/dist/commonjs/funcs/keysMigrateKeys.js +133 -0
- package/dist/commonjs/funcs/keysMigrateKeys.js.map +1 -0
- package/dist/commonjs/funcs/ratelimitLimit.d.ts +0 -4
- package/dist/commonjs/funcs/ratelimitLimit.d.ts.map +1 -1
- package/dist/commonjs/funcs/ratelimitLimit.js +0 -4
- package/dist/commonjs/funcs/ratelimitLimit.js.map +1 -1
- package/dist/commonjs/funcs/ratelimitMultiLimit.d.ts +28 -0
- package/dist/commonjs/funcs/ratelimitMultiLimit.d.ts.map +1 -0
- package/dist/commonjs/funcs/ratelimitMultiLimit.js +139 -0
- package/dist/commonjs/funcs/ratelimitMultiLimit.js.map +1 -0
- package/dist/commonjs/lib/config.d.ts +3 -3
- package/dist/commonjs/lib/config.js +3 -3
- 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 +5 -1
- package/dist/commonjs/mcp-server/server.js.map +1 -1
- package/dist/commonjs/mcp-server/tools/keysMigrateKeys.d.ts +8 -0
- package/dist/commonjs/mcp-server/tools/keysMigrateKeys.d.ts.map +1 -0
- package/dist/commonjs/mcp-server/tools/keysMigrateKeys.js +70 -0
- package/dist/commonjs/mcp-server/tools/keysMigrateKeys.js.map +1 -0
- package/dist/commonjs/mcp-server/tools/ratelimitLimit.d.ts.map +1 -1
- package/dist/commonjs/mcp-server/tools/ratelimitLimit.js +0 -4
- package/dist/commonjs/mcp-server/tools/ratelimitLimit.js.map +1 -1
- package/dist/commonjs/mcp-server/tools/ratelimitMultiLimit.d.ts +9 -0
- package/dist/commonjs/mcp-server/tools/ratelimitMultiLimit.d.ts.map +1 -0
- package/dist/commonjs/mcp-server/tools/ratelimitMultiLimit.js +76 -0
- package/dist/commonjs/mcp-server/tools/ratelimitMultiLimit.js.map +1 -0
- package/dist/commonjs/models/components/index.d.ts +8 -0
- package/dist/commonjs/models/components/index.d.ts.map +1 -1
- package/dist/commonjs/models/components/index.js +8 -0
- package/dist/commonjs/models/components/index.js.map +1 -1
- package/dist/commonjs/models/components/v2keysmigratekeydata.d.ts +113 -0
- package/dist/commonjs/models/components/v2keysmigratekeydata.d.ts.map +1 -0
- package/dist/commonjs/models/components/v2keysmigratekeydata.js +78 -0
- package/dist/commonjs/models/components/v2keysmigratekeydata.js.map +1 -0
- package/dist/commonjs/models/components/v2keysmigratekeysmigration.d.ts +25 -0
- package/dist/commonjs/models/components/v2keysmigratekeysmigration.d.ts.map +1 -0
- package/dist/commonjs/models/components/v2keysmigratekeysmigration.js +60 -0
- package/dist/commonjs/models/components/v2keysmigratekeysmigration.js.map +1 -0
- package/dist/commonjs/models/components/v2keysmigratekeysrequestbody.d.ts +28 -0
- package/dist/commonjs/models/components/v2keysmigratekeysrequestbody.d.ts.map +1 -0
- package/dist/commonjs/models/components/v2keysmigratekeysrequestbody.js +63 -0
- package/dist/commonjs/models/components/v2keysmigratekeysrequestbody.js.map +1 -0
- package/dist/commonjs/models/components/v2keysmigratekeysresponsebody.d.ts +24 -0
- package/dist/commonjs/models/components/v2keysmigratekeysresponsebody.d.ts.map +1 -0
- package/dist/commonjs/models/components/v2keysmigratekeysresponsebody.js +62 -0
- package/dist/commonjs/models/components/v2keysmigratekeysresponsebody.js.map +1 -0
- package/dist/commonjs/models/components/v2keysmigratekeysresponsedata.d.ts +26 -0
- package/dist/commonjs/models/components/v2keysmigratekeysresponsedata.d.ts.map +1 -0
- package/dist/commonjs/models/components/v2keysmigratekeysresponsedata.js +61 -0
- package/dist/commonjs/models/components/v2keysmigratekeysresponsedata.js.map +1 -0
- package/dist/commonjs/models/components/v2keysverifykeyrequestbody.d.ts +5 -0
- package/dist/commonjs/models/components/v2keysverifykeyrequestbody.d.ts.map +1 -1
- package/dist/commonjs/models/components/v2keysverifykeyrequestbody.js +2 -0
- package/dist/commonjs/models/components/v2keysverifykeyrequestbody.js.map +1 -1
- package/dist/commonjs/models/components/v2keysverifykeyresponsedata.d.ts +3 -3
- package/dist/commonjs/models/components/v2ratelimitmultilimitcheck.d.ts +84 -0
- package/dist/commonjs/models/components/v2ratelimitmultilimitcheck.d.ts.map +1 -0
- package/dist/commonjs/models/components/v2ratelimitmultilimitcheck.js +70 -0
- package/dist/commonjs/models/components/v2ratelimitmultilimitcheck.js.map +1 -0
- package/dist/commonjs/models/components/v2ratelimitmultilimitresponsebody.d.ts +27 -0
- package/dist/commonjs/models/components/v2ratelimitmultilimitresponsebody.d.ts.map +1 -0
- package/dist/commonjs/models/components/v2ratelimitmultilimitresponsebody.js +62 -0
- package/dist/commonjs/models/components/v2ratelimitmultilimitresponsebody.js.map +1 -0
- package/dist/commonjs/models/components/v2ratelimitmultilimitresponsedata.d.ts +33 -0
- package/dist/commonjs/models/components/v2ratelimitmultilimitresponsedata.d.ts.map +1 -0
- package/dist/commonjs/models/components/v2ratelimitmultilimitresponsedata.js +61 -0
- package/dist/commonjs/models/components/v2ratelimitmultilimitresponsedata.js.map +1 -0
- package/dist/commonjs/sdk/keys.d.ts +12 -0
- package/dist/commonjs/sdk/keys.d.ts.map +1 -1
- package/dist/commonjs/sdk/keys.js +15 -0
- package/dist/commonjs/sdk/keys.js.map +1 -1
- package/dist/commonjs/sdk/ratelimit.d.ts +17 -4
- package/dist/commonjs/sdk/ratelimit.d.ts.map +1 -1
- package/dist/commonjs/sdk/ratelimit.js +20 -4
- package/dist/commonjs/sdk/ratelimit.js.map +1 -1
- package/dist/commonjs/types/enums.d.ts +10 -6
- package/dist/commonjs/types/enums.d.ts.map +1 -1
- package/dist/commonjs/types/enums.js +76 -2
- package/dist/commonjs/types/enums.js.map +1 -1
- package/dist/commonjs/types/index.d.ts +0 -1
- package/dist/commonjs/types/index.d.ts.map +1 -1
- package/dist/commonjs/types/index.js +1 -3
- package/dist/commonjs/types/index.js.map +1 -1
- package/dist/esm/funcs/keysMigrateKeys.d.ts +23 -0
- package/dist/esm/funcs/keysMigrateKeys.d.ts.map +1 -0
- package/dist/esm/funcs/keysMigrateKeys.js +97 -0
- package/dist/esm/funcs/keysMigrateKeys.js.map +1 -0
- package/dist/esm/funcs/ratelimitLimit.d.ts +0 -4
- package/dist/esm/funcs/ratelimitLimit.d.ts.map +1 -1
- package/dist/esm/funcs/ratelimitLimit.js +0 -4
- package/dist/esm/funcs/ratelimitLimit.js.map +1 -1
- package/dist/esm/funcs/ratelimitMultiLimit.d.ts +28 -0
- package/dist/esm/funcs/ratelimitMultiLimit.d.ts.map +1 -0
- package/dist/esm/funcs/ratelimitMultiLimit.js +103 -0
- package/dist/esm/funcs/ratelimitMultiLimit.js.map +1 -0
- package/dist/esm/lib/config.d.ts +3 -3
- package/dist/esm/lib/config.js +3 -3
- 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 +5 -1
- package/dist/esm/mcp-server/server.js.map +1 -1
- package/dist/esm/mcp-server/tools/keysMigrateKeys.d.ts +8 -0
- package/dist/esm/mcp-server/tools/keysMigrateKeys.d.ts.map +1 -0
- package/dist/esm/mcp-server/tools/keysMigrateKeys.js +34 -0
- package/dist/esm/mcp-server/tools/keysMigrateKeys.js.map +1 -0
- package/dist/esm/mcp-server/tools/ratelimitLimit.d.ts.map +1 -1
- package/dist/esm/mcp-server/tools/ratelimitLimit.js +0 -4
- package/dist/esm/mcp-server/tools/ratelimitLimit.js.map +1 -1
- package/dist/esm/mcp-server/tools/ratelimitMultiLimit.d.ts +9 -0
- package/dist/esm/mcp-server/tools/ratelimitMultiLimit.d.ts.map +1 -0
- package/dist/esm/mcp-server/tools/ratelimitMultiLimit.js +40 -0
- package/dist/esm/mcp-server/tools/ratelimitMultiLimit.js.map +1 -0
- package/dist/esm/models/components/index.d.ts +8 -0
- package/dist/esm/models/components/index.d.ts.map +1 -1
- package/dist/esm/models/components/index.js +8 -0
- package/dist/esm/models/components/index.js.map +1 -1
- package/dist/esm/models/components/v2keysmigratekeydata.d.ts +113 -0
- package/dist/esm/models/components/v2keysmigratekeydata.d.ts.map +1 -0
- package/dist/esm/models/components/v2keysmigratekeydata.js +40 -0
- package/dist/esm/models/components/v2keysmigratekeydata.js.map +1 -0
- package/dist/esm/models/components/v2keysmigratekeysmigration.d.ts +25 -0
- package/dist/esm/models/components/v2keysmigratekeysmigration.d.ts.map +1 -0
- package/dist/esm/models/components/v2keysmigratekeysmigration.js +22 -0
- package/dist/esm/models/components/v2keysmigratekeysmigration.js.map +1 -0
- package/dist/esm/models/components/v2keysmigratekeysrequestbody.d.ts +28 -0
- package/dist/esm/models/components/v2keysmigratekeysrequestbody.d.ts.map +1 -0
- package/dist/esm/models/components/v2keysmigratekeysrequestbody.js +25 -0
- package/dist/esm/models/components/v2keysmigratekeysrequestbody.js.map +1 -0
- package/dist/esm/models/components/v2keysmigratekeysresponsebody.d.ts +24 -0
- package/dist/esm/models/components/v2keysmigratekeysresponsebody.d.ts.map +1 -0
- package/dist/esm/models/components/v2keysmigratekeysresponsebody.js +24 -0
- package/dist/esm/models/components/v2keysmigratekeysresponsebody.js.map +1 -0
- package/dist/esm/models/components/v2keysmigratekeysresponsedata.d.ts +26 -0
- package/dist/esm/models/components/v2keysmigratekeysresponsedata.d.ts.map +1 -0
- package/dist/esm/models/components/v2keysmigratekeysresponsedata.js +23 -0
- package/dist/esm/models/components/v2keysmigratekeysresponsedata.js.map +1 -0
- package/dist/esm/models/components/v2keysverifykeyrequestbody.d.ts +5 -0
- package/dist/esm/models/components/v2keysverifykeyrequestbody.d.ts.map +1 -1
- package/dist/esm/models/components/v2keysverifykeyrequestbody.js +2 -0
- package/dist/esm/models/components/v2keysverifykeyrequestbody.js.map +1 -1
- package/dist/esm/models/components/v2keysverifykeyresponsedata.d.ts +3 -3
- package/dist/esm/models/components/v2ratelimitmultilimitcheck.d.ts +84 -0
- package/dist/esm/models/components/v2ratelimitmultilimitcheck.d.ts.map +1 -0
- package/dist/esm/models/components/v2ratelimitmultilimitcheck.js +32 -0
- package/dist/esm/models/components/v2ratelimitmultilimitcheck.js.map +1 -0
- package/dist/esm/models/components/v2ratelimitmultilimitresponsebody.d.ts +27 -0
- package/dist/esm/models/components/v2ratelimitmultilimitresponsebody.d.ts.map +1 -0
- package/dist/esm/models/components/v2ratelimitmultilimitresponsebody.js +24 -0
- package/dist/esm/models/components/v2ratelimitmultilimitresponsebody.js.map +1 -0
- package/dist/esm/models/components/v2ratelimitmultilimitresponsedata.d.ts +33 -0
- package/dist/esm/models/components/v2ratelimitmultilimitresponsedata.d.ts.map +1 -0
- package/dist/esm/models/components/v2ratelimitmultilimitresponsedata.js +23 -0
- package/dist/esm/models/components/v2ratelimitmultilimitresponsedata.js.map +1 -0
- package/dist/esm/sdk/keys.d.ts +12 -0
- package/dist/esm/sdk/keys.d.ts.map +1 -1
- package/dist/esm/sdk/keys.js +15 -0
- package/dist/esm/sdk/keys.js.map +1 -1
- package/dist/esm/sdk/ratelimit.d.ts +17 -4
- package/dist/esm/sdk/ratelimit.d.ts.map +1 -1
- package/dist/esm/sdk/ratelimit.js +20 -4
- package/dist/esm/sdk/ratelimit.js.map +1 -1
- package/dist/esm/types/enums.d.ts +10 -6
- package/dist/esm/types/enums.d.ts.map +1 -1
- package/dist/esm/types/enums.js +38 -1
- package/dist/esm/types/enums.js.map +1 -1
- package/dist/esm/types/index.d.ts +0 -1
- package/dist/esm/types/index.d.ts.map +1 -1
- package/dist/esm/types/index.js +0 -1
- package/dist/esm/types/index.js.map +1 -1
- package/examples/package-lock.json +1 -1
- package/jsr.json +1 -1
- package/package.json +1 -1
- package/src/funcs/keysMigrateKeys.ts +201 -0
- package/src/funcs/ratelimitLimit.ts +0 -4
- package/src/funcs/ratelimitMultiLimit.ts +213 -0
- package/src/lib/config.ts +3 -3
- package/src/mcp-server/mcp-server.ts +1 -1
- package/src/mcp-server/server.ts +5 -1
- package/src/mcp-server/tools/keysMigrateKeys.ts +43 -0
- package/src/mcp-server/tools/ratelimitLimit.ts +0 -4
- package/src/mcp-server/tools/ratelimitMultiLimit.ts +49 -0
- package/src/models/components/index.ts +8 -0
- package/src/models/components/v2keysmigratekeydata.ts +171 -0
- package/src/models/components/v2keysmigratekeysmigration.ts +61 -0
- package/src/models/components/v2keysmigratekeysrequestbody.ts +73 -0
- package/src/models/components/v2keysmigratekeysresponsebody.ts +72 -0
- package/src/models/components/v2keysmigratekeysresponsedata.ts +69 -0
- package/src/models/components/v2keysverifykeyrequestbody.ts +7 -0
- package/src/models/components/v2keysverifykeyresponsedata.ts +3 -3
- package/src/models/components/v2ratelimitmultilimitcheck.ts +130 -0
- package/src/models/components/v2ratelimitmultilimitresponsebody.ts +75 -0
- package/src/models/components/v2ratelimitmultilimitresponsedata.ts +76 -0
- package/src/sdk/keys.ts +23 -0
- package/src/sdk/ratelimit.ts +28 -4
- package/src/types/enums.ts +55 -6
- package/src/types/index.ts +0 -1
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import * as z from "zod/v3";
|
|
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
|
+
V2KeysMigrateKeyData,
|
|
11
|
+
V2KeysMigrateKeyData$inboundSchema,
|
|
12
|
+
V2KeysMigrateKeyData$Outbound,
|
|
13
|
+
V2KeysMigrateKeyData$outboundSchema,
|
|
14
|
+
} from "./v2keysmigratekeydata.js";
|
|
15
|
+
|
|
16
|
+
export type V2KeysMigrateKeysRequestBody = {
|
|
17
|
+
/**
|
|
18
|
+
* Identifier of the configured migration provider/strategy to use (e.g., "your_company").
|
|
19
|
+
*/
|
|
20
|
+
migrationId: string;
|
|
21
|
+
/**
|
|
22
|
+
* The ID of the API that the keys should be inserted into
|
|
23
|
+
*/
|
|
24
|
+
apiId: string;
|
|
25
|
+
keys: Array<V2KeysMigrateKeyData>;
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
/** @internal */
|
|
29
|
+
export const V2KeysMigrateKeysRequestBody$inboundSchema: z.ZodType<
|
|
30
|
+
V2KeysMigrateKeysRequestBody,
|
|
31
|
+
z.ZodTypeDef,
|
|
32
|
+
unknown
|
|
33
|
+
> = z.object({
|
|
34
|
+
migrationId: z.string(),
|
|
35
|
+
apiId: z.string(),
|
|
36
|
+
keys: z.array(V2KeysMigrateKeyData$inboundSchema),
|
|
37
|
+
});
|
|
38
|
+
/** @internal */
|
|
39
|
+
export type V2KeysMigrateKeysRequestBody$Outbound = {
|
|
40
|
+
migrationId: string;
|
|
41
|
+
apiId: string;
|
|
42
|
+
keys: Array<V2KeysMigrateKeyData$Outbound>;
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
/** @internal */
|
|
46
|
+
export const V2KeysMigrateKeysRequestBody$outboundSchema: z.ZodType<
|
|
47
|
+
V2KeysMigrateKeysRequestBody$Outbound,
|
|
48
|
+
z.ZodTypeDef,
|
|
49
|
+
V2KeysMigrateKeysRequestBody
|
|
50
|
+
> = z.object({
|
|
51
|
+
migrationId: z.string(),
|
|
52
|
+
apiId: z.string(),
|
|
53
|
+
keys: z.array(V2KeysMigrateKeyData$outboundSchema),
|
|
54
|
+
});
|
|
55
|
+
|
|
56
|
+
export function v2KeysMigrateKeysRequestBodyToJSON(
|
|
57
|
+
v2KeysMigrateKeysRequestBody: V2KeysMigrateKeysRequestBody,
|
|
58
|
+
): string {
|
|
59
|
+
return JSON.stringify(
|
|
60
|
+
V2KeysMigrateKeysRequestBody$outboundSchema.parse(
|
|
61
|
+
v2KeysMigrateKeysRequestBody,
|
|
62
|
+
),
|
|
63
|
+
);
|
|
64
|
+
}
|
|
65
|
+
export function v2KeysMigrateKeysRequestBodyFromJSON(
|
|
66
|
+
jsonString: string,
|
|
67
|
+
): SafeParseResult<V2KeysMigrateKeysRequestBody, SDKValidationError> {
|
|
68
|
+
return safeParse(
|
|
69
|
+
jsonString,
|
|
70
|
+
(x) => V2KeysMigrateKeysRequestBody$inboundSchema.parse(JSON.parse(x)),
|
|
71
|
+
`Failed to parse 'V2KeysMigrateKeysRequestBody' from JSON`,
|
|
72
|
+
);
|
|
73
|
+
}
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import * as z from "zod/v3";
|
|
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
|
+
V2KeysMigrateKeysResponseData,
|
|
17
|
+
V2KeysMigrateKeysResponseData$inboundSchema,
|
|
18
|
+
V2KeysMigrateKeysResponseData$Outbound,
|
|
19
|
+
V2KeysMigrateKeysResponseData$outboundSchema,
|
|
20
|
+
} from "./v2keysmigratekeysresponsedata.js";
|
|
21
|
+
|
|
22
|
+
export type V2KeysMigrateKeysResponseBody = {
|
|
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: V2KeysMigrateKeysResponseData;
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
/** @internal */
|
|
31
|
+
export const V2KeysMigrateKeysResponseBody$inboundSchema: z.ZodType<
|
|
32
|
+
V2KeysMigrateKeysResponseBody,
|
|
33
|
+
z.ZodTypeDef,
|
|
34
|
+
unknown
|
|
35
|
+
> = z.object({
|
|
36
|
+
meta: Meta$inboundSchema,
|
|
37
|
+
data: V2KeysMigrateKeysResponseData$inboundSchema,
|
|
38
|
+
});
|
|
39
|
+
/** @internal */
|
|
40
|
+
export type V2KeysMigrateKeysResponseBody$Outbound = {
|
|
41
|
+
meta: Meta$Outbound;
|
|
42
|
+
data: V2KeysMigrateKeysResponseData$Outbound;
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
/** @internal */
|
|
46
|
+
export const V2KeysMigrateKeysResponseBody$outboundSchema: z.ZodType<
|
|
47
|
+
V2KeysMigrateKeysResponseBody$Outbound,
|
|
48
|
+
z.ZodTypeDef,
|
|
49
|
+
V2KeysMigrateKeysResponseBody
|
|
50
|
+
> = z.object({
|
|
51
|
+
meta: Meta$outboundSchema,
|
|
52
|
+
data: V2KeysMigrateKeysResponseData$outboundSchema,
|
|
53
|
+
});
|
|
54
|
+
|
|
55
|
+
export function v2KeysMigrateKeysResponseBodyToJSON(
|
|
56
|
+
v2KeysMigrateKeysResponseBody: V2KeysMigrateKeysResponseBody,
|
|
57
|
+
): string {
|
|
58
|
+
return JSON.stringify(
|
|
59
|
+
V2KeysMigrateKeysResponseBody$outboundSchema.parse(
|
|
60
|
+
v2KeysMigrateKeysResponseBody,
|
|
61
|
+
),
|
|
62
|
+
);
|
|
63
|
+
}
|
|
64
|
+
export function v2KeysMigrateKeysResponseBodyFromJSON(
|
|
65
|
+
jsonString: string,
|
|
66
|
+
): SafeParseResult<V2KeysMigrateKeysResponseBody, SDKValidationError> {
|
|
67
|
+
return safeParse(
|
|
68
|
+
jsonString,
|
|
69
|
+
(x) => V2KeysMigrateKeysResponseBody$inboundSchema.parse(JSON.parse(x)),
|
|
70
|
+
`Failed to parse 'V2KeysMigrateKeysResponseBody' from JSON`,
|
|
71
|
+
);
|
|
72
|
+
}
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import * as z from "zod/v3";
|
|
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
|
+
V2KeysMigrateKeysMigration,
|
|
11
|
+
V2KeysMigrateKeysMigration$inboundSchema,
|
|
12
|
+
V2KeysMigrateKeysMigration$Outbound,
|
|
13
|
+
V2KeysMigrateKeysMigration$outboundSchema,
|
|
14
|
+
} from "./v2keysmigratekeysmigration.js";
|
|
15
|
+
|
|
16
|
+
export type V2KeysMigrateKeysResponseData = {
|
|
17
|
+
/**
|
|
18
|
+
* Successfully migrated keys with their hash and generated keyId
|
|
19
|
+
*/
|
|
20
|
+
migrated: Array<V2KeysMigrateKeysMigration>;
|
|
21
|
+
/**
|
|
22
|
+
* Hashes that could not be migrated (e.g., already exist in the system)
|
|
23
|
+
*/
|
|
24
|
+
failed: Array<string>;
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
/** @internal */
|
|
28
|
+
export const V2KeysMigrateKeysResponseData$inboundSchema: z.ZodType<
|
|
29
|
+
V2KeysMigrateKeysResponseData,
|
|
30
|
+
z.ZodTypeDef,
|
|
31
|
+
unknown
|
|
32
|
+
> = z.object({
|
|
33
|
+
migrated: z.array(V2KeysMigrateKeysMigration$inboundSchema),
|
|
34
|
+
failed: z.array(z.string()),
|
|
35
|
+
});
|
|
36
|
+
/** @internal */
|
|
37
|
+
export type V2KeysMigrateKeysResponseData$Outbound = {
|
|
38
|
+
migrated: Array<V2KeysMigrateKeysMigration$Outbound>;
|
|
39
|
+
failed: Array<string>;
|
|
40
|
+
};
|
|
41
|
+
|
|
42
|
+
/** @internal */
|
|
43
|
+
export const V2KeysMigrateKeysResponseData$outboundSchema: z.ZodType<
|
|
44
|
+
V2KeysMigrateKeysResponseData$Outbound,
|
|
45
|
+
z.ZodTypeDef,
|
|
46
|
+
V2KeysMigrateKeysResponseData
|
|
47
|
+
> = z.object({
|
|
48
|
+
migrated: z.array(V2KeysMigrateKeysMigration$outboundSchema),
|
|
49
|
+
failed: z.array(z.string()),
|
|
50
|
+
});
|
|
51
|
+
|
|
52
|
+
export function v2KeysMigrateKeysResponseDataToJSON(
|
|
53
|
+
v2KeysMigrateKeysResponseData: V2KeysMigrateKeysResponseData,
|
|
54
|
+
): string {
|
|
55
|
+
return JSON.stringify(
|
|
56
|
+
V2KeysMigrateKeysResponseData$outboundSchema.parse(
|
|
57
|
+
v2KeysMigrateKeysResponseData,
|
|
58
|
+
),
|
|
59
|
+
);
|
|
60
|
+
}
|
|
61
|
+
export function v2KeysMigrateKeysResponseDataFromJSON(
|
|
62
|
+
jsonString: string,
|
|
63
|
+
): SafeParseResult<V2KeysMigrateKeysResponseData, SDKValidationError> {
|
|
64
|
+
return safeParse(
|
|
65
|
+
jsonString,
|
|
66
|
+
(x) => V2KeysMigrateKeysResponseData$inboundSchema.parse(JSON.parse(x)),
|
|
67
|
+
`Failed to parse 'V2KeysMigrateKeysResponseData' from JSON`,
|
|
68
|
+
);
|
|
69
|
+
}
|
|
@@ -65,6 +65,10 @@ export type V2KeysVerifyKeyRequestBody = {
|
|
|
65
65
|
* Rate limit checks are optimized for performance but may allow brief bursts during high concurrency.
|
|
66
66
|
*/
|
|
67
67
|
ratelimits?: Array<KeysVerifyKeyRatelimit> | undefined;
|
|
68
|
+
/**
|
|
69
|
+
* Migrate keys on demand from your previous system. Reach out for migration support at support@unkey.dev
|
|
70
|
+
*/
|
|
71
|
+
migrationId?: string | undefined;
|
|
68
72
|
};
|
|
69
73
|
|
|
70
74
|
/** @internal */
|
|
@@ -78,6 +82,7 @@ export const V2KeysVerifyKeyRequestBody$inboundSchema: z.ZodType<
|
|
|
78
82
|
permissions: z.string().optional(),
|
|
79
83
|
credits: KeysVerifyKeyCredits$inboundSchema.optional(),
|
|
80
84
|
ratelimits: z.array(KeysVerifyKeyRatelimit$inboundSchema).optional(),
|
|
85
|
+
migrationId: z.string().optional(),
|
|
81
86
|
});
|
|
82
87
|
/** @internal */
|
|
83
88
|
export type V2KeysVerifyKeyRequestBody$Outbound = {
|
|
@@ -86,6 +91,7 @@ export type V2KeysVerifyKeyRequestBody$Outbound = {
|
|
|
86
91
|
permissions?: string | undefined;
|
|
87
92
|
credits?: KeysVerifyKeyCredits$Outbound | undefined;
|
|
88
93
|
ratelimits?: Array<KeysVerifyKeyRatelimit$Outbound> | undefined;
|
|
94
|
+
migrationId?: string | undefined;
|
|
89
95
|
};
|
|
90
96
|
|
|
91
97
|
/** @internal */
|
|
@@ -99,6 +105,7 @@ export const V2KeysVerifyKeyRequestBody$outboundSchema: z.ZodType<
|
|
|
99
105
|
permissions: z.string().optional(),
|
|
100
106
|
credits: KeysVerifyKeyCredits$outboundSchema.optional(),
|
|
101
107
|
ratelimits: z.array(KeysVerifyKeyRatelimit$outboundSchema).optional(),
|
|
108
|
+
migrationId: z.string().optional(),
|
|
102
109
|
});
|
|
103
110
|
|
|
104
111
|
export function v2KeysVerifyKeyRequestBodyToJSON(
|
|
@@ -103,15 +103,15 @@ export type V2KeysVerifyKeyResponseData = {
|
|
|
103
103
|
* Unix timestamp (in milliseconds) when the key will expire.
|
|
104
104
|
*
|
|
105
105
|
* @remarks
|
|
106
|
-
* If
|
|
106
|
+
* If omitted, the key has no expiration. You can use this to
|
|
107
107
|
* warn users about upcoming expirations or to understand the validity period.
|
|
108
108
|
*/
|
|
109
109
|
expires?: number | undefined;
|
|
110
110
|
/**
|
|
111
|
-
* The number of requests/credits remaining for this key. If
|
|
111
|
+
* The number of requests/credits remaining for this key. If omitted,
|
|
112
112
|
*
|
|
113
113
|
* @remarks
|
|
114
|
-
*
|
|
114
|
+
* the key has unlimited usage. This value decreases with
|
|
115
115
|
* each verification (based on the 'cost' parameter) unless explicit credit
|
|
116
116
|
* refills are configured.
|
|
117
117
|
*/
|
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import * as z from "zod/v3";
|
|
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 V2RatelimitMultiLimitCheck = {
|
|
11
|
+
/**
|
|
12
|
+
* The namespace this rate limit result corresponds to. Use this field to correlate the response with the request when checking multiple rate limits.
|
|
13
|
+
*/
|
|
14
|
+
namespace: string;
|
|
15
|
+
/**
|
|
16
|
+
* The identifier this rate limit result corresponds to. Use this field to correlate the response with the request when checking multiple rate limits.
|
|
17
|
+
*/
|
|
18
|
+
identifier: string;
|
|
19
|
+
/**
|
|
20
|
+
* The maximum number of operations allowed within the time window. This reflects either the default limit specified in the request or an override limit if one exists for this identifier.
|
|
21
|
+
*
|
|
22
|
+
* @remarks
|
|
23
|
+
*
|
|
24
|
+
* This value helps clients understand their total quota for the current window.
|
|
25
|
+
*/
|
|
26
|
+
limit: number;
|
|
27
|
+
/**
|
|
28
|
+
* The number of operations remaining in the current window before the rate limit is exceeded. Applications should use this value to:
|
|
29
|
+
*
|
|
30
|
+
* @remarks
|
|
31
|
+
*
|
|
32
|
+
* - Implement client-side throttling before hitting limits
|
|
33
|
+
* - Display usage information to end users
|
|
34
|
+
* - Trigger alerts when approaching limits
|
|
35
|
+
* - Adjust request patterns based on available capacity
|
|
36
|
+
*
|
|
37
|
+
* When this reaches zero, requests will be rejected until the window resets.
|
|
38
|
+
*/
|
|
39
|
+
remaining: number;
|
|
40
|
+
/**
|
|
41
|
+
* The Unix timestamp in milliseconds when the rate limit window will reset and 'remaining' will return to 'limit'.
|
|
42
|
+
*
|
|
43
|
+
* @remarks
|
|
44
|
+
*
|
|
45
|
+
* This timestamp enables clients to:
|
|
46
|
+
* - Calculate and display wait times to users
|
|
47
|
+
* - Implement intelligent retry mechanisms
|
|
48
|
+
* - Schedule requests to resume after the reset
|
|
49
|
+
* - Implement exponential backoff when needed
|
|
50
|
+
*
|
|
51
|
+
* The reset time is based on a sliding window from the first request in the current window.
|
|
52
|
+
*/
|
|
53
|
+
reset: number;
|
|
54
|
+
/**
|
|
55
|
+
* Whether the request passed the rate limit check. If true, the request is allowed to proceed. If false, the request has exceeded the rate limit and should be blocked or rejected.
|
|
56
|
+
*
|
|
57
|
+
* @remarks
|
|
58
|
+
*
|
|
59
|
+
* You MUST check this field to determine if the request should proceed, as the endpoint always returns `HTTP 200` even when rate limited.
|
|
60
|
+
*/
|
|
61
|
+
passed: boolean;
|
|
62
|
+
/**
|
|
63
|
+
* If a rate limit override was applied for this identifier, this field contains the ID of the override that was used. Empty when no override is in effect.
|
|
64
|
+
*
|
|
65
|
+
* @remarks
|
|
66
|
+
*
|
|
67
|
+
* This can be useful for:
|
|
68
|
+
* - Debugging which override rule was matched
|
|
69
|
+
* - Tracking the effects of specific overrides
|
|
70
|
+
* - Understanding why limits differ from default values
|
|
71
|
+
*/
|
|
72
|
+
overrideId?: string | undefined;
|
|
73
|
+
};
|
|
74
|
+
|
|
75
|
+
/** @internal */
|
|
76
|
+
export const V2RatelimitMultiLimitCheck$inboundSchema: z.ZodType<
|
|
77
|
+
V2RatelimitMultiLimitCheck,
|
|
78
|
+
z.ZodTypeDef,
|
|
79
|
+
unknown
|
|
80
|
+
> = z.object({
|
|
81
|
+
namespace: z.string(),
|
|
82
|
+
identifier: z.string(),
|
|
83
|
+
limit: z.number().int(),
|
|
84
|
+
remaining: z.number().int(),
|
|
85
|
+
reset: z.number().int(),
|
|
86
|
+
passed: z.boolean(),
|
|
87
|
+
overrideId: z.string().optional(),
|
|
88
|
+
});
|
|
89
|
+
/** @internal */
|
|
90
|
+
export type V2RatelimitMultiLimitCheck$Outbound = {
|
|
91
|
+
namespace: string;
|
|
92
|
+
identifier: string;
|
|
93
|
+
limit: number;
|
|
94
|
+
remaining: number;
|
|
95
|
+
reset: number;
|
|
96
|
+
passed: boolean;
|
|
97
|
+
overrideId?: string | undefined;
|
|
98
|
+
};
|
|
99
|
+
|
|
100
|
+
/** @internal */
|
|
101
|
+
export const V2RatelimitMultiLimitCheck$outboundSchema: z.ZodType<
|
|
102
|
+
V2RatelimitMultiLimitCheck$Outbound,
|
|
103
|
+
z.ZodTypeDef,
|
|
104
|
+
V2RatelimitMultiLimitCheck
|
|
105
|
+
> = z.object({
|
|
106
|
+
namespace: z.string(),
|
|
107
|
+
identifier: z.string(),
|
|
108
|
+
limit: z.number().int(),
|
|
109
|
+
remaining: z.number().int(),
|
|
110
|
+
reset: z.number().int(),
|
|
111
|
+
passed: z.boolean(),
|
|
112
|
+
overrideId: z.string().optional(),
|
|
113
|
+
});
|
|
114
|
+
|
|
115
|
+
export function v2RatelimitMultiLimitCheckToJSON(
|
|
116
|
+
v2RatelimitMultiLimitCheck: V2RatelimitMultiLimitCheck,
|
|
117
|
+
): string {
|
|
118
|
+
return JSON.stringify(
|
|
119
|
+
V2RatelimitMultiLimitCheck$outboundSchema.parse(v2RatelimitMultiLimitCheck),
|
|
120
|
+
);
|
|
121
|
+
}
|
|
122
|
+
export function v2RatelimitMultiLimitCheckFromJSON(
|
|
123
|
+
jsonString: string,
|
|
124
|
+
): SafeParseResult<V2RatelimitMultiLimitCheck, SDKValidationError> {
|
|
125
|
+
return safeParse(
|
|
126
|
+
jsonString,
|
|
127
|
+
(x) => V2RatelimitMultiLimitCheck$inboundSchema.parse(JSON.parse(x)),
|
|
128
|
+
`Failed to parse 'V2RatelimitMultiLimitCheck' from JSON`,
|
|
129
|
+
);
|
|
130
|
+
}
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import * as z from "zod/v3";
|
|
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
|
+
V2RatelimitMultiLimitResponseData,
|
|
17
|
+
V2RatelimitMultiLimitResponseData$inboundSchema,
|
|
18
|
+
V2RatelimitMultiLimitResponseData$Outbound,
|
|
19
|
+
V2RatelimitMultiLimitResponseData$outboundSchema,
|
|
20
|
+
} from "./v2ratelimitmultilimitresponsedata.js";
|
|
21
|
+
|
|
22
|
+
export type V2RatelimitMultiLimitResponseBody = {
|
|
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
|
+
/**
|
|
28
|
+
* Container for multi-limit rate limit check results
|
|
29
|
+
*/
|
|
30
|
+
data: V2RatelimitMultiLimitResponseData;
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
/** @internal */
|
|
34
|
+
export const V2RatelimitMultiLimitResponseBody$inboundSchema: z.ZodType<
|
|
35
|
+
V2RatelimitMultiLimitResponseBody,
|
|
36
|
+
z.ZodTypeDef,
|
|
37
|
+
unknown
|
|
38
|
+
> = z.object({
|
|
39
|
+
meta: Meta$inboundSchema,
|
|
40
|
+
data: V2RatelimitMultiLimitResponseData$inboundSchema,
|
|
41
|
+
});
|
|
42
|
+
/** @internal */
|
|
43
|
+
export type V2RatelimitMultiLimitResponseBody$Outbound = {
|
|
44
|
+
meta: Meta$Outbound;
|
|
45
|
+
data: V2RatelimitMultiLimitResponseData$Outbound;
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
/** @internal */
|
|
49
|
+
export const V2RatelimitMultiLimitResponseBody$outboundSchema: z.ZodType<
|
|
50
|
+
V2RatelimitMultiLimitResponseBody$Outbound,
|
|
51
|
+
z.ZodTypeDef,
|
|
52
|
+
V2RatelimitMultiLimitResponseBody
|
|
53
|
+
> = z.object({
|
|
54
|
+
meta: Meta$outboundSchema,
|
|
55
|
+
data: V2RatelimitMultiLimitResponseData$outboundSchema,
|
|
56
|
+
});
|
|
57
|
+
|
|
58
|
+
export function v2RatelimitMultiLimitResponseBodyToJSON(
|
|
59
|
+
v2RatelimitMultiLimitResponseBody: V2RatelimitMultiLimitResponseBody,
|
|
60
|
+
): string {
|
|
61
|
+
return JSON.stringify(
|
|
62
|
+
V2RatelimitMultiLimitResponseBody$outboundSchema.parse(
|
|
63
|
+
v2RatelimitMultiLimitResponseBody,
|
|
64
|
+
),
|
|
65
|
+
);
|
|
66
|
+
}
|
|
67
|
+
export function v2RatelimitMultiLimitResponseBodyFromJSON(
|
|
68
|
+
jsonString: string,
|
|
69
|
+
): SafeParseResult<V2RatelimitMultiLimitResponseBody, SDKValidationError> {
|
|
70
|
+
return safeParse(
|
|
71
|
+
jsonString,
|
|
72
|
+
(x) => V2RatelimitMultiLimitResponseBody$inboundSchema.parse(JSON.parse(x)),
|
|
73
|
+
`Failed to parse 'V2RatelimitMultiLimitResponseBody' from JSON`,
|
|
74
|
+
);
|
|
75
|
+
}
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import * as z from "zod/v3";
|
|
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
|
+
V2RatelimitMultiLimitCheck,
|
|
11
|
+
V2RatelimitMultiLimitCheck$inboundSchema,
|
|
12
|
+
V2RatelimitMultiLimitCheck$Outbound,
|
|
13
|
+
V2RatelimitMultiLimitCheck$outboundSchema,
|
|
14
|
+
} from "./v2ratelimitmultilimitcheck.js";
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* Container for multi-limit rate limit check results
|
|
18
|
+
*/
|
|
19
|
+
export type V2RatelimitMultiLimitResponseData = {
|
|
20
|
+
/**
|
|
21
|
+
* Overall success indicator for all rate limit checks. This is true if ALL individual rate limit checks passed (all have success: true), and false if ANY check failed.
|
|
22
|
+
*
|
|
23
|
+
* @remarks
|
|
24
|
+
*
|
|
25
|
+
* Use this as a quick indicator to determine if the request should proceed.
|
|
26
|
+
*/
|
|
27
|
+
passed: boolean;
|
|
28
|
+
/**
|
|
29
|
+
* Array of individual rate limit check results, one for each rate limit check in the request
|
|
30
|
+
*/
|
|
31
|
+
limits: Array<V2RatelimitMultiLimitCheck>;
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
/** @internal */
|
|
35
|
+
export const V2RatelimitMultiLimitResponseData$inboundSchema: z.ZodType<
|
|
36
|
+
V2RatelimitMultiLimitResponseData,
|
|
37
|
+
z.ZodTypeDef,
|
|
38
|
+
unknown
|
|
39
|
+
> = z.object({
|
|
40
|
+
passed: z.boolean(),
|
|
41
|
+
limits: z.array(V2RatelimitMultiLimitCheck$inboundSchema),
|
|
42
|
+
});
|
|
43
|
+
/** @internal */
|
|
44
|
+
export type V2RatelimitMultiLimitResponseData$Outbound = {
|
|
45
|
+
passed: boolean;
|
|
46
|
+
limits: Array<V2RatelimitMultiLimitCheck$Outbound>;
|
|
47
|
+
};
|
|
48
|
+
|
|
49
|
+
/** @internal */
|
|
50
|
+
export const V2RatelimitMultiLimitResponseData$outboundSchema: z.ZodType<
|
|
51
|
+
V2RatelimitMultiLimitResponseData$Outbound,
|
|
52
|
+
z.ZodTypeDef,
|
|
53
|
+
V2RatelimitMultiLimitResponseData
|
|
54
|
+
> = z.object({
|
|
55
|
+
passed: z.boolean(),
|
|
56
|
+
limits: z.array(V2RatelimitMultiLimitCheck$outboundSchema),
|
|
57
|
+
});
|
|
58
|
+
|
|
59
|
+
export function v2RatelimitMultiLimitResponseDataToJSON(
|
|
60
|
+
v2RatelimitMultiLimitResponseData: V2RatelimitMultiLimitResponseData,
|
|
61
|
+
): string {
|
|
62
|
+
return JSON.stringify(
|
|
63
|
+
V2RatelimitMultiLimitResponseData$outboundSchema.parse(
|
|
64
|
+
v2RatelimitMultiLimitResponseData,
|
|
65
|
+
),
|
|
66
|
+
);
|
|
67
|
+
}
|
|
68
|
+
export function v2RatelimitMultiLimitResponseDataFromJSON(
|
|
69
|
+
jsonString: string,
|
|
70
|
+
): SafeParseResult<V2RatelimitMultiLimitResponseData, SDKValidationError> {
|
|
71
|
+
return safeParse(
|
|
72
|
+
jsonString,
|
|
73
|
+
(x) => V2RatelimitMultiLimitResponseData$inboundSchema.parse(JSON.parse(x)),
|
|
74
|
+
`Failed to parse 'V2RatelimitMultiLimitResponseData' from JSON`,
|
|
75
|
+
);
|
|
76
|
+
}
|
package/src/sdk/keys.ts
CHANGED
|
@@ -7,6 +7,7 @@ import { keysAddRoles } from "../funcs/keysAddRoles.js";
|
|
|
7
7
|
import { keysCreateKey } from "../funcs/keysCreateKey.js";
|
|
8
8
|
import { keysDeleteKey } from "../funcs/keysDeleteKey.js";
|
|
9
9
|
import { keysGetKey } from "../funcs/keysGetKey.js";
|
|
10
|
+
import { keysMigrateKeys } from "../funcs/keysMigrateKeys.js";
|
|
10
11
|
import { keysRemovePermissions } from "../funcs/keysRemovePermissions.js";
|
|
11
12
|
import { keysRemoveRoles } from "../funcs/keysRemoveRoles.js";
|
|
12
13
|
import { keysRerollKey } from "../funcs/keysRerollKey.js";
|
|
@@ -172,6 +173,28 @@ export class Keys extends ClientSDK {
|
|
|
172
173
|
));
|
|
173
174
|
}
|
|
174
175
|
|
|
176
|
+
/**
|
|
177
|
+
* Migrate API key(s)
|
|
178
|
+
*
|
|
179
|
+
* @remarks
|
|
180
|
+
* Returns HTTP 200 even on partial success; hashes that could not be migrated are listed under `data.failed`.
|
|
181
|
+
*
|
|
182
|
+
* **Required Permissions**
|
|
183
|
+
* Your root key must have one of the following permissions for basic key information:
|
|
184
|
+
* - `api.*.create_key` (to migrate keys to any API)
|
|
185
|
+
* - `api.<api_id>.create_key` (to migrate keys to a specific API)
|
|
186
|
+
*/
|
|
187
|
+
async migrateKeys(
|
|
188
|
+
request: components.V2KeysMigrateKeysRequestBody,
|
|
189
|
+
options?: RequestOptions,
|
|
190
|
+
): Promise<components.V2KeysMigrateKeysResponseBody> {
|
|
191
|
+
return unwrapAsync(keysMigrateKeys(
|
|
192
|
+
this,
|
|
193
|
+
request,
|
|
194
|
+
options,
|
|
195
|
+
));
|
|
196
|
+
}
|
|
197
|
+
|
|
175
198
|
/**
|
|
176
199
|
* Remove key permissions
|
|
177
200
|
*
|
package/src/sdk/ratelimit.ts
CHANGED
|
@@ -6,6 +6,7 @@ import { ratelimitDeleteOverride } from "../funcs/ratelimitDeleteOverride.js";
|
|
|
6
6
|
import { ratelimitGetOverride } from "../funcs/ratelimitGetOverride.js";
|
|
7
7
|
import { ratelimitLimit } from "../funcs/ratelimitLimit.js";
|
|
8
8
|
import { ratelimitListOverrides } from "../funcs/ratelimitListOverrides.js";
|
|
9
|
+
import { ratelimitMultiLimit } from "../funcs/ratelimitMultiLimit.js";
|
|
9
10
|
import { ratelimitSetOverride } from "../funcs/ratelimitSetOverride.js";
|
|
10
11
|
import { ClientSDK, RequestOptions } from "../lib/sdks.js";
|
|
11
12
|
import * as components from "../models/components/index.js";
|
|
@@ -73,10 +74,6 @@ export class Ratelimit extends ClientSDK {
|
|
|
73
74
|
* Your root key must have one of the following permissions:
|
|
74
75
|
* - `ratelimit.*.limit` (to check limits in any namespace)
|
|
75
76
|
* - `ratelimit.<namespace_id>.limit` (to check limits in a specific namespace)
|
|
76
|
-
*
|
|
77
|
-
* **Side Effects**
|
|
78
|
-
*
|
|
79
|
-
* Records rate limit metrics for analytics and monitoring, updates rate limit counters with sliding window algorithm, and optionally triggers override matching for custom limits.
|
|
80
77
|
*/
|
|
81
78
|
async limit(
|
|
82
79
|
request: components.V2RatelimitLimitRequestBody,
|
|
@@ -112,6 +109,33 @@ export class Ratelimit extends ClientSDK {
|
|
|
112
109
|
));
|
|
113
110
|
}
|
|
114
111
|
|
|
112
|
+
/**
|
|
113
|
+
* Apply multiple rate limit checks
|
|
114
|
+
*
|
|
115
|
+
* @remarks
|
|
116
|
+
* Check and enforce multiple rate limits in a single request for any identifiers (user IDs, IP addresses, API clients, etc.).
|
|
117
|
+
*
|
|
118
|
+
* Use this to efficiently check multiple rate limits at once. Each rate limit check is independent and returns its own result with a top-level `passed` indicator showing if all checks succeeded.
|
|
119
|
+
*
|
|
120
|
+
* **Response Codes**: Rate limit checks return HTTP 200 regardless of whether limits are exceeded - check the `passed` field to see if all limits passed, or the `success` field in each individual result. 4xx responses indicate auth, namespace existence/deletion, or validation errors (e.g., 410 Gone for deleted namespaces). 5xx responses indicate server errors.
|
|
121
|
+
*
|
|
122
|
+
* **Required Permissions**
|
|
123
|
+
*
|
|
124
|
+
* Your root key must have one of the following permissions:
|
|
125
|
+
* - `ratelimit.*.limit` (to check limits in any namespace)
|
|
126
|
+
* - `ratelimit.<namespace_id>.limit` (to check limits in all specific namespaces being checked)
|
|
127
|
+
*/
|
|
128
|
+
async multiLimit(
|
|
129
|
+
request: Array<components.V2RatelimitLimitRequestBody>,
|
|
130
|
+
options?: RequestOptions,
|
|
131
|
+
): Promise<components.V2RatelimitMultiLimitResponseBody> {
|
|
132
|
+
return unwrapAsync(ratelimitMultiLimit(
|
|
133
|
+
this,
|
|
134
|
+
request,
|
|
135
|
+
options,
|
|
136
|
+
));
|
|
137
|
+
}
|
|
138
|
+
|
|
115
139
|
/**
|
|
116
140
|
* Set ratelimit override
|
|
117
141
|
*
|