/* * 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 * as components from "../components/index.js"; import { SDKValidationError } from "../errors/sdkvalidationerror.js"; export type OrderServiceListCorrespondentOrdersRequest = { /** * The correspondent id. */ correspondentId: string; /** * CEL filter string expressing what orders should be listed. The only properties available for filtering are the boolean `open` and `order_date`. Each of these represent fields on the Orders object, and more details about each can be found attached to the properties. * * @remarks * * If `open` is not provided, both "open" and "not open" orders will be returned. All `order_date` searches are limited to orders within the most recent 365 days. If no `order_date` is specified, the default will search between now and 365 days ago. */ filter?: string | undefined; /** * The number of records to return in a single page. The maximum page size is 100. If a value is not provided, the default of 100 will be used. If a value less than one, or greater than the maximum, is provided, the default value will be used. */ pageSize?: number | undefined; /** * The token for the next page of content to fetch. When paginating, all other parameters provided to `ListOrders` must match the call that provided the page token. */ pageToken?: string | undefined; }; export type OrderServiceListCorrespondentOrdersResponse = { httpMeta: components.HTTPMetadata; /** * OK */ listCorrespondentOrdersResponse?: | components.ListCorrespondentOrdersResponse | undefined; /** * INVALID_ARGUMENT: There was an issue with one or more fields in the request. The message field will contain details about which field failed validation and why. */ status?: components.Status | undefined; }; /** @internal */ export const OrderServiceListCorrespondentOrdersRequest$inboundSchema: z.ZodType = z.object({ correspondent_id: z.string(), filter: z.string().optional(), page_size: z.number().int().optional(), page_token: z.string().optional(), }).transform((v) => { return remap$(v, { "correspondent_id": "correspondentId", "page_size": "pageSize", "page_token": "pageToken", }); }); /** @internal */ export type OrderServiceListCorrespondentOrdersRequest$Outbound = { correspondent_id: string; filter?: string | undefined; page_size?: number | undefined; page_token?: string | undefined; }; /** @internal */ export const OrderServiceListCorrespondentOrdersRequest$outboundSchema: z.ZodType< OrderServiceListCorrespondentOrdersRequest$Outbound, z.ZodTypeDef, OrderServiceListCorrespondentOrdersRequest > = z.object({ correspondentId: z.string(), filter: z.string().optional(), pageSize: z.number().int().optional(), pageToken: z.string().optional(), }).transform((v) => { return remap$(v, { correspondentId: "correspondent_id", pageSize: "page_size", pageToken: "page_token", }); }); /** * @internal * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. */ export namespace OrderServiceListCorrespondentOrdersRequest$ { /** @deprecated use `OrderServiceListCorrespondentOrdersRequest$inboundSchema` instead. */ export const inboundSchema = OrderServiceListCorrespondentOrdersRequest$inboundSchema; /** @deprecated use `OrderServiceListCorrespondentOrdersRequest$outboundSchema` instead. */ export const outboundSchema = OrderServiceListCorrespondentOrdersRequest$outboundSchema; /** @deprecated use `OrderServiceListCorrespondentOrdersRequest$Outbound` instead. */ export type Outbound = OrderServiceListCorrespondentOrdersRequest$Outbound; } export function orderServiceListCorrespondentOrdersRequestToJSON( orderServiceListCorrespondentOrdersRequest: OrderServiceListCorrespondentOrdersRequest, ): string { return JSON.stringify( OrderServiceListCorrespondentOrdersRequest$outboundSchema.parse( orderServiceListCorrespondentOrdersRequest, ), ); } export function orderServiceListCorrespondentOrdersRequestFromJSON( jsonString: string, ): SafeParseResult< OrderServiceListCorrespondentOrdersRequest, SDKValidationError > { return safeParse( jsonString, (x) => OrderServiceListCorrespondentOrdersRequest$inboundSchema.parse( JSON.parse(x), ), `Failed to parse 'OrderServiceListCorrespondentOrdersRequest' from JSON`, ); } /** @internal */ export const OrderServiceListCorrespondentOrdersResponse$inboundSchema: z.ZodType< OrderServiceListCorrespondentOrdersResponse, z.ZodTypeDef, unknown > = z.object({ HttpMeta: components.HTTPMetadata$inboundSchema, ListCorrespondentOrdersResponse: components .ListCorrespondentOrdersResponse$inboundSchema.optional(), Status: components.Status$inboundSchema.optional(), }).transform((v) => { return remap$(v, { "HttpMeta": "httpMeta", "ListCorrespondentOrdersResponse": "listCorrespondentOrdersResponse", "Status": "status", }); }); /** @internal */ export type OrderServiceListCorrespondentOrdersResponse$Outbound = { HttpMeta: components.HTTPMetadata$Outbound; ListCorrespondentOrdersResponse?: | components.ListCorrespondentOrdersResponse$Outbound | undefined; Status?: components.Status$Outbound | undefined; }; /** @internal */ export const OrderServiceListCorrespondentOrdersResponse$outboundSchema: z.ZodType< OrderServiceListCorrespondentOrdersResponse$Outbound, z.ZodTypeDef, OrderServiceListCorrespondentOrdersResponse > = z.object({ httpMeta: components.HTTPMetadata$outboundSchema, listCorrespondentOrdersResponse: components .ListCorrespondentOrdersResponse$outboundSchema.optional(), status: components.Status$outboundSchema.optional(), }).transform((v) => { return remap$(v, { httpMeta: "HttpMeta", listCorrespondentOrdersResponse: "ListCorrespondentOrdersResponse", status: "Status", }); }); /** * @internal * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. */ export namespace OrderServiceListCorrespondentOrdersResponse$ { /** @deprecated use `OrderServiceListCorrespondentOrdersResponse$inboundSchema` instead. */ export const inboundSchema = OrderServiceListCorrespondentOrdersResponse$inboundSchema; /** @deprecated use `OrderServiceListCorrespondentOrdersResponse$outboundSchema` instead. */ export const outboundSchema = OrderServiceListCorrespondentOrdersResponse$outboundSchema; /** @deprecated use `OrderServiceListCorrespondentOrdersResponse$Outbound` instead. */ export type Outbound = OrderServiceListCorrespondentOrdersResponse$Outbound; } export function orderServiceListCorrespondentOrdersResponseToJSON( orderServiceListCorrespondentOrdersResponse: OrderServiceListCorrespondentOrdersResponse, ): string { return JSON.stringify( OrderServiceListCorrespondentOrdersResponse$outboundSchema.parse( orderServiceListCorrespondentOrdersResponse, ), ); } export function orderServiceListCorrespondentOrdersResponseFromJSON( jsonString: string, ): SafeParseResult< OrderServiceListCorrespondentOrdersResponse, SDKValidationError > { return safeParse( jsonString, (x) => OrderServiceListCorrespondentOrdersResponse$inboundSchema.parse( JSON.parse(x), ), `Failed to parse 'OrderServiceListCorrespondentOrdersResponse' from JSON`, ); }