/* * 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"; /** * A media object containing information about the generated media. */ export type Media = { /** * The URL where the media can be accessed. */ url: string; /** * The seed used to generate the media. */ seed: number; /** * Whether the media was flagged as NSFW. */ nsfw: boolean; }; /** @internal */ export const Media$inboundSchema: z.ZodType = z .object({ url: z.string(), seed: z.number().int(), nsfw: z.boolean(), }); /** @internal */ export type Media$Outbound = { url: string; seed: number; nsfw: boolean; }; /** @internal */ export const Media$outboundSchema: z.ZodType< Media$Outbound, z.ZodTypeDef, Media > = z.object({ url: z.string(), seed: z.number().int(), nsfw: z.boolean(), }); /** * @internal * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. */ export namespace Media$ { /** @deprecated use `Media$inboundSchema` instead. */ export const inboundSchema = Media$inboundSchema; /** @deprecated use `Media$outboundSchema` instead. */ export const outboundSchema = Media$outboundSchema; /** @deprecated use `Media$Outbound` instead. */ export type Outbound = Media$Outbound; } export function mediaToJSON(media: Media): string { return JSON.stringify(Media$outboundSchema.parse(media)); } export function mediaFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => Media$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'Media' from JSON`, ); }