/* * 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 { lazySchema as lazySchema$, safeParse } from "../../lib/schemas.js"; import * as openEnums from "../../types/enums.js"; import { OpenEnum } from "../../types/enums.js"; import { Result as SafeParseResult } from "../../types/fp.js"; import * as types from "../../types/primitives.js"; import { SDKValidationError } from "../errors/sdkvalidationerror.js"; import { Assignee, Assignee$inboundSchema } from "./assignee.js"; import { AssigneeInput, AssigneeInput$Outbound, AssigneeInput$outboundSchema, } from "./assigneeinput.js"; import { CollectionTag, CollectionTag$inboundSchema } from "./collectiontag.js"; import { CollectionTagInput, CollectionTagInput$Outbound, CollectionTagInput$outboundSchema, } from "./collectiontaginput.js"; import { PassThroughBody, PassThroughBody$inboundSchema, PassThroughBody$Outbound, PassThroughBody$outboundSchema, } from "./passthroughbody.js"; /** * Priority of the ticket */ export const TicketPriority = { Low: "low", Normal: "normal", High: "high", Urgent: "urgent", } as const; /** * Priority of the ticket */ export type TicketPriority = OpenEnum; export type Ticket = { /** * A unique identifier for an object. */ id: string; /** * The ticket's parent ID */ parentId?: string | null | undefined; /** * The ticket's collection ID */ collectionId?: string | null | undefined; /** * The ticket's type */ type?: string | null | undefined; /** * Subject of the ticket */ subject?: string | null | undefined; /** * The ticket's description. HTML version of description is mapped if supported by the third-party platform */ description?: string | null | undefined; /** * The current status of the ticket. Possible values include: open, in_progress, closed, or - in cases where there is no clear mapping - the original value passed through. */ status?: string | null | undefined; /** * Priority of the ticket */ priority?: TicketPriority | null | undefined; assignees?: Array | 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 user who created the object. */ createdBy?: string | null | undefined; /** * Due date of the ticket */ dueDate?: Date | null | undefined; /** * When the ticket was completed */ completedAt?: Date | null | undefined; tags?: Array | undefined; /** * When custom mappings are configured on the resource, the result is included here. */ customMappings?: { [k: string]: any } | 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; }; export type TicketInput = { /** * The ticket's parent ID */ parentId?: string | null | undefined; /** * The ticket's type */ type?: string | null | undefined; /** * Subject of the ticket */ subject?: string | null | undefined; /** * The ticket's description. HTML version of description is mapped if supported by the third-party platform */ description?: string | null | undefined; /** * The current status of the ticket. Possible values include: open, in_progress, closed, or - in cases where there is no clear mapping - the original value passed through. */ status?: string | null | undefined; /** * Priority of the ticket */ priority?: TicketPriority | null | undefined; assignees?: Array | undefined; /** * Due date of the ticket */ dueDate?: Date | null | undefined; tags?: Array | 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 TicketPriority$inboundSchema: z.ZodType< TicketPriority, z.ZodTypeDef, unknown > = /* @__PURE__ */ lazySchema$(() => openEnums.inboundSchema(TicketPriority)); /** @internal */ export const TicketPriority$outboundSchema: z.ZodType< string, z.ZodTypeDef, TicketPriority > = /* @__PURE__ */ lazySchema$(() => openEnums.outboundSchema(TicketPriority)); /** @internal */ export const Ticket$inboundSchema: z.ZodType = /* @__PURE__ */ lazySchema$(() => z.object({ id: types.string(), parent_id: z.nullable(types.string()).optional(), collection_id: z.nullable(types.string()).optional(), type: z.nullable(types.string()).optional(), subject: z.nullable(types.string()).optional(), description: z.nullable(types.string()).optional(), status: z.nullable(types.string()).optional(), priority: z.nullable(TicketPriority$inboundSchema).optional(), assignees: types.optional(z.array(Assignee$inboundSchema)), updated_at: z.nullable(types.date()).optional(), created_at: z.nullable(types.date()).optional(), created_by: z.nullable(types.string()).optional(), due_date: z.nullable(types.date()).optional(), completed_at: z.nullable(types.date()).optional(), tags: types.optional(z.array(CollectionTag$inboundSchema)), custom_mappings: z.nullable(z.record(z.any())).optional(), pass_through: types.optional(z.array(PassThroughBody$inboundSchema)), }).transform((v) => { return remap$(v, { "parent_id": "parentId", "collection_id": "collectionId", "updated_at": "updatedAt", "created_at": "createdAt", "created_by": "createdBy", "due_date": "dueDate", "completed_at": "completedAt", "custom_mappings": "customMappings", "pass_through": "passThrough", }); }) ); export function ticketFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => Ticket$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'Ticket' from JSON`, ); } /** @internal */ export type TicketInput$Outbound = { parent_id?: string | null | undefined; type?: string | null | undefined; subject?: string | null | undefined; description?: string | null | undefined; status?: string | null | undefined; priority?: string | null | undefined; assignees?: Array | undefined; due_date?: string | null | undefined; tags?: Array | undefined; pass_through?: Array | undefined; }; /** @internal */ export const TicketInput$outboundSchema: z.ZodType< TicketInput$Outbound, z.ZodTypeDef, TicketInput > = /* @__PURE__ */ lazySchema$(() => z.object({ parentId: z.nullable(z.string()).optional(), type: z.nullable(z.string()).optional(), subject: z.nullable(z.string()).optional(), description: z.nullable(z.string()).optional(), status: z.nullable(z.string()).optional(), priority: z.nullable(TicketPriority$outboundSchema).optional(), assignees: z.array(AssigneeInput$outboundSchema).optional(), dueDate: z.nullable(z.date().transform(v => v.toISOString())).optional(), tags: z.array(CollectionTagInput$outboundSchema).optional(), passThrough: z.array(PassThroughBody$outboundSchema).optional(), }).transform((v) => { return remap$(v, { parentId: "parent_id", dueDate: "due_date", passThrough: "pass_through", }); }) ); export function ticketInputToJSON(ticketInput: TicketInput): string { return JSON.stringify(TicketInput$outboundSchema.parse(ticketInput)); }