UNPKG

buena-typescript-sdk

Version:

Official TypeScript SDK for Buena.ai API - LinkedIn automation and lead management

112 lines (103 loc) 3.03 kB
/* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ import * as z from "zod"; import { remap as remap$ } from "../lib/primitives.js"; import { safeParse } from "../lib/schemas.js"; import { Result as SafeParseResult } from "../types/fp.js"; import { SDKValidationError } from "./errors/sdkvalidationerror.js"; export type ApiKey = { /** * Unique identifier for the API key */ id?: string | undefined; /** * Name of the API key */ name?: string | undefined; /** * The actual API key (only shown once during creation) */ key?: string | undefined; /** * List of permissions */ permissions?: Array<string> | undefined; /** * When the key was created */ createdAt?: Date | undefined; /** * When the key was last used */ lastUsed?: Date | undefined; }; /** @internal */ export const ApiKey$inboundSchema: z.ZodType<ApiKey, z.ZodTypeDef, unknown> = z .object({ id: z.string().optional(), name: z.string().optional(), key: z.string().optional(), permissions: z.array(z.string()).optional(), created_at: z.string().datetime({ offset: true }).transform(v => new Date(v) ).optional(), last_used: z.string().datetime({ offset: true }).transform(v => new Date(v)) .optional(), }).transform((v) => { return remap$(v, { "created_at": "createdAt", "last_used": "lastUsed", }); }); /** @internal */ export type ApiKey$Outbound = { id?: string | undefined; name?: string | undefined; key?: string | undefined; permissions?: Array<string> | undefined; created_at?: string | undefined; last_used?: string | undefined; }; /** @internal */ export const ApiKey$outboundSchema: z.ZodType< ApiKey$Outbound, z.ZodTypeDef, ApiKey > = z.object({ id: z.string().optional(), name: z.string().optional(), key: z.string().optional(), permissions: z.array(z.string()).optional(), createdAt: z.date().transform(v => v.toISOString()).optional(), lastUsed: z.date().transform(v => v.toISOString()).optional(), }).transform((v) => { return remap$(v, { createdAt: "created_at", lastUsed: "last_used", }); }); /** * @internal * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. */ export namespace ApiKey$ { /** @deprecated use `ApiKey$inboundSchema` instead. */ export const inboundSchema = ApiKey$inboundSchema; /** @deprecated use `ApiKey$outboundSchema` instead. */ export const outboundSchema = ApiKey$outboundSchema; /** @deprecated use `ApiKey$Outbound` instead. */ export type Outbound = ApiKey$Outbound; } export function apiKeyToJSON(apiKey: ApiKey): string { return JSON.stringify(ApiKey$outboundSchema.parse(apiKey)); } export function apiKeyFromJSON( jsonString: string, ): SafeParseResult<ApiKey, SDKValidationError> { return safeParse( jsonString, (x) => ApiKey$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'ApiKey' from JSON`, ); }