/* * 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 AddMultistreamTargetRequest = { /** * ID of the parent stream */ id: string; targetAddPayload: components.TargetAddPayload; }; export type AddMultistreamTargetResponse = { /** * HTTP response content type for this operation */ contentType: string; /** * HTTP response status code for this operation */ statusCode: number; /** * Raw HTTP response; suitable for custom response parsing */ rawResponse: Response; /** * Error */ error?: components.ErrorT | undefined; }; /** @internal */ export const AddMultistreamTargetRequest$inboundSchema: z.ZodType< AddMultistreamTargetRequest, z.ZodTypeDef, unknown > = z.object({ id: z.string(), "target-add-payload": components.TargetAddPayload$inboundSchema, }).transform((v) => { return remap$(v, { "target-add-payload": "targetAddPayload", }); }); /** @internal */ export type AddMultistreamTargetRequest$Outbound = { id: string; "target-add-payload": components.TargetAddPayload$Outbound; }; /** @internal */ export const AddMultistreamTargetRequest$outboundSchema: z.ZodType< AddMultistreamTargetRequest$Outbound, z.ZodTypeDef, AddMultistreamTargetRequest > = z.object({ id: z.string(), targetAddPayload: components.TargetAddPayload$outboundSchema, }).transform((v) => { return remap$(v, { targetAddPayload: "target-add-payload", }); }); /** * @internal * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. */ export namespace AddMultistreamTargetRequest$ { /** @deprecated use `AddMultistreamTargetRequest$inboundSchema` instead. */ export const inboundSchema = AddMultistreamTargetRequest$inboundSchema; /** @deprecated use `AddMultistreamTargetRequest$outboundSchema` instead. */ export const outboundSchema = AddMultistreamTargetRequest$outboundSchema; /** @deprecated use `AddMultistreamTargetRequest$Outbound` instead. */ export type Outbound = AddMultistreamTargetRequest$Outbound; } export function addMultistreamTargetRequestToJSON( addMultistreamTargetRequest: AddMultistreamTargetRequest, ): string { return JSON.stringify( AddMultistreamTargetRequest$outboundSchema.parse( addMultistreamTargetRequest, ), ); } export function addMultistreamTargetRequestFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => AddMultistreamTargetRequest$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'AddMultistreamTargetRequest' from JSON`, ); } /** @internal */ export const AddMultistreamTargetResponse$inboundSchema: z.ZodType< AddMultistreamTargetResponse, z.ZodTypeDef, unknown > = z.object({ ContentType: z.string(), StatusCode: z.number().int(), RawResponse: z.instanceof(Response), error: components.ErrorT$inboundSchema.optional(), }).transform((v) => { return remap$(v, { "ContentType": "contentType", "StatusCode": "statusCode", "RawResponse": "rawResponse", }); }); /** @internal */ export type AddMultistreamTargetResponse$Outbound = { ContentType: string; StatusCode: number; RawResponse: never; error?: components.ErrorT$Outbound | undefined; }; /** @internal */ export const AddMultistreamTargetResponse$outboundSchema: z.ZodType< AddMultistreamTargetResponse$Outbound, z.ZodTypeDef, AddMultistreamTargetResponse > = z.object({ contentType: z.string(), statusCode: z.number().int(), rawResponse: z.instanceof(Response).transform(() => { throw new Error("Response cannot be serialized"); }), error: components.ErrorT$outboundSchema.optional(), }).transform((v) => { return remap$(v, { contentType: "ContentType", statusCode: "StatusCode", rawResponse: "RawResponse", }); }); /** * @internal * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. */ export namespace AddMultistreamTargetResponse$ { /** @deprecated use `AddMultistreamTargetResponse$inboundSchema` instead. */ export const inboundSchema = AddMultistreamTargetResponse$inboundSchema; /** @deprecated use `AddMultistreamTargetResponse$outboundSchema` instead. */ export const outboundSchema = AddMultistreamTargetResponse$outboundSchema; /** @deprecated use `AddMultistreamTargetResponse$Outbound` instead. */ export type Outbound = AddMultistreamTargetResponse$Outbound; } export function addMultistreamTargetResponseToJSON( addMultistreamTargetResponse: AddMultistreamTargetResponse, ): string { return JSON.stringify( AddMultistreamTargetResponse$outboundSchema.parse( addMultistreamTargetResponse, ), ); } export function addMultistreamTargetResponseFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => AddMultistreamTargetResponse$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'AddMultistreamTargetResponse' from JSON`, ); }