/* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ import * as z from "zod"; import { remap as remap$ } from "../../lib/primitives.js"; import { safeParse } from "../../lib/schemas.js"; import { catchUnrecognizedEnum, OpenEnum, Unrecognized, } from "../../types/enums.js"; import { Result as SafeParseResult } from "../../types/fp.js"; import { SDKValidationError } from "../errors/sdkvalidationerror.js"; import { DateCreate, DateCreate$inboundSchema, DateCreate$Outbound, DateCreate$outboundSchema, } from "./datecreate.js"; /** * The time unit used to calculate the interval between transfers. The time period between transfers in a scheduled series is the unit of time times the multiplier */ export enum TimeUnit { Day = "DAY", Week = "WEEK", Month = "MONTH", } /** * The time unit used to calculate the interval between transfers. The time period between transfers in a scheduled series is the unit of time times the multiplier */ export type TimeUnitOpen = OpenEnum; /** * Properties common to all transfer schedules */ export type SchedulePropertiesCreate = { /** * The number of occurrences (empty or 0 indicates unlimited occurrences) */ occurrences?: number | undefined; /** * Represents a whole or partial calendar date, such as a birthday. The time of day and time zone are either specified elsewhere or are insignificant. The date is relative to the Gregorian Calendar. This can represent one of the following: * * @remarks * * * A full date, with non-zero year, month, and day values * A month and day value, with a zero year, such as an anniversary * A year on its own, with zero month and day values * A year and month value, with a zero day, such as a credit card expiration date * * Related types are [google.type.TimeOfDay][google.type.TimeOfDay] and `google.protobuf.Timestamp`. */ startDate: DateCreate; /** * The time unit used to calculate the interval between transfers. The time period between transfers in a scheduled series is the unit of time times the multiplier */ timeUnit: TimeUnitOpen; /** * The multiplier used to determine the length of the interval between transfers. The time period between transfers in a scheduled series is the unit of time times the multiplier */ unitMultiplier: number; }; /** @internal */ export const TimeUnit$inboundSchema: z.ZodType< TimeUnitOpen, z.ZodTypeDef, unknown > = z .union([ z.nativeEnum(TimeUnit), z.string().transform(catchUnrecognizedEnum), ]); /** @internal */ export const TimeUnit$outboundSchema: z.ZodType< TimeUnitOpen, z.ZodTypeDef, TimeUnitOpen > = z.union([ z.nativeEnum(TimeUnit), z.string().and(z.custom>()), ]); /** * @internal * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. */ export namespace TimeUnit$ { /** @deprecated use `TimeUnit$inboundSchema` instead. */ export const inboundSchema = TimeUnit$inboundSchema; /** @deprecated use `TimeUnit$outboundSchema` instead. */ export const outboundSchema = TimeUnit$outboundSchema; } /** @internal */ export const SchedulePropertiesCreate$inboundSchema: z.ZodType< SchedulePropertiesCreate, z.ZodTypeDef, unknown > = z.object({ occurrences: z.number().int().optional(), start_date: DateCreate$inboundSchema, time_unit: TimeUnit$inboundSchema, unit_multiplier: z.number().int(), }).transform((v) => { return remap$(v, { "start_date": "startDate", "time_unit": "timeUnit", "unit_multiplier": "unitMultiplier", }); }); /** @internal */ export type SchedulePropertiesCreate$Outbound = { occurrences?: number | undefined; start_date: DateCreate$Outbound; time_unit: string; unit_multiplier: number; }; /** @internal */ export const SchedulePropertiesCreate$outboundSchema: z.ZodType< SchedulePropertiesCreate$Outbound, z.ZodTypeDef, SchedulePropertiesCreate > = z.object({ occurrences: z.number().int().optional(), startDate: DateCreate$outboundSchema, timeUnit: TimeUnit$outboundSchema, unitMultiplier: z.number().int(), }).transform((v) => { return remap$(v, { startDate: "start_date", timeUnit: "time_unit", unitMultiplier: "unit_multiplier", }); }); /** * @internal * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. */ export namespace SchedulePropertiesCreate$ { /** @deprecated use `SchedulePropertiesCreate$inboundSchema` instead. */ export const inboundSchema = SchedulePropertiesCreate$inboundSchema; /** @deprecated use `SchedulePropertiesCreate$outboundSchema` instead. */ export const outboundSchema = SchedulePropertiesCreate$outboundSchema; /** @deprecated use `SchedulePropertiesCreate$Outbound` instead. */ export type Outbound = SchedulePropertiesCreate$Outbound; } export function schedulePropertiesCreateToJSON( schedulePropertiesCreate: SchedulePropertiesCreate, ): string { return JSON.stringify( SchedulePropertiesCreate$outboundSchema.parse(schedulePropertiesCreate), ); } export function schedulePropertiesCreateFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => SchedulePropertiesCreate$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'SchedulePropertiesCreate' from JSON`, ); }