/* * 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 { ClosedEnum } from "../../types/enums.js"; import { Result as SafeParseResult } from "../../types/fp.js"; import { SDKValidationError } from "../errors/sdkvalidationerror.js"; /** * Whether to use TLS connection (amqps). Defaults to "false". */ export const Tls = { True: "true", False: "false", } as const; /** * Whether to use TLS connection (amqps). Defaults to "false". */ export type Tls = ClosedEnum; export type RabbitMQConfig = { /** * RabbitMQ server address (host:port). */ serverUrl: string; /** * The exchange to publish messages to. */ exchange: string; /** * Whether to use TLS connection (amqps). Defaults to "false". */ tls?: Tls | undefined; }; /** @internal */ export const Tls$inboundSchema: z.ZodNativeEnum = z.nativeEnum(Tls); /** @internal */ export const Tls$outboundSchema: z.ZodNativeEnum = Tls$inboundSchema; /** @internal */ export const RabbitMQConfig$inboundSchema: z.ZodType< RabbitMQConfig, z.ZodTypeDef, unknown > = z.object({ server_url: z.string(), exchange: z.string(), tls: Tls$inboundSchema.optional(), }).transform((v) => { return remap$(v, { "server_url": "serverUrl", }); }); /** @internal */ export type RabbitMQConfig$Outbound = { server_url: string; exchange: string; tls?: string | undefined; }; /** @internal */ export const RabbitMQConfig$outboundSchema: z.ZodType< RabbitMQConfig$Outbound, z.ZodTypeDef, RabbitMQConfig > = z.object({ serverUrl: z.string(), exchange: z.string(), tls: Tls$outboundSchema.optional(), }).transform((v) => { return remap$(v, { serverUrl: "server_url", }); }); export function rabbitMQConfigToJSON(rabbitMQConfig: RabbitMQConfig): string { return JSON.stringify(RabbitMQConfig$outboundSchema.parse(rabbitMQConfig)); } export function rabbitMQConfigFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => RabbitMQConfig$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'RabbitMQConfig' from JSON`, ); }