/* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ import * as z from "zod/v3"; import { remap as remap$ } from "../../lib/primitives.js"; import { safeParse } from "../../lib/schemas.js"; import { Result as SafeParseResult } from "../../types/fp.js"; import { SDKValidationError } from "../errors/sdkvalidationerror.js"; export type PutChannelEpisodesChannelEpisodeHashedIdPublishRequestBody = { /** * The date and time when the episode is scheduled to be published in UTC timezone. */ publishAt?: Date | undefined; }; export type PutChannelEpisodesChannelEpisodeHashedIdPublishRequest = { /** * The hashed id of the Channel Episode */ channelEpisodeHashedId: string; requestBody?: | PutChannelEpisodesChannelEpisodeHashedIdPublishRequestBody | undefined; }; /** * A channel episode represents a media that has been added to a channel. Only published * * @remarks * episodes are displayed in a channel. */ export type PutChannelEpisodesChannelEpisodeHashedIdPublishResponse = { /** * A unique alphanumeric identifier for the channel episode's channel. */ channelHashedId: string; /** * The date when the channel episode was originally created. */ created: Date; /** * A cursor for stable pagination based on current `sort_by` order. You can pass this to `cursor[before]` or `cursor[after]` as a parameter to fetch the records before or after this record in the same sort order. This is only populated if records were fetched with `cursor[enabled]`, or `cursor[before]` or `cursor[after]`. */ cursor?: string | null | undefined; /** * The channel episode's description or episode notes. */ description: string; /** * A short summary of the episode that is displayed when space is limited. */ summary: string; /** * A unique alphanumeric identifier for the channel episode. */ hashedId: string; /** * A unique alphanumeric identifier for the channel episode's media. */ mediaHashedId: string; /** * Whether the channel episode has been published or is still in draft form. */ published: boolean; /** * The date and time when the episode is scheduled to be published in UTC timezone (only present when publish_status is 'scheduled'). */ publishAt?: Date | undefined; /** * The title of the channel episode */ title: string | null; /** * The date when the channel was last updated. */ updated: Date; }; /** @internal */ export type PutChannelEpisodesChannelEpisodeHashedIdPublishRequestBody$Outbound = { publish_at?: string | undefined; }; /** @internal */ export const PutChannelEpisodesChannelEpisodeHashedIdPublishRequestBody$outboundSchema: z.ZodType< PutChannelEpisodesChannelEpisodeHashedIdPublishRequestBody$Outbound, z.ZodTypeDef, PutChannelEpisodesChannelEpisodeHashedIdPublishRequestBody > = z.object({ publishAt: z.date().transform(v => v.toISOString()).optional(), }).transform((v) => { return remap$(v, { publishAt: "publish_at", }); }); export function putChannelEpisodesChannelEpisodeHashedIdPublishRequestBodyToJSON( putChannelEpisodesChannelEpisodeHashedIdPublishRequestBody: PutChannelEpisodesChannelEpisodeHashedIdPublishRequestBody, ): string { return JSON.stringify( PutChannelEpisodesChannelEpisodeHashedIdPublishRequestBody$outboundSchema .parse(putChannelEpisodesChannelEpisodeHashedIdPublishRequestBody), ); } /** @internal */ export type PutChannelEpisodesChannelEpisodeHashedIdPublishRequest$Outbound = { channelEpisodeHashedId: string; RequestBody?: | PutChannelEpisodesChannelEpisodeHashedIdPublishRequestBody$Outbound | undefined; }; /** @internal */ export const PutChannelEpisodesChannelEpisodeHashedIdPublishRequest$outboundSchema: z.ZodType< PutChannelEpisodesChannelEpisodeHashedIdPublishRequest$Outbound, z.ZodTypeDef, PutChannelEpisodesChannelEpisodeHashedIdPublishRequest > = z.object({ channelEpisodeHashedId: z.string(), requestBody: z.lazy(() => PutChannelEpisodesChannelEpisodeHashedIdPublishRequestBody$outboundSchema ).optional(), }).transform((v) => { return remap$(v, { requestBody: "RequestBody", }); }); export function putChannelEpisodesChannelEpisodeHashedIdPublishRequestToJSON( putChannelEpisodesChannelEpisodeHashedIdPublishRequest: PutChannelEpisodesChannelEpisodeHashedIdPublishRequest, ): string { return JSON.stringify( PutChannelEpisodesChannelEpisodeHashedIdPublishRequest$outboundSchema.parse( putChannelEpisodesChannelEpisodeHashedIdPublishRequest, ), ); } /** @internal */ export const PutChannelEpisodesChannelEpisodeHashedIdPublishResponse$inboundSchema: z.ZodType< PutChannelEpisodesChannelEpisodeHashedIdPublishResponse, z.ZodTypeDef, unknown > = z.object({ channel_hashed_id: z.string(), created: z.string().datetime({ offset: true }).transform(v => new Date(v)), cursor: z.nullable(z.string()).optional(), description: z.string(), summary: z.string(), hashed_id: z.string(), media_hashed_id: z.string(), published: z.boolean(), publish_at: z.string().datetime({ offset: true }).transform(v => new Date(v) ).optional(), title: z.nullable(z.string()), updated: z.string().datetime({ offset: true }).transform(v => new Date(v)), }).transform((v) => { return remap$(v, { "channel_hashed_id": "channelHashedId", "hashed_id": "hashedId", "media_hashed_id": "mediaHashedId", "publish_at": "publishAt", }); }); export function putChannelEpisodesChannelEpisodeHashedIdPublishResponseFromJSON( jsonString: string, ): SafeParseResult< PutChannelEpisodesChannelEpisodeHashedIdPublishResponse, SDKValidationError > { return safeParse( jsonString, (x) => PutChannelEpisodesChannelEpisodeHashedIdPublishResponse$inboundSchema .parse(JSON.parse(x)), `Failed to parse 'PutChannelEpisodesChannelEpisodeHashedIdPublishResponse' from JSON`, ); }