/* * 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 * as components from "../components/index.js"; import { NovuError } from "./novuerror.js"; export type SubscriberResponseDtoData = { /** * 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; /** * The identifier used to create this subscriber, which typically corresponds to the user ID in your system. */ subscriberId: string; /** * The unique identifier of the organization to which the subscriber belongs. */ organizationId: string; /** * The unique identifier of the environment associated with this subscriber. */ environmentId: string; /** * Indicates whether the subscriber has been deleted. */ deleted: boolean; /** * The timestamp indicating when the subscriber was created, in ISO 8601 format. */ createdAt: string; /** * The timestamp indicating when the subscriber was last updated, in ISO 8601 format. */ updatedAt: string; }; export class SubscriberResponseDto extends NovuError { /** * 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; /** * The identifier used to create this subscriber, which typically corresponds to the user ID in your system. */ subscriberId: string; /** * The unique identifier of the organization to which the subscriber belongs. */ organizationId: string; /** * The unique identifier of the environment associated with this subscriber. */ environmentId: string; /** * Indicates whether the subscriber has been deleted. */ deleted: boolean; /** * The timestamp indicating when the subscriber was created, in ISO 8601 format. */ createdAt: string; /** * The timestamp indicating when the subscriber was last updated, in ISO 8601 format. */ updatedAt: string; /** The original data that was passed to this error instance. */ data$: SubscriberResponseDtoData; constructor( err: SubscriberResponseDtoData, httpMeta: { response: Response; request: Request; body: string }, ) { const message = "message" in err && typeof err.message === "string" ? err.message : `API error occurred: ${JSON.stringify(err)}`; super(message, httpMeta); this.data$ = err; if (err.id != null) this.id = err.id; if (err.firstName != null) this.firstName = err.firstName; if (err.lastName != null) this.lastName = err.lastName; if (err.email != null) this.email = err.email; if (err.phone != null) this.phone = err.phone; if (err.avatar != null) this.avatar = err.avatar; if (err.locale != null) this.locale = err.locale; if (err.channels != null) this.channels = err.channels; if (err.topics != null) this.topics = err.topics; if (err.isOnline != null) this.isOnline = err.isOnline; if (err.lastOnlineAt != null) this.lastOnlineAt = err.lastOnlineAt; if (err.v != null) this.v = err.v; if (err.data != null) this.data = err.data; if (err.timezone != null) this.timezone = err.timezone; this.subscriberId = err.subscriberId; this.organizationId = err.organizationId; this.environmentId = err.environmentId; this.deleted = err.deleted; this.createdAt = err.createdAt; this.updatedAt = err.updatedAt; this.name = "SubscriberResponseDto"; } } /** @internal */ export const SubscriberResponseDto$inboundSchema: z.ZodType< SubscriberResponseDto, 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(components.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(), subscriberId: z.string(), _organizationId: z.string(), _environmentId: z.string(), deleted: z.boolean(), createdAt: z.string(), updatedAt: z.string(), request$: z.instanceof(Request), response$: z.instanceof(Response), body$: z.string(), }) .transform((v) => { const remapped = remap$(v, { "_id": "id", "__v": "v", "_organizationId": "organizationId", "_environmentId": "environmentId", }); return new SubscriberResponseDto(remapped, { request: v.request$, response: v.response$, body: v.body$, }); });