/* * 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 TopicsControllerCreateTopicSubscriptionsRequest = { /** * The key identifier of the topic */ topicKey: string; /** * A header for idempotency purposes */ idempotencyKey?: string | undefined; createTopicSubscriptionsRequestDto: components.CreateTopicSubscriptionsRequestDto; }; export type TopicsControllerCreateTopicSubscriptionsResponse = { headers: { [k: string]: Array }; result: components.CreateSubscriptionsResponseDto; }; /** @internal */ export type TopicsControllerCreateTopicSubscriptionsRequest$Outbound = { topicKey: string; "idempotency-key"?: string | undefined; CreateTopicSubscriptionsRequestDto: components.CreateTopicSubscriptionsRequestDto$Outbound; }; /** @internal */ export const TopicsControllerCreateTopicSubscriptionsRequest$outboundSchema: z.ZodType< TopicsControllerCreateTopicSubscriptionsRequest$Outbound, z.ZodTypeDef, TopicsControllerCreateTopicSubscriptionsRequest > = z.object({ topicKey: z.string(), idempotencyKey: z.string().optional(), createTopicSubscriptionsRequestDto: components.CreateTopicSubscriptionsRequestDto$outboundSchema, }).transform((v) => { return remap$(v, { idempotencyKey: "idempotency-key", createTopicSubscriptionsRequestDto: "CreateTopicSubscriptionsRequestDto", }); }); export function topicsControllerCreateTopicSubscriptionsRequestToJSON( topicsControllerCreateTopicSubscriptionsRequest: TopicsControllerCreateTopicSubscriptionsRequest, ): string { return JSON.stringify( TopicsControllerCreateTopicSubscriptionsRequest$outboundSchema.parse( topicsControllerCreateTopicSubscriptionsRequest, ), ); } /** @internal */ export const TopicsControllerCreateTopicSubscriptionsResponse$inboundSchema: z.ZodType< TopicsControllerCreateTopicSubscriptionsResponse, z.ZodTypeDef, unknown > = z.object({ Headers: z.record(z.array(z.string())).default({}), Result: components.CreateSubscriptionsResponseDto$inboundSchema, }).transform((v) => { return remap$(v, { "Headers": "headers", "Result": "result", }); }); export function topicsControllerCreateTopicSubscriptionsResponseFromJSON( jsonString: string, ): SafeParseResult< TopicsControllerCreateTopicSubscriptionsResponse, SDKValidationError > { return safeParse( jsonString, (x) => TopicsControllerCreateTopicSubscriptionsResponse$inboundSchema.parse( JSON.parse(x), ), `Failed to parse 'TopicsControllerCreateTopicSubscriptionsResponse' from JSON`, ); }