/* * 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 GetFeedbackResponseRating = { ThumbsUp: "thumbs_up", ThumbsDown: "thumbs_down", } as const; /** * The feedback rating indicating user satisfaction */ export type GetFeedbackResponseRating = ClosedEnum< typeof GetFeedbackResponseRating >; /** * Response containing the feedback entry for the requested resource. */ export type GetFeedbackResponse = { /** * The request ID that this feedback is associated with */ id: string; /** * The feedback rating indicating user satisfaction */ rating?: GetFeedbackResponseRating | 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 GetFeedbackResponseRating$inboundSchema: z.ZodNativeEnum< typeof GetFeedbackResponseRating > = z.nativeEnum(GetFeedbackResponseRating); /** @internal */ export const GetFeedbackResponseRating$outboundSchema: z.ZodNativeEnum< typeof GetFeedbackResponseRating > = GetFeedbackResponseRating$inboundSchema; /** @internal */ export const GetFeedbackResponse$inboundSchema: z.ZodType< GetFeedbackResponse, z.ZodTypeDef, unknown > = z.object({ id: z.string(), rating: GetFeedbackResponseRating$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 GetFeedbackResponse$Outbound = { id: string; rating?: string | undefined; description?: string | undefined; createdAt?: string | undefined; updatedAt?: string | undefined; }; /** @internal */ export const GetFeedbackResponse$outboundSchema: z.ZodType< GetFeedbackResponse$Outbound, z.ZodTypeDef, GetFeedbackResponse > = z.object({ id: z.string(), rating: GetFeedbackResponseRating$outboundSchema.optional(), description: z.string().optional(), createdAt: z.date().transform(v => v.toISOString()).optional(), updatedAt: z.date().transform(v => v.toISOString()).optional(), }); export function getFeedbackResponseToJSON( getFeedbackResponse: GetFeedbackResponse, ): string { return JSON.stringify( GetFeedbackResponse$outboundSchema.parse(getFeedbackResponse), ); } export function getFeedbackResponseFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => GetFeedbackResponse$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'GetFeedbackResponse' from JSON`, ); }