/* * 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 MessagesControllerGetMessagesRequest = { /** * Channel type through which the message is sent */ channel?: components.ChannelTypeEnum | undefined; subscriberId?: string | undefined; transactionId?: Array | undefined; /** * Filter by exact context keys, order insensitive (format: "type:id") */ contextKeys?: Array | undefined; page?: number | undefined; limit?: number | undefined; /** * A header for idempotency purposes */ idempotencyKey?: string | undefined; }; export type MessagesControllerGetMessagesResponse = { headers: { [k: string]: Array }; result: components.MessagesResponseDto; }; /** @internal */ export type MessagesControllerGetMessagesRequest$Outbound = { channel?: string | undefined; subscriberId?: string | undefined; transactionId?: Array | undefined; contextKeys?: Array | undefined; page: number; limit: number; "idempotency-key"?: string | undefined; }; /** @internal */ export const MessagesControllerGetMessagesRequest$outboundSchema: z.ZodType< MessagesControllerGetMessagesRequest$Outbound, z.ZodTypeDef, MessagesControllerGetMessagesRequest > = z.object({ channel: components.ChannelTypeEnum$outboundSchema.optional(), subscriberId: z.string().optional(), transactionId: z.array(z.string()).optional(), contextKeys: z.array(z.string()).optional(), page: z.number().default(0), limit: z.number().default(10), idempotencyKey: z.string().optional(), }).transform((v) => { return remap$(v, { idempotencyKey: "idempotency-key", }); }); export function messagesControllerGetMessagesRequestToJSON( messagesControllerGetMessagesRequest: MessagesControllerGetMessagesRequest, ): string { return JSON.stringify( MessagesControllerGetMessagesRequest$outboundSchema.parse( messagesControllerGetMessagesRequest, ), ); } /** @internal */ export const MessagesControllerGetMessagesResponse$inboundSchema: z.ZodType< MessagesControllerGetMessagesResponse, z.ZodTypeDef, unknown > = z.object({ Headers: z.record(z.array(z.string())).default({}), Result: components.MessagesResponseDto$inboundSchema, }).transform((v) => { return remap$(v, { "Headers": "headers", "Result": "result", }); }); export function messagesControllerGetMessagesResponseFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => MessagesControllerGetMessagesResponse$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'MessagesControllerGetMessagesResponse' from JSON`, ); }