/* * 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 { Occurrence, Occurrence$inboundSchema, Occurrence$Outbound, Occurrence$outboundSchema, } from "./occurrence.js"; import { Recur, Recur$inboundSchema, Recur$Outbound, Recur$outboundSchema, } from "./recur.js"; export type UpsertSchedule = { /** * Simple description of what the schedule is. */ description?: string | undefined; occurrences?: Array | undefined; /** * Defines configuration for recurring transfers. */ recur?: Recur | undefined; }; /** @internal */ export const UpsertSchedule$inboundSchema: z.ZodType< UpsertSchedule, z.ZodTypeDef, unknown > = z.object({ description: z.string().optional(), occurrences: z.array(Occurrence$inboundSchema).optional(), recur: Recur$inboundSchema.optional(), }); /** @internal */ export type UpsertSchedule$Outbound = { description?: string | undefined; occurrences?: Array | undefined; recur?: Recur$Outbound | undefined; }; /** @internal */ export const UpsertSchedule$outboundSchema: z.ZodType< UpsertSchedule$Outbound, z.ZodTypeDef, UpsertSchedule > = z.object({ description: z.string().optional(), occurrences: z.array(Occurrence$outboundSchema).optional(), recur: Recur$outboundSchema.optional(), }); export function upsertScheduleToJSON(upsertSchedule: UpsertSchedule): string { return JSON.stringify(UpsertSchedule$outboundSchema.parse(upsertSchedule)); } export function upsertScheduleFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => UpsertSchedule$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'UpsertSchedule' from JSON`, ); }