UNPKG

@unkey/api

Version:

Developer-friendly & type-safe Typescript SDK specifically catered to leverage *@unkey/api* API.

73 lines (68 loc) 1.81 kB
/* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ import * as z from "zod/v3"; import { safeParse } from "../../lib/schemas.js"; import { Result as SafeParseResult } from "../../types/fp.js"; import { SDKValidationError } from "../errors/sdkvalidationerror.js"; export type VerifyKeyRatelimitData = { /** * Whether the rate limit was exceeded. */ exceeded: boolean; /** * Unique identifier for this rate limit configuration. */ id: string; /** * Human-readable name for this rate limit. */ name: string; /** * Maximum requests allowed within the time window. */ limit: number; /** * Rate limit window duration in milliseconds. */ duration: number; /** * Rate limit reset duration in milliseconds. */ reset: number; /** * Rate limit remaining requests within the time window. */ remaining: number; /** * Whether this rate limit should be automatically applied when verifying keys. * * @remarks * When true, we will automatically apply this limit during verification without it being explicitly listed. */ autoApply: boolean; }; /** @internal */ export const VerifyKeyRatelimitData$inboundSchema: z.ZodType< VerifyKeyRatelimitData, z.ZodTypeDef, unknown > = z.object({ exceeded: z.boolean(), id: z.string(), name: z.string(), limit: z.number().int(), duration: z.number().int(), reset: z.number().int(), remaining: z.number().int(), autoApply: z.boolean(), }); export function verifyKeyRatelimitDataFromJSON( jsonString: string, ): SafeParseResult<VerifyKeyRatelimitData, SDKValidationError> { return safeParse( jsonString, (x) => VerifyKeyRatelimitData$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'VerifyKeyRatelimitData' from JSON`, ); }