UNPKG

@unkey/api

Version:

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

55 lines (50 loc) 1.31 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 RatelimitResponse = { /** * 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; /** * Whether this rate limit was automatically applied when verifying the key. */ autoApply: boolean; }; /** @internal */ export const RatelimitResponse$inboundSchema: z.ZodType< RatelimitResponse, z.ZodTypeDef, unknown > = z.object({ id: z.string(), name: z.string(), limit: z.number().int(), duration: z.number().int(), autoApply: z.boolean(), }); export function ratelimitResponseFromJSON( jsonString: string, ): SafeParseResult<RatelimitResponse, SDKValidationError> { return safeParse( jsonString, (x) => RatelimitResponse$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'RatelimitResponse' from JSON`, ); }