/* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ import * as z from "zod/v3"; import { safeParse } from "../../lib/schemas.js"; import { Result as SafeParseResult } from "../../types/fp.js"; import { SDKValidationError } from "../errors/sdkvalidationerror.js"; import { CreateRunTransfer, CreateRunTransfer$inboundSchema, CreateRunTransfer$Outbound, CreateRunTransfer$outboundSchema, } from "./createruntransfer.js"; /** * Occurrences to either create or modify. */ export type Occurrence = { /** * If set to true, will cancel the occurrence. If set false will resume the occurrence. If unset leaves the value unchanged. */ canceled?: boolean | undefined; /** * If set this defines what occurrence to modify, if invalid will fail the request. * * @remarks * If null or "" it defines to add a new occurrence. */ occurrenceID?: string | undefined; /** * Timestamp to run the transfer after. Value must be into the future. */ runOn?: Date | undefined; /** * Defines the attributes of a transfer. */ runTransfer?: CreateRunTransfer | undefined; }; /** @internal */ export const Occurrence$inboundSchema: z.ZodType< Occurrence, z.ZodTypeDef, unknown > = z.object({ canceled: z.boolean().optional(), occurrenceID: z.string().optional(), runOn: z.string().datetime({ offset: true }).transform(v => new Date(v)) .optional(), runTransfer: CreateRunTransfer$inboundSchema.optional(), }); /** @internal */ export type Occurrence$Outbound = { canceled?: boolean | undefined; occurrenceID?: string | undefined; runOn?: string | undefined; runTransfer?: CreateRunTransfer$Outbound | undefined; }; /** @internal */ export const Occurrence$outboundSchema: z.ZodType< Occurrence$Outbound, z.ZodTypeDef, Occurrence > = z.object({ canceled: z.boolean().optional(), occurrenceID: z.string().optional(), runOn: z.date().transform(v => v.toISOString()).optional(), runTransfer: CreateRunTransfer$outboundSchema.optional(), }); export function occurrenceToJSON(occurrence: Occurrence): string { return JSON.stringify(Occurrence$outboundSchema.parse(occurrence)); } export function occurrenceFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => Occurrence$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'Occurrence' from JSON`, ); }