/* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. * @generated-id: c69c544dda74 */ 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 { CommunicationChannel, CommunicationChannel$inboundSchema, CommunicationChannel$outboundSchema, } from "./communicationchannel.js"; import { Person, Person$inboundSchema, Person$Outbound, Person$outboundSchema, } from "./person.js"; /** * Information regarding the invite status of a person for a particular channel. */ export type ChannelInviteInfo = { channel?: CommunicationChannel | undefined; /** * Bit that tracks if this invite was automatically sent or user-sent */ isAutoInvite?: boolean | undefined; inviter?: Person | undefined; /** * The time this person was invited in ISO format (ISO 8601). */ inviteTime?: Date | undefined; /** * The time this person was reminded in ISO format (ISO 8601) if a reminder was sent. */ reminderTime?: Date | undefined; }; /** @internal */ export const ChannelInviteInfo$inboundSchema: z.ZodType< ChannelInviteInfo, z.ZodTypeDef, unknown > = z.object({ channel: CommunicationChannel$inboundSchema.optional(), isAutoInvite: z.boolean().optional(), inviter: z.lazy(() => Person$inboundSchema).optional(), inviteTime: z.string().datetime({ offset: true }).transform(v => new Date(v)) .optional(), reminderTime: z.string().datetime({ offset: true }).transform(v => new Date(v) ).optional(), }); /** @internal */ export type ChannelInviteInfo$Outbound = { channel?: string | undefined; isAutoInvite?: boolean | undefined; inviter?: Person$Outbound | undefined; inviteTime?: string | undefined; reminderTime?: string | undefined; }; /** @internal */ export const ChannelInviteInfo$outboundSchema: z.ZodType< ChannelInviteInfo$Outbound, z.ZodTypeDef, ChannelInviteInfo > = z.object({ channel: CommunicationChannel$outboundSchema.optional(), isAutoInvite: z.boolean().optional(), inviter: z.lazy(() => Person$outboundSchema).optional(), inviteTime: z.date().transform(v => v.toISOString()).optional(), reminderTime: z.date().transform(v => v.toISOString()).optional(), }); export function channelInviteInfoToJSON( channelInviteInfo: ChannelInviteInfo, ): string { return JSON.stringify( ChannelInviteInfo$outboundSchema.parse(channelInviteInfo), ); } export function channelInviteInfoFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => ChannelInviteInfo$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'ChannelInviteInfo' from JSON`, ); }