/* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ import * as z from "zod/v3"; import { remap as remap$ } from "../../lib/primitives.js"; import { safeParse } from "../../lib/schemas.js"; import { Result as SafeParseResult } from "../../types/fp.js"; import { SDKValidationError } from "../errors/sdkvalidationerror.js"; import { ChannelSettingsDto, ChannelSettingsDto$inboundSchema, ChannelSettingsDto$Outbound, ChannelSettingsDto$outboundSchema, } from "./channelsettingsdto.js"; export type SubscriberResponseDtoOptional = { /** * The internal ID generated by Novu for your subscriber. This ID does not match the `subscriberId` used in your queries. Refer to `subscriberId` for that identifier. */ id?: string | undefined; /** * The first name of the subscriber. */ firstName?: string | null | undefined; /** * The last name of the subscriber. */ lastName?: string | null | undefined; /** * The email address of the subscriber. */ email?: string | null | undefined; /** * The phone number of the subscriber. */ phone?: string | null | undefined; /** * The URL of the subscriber's avatar image. */ avatar?: string | null | undefined; /** * The locale setting of the subscriber, indicating their preferred language or region. */ locale?: string | null | undefined; /** * An array of channel settings associated with the subscriber. */ channels?: Array | undefined; /** * An array of topics that the subscriber is subscribed to. * * @deprecated field: This will be removed in a future release, please migrate away from it as soon as possible. */ topics?: Array | undefined; /** * Indicates whether the subscriber is currently online. */ isOnline?: boolean | null | undefined; /** * The timestamp indicating when the subscriber was last online, in ISO 8601 format. */ lastOnlineAt?: string | null | undefined; /** * The version of the subscriber document. */ v?: number | undefined; /** * Additional custom data for the subscriber */ data?: { [k: string]: any } | null | undefined; /** * Timezone of the subscriber */ timezone?: string | null | undefined; }; /** @internal */ export const SubscriberResponseDtoOptional$inboundSchema: z.ZodType< SubscriberResponseDtoOptional, z.ZodTypeDef, unknown > = z.object({ _id: z.string().optional(), firstName: z.nullable(z.string()).optional(), lastName: z.nullable(z.string()).optional(), email: z.nullable(z.string()).optional(), phone: z.nullable(z.string()).optional(), avatar: z.nullable(z.string()).optional(), locale: z.nullable(z.string()).optional(), channels: z.array(ChannelSettingsDto$inboundSchema).optional(), topics: z.array(z.string()).optional(), isOnline: z.nullable(z.boolean()).optional(), lastOnlineAt: z.nullable(z.string()).optional(), __v: z.number().optional(), data: z.nullable(z.record(z.any())).optional(), timezone: z.nullable(z.string()).optional(), }).transform((v) => { return remap$(v, { "_id": "id", "__v": "v", }); }); /** @internal */ export type SubscriberResponseDtoOptional$Outbound = { _id?: string | undefined; firstName?: string | null | undefined; lastName?: string | null | undefined; email?: string | null | undefined; phone?: string | null | undefined; avatar?: string | null | undefined; locale?: string | null | undefined; channels?: Array | undefined; topics?: Array | undefined; isOnline?: boolean | null | undefined; lastOnlineAt?: string | null | undefined; __v?: number | undefined; data?: { [k: string]: any } | null | undefined; timezone?: string | null | undefined; }; /** @internal */ export const SubscriberResponseDtoOptional$outboundSchema: z.ZodType< SubscriberResponseDtoOptional$Outbound, z.ZodTypeDef, SubscriberResponseDtoOptional > = z.object({ id: z.string().optional(), firstName: z.nullable(z.string()).optional(), lastName: z.nullable(z.string()).optional(), email: z.nullable(z.string()).optional(), phone: z.nullable(z.string()).optional(), avatar: z.nullable(z.string()).optional(), locale: z.nullable(z.string()).optional(), channels: z.array(ChannelSettingsDto$outboundSchema).optional(), topics: z.array(z.string()).optional(), isOnline: z.nullable(z.boolean()).optional(), lastOnlineAt: z.nullable(z.string()).optional(), v: z.number().optional(), data: z.nullable(z.record(z.any())).optional(), timezone: z.nullable(z.string()).optional(), }).transform((v) => { return remap$(v, { id: "_id", v: "__v", }); }); export function subscriberResponseDtoOptionalToJSON( subscriberResponseDtoOptional: SubscriberResponseDtoOptional, ): string { return JSON.stringify( SubscriberResponseDtoOptional$outboundSchema.parse( subscriberResponseDtoOptional, ), ); } export function subscriberResponseDtoOptionalFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => SubscriberResponseDtoOptional$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'SubscriberResponseDtoOptional' from JSON`, ); }