/* * 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 * as components from "../components/index.js"; import { SDKValidationError } from "../errors/sdkvalidationerror.js"; export type ListTicketsGlobals = { /** * Specify an API version. * * @remarks * * API versioning follows the format `vYYYY.QQ.BB`, where * - `YYYY` is the year * - `QQ` is the two-digit month for the first month of the quarter (e.g., 01, 04, 07, 10) * - `BB` is the build number, starting at `.01`, for subsequent builds in the same quarter. * - For example, `v2024.01.00` is the initial release of the first quarter of 2024. * * The `latest` version represents the most recent development state. It may include breaking changes and should be treated as a beta release. * When no version is specified, the API defaults to `v2024.01.00`. */ xMoovVersion?: string | undefined; }; export type ListTicketsRequest = { cursor?: string | undefined; count?: number | undefined; status?: components.TicketStatus | undefined; foreignID?: string | undefined; accountID: string; }; /** * A paginated list of items. The `nextPage` field is omitted if there are no more pages available. */ export type ListTicketsResponseBody = { items: Array; nextPage?: components.ItemListNextPage | undefined; }; export type ListTicketsResponse = { headers: { [k: string]: Array }; result: ListTicketsResponseBody; }; /** @internal */ export const ListTicketsGlobals$inboundSchema: z.ZodType< ListTicketsGlobals, z.ZodTypeDef, unknown > = z.object({ "X-Moov-Version": z.string().optional(), }).transform((v) => { return remap$(v, { "X-Moov-Version": "xMoovVersion", }); }); /** @internal */ export type ListTicketsGlobals$Outbound = { "X-Moov-Version"?: string | undefined; }; /** @internal */ export const ListTicketsGlobals$outboundSchema: z.ZodType< ListTicketsGlobals$Outbound, z.ZodTypeDef, ListTicketsGlobals > = z.object({ xMoovVersion: z.string().optional(), }).transform((v) => { return remap$(v, { xMoovVersion: "X-Moov-Version", }); }); export function listTicketsGlobalsToJSON( listTicketsGlobals: ListTicketsGlobals, ): string { return JSON.stringify( ListTicketsGlobals$outboundSchema.parse(listTicketsGlobals), ); } export function listTicketsGlobalsFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => ListTicketsGlobals$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'ListTicketsGlobals' from JSON`, ); } /** @internal */ export const ListTicketsRequest$inboundSchema: z.ZodType< ListTicketsRequest, z.ZodTypeDef, unknown > = z.object({ cursor: z.string().optional(), count: z.number().int().optional(), status: components.TicketStatus$inboundSchema.optional(), foreignID: z.string().optional(), accountID: z.string(), }); /** @internal */ export type ListTicketsRequest$Outbound = { cursor?: string | undefined; count?: number | undefined; status?: string | undefined; foreignID?: string | undefined; accountID: string; }; /** @internal */ export const ListTicketsRequest$outboundSchema: z.ZodType< ListTicketsRequest$Outbound, z.ZodTypeDef, ListTicketsRequest > = z.object({ cursor: z.string().optional(), count: z.number().int().optional(), status: components.TicketStatus$outboundSchema.optional(), foreignID: z.string().optional(), accountID: z.string(), }); export function listTicketsRequestToJSON( listTicketsRequest: ListTicketsRequest, ): string { return JSON.stringify( ListTicketsRequest$outboundSchema.parse(listTicketsRequest), ); } export function listTicketsRequestFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => ListTicketsRequest$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'ListTicketsRequest' from JSON`, ); } /** @internal */ export const ListTicketsResponseBody$inboundSchema: z.ZodType< ListTicketsResponseBody, z.ZodTypeDef, unknown > = z.object({ items: z.array(components.Ticket$inboundSchema), nextPage: components.ItemListNextPage$inboundSchema.optional(), }); /** @internal */ export type ListTicketsResponseBody$Outbound = { items: Array; nextPage?: components.ItemListNextPage$Outbound | undefined; }; /** @internal */ export const ListTicketsResponseBody$outboundSchema: z.ZodType< ListTicketsResponseBody$Outbound, z.ZodTypeDef, ListTicketsResponseBody > = z.object({ items: z.array(components.Ticket$outboundSchema), nextPage: components.ItemListNextPage$outboundSchema.optional(), }); export function listTicketsResponseBodyToJSON( listTicketsResponseBody: ListTicketsResponseBody, ): string { return JSON.stringify( ListTicketsResponseBody$outboundSchema.parse(listTicketsResponseBody), ); } export function listTicketsResponseBodyFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => ListTicketsResponseBody$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'ListTicketsResponseBody' from JSON`, ); } /** @internal */ export const ListTicketsResponse$inboundSchema: z.ZodType< ListTicketsResponse, z.ZodTypeDef, unknown > = z.object({ Headers: z.record(z.array(z.string())).default({}), Result: z.lazy(() => ListTicketsResponseBody$inboundSchema), }).transform((v) => { return remap$(v, { "Headers": "headers", "Result": "result", }); }); /** @internal */ export type ListTicketsResponse$Outbound = { Headers: { [k: string]: Array }; Result: ListTicketsResponseBody$Outbound; }; /** @internal */ export const ListTicketsResponse$outboundSchema: z.ZodType< ListTicketsResponse$Outbound, z.ZodTypeDef, ListTicketsResponse > = z.object({ headers: z.record(z.array(z.string())), result: z.lazy(() => ListTicketsResponseBody$outboundSchema), }).transform((v) => { return remap$(v, { headers: "Headers", result: "Result", }); }); export function listTicketsResponseToJSON( listTicketsResponse: ListTicketsResponse, ): string { return JSON.stringify( ListTicketsResponse$outboundSchema.parse(listTicketsResponse), ); } export function listTicketsResponseFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => ListTicketsResponse$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'ListTicketsResponse' from JSON`, ); }