/* * 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 { Mode, Mode$inboundSchema, Mode$outboundSchema } from "./mode.js"; import { OccurrencesResponse, OccurrencesResponse$inboundSchema, OccurrencesResponse$Outbound, OccurrencesResponse$outboundSchema, } from "./occurrencesresponse.js"; import { PartialScheduleAccount, PartialScheduleAccount$inboundSchema, PartialScheduleAccount$Outbound, PartialScheduleAccount$outboundSchema, } from "./partialscheduleaccount.js"; import { RecurResponse, RecurResponse$inboundSchema, RecurResponse$Outbound, RecurResponse$outboundSchema, } from "./recurresponse.js"; export type ScheduleListResponse = { /** * Simple description to place on the transfer. */ description?: string | undefined; destinationAccountID: string; /** * The operating mode for an account. */ mode: Mode; occurrences?: Array | undefined; ownerAccountID: string; partnerAccountID: string; recur?: RecurResponse | undefined; scheduleID: string; sourceAccountID: string; createdOn: Date; updatedOn: Date; disabledOn?: Date | undefined; sourceAccount?: PartialScheduleAccount | undefined; destinationAccount?: PartialScheduleAccount | undefined; partnerAccount?: PartialScheduleAccount | undefined; }; /** @internal */ export const ScheduleListResponse$inboundSchema: z.ZodType< ScheduleListResponse, z.ZodTypeDef, unknown > = z.object({ description: z.string().optional(), destinationAccountID: z.string(), mode: Mode$inboundSchema, occurrences: z.array(OccurrencesResponse$inboundSchema).optional(), ownerAccountID: z.string(), partnerAccountID: z.string(), recur: RecurResponse$inboundSchema.optional(), scheduleID: z.string(), sourceAccountID: z.string(), createdOn: z.string().datetime({ offset: true }).transform(v => new Date(v)), updatedOn: z.string().datetime({ offset: true }).transform(v => new Date(v)), disabledOn: z.string().datetime({ offset: true }).transform(v => new Date(v)) .optional(), sourceAccount: PartialScheduleAccount$inboundSchema.optional(), destinationAccount: PartialScheduleAccount$inboundSchema.optional(), partnerAccount: PartialScheduleAccount$inboundSchema.optional(), }); /** @internal */ export type ScheduleListResponse$Outbound = { description?: string | undefined; destinationAccountID: string; mode: string; occurrences?: Array | undefined; ownerAccountID: string; partnerAccountID: string; recur?: RecurResponse$Outbound | undefined; scheduleID: string; sourceAccountID: string; createdOn: string; updatedOn: string; disabledOn?: string | undefined; sourceAccount?: PartialScheduleAccount$Outbound | undefined; destinationAccount?: PartialScheduleAccount$Outbound | undefined; partnerAccount?: PartialScheduleAccount$Outbound | undefined; }; /** @internal */ export const ScheduleListResponse$outboundSchema: z.ZodType< ScheduleListResponse$Outbound, z.ZodTypeDef, ScheduleListResponse > = z.object({ description: z.string().optional(), destinationAccountID: z.string(), mode: Mode$outboundSchema, occurrences: z.array(OccurrencesResponse$outboundSchema).optional(), ownerAccountID: z.string(), partnerAccountID: z.string(), recur: RecurResponse$outboundSchema.optional(), scheduleID: z.string(), sourceAccountID: z.string(), createdOn: z.date().transform(v => v.toISOString()), updatedOn: z.date().transform(v => v.toISOString()), disabledOn: z.date().transform(v => v.toISOString()).optional(), sourceAccount: PartialScheduleAccount$outboundSchema.optional(), destinationAccount: PartialScheduleAccount$outboundSchema.optional(), partnerAccount: PartialScheduleAccount$outboundSchema.optional(), }); export function scheduleListResponseToJSON( scheduleListResponse: ScheduleListResponse, ): string { return JSON.stringify( ScheduleListResponse$outboundSchema.parse(scheduleListResponse), ); } export function scheduleListResponseFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => ScheduleListResponse$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'ScheduleListResponse' from JSON`, ); }