/* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ import * as z from "zod/v4-mini"; import { smartUnion } from "../types/smart-union.js"; import { FeedbackCategory, FeedbackCategory$outboundSchema, } from "./feedback-category.js"; import { FeedbackContext, FeedbackContext$Outbound, FeedbackContext$outboundSchema, } from "./feedback-context.js"; import { FeedbackTarget, FeedbackTarget$Outbound, FeedbackTarget$outboundSchema, } from "./feedback-target.js"; export type FeedbackSubmitRequest2 = { target: FeedbackTarget; category?: FeedbackCategory | undefined; rating?: number | undefined; message: string; labels?: Array | undefined; context?: FeedbackContext | undefined; metadata?: { [k: string]: any } | undefined; }; export type FeedbackSubmitRequest1 = { target: FeedbackTarget; category?: FeedbackCategory | undefined; rating: number; message?: string | undefined; labels?: Array | undefined; context?: FeedbackContext | undefined; metadata?: { [k: string]: any } | undefined; }; export type FeedbackSubmitRequestUnion = | FeedbackSubmitRequest1 | FeedbackSubmitRequest2; /** @internal */ export type FeedbackSubmitRequest2$Outbound = { target: FeedbackTarget$Outbound; category?: string | undefined; rating?: number | undefined; message: string; labels?: Array | undefined; context?: FeedbackContext$Outbound | undefined; metadata?: { [k: string]: any } | undefined; }; /** @internal */ export const FeedbackSubmitRequest2$outboundSchema: z.ZodMiniType< FeedbackSubmitRequest2$Outbound, FeedbackSubmitRequest2 > = z.object({ target: FeedbackTarget$outboundSchema, category: z.optional(FeedbackCategory$outboundSchema), rating: z.optional(z.int()), message: z.string(), labels: z.optional(z.array(z.string())), context: z.optional(FeedbackContext$outboundSchema), metadata: z.optional(z.record(z.string(), z.any())), }); export function feedbackSubmitRequest2ToJSON( feedbackSubmitRequest2: FeedbackSubmitRequest2, ): string { return JSON.stringify( FeedbackSubmitRequest2$outboundSchema.parse(feedbackSubmitRequest2), ); } /** @internal */ export type FeedbackSubmitRequest1$Outbound = { target: FeedbackTarget$Outbound; category?: string | undefined; rating: number; message?: string | undefined; labels?: Array | undefined; context?: FeedbackContext$Outbound | undefined; metadata?: { [k: string]: any } | undefined; }; /** @internal */ export const FeedbackSubmitRequest1$outboundSchema: z.ZodMiniType< FeedbackSubmitRequest1$Outbound, FeedbackSubmitRequest1 > = z.object({ target: FeedbackTarget$outboundSchema, category: z.optional(FeedbackCategory$outboundSchema), rating: z.int(), message: z.optional(z.string()), labels: z.optional(z.array(z.string())), context: z.optional(FeedbackContext$outboundSchema), metadata: z.optional(z.record(z.string(), z.any())), }); export function feedbackSubmitRequest1ToJSON( feedbackSubmitRequest1: FeedbackSubmitRequest1, ): string { return JSON.stringify( FeedbackSubmitRequest1$outboundSchema.parse(feedbackSubmitRequest1), ); } /** @internal */ export type FeedbackSubmitRequestUnion$Outbound = | FeedbackSubmitRequest1$Outbound | FeedbackSubmitRequest2$Outbound; /** @internal */ export const FeedbackSubmitRequestUnion$outboundSchema: z.ZodMiniType< FeedbackSubmitRequestUnion$Outbound, FeedbackSubmitRequestUnion > = smartUnion([ z.lazy(() => FeedbackSubmitRequest1$outboundSchema), z.lazy(() => FeedbackSubmitRequest2$outboundSchema), ]); export function feedbackSubmitRequestUnionToJSON( feedbackSubmitRequestUnion: FeedbackSubmitRequestUnion, ): string { return JSON.stringify( FeedbackSubmitRequestUnion$outboundSchema.parse(feedbackSubmitRequestUnion), ); }