/* * 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 { IndexerCategory, IndexerCategory$inboundSchema, IndexerCategory$Outbound, IndexerCategory$outboundSchema, } from "./indexercategory.js"; export type ReleaseResource = { id?: number | undefined; guid?: string | null | undefined; age?: number | undefined; ageHours?: number | undefined; ageMinutes?: number | undefined; size?: number | undefined; files?: number | null | undefined; grabs?: number | null | undefined; indexerId?: number | undefined; indexer?: string | null | undefined; subGroup?: string | null | undefined; releaseHash?: string | null | undefined; title?: string | null | undefined; sortTitle?: string | null | undefined; imdbId?: number | undefined; tmdbId?: number | undefined; tvdbId?: number | undefined; tvMazeId?: number | undefined; publishDate?: Date | undefined; commentUrl?: string | null | undefined; downloadUrl?: string | null | undefined; infoUrl?: string | null | undefined; posterUrl?: string | null | undefined; indexerFlags?: Array | null | undefined; categories?: Array | null | undefined; magnetUrl?: string | null | undefined; infoHash?: string | null | undefined; seeders?: number | null | undefined; leechers?: number | null | undefined; protocol?: DownloadProtocol | undefined; fileName?: string | null | undefined; downloadClientId?: number | null | undefined; }; /** @internal */ export const ReleaseResource$inboundSchema: z.ZodType< ReleaseResource, z.ZodTypeDef, unknown > = z.object({ id: z.number().int().optional(), guid: z.nullable(z.string()).optional(), age: z.number().int().optional(), ageHours: z.number().optional(), ageMinutes: z.number().optional(), size: z.number().int().optional(), files: z.nullable(z.number().int()).optional(), grabs: z.nullable(z.number().int()).optional(), indexerId: z.number().int().optional(), indexer: z.nullable(z.string()).optional(), subGroup: z.nullable(z.string()).optional(), releaseHash: z.nullable(z.string()).optional(), title: z.nullable(z.string()).optional(), sortTitle: z.nullable(z.string()).optional(), imdbId: z.number().int().optional(), tmdbId: z.number().int().optional(), tvdbId: z.number().int().optional(), tvMazeId: z.number().int().optional(), publishDate: z.string().datetime({ offset: true }).transform(v => new Date(v)) .optional(), commentUrl: z.nullable(z.string()).optional(), downloadUrl: z.nullable(z.string()).optional(), infoUrl: z.nullable(z.string()).optional(), posterUrl: z.nullable(z.string()).optional(), indexerFlags: z.nullable(z.array(z.string())).optional(), categories: z.nullable(z.array(IndexerCategory$inboundSchema)).optional(), magnetUrl: z.nullable(z.string()).optional(), infoHash: z.nullable(z.string()).optional(), seeders: z.nullable(z.number().int()).optional(), leechers: z.nullable(z.number().int()).optional(), protocol: DownloadProtocol$inboundSchema.optional(), fileName: z.nullable(z.string()).optional(), downloadClientId: z.nullable(z.number().int()).optional(), }); /** @internal */ export type ReleaseResource$Outbound = { id?: number | undefined; guid?: string | null | undefined; age?: number | undefined; ageHours?: number | undefined; ageMinutes?: number | undefined; size?: number | undefined; files?: number | null | undefined; grabs?: number | null | undefined; indexerId?: number | undefined; indexer?: string | null | undefined; subGroup?: string | null | undefined; releaseHash?: string | null | undefined; title?: string | null | undefined; sortTitle?: string | null | undefined; imdbId?: number | undefined; tmdbId?: number | undefined; tvdbId?: number | undefined; tvMazeId?: number | undefined; publishDate?: string | undefined; commentUrl?: string | null | undefined; downloadUrl?: string | null | undefined; infoUrl?: string | null | undefined; posterUrl?: string | null | undefined; indexerFlags?: Array | null | undefined; categories?: Array | null | undefined; magnetUrl?: string | null | undefined; infoHash?: string | null | undefined; seeders?: number | null | undefined; leechers?: number | null | undefined; protocol?: string | undefined; fileName?: string | null | undefined; downloadClientId?: number | null | undefined; }; /** @internal */ export const ReleaseResource$outboundSchema: z.ZodType< ReleaseResource$Outbound, z.ZodTypeDef, ReleaseResource > = z.object({ id: z.number().int().optional(), guid: z.nullable(z.string()).optional(), age: z.number().int().optional(), ageHours: z.number().optional(), ageMinutes: z.number().optional(), size: z.number().int().optional(), files: z.nullable(z.number().int()).optional(), grabs: z.nullable(z.number().int()).optional(), indexerId: z.number().int().optional(), indexer: z.nullable(z.string()).optional(), subGroup: z.nullable(z.string()).optional(), releaseHash: z.nullable(z.string()).optional(), title: z.nullable(z.string()).optional(), sortTitle: z.nullable(z.string()).optional(), imdbId: z.number().int().optional(), tmdbId: z.number().int().optional(), tvdbId: z.number().int().optional(), tvMazeId: z.number().int().optional(), publishDate: z.date().transform(v => v.toISOString()).optional(), commentUrl: z.nullable(z.string()).optional(), downloadUrl: z.nullable(z.string()).optional(), infoUrl: z.nullable(z.string()).optional(), posterUrl: z.nullable(z.string()).optional(), indexerFlags: z.nullable(z.array(z.string())).optional(), categories: z.nullable(z.array(IndexerCategory$outboundSchema)).optional(), magnetUrl: z.nullable(z.string()).optional(), infoHash: z.nullable(z.string()).optional(), seeders: z.nullable(z.number().int()).optional(), leechers: z.nullable(z.number().int()).optional(), protocol: DownloadProtocol$outboundSchema.optional(), fileName: z.nullable(z.string()).optional(), downloadClientId: z.nullable(z.number().int()).optional(), }); /** * @internal * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. */ export namespace ReleaseResource$ { /** @deprecated use `ReleaseResource$inboundSchema` instead. */ export const inboundSchema = ReleaseResource$inboundSchema; /** @deprecated use `ReleaseResource$outboundSchema` instead. */ export const outboundSchema = ReleaseResource$outboundSchema; /** @deprecated use `ReleaseResource$Outbound` instead. */ export type Outbound = ReleaseResource$Outbound; } export function releaseResourceToJSON( releaseResource: ReleaseResource, ): string { return JSON.stringify(ReleaseResource$outboundSchema.parse(releaseResource)); } export function releaseResourceFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => ReleaseResource$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'ReleaseResource' from JSON`, ); }