/* * 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 { 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 { IndexerCapabilityResource, IndexerCapabilityResource$inboundSchema, IndexerCapabilityResource$Outbound, IndexerCapabilityResource$outboundSchema, } from "./indexercapabilityresource.js"; import { IndexerPrivacy, IndexerPrivacy$inboundSchema, IndexerPrivacy$outboundSchema, } from "./indexerprivacy.js"; import { IndexerStatusResource, IndexerStatusResource$inboundSchema, IndexerStatusResource$Outbound, IndexerStatusResource$outboundSchema, } from "./indexerstatusresource.js"; import { ProviderMessage, ProviderMessage$inboundSchema, ProviderMessage$Outbound, ProviderMessage$outboundSchema, } from "./providermessage.js"; export type IndexerResource = { 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; indexerUrls?: Array | null | undefined; legacyUrls?: Array | null | undefined; definitionName?: string | null | undefined; description?: string | null | undefined; language?: string | null | undefined; encoding?: string | null | undefined; enable?: boolean | undefined; redirect?: boolean | undefined; supportsRss?: boolean | undefined; supportsSearch?: boolean | undefined; supportsRedirect?: boolean | undefined; supportsPagination?: boolean | undefined; appProfileId?: number | undefined; protocol?: DownloadProtocol | undefined; privacy?: IndexerPrivacy | undefined; capabilities?: IndexerCapabilityResource | undefined; priority?: number | undefined; downloadClientId?: number | undefined; added?: Date | undefined; status?: IndexerStatusResource | undefined; sortName?: string | null | undefined; }; /** @internal */ export const IndexerResource$inboundSchema: z.ZodType< IndexerResource, 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(() => IndexerResource$inboundSchema))) .optional(), indexerUrls: z.nullable(z.array(z.string())).optional(), legacyUrls: z.nullable(z.array(z.string())).optional(), definitionName: z.nullable(z.string()).optional(), description: z.nullable(z.string()).optional(), language: z.nullable(z.string()).optional(), encoding: z.nullable(z.string()).optional(), enable: z.boolean().optional(), redirect: z.boolean().optional(), supportsRss: z.boolean().optional(), supportsSearch: z.boolean().optional(), supportsRedirect: z.boolean().optional(), supportsPagination: z.boolean().optional(), appProfileId: z.number().int().optional(), protocol: DownloadProtocol$inboundSchema.optional(), privacy: IndexerPrivacy$inboundSchema.optional(), capabilities: IndexerCapabilityResource$inboundSchema.optional(), priority: z.number().int().optional(), downloadClientId: z.number().int().optional(), added: z.string().datetime({ offset: true }).transform(v => new Date(v)) .optional(), status: IndexerStatusResource$inboundSchema.optional(), sortName: z.nullable(z.string()).optional(), }); /** @internal */ export type IndexerResource$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; indexerUrls?: Array | null | undefined; legacyUrls?: Array | null | undefined; definitionName?: string | null | undefined; description?: string | null | undefined; language?: string | null | undefined; encoding?: string | null | undefined; enable?: boolean | undefined; redirect?: boolean | undefined; supportsRss?: boolean | undefined; supportsSearch?: boolean | undefined; supportsRedirect?: boolean | undefined; supportsPagination?: boolean | undefined; appProfileId?: number | undefined; protocol?: string | undefined; privacy?: string | undefined; capabilities?: IndexerCapabilityResource$Outbound | undefined; priority?: number | undefined; downloadClientId?: number | undefined; added?: string | undefined; status?: IndexerStatusResource$Outbound | undefined; sortName?: string | null | undefined; }; /** @internal */ export const IndexerResource$outboundSchema: z.ZodType< IndexerResource$Outbound, z.ZodTypeDef, IndexerResource > = 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(() => IndexerResource$outboundSchema))) .optional(), indexerUrls: z.nullable(z.array(z.string())).optional(), legacyUrls: z.nullable(z.array(z.string())).optional(), definitionName: z.nullable(z.string()).optional(), description: z.nullable(z.string()).optional(), language: z.nullable(z.string()).optional(), encoding: z.nullable(z.string()).optional(), enable: z.boolean().optional(), redirect: z.boolean().optional(), supportsRss: z.boolean().optional(), supportsSearch: z.boolean().optional(), supportsRedirect: z.boolean().optional(), supportsPagination: z.boolean().optional(), appProfileId: z.number().int().optional(), protocol: DownloadProtocol$outboundSchema.optional(), privacy: IndexerPrivacy$outboundSchema.optional(), capabilities: IndexerCapabilityResource$outboundSchema.optional(), priority: z.number().int().optional(), downloadClientId: z.number().int().optional(), added: z.date().transform(v => v.toISOString()).optional(), status: IndexerStatusResource$outboundSchema.optional(), sortName: z.nullable(z.string()).optional(), }); /** * @internal * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. */ export namespace IndexerResource$ { /** @deprecated use `IndexerResource$inboundSchema` instead. */ export const inboundSchema = IndexerResource$inboundSchema; /** @deprecated use `IndexerResource$outboundSchema` instead. */ export const outboundSchema = IndexerResource$outboundSchema; /** @deprecated use `IndexerResource$Outbound` instead. */ export type Outbound = IndexerResource$Outbound; } export function indexerResourceToJSON( indexerResource: IndexerResource, ): string { return JSON.stringify(IndexerResource$outboundSchema.parse(indexerResource)); } export function indexerResourceFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => IndexerResource$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'IndexerResource' from JSON`, ); }