/* * 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 { Result as SafeParseResult } from "../../types/fp.js"; import { SDKValidationError } from "../errors/sdkvalidationerror.js"; import { CustomMappings, CustomMappings$inboundSchema, CustomMappings$Outbound, CustomMappings$outboundSchema, } from "./custommappings.js"; import { PassThroughBody, PassThroughBody$inboundSchema, PassThroughBody$Outbound, PassThroughBody$outboundSchema, } from "./passthroughbody.js"; export type CollectionTicketComment = { /** * A unique identifier for an object. */ id?: string | undefined; /** * Body of the comment */ body?: string | null | undefined; /** * When custom mappings are configured on the resource, the result is included here. */ customMappings?: CustomMappings | null | undefined; /** * The user who created the object. */ createdBy?: string | null | undefined; /** * The date and time when the object was last updated. */ updatedAt?: Date | null | undefined; /** * The date and time when the object was created. */ createdAt?: Date | null | undefined; /** * The pass_through property allows passing service-specific, custom data or structured modifications in request body when creating or updating resources. */ passThrough?: Array | undefined; }; /** @internal */ export const CollectionTicketComment$inboundSchema: z.ZodType< CollectionTicketComment, z.ZodTypeDef, unknown > = z.object({ id: z.string().optional(), body: z.nullable(z.string()).optional(), custom_mappings: z.nullable(CustomMappings$inboundSchema).optional(), created_by: z.nullable(z.string()).optional(), updated_at: z.nullable( z.string().datetime({ offset: true }).transform(v => new Date(v)), ).optional(), created_at: z.nullable( z.string().datetime({ offset: true }).transform(v => new Date(v)), ).optional(), pass_through: z.array(PassThroughBody$inboundSchema).optional(), }).transform((v) => { return remap$(v, { "custom_mappings": "customMappings", "created_by": "createdBy", "updated_at": "updatedAt", "created_at": "createdAt", "pass_through": "passThrough", }); }); /** @internal */ export type CollectionTicketComment$Outbound = { id?: string | undefined; body?: string | null | undefined; custom_mappings?: CustomMappings$Outbound | null | undefined; created_by?: string | null | undefined; updated_at?: string | null | undefined; created_at?: string | null | undefined; pass_through?: Array | undefined; }; /** @internal */ export const CollectionTicketComment$outboundSchema: z.ZodType< CollectionTicketComment$Outbound, z.ZodTypeDef, CollectionTicketComment > = z.object({ id: z.string().optional(), body: z.nullable(z.string()).optional(), customMappings: z.nullable(CustomMappings$outboundSchema).optional(), createdBy: z.nullable(z.string()).optional(), updatedAt: z.nullable(z.date().transform(v => v.toISOString())).optional(), createdAt: z.nullable(z.date().transform(v => v.toISOString())).optional(), passThrough: z.array(PassThroughBody$outboundSchema).optional(), }).transform((v) => { return remap$(v, { customMappings: "custom_mappings", createdBy: "created_by", updatedAt: "updated_at", createdAt: "created_at", passThrough: "pass_through", }); }); /** * @internal * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. */ export namespace CollectionTicketComment$ { /** @deprecated use `CollectionTicketComment$inboundSchema` instead. */ export const inboundSchema = CollectionTicketComment$inboundSchema; /** @deprecated use `CollectionTicketComment$outboundSchema` instead. */ export const outboundSchema = CollectionTicketComment$outboundSchema; /** @deprecated use `CollectionTicketComment$Outbound` instead. */ export type Outbound = CollectionTicketComment$Outbound; } export function collectionTicketCommentToJSON( collectionTicketComment: CollectionTicketComment, ): string { return JSON.stringify( CollectionTicketComment$outboundSchema.parse(collectionTicketComment), ); } export function collectionTicketCommentFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => CollectionTicketComment$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'CollectionTicketComment' from JSON`, ); }