@unkey/api
Version:
Developer-friendly & type-safe Typescript SDK specifically catered to leverage *@unkey/api* API.
30 lines • 1.28 kB
JavaScript
/*
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
*/
import * as z from "zod/v3";
import { safeParse } from "../../lib/schemas.js";
import { Identity$inboundSchema } from "./identity.js";
import { KeyCreditsData$inboundSchema, } from "./keycreditsdata.js";
import { RatelimitResponse$inboundSchema, } from "./ratelimitresponse.js";
/** @internal */
export const KeyResponseData$inboundSchema = z.object({
keyId: z.string(),
start: z.string(),
enabled: z.boolean(),
name: z.string().optional(),
meta: z.record(z.any()).optional(),
createdAt: z.number().int(),
updatedAt: z.number().int().optional(),
lastUsedAt: z.number().int().optional(),
expires: z.number().int().optional(),
permissions: z.array(z.string()).optional(),
roles: z.array(z.string()).optional(),
credits: KeyCreditsData$inboundSchema.optional(),
identity: Identity$inboundSchema.optional(),
plaintext: z.string().optional(),
ratelimits: z.array(RatelimitResponse$inboundSchema).optional(),
});
export function keyResponseDataFromJSON(jsonString) {
return safeParse(jsonString, (x) => KeyResponseData$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'KeyResponseData' from JSON`);
}
//# sourceMappingURL=keyresponsedata.js.map