/* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ import * as z from "zod/v3"; 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"; /** * The feedback rating indicating user satisfaction */ export const CreateFeedbackResponseRating = { ThumbsUp: "thumbs_up", ThumbsDown: "thumbs_down", } as const; /** * The feedback rating indicating user satisfaction */ export type CreateFeedbackResponseRating = ClosedEnum< typeof CreateFeedbackResponseRating >; /** * Response containing the created feedback entry with generated ID and timestamps. */ export type CreateFeedbackResponse = { /** * The request ID that this feedback is associated with */ id: string; /** * The feedback rating indicating user satisfaction */ rating?: CreateFeedbackResponseRating | undefined; /** * Optional detailed feedback description providing additional context or explanation (max 2000 characters) */ description?: string | undefined; /** * Timestamp when the feedback was created */ createdAt?: Date | undefined; /** * Timestamp when the feedback was last updated */ updatedAt?: Date | undefined; }; /** @internal */ export const CreateFeedbackResponseRating$inboundSchema: z.ZodNativeEnum< typeof CreateFeedbackResponseRating > = z.nativeEnum(CreateFeedbackResponseRating); /** @internal */ export const CreateFeedbackResponseRating$outboundSchema: z.ZodNativeEnum< typeof CreateFeedbackResponseRating > = CreateFeedbackResponseRating$inboundSchema; /** @internal */ export const CreateFeedbackResponse$inboundSchema: z.ZodType< CreateFeedbackResponse, z.ZodTypeDef, unknown > = z.object({ id: z.string(), rating: CreateFeedbackResponseRating$inboundSchema.optional(), description: z.string().optional(), createdAt: z.string().datetime({ offset: true }).transform(v => new Date(v)) .optional(), updatedAt: z.string().datetime({ offset: true }).transform(v => new Date(v)) .optional(), }); /** @internal */ export type CreateFeedbackResponse$Outbound = { id: string; rating?: string | undefined; description?: string | undefined; createdAt?: string | undefined; updatedAt?: string | undefined; }; /** @internal */ export const CreateFeedbackResponse$outboundSchema: z.ZodType< CreateFeedbackResponse$Outbound, z.ZodTypeDef, CreateFeedbackResponse > = z.object({ id: z.string(), rating: CreateFeedbackResponseRating$outboundSchema.optional(), description: z.string().optional(), createdAt: z.date().transform(v => v.toISOString()).optional(), updatedAt: z.date().transform(v => v.toISOString()).optional(), }); export function createFeedbackResponseToJSON( createFeedbackResponse: CreateFeedbackResponse, ): string { return JSON.stringify( CreateFeedbackResponse$outboundSchema.parse(createFeedbackResponse), ); } export function createFeedbackResponseFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => CreateFeedbackResponse$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'CreateFeedbackResponse' from JSON`, ); }