/* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ import * as z from "zod"; import { safeParse } from "../../lib/schemas.js"; import { Result as SafeParseResult } from "../../types/fp.js"; import { SDKValidationError } from "../errors/sdkvalidationerror.js"; export type PushToken = { /** * DeviceID is the UUID of the device where the push message will be sent. */ deviceId: string; /** * Platform is the platform of the device were the push message will be received. Possible values: ios, android, * * @remarks * and web. */ platform: string; /** * PushToken is the push token to use when sending a push message to the user. */ pushToken: string; /** * RegistrationTimestamp is the timestamp when the push token was associated with the device. The field is in Unix * * @remarks * time which is the number of seconds elapsed since January 1, 1970 UTC. */ registrationTimestamp: number; }; /** @internal */ export const PushToken$inboundSchema: z.ZodType< PushToken, z.ZodTypeDef, unknown > = z.object({ deviceId: z.string(), platform: z.string(), pushToken: z.string(), registrationTimestamp: z.number().int(), }); /** @internal */ export type PushToken$Outbound = { deviceId: string; platform: string; pushToken: string; registrationTimestamp: number; }; /** @internal */ export const PushToken$outboundSchema: z.ZodType< PushToken$Outbound, z.ZodTypeDef, PushToken > = z.object({ deviceId: z.string(), platform: z.string(), pushToken: z.string(), registrationTimestamp: z.number().int(), }); /** * @internal * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. */ export namespace PushToken$ { /** @deprecated use `PushToken$inboundSchema` instead. */ export const inboundSchema = PushToken$inboundSchema; /** @deprecated use `PushToken$outboundSchema` instead. */ export const outboundSchema = PushToken$outboundSchema; /** @deprecated use `PushToken$Outbound` instead. */ export type Outbound = PushToken$Outbound; } export function pushTokenToJSON(pushToken: PushToken): string { return JSON.stringify(PushToken$outboundSchema.parse(pushToken)); } export function pushTokenFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => PushToken$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'PushToken' from JSON`, ); }