/* * 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 { DownloadClientCategory, DownloadClientCategory$inboundSchema, DownloadClientCategory$Outbound, DownloadClientCategory$outboundSchema, } from "./downloadclientcategory.js"; import { DownloadProtocol, DownloadProtocol$inboundSchema, DownloadProtocol$outboundSchema, } from "./downloadprotocol.js"; import { SDKValidationError } from "./errors/sdkvalidationerror.js"; import { Field, Field$inboundSchema, Field$Outbound, Field$outboundSchema, } from "./field.js"; import { ProviderMessage, ProviderMessage$inboundSchema, ProviderMessage$Outbound, ProviderMessage$outboundSchema, } from "./providermessage.js"; export type DownloadClientResource = { id?: number | undefined; name?: string | null | undefined; fields?: Array | null | undefined; implementationName?: string | null | undefined; implementation?: string | null | undefined; configContract?: string | null | undefined; infoLink?: string | null | undefined; message?: ProviderMessage | undefined; tags?: Array | null | undefined; presets?: Array | null | undefined; enable?: boolean | undefined; protocol?: DownloadProtocol | undefined; priority?: number | undefined; categories?: Array | null | undefined; supportsCategories?: boolean | undefined; }; /** @internal */ export const DownloadClientResource$inboundSchema: z.ZodType< DownloadClientResource, z.ZodTypeDef, unknown > = z.object({ id: z.number().int().optional(), name: z.nullable(z.string()).optional(), fields: z.nullable(z.array(Field$inboundSchema)).optional(), implementationName: z.nullable(z.string()).optional(), implementation: z.nullable(z.string()).optional(), configContract: z.nullable(z.string()).optional(), infoLink: z.nullable(z.string()).optional(), message: ProviderMessage$inboundSchema.optional(), tags: z.nullable(z.array(z.number().int())).optional(), presets: z.nullable( z.array(z.lazy(() => DownloadClientResource$inboundSchema)), ).optional(), enable: z.boolean().optional(), protocol: DownloadProtocol$inboundSchema.optional(), priority: z.number().int().optional(), categories: z.nullable(z.array(DownloadClientCategory$inboundSchema)) .optional(), supportsCategories: z.boolean().optional(), }); /** @internal */ export type DownloadClientResource$Outbound = { id?: number | undefined; name?: string | null | undefined; fields?: Array | null | undefined; implementationName?: string | null | undefined; implementation?: string | null | undefined; configContract?: string | null | undefined; infoLink?: string | null | undefined; message?: ProviderMessage$Outbound | undefined; tags?: Array | null | undefined; presets?: Array | null | undefined; enable?: boolean | undefined; protocol?: string | undefined; priority?: number | undefined; categories?: Array | null | undefined; supportsCategories?: boolean | undefined; }; /** @internal */ export const DownloadClientResource$outboundSchema: z.ZodType< DownloadClientResource$Outbound, z.ZodTypeDef, DownloadClientResource > = z.object({ id: z.number().int().optional(), name: z.nullable(z.string()).optional(), fields: z.nullable(z.array(Field$outboundSchema)).optional(), implementationName: z.nullable(z.string()).optional(), implementation: z.nullable(z.string()).optional(), configContract: z.nullable(z.string()).optional(), infoLink: z.nullable(z.string()).optional(), message: ProviderMessage$outboundSchema.optional(), tags: z.nullable(z.array(z.number().int())).optional(), presets: z.nullable( z.array(z.lazy(() => DownloadClientResource$outboundSchema)), ).optional(), enable: z.boolean().optional(), protocol: DownloadProtocol$outboundSchema.optional(), priority: z.number().int().optional(), categories: z.nullable(z.array(DownloadClientCategory$outboundSchema)) .optional(), supportsCategories: z.boolean().optional(), }); /** * @internal * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. */ export namespace DownloadClientResource$ { /** @deprecated use `DownloadClientResource$inboundSchema` instead. */ export const inboundSchema = DownloadClientResource$inboundSchema; /** @deprecated use `DownloadClientResource$outboundSchema` instead. */ export const outboundSchema = DownloadClientResource$outboundSchema; /** @deprecated use `DownloadClientResource$Outbound` instead. */ export type Outbound = DownloadClientResource$Outbound; } export function downloadClientResourceToJSON( downloadClientResource: DownloadClientResource, ): string { return JSON.stringify( DownloadClientResource$outboundSchema.parse(downloadClientResource), ); } export function downloadClientResourceFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => DownloadClientResource$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'DownloadClientResource' from JSON`, ); }