/* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. * @generated-id: 6f35b94388b6 */ import * as z from "zod/v4"; import { safeParse } from "../../lib/schemas.js"; import { Result as SafeParseResult } from "../../types/fp.js"; import { smartUnion } from "../../types/smartUnion.js"; import { SDKValidationError } from "../errors/sdkvalidationerror.js"; export type SkillAssetContentTextContent = { textContent: string; isExecutable?: boolean | undefined; }; export type RawContent = { rawContent: string; isExecutable?: boolean | undefined; }; export type SkillAssetContent = RawContent | SkillAssetContentTextContent; /** @internal */ export const SkillAssetContentTextContent$inboundSchema: z.ZodType< SkillAssetContentTextContent, unknown > = z.object({ textContent: z.string(), isExecutable: z.boolean().optional(), }); /** @internal */ export type SkillAssetContentTextContent$Outbound = { textContent: string; isExecutable?: boolean | undefined; }; /** @internal */ export const SkillAssetContentTextContent$outboundSchema: z.ZodType< SkillAssetContentTextContent$Outbound, SkillAssetContentTextContent > = z.object({ textContent: z.string(), isExecutable: z.boolean().optional(), }); export function skillAssetContentTextContentToJSON( skillAssetContentTextContent: SkillAssetContentTextContent, ): string { return JSON.stringify( SkillAssetContentTextContent$outboundSchema.parse( skillAssetContentTextContent, ), ); } export function skillAssetContentTextContentFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => SkillAssetContentTextContent$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'SkillAssetContentTextContent' from JSON`, ); } /** @internal */ export const RawContent$inboundSchema: z.ZodType = z .object({ rawContent: z.string(), isExecutable: z.boolean().optional(), }); /** @internal */ export type RawContent$Outbound = { rawContent: string; isExecutable?: boolean | undefined; }; /** @internal */ export const RawContent$outboundSchema: z.ZodType< RawContent$Outbound, RawContent > = z.object({ rawContent: z.string(), isExecutable: z.boolean().optional(), }); export function rawContentToJSON(rawContent: RawContent): string { return JSON.stringify(RawContent$outboundSchema.parse(rawContent)); } export function rawContentFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => RawContent$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'RawContent' from JSON`, ); } /** @internal */ export const SkillAssetContent$inboundSchema: z.ZodType< SkillAssetContent, unknown > = smartUnion([ z.lazy(() => RawContent$inboundSchema), z.lazy(() => SkillAssetContentTextContent$inboundSchema), ]); /** @internal */ export type SkillAssetContent$Outbound = | RawContent$Outbound | SkillAssetContentTextContent$Outbound; /** @internal */ export const SkillAssetContent$outboundSchema: z.ZodType< SkillAssetContent$Outbound, SkillAssetContent > = smartUnion([ z.lazy(() => RawContent$outboundSchema), z.lazy(() => SkillAssetContentTextContent$outboundSchema), ]); export function skillAssetContentToJSON( skillAssetContent: SkillAssetContent, ): string { return JSON.stringify( SkillAssetContent$outboundSchema.parse(skillAssetContent), ); } export function skillAssetContentFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => SkillAssetContent$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'SkillAssetContent' from JSON`, ); }