UNPKG

@unkey/api

Version:

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

54 lines (49 loc) 1.21 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"; import { RatelimitResponse, RatelimitResponse$inboundSchema, } from "./ratelimitresponse.js"; export type Identity = { /** * Identity ID */ id: string; /** * External identity ID */ externalId: string; /** * Identity metadata */ meta?: { [k: string]: any } | undefined; /** * Identity ratelimits */ ratelimits?: Array<RatelimitResponse> | undefined; }; /** @internal */ export const Identity$inboundSchema: z.ZodType< Identity, z.ZodTypeDef, unknown > = z.object({ id: z.string(), externalId: z.string(), meta: z.record(z.any()).optional(), ratelimits: z.array(RatelimitResponse$inboundSchema).optional(), }); export function identityFromJSON( jsonString: string, ): SafeParseResult<Identity, SDKValidationError> { return safeParse( jsonString, (x) => Identity$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'Identity' from JSON`, ); }