/* * 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 { RecurResponse, RecurResponse$inboundSchema, RecurResponse$Outbound, RecurResponse$outboundSchema, } from "./recurresponse.js"; export type ScheduleResponse = { /** * 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; }; /** @internal */ export const ScheduleResponse$inboundSchema: z.ZodType< ScheduleResponse, 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(), }); /** @internal */ export type ScheduleResponse$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; }; /** @internal */ export const ScheduleResponse$outboundSchema: z.ZodType< ScheduleResponse$Outbound, z.ZodTypeDef, ScheduleResponse > = 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(), }); export function scheduleResponseToJSON( scheduleResponse: ScheduleResponse, ): string { return JSON.stringify( ScheduleResponse$outboundSchema.parse(scheduleResponse), ); } export function scheduleResponseFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => ScheduleResponse$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'ScheduleResponse' from JSON`, ); }