UNPKG

@vercel/sdk

Version:

<p align="center"> <a href="https://vercel.com"> <img src="https://assets.vercel.com/image/upload/v1588805858/repositories/vercel/logo.png" height="96"> <h3 align="center">Vercel</h3> </a> <p align="center">Develop. Preview. Ship.</p> </p>

134 lines (120 loc) 3.57 kB
/* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ import * as z from "zod/v3"; import { safeParse } from "../lib/schemas.js"; import { ClosedEnum } from "../types/enums.js"; import { Result as SafeParseResult } from "../types/fp.js"; import * as types from "../types/primitives.js"; import { SDKValidationError } from "./sdkvalidationerror.js"; export type GetSDKKeysRequest = { /** * The project id or name */ projectIdOrName: string; /** * The Team identifier to perform the request on behalf of. */ teamId?: string | undefined; /** * The Team slug to perform the request on behalf of. */ slug?: string | undefined; }; export const GetSDKKeysType = { Client: "client", Mobile: "mobile", Server: "server", } as const; export type GetSDKKeysType = ClosedEnum<typeof GetSDKKeysType>; /** * Shared metadata for a Flags SDK key, safe to return on both LIST and CREATE. Never contains cleartext secrets. */ export type GetSDKKeysData = { hashKey: string; projectId: string; type: GetSDKKeysType; environment: string; createdBy: string; createdAt: number; updatedAt: number; label?: string | undefined; deletedAt?: number | undefined; /** * Partially-masked representation of the SDK key value, safe to display in UIs. The value is the `vf_<type>_` prefix followed by the first 3 characters of the secret portion and a fixed 8-character `*` mask (e.g. `vf_server_abc********`). */ partialKeyValue: string; }; export type GetSDKKeysResponseBody = { data: Array<GetSDKKeysData>; }; /** @internal */ export type GetSDKKeysRequest$Outbound = { projectIdOrName: string; teamId?: string | undefined; slug?: string | undefined; }; /** @internal */ export const GetSDKKeysRequest$outboundSchema: z.ZodType< GetSDKKeysRequest$Outbound, z.ZodTypeDef, GetSDKKeysRequest > = z.object({ projectIdOrName: z.string(), teamId: z.string().optional(), slug: z.string().optional(), }); export function getSDKKeysRequestToJSON( getSDKKeysRequest: GetSDKKeysRequest, ): string { return JSON.stringify( GetSDKKeysRequest$outboundSchema.parse(getSDKKeysRequest), ); } /** @internal */ export const GetSDKKeysType$inboundSchema: z.ZodNativeEnum< typeof GetSDKKeysType > = z.nativeEnum(GetSDKKeysType); /** @internal */ export const GetSDKKeysData$inboundSchema: z.ZodType< GetSDKKeysData, z.ZodTypeDef, unknown > = z.object({ hashKey: types.string(), projectId: types.string(), type: GetSDKKeysType$inboundSchema, environment: types.string(), createdBy: types.string(), createdAt: types.number(), updatedAt: types.number(), label: types.optional(types.string()), deletedAt: types.optional(types.number()), partialKeyValue: types.string(), }); export function getSDKKeysDataFromJSON( jsonString: string, ): SafeParseResult<GetSDKKeysData, SDKValidationError> { return safeParse( jsonString, (x) => GetSDKKeysData$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'GetSDKKeysData' from JSON`, ); } /** @internal */ export const GetSDKKeysResponseBody$inboundSchema: z.ZodType< GetSDKKeysResponseBody, z.ZodTypeDef, unknown > = z.object({ data: z.array(z.lazy(() => GetSDKKeysData$inboundSchema)), }); export function getSDKKeysResponseBodyFromJSON( jsonString: string, ): SafeParseResult<GetSDKKeysResponseBody, SDKValidationError> { return safeParse( jsonString, (x) => GetSDKKeysResponseBody$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'GetSDKKeysResponseBody' from JSON`, ); }