/* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ import * as z from "zod"; import { safeParse } from "../../lib/schemas.js"; import { Result as SafeParseResult } from "../../types/fp.js"; import { SDKValidationError } from "../errors/sdkvalidationerror.js"; export type ServiceAccountCreds = { privateKey: string; name: string; organization: string; type: string; }; export type Security = { apiKey?: string | undefined; serviceAccountCreds?: ServiceAccountCreds | undefined; }; /** @internal */ export const ServiceAccountCreds$inboundSchema: z.ZodType< ServiceAccountCreds, z.ZodTypeDef, unknown > = z.object({ privateKey: z.string(), name: z.string(), organization: z.string(), type: z.string(), }); /** @internal */ export type ServiceAccountCreds$Outbound = { privateKey: string; name: string; organization: string; type: string; }; /** @internal */ export const ServiceAccountCreds$outboundSchema: z.ZodType< ServiceAccountCreds$Outbound, z.ZodTypeDef, ServiceAccountCreds > = z.object({ privateKey: z.string(), name: z.string(), organization: z.string(), type: z.string(), }); /** * @internal * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. */ export namespace ServiceAccountCreds$ { /** @deprecated use `ServiceAccountCreds$inboundSchema` instead. */ export const inboundSchema = ServiceAccountCreds$inboundSchema; /** @deprecated use `ServiceAccountCreds$outboundSchema` instead. */ export const outboundSchema = ServiceAccountCreds$outboundSchema; /** @deprecated use `ServiceAccountCreds$Outbound` instead. */ export type Outbound = ServiceAccountCreds$Outbound; } export function serviceAccountCredsToJSON( serviceAccountCreds: ServiceAccountCreds, ): string { return JSON.stringify( ServiceAccountCreds$outboundSchema.parse(serviceAccountCreds), ); } export function serviceAccountCredsFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => ServiceAccountCreds$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'ServiceAccountCreds' from JSON`, ); } /** @internal */ export const Security$inboundSchema: z.ZodType< Security, z.ZodTypeDef, unknown > = z.object({ apiKey: z.string().optional(), serviceAccountCreds: z.lazy(() => ServiceAccountCreds$inboundSchema) .optional(), }); /** @internal */ export type Security$Outbound = { apiKey?: string | undefined; serviceAccountCreds?: ServiceAccountCreds$Outbound | undefined; }; /** @internal */ export const Security$outboundSchema: z.ZodType< Security$Outbound, z.ZodTypeDef, Security > = z.object({ apiKey: z.string().optional(), serviceAccountCreds: z.lazy(() => ServiceAccountCreds$outboundSchema) .optional(), }); /** * @internal * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. */ export namespace Security$ { /** @deprecated use `Security$inboundSchema` instead. */ export const inboundSchema = Security$inboundSchema; /** @deprecated use `Security$outboundSchema` instead. */ export const outboundSchema = Security$outboundSchema; /** @deprecated use `Security$Outbound` instead. */ export type Outbound = Security$Outbound; } export function securityToJSON(security: Security): string { return JSON.stringify(Security$outboundSchema.parse(security)); } export function securityFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => Security$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'Security' from JSON`, ); }