/* * 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"; /** * Current status of the export job */ export const StartExportFeedbackResponseStatus = { NotFound: "NOT_FOUND", Running: "RUNNING", Completed: "COMPLETED", Failed: "FAILED", Cancelled: "CANCELLED", Terminated: "TERMINATED", ContinuedAsNew: "CONTINUED_AS_NEW", TimedOut: "TIMED_OUT", } as const; /** * Current status of the export job */ export type StartExportFeedbackResponseStatus = ClosedEnum< typeof StartExportFeedbackResponseStatus >; /** * Current stage of the export process */ export const Stage = { Starting: "starting", Fetching: "fetching", Converting: "converting", Uploading: "uploading", Completed: "completed", Failed: "failed", } as const; /** * Current stage of the export process */ export type Stage = ClosedEnum; /** * Progress information (available when running) */ export type Progress = { /** * Current stage of the export process */ stage: Stage; /** * Number of records fetched (available after fetching stage) */ recordCount?: number | undefined; /** * Number of completion feedback records */ completionCount?: number | undefined; /** * Number of response feedback records */ responseCount?: number | undefined; /** * Size of parquet file in bytes (available after converting stage) */ parquetBytes?: number | undefined; /** * Human-readable progress message */ message: string; }; /** * Response when starting a feedback export job. */ export type StartExportFeedbackResponse = { /** * Whether a new export was started (false if already running) */ started: boolean; /** * Current status of the export job */ status: StartExportFeedbackResponseStatus; /** * Progress information (available when running) */ progress?: Progress | undefined; }; /** @internal */ export const StartExportFeedbackResponseStatus$inboundSchema: z.ZodNativeEnum< typeof StartExportFeedbackResponseStatus > = z.nativeEnum(StartExportFeedbackResponseStatus); /** @internal */ export const StartExportFeedbackResponseStatus$outboundSchema: z.ZodNativeEnum< typeof StartExportFeedbackResponseStatus > = StartExportFeedbackResponseStatus$inboundSchema; /** @internal */ export const Stage$inboundSchema: z.ZodNativeEnum = z.nativeEnum( Stage, ); /** @internal */ export const Stage$outboundSchema: z.ZodNativeEnum = Stage$inboundSchema; /** @internal */ export const Progress$inboundSchema: z.ZodType< Progress, z.ZodTypeDef, unknown > = z.object({ stage: Stage$inboundSchema, recordCount: z.number().int().optional(), completionCount: z.number().int().optional(), responseCount: z.number().int().optional(), parquetBytes: z.number().int().optional(), message: z.string(), }); /** @internal */ export type Progress$Outbound = { stage: string; recordCount?: number | undefined; completionCount?: number | undefined; responseCount?: number | undefined; parquetBytes?: number | undefined; message: string; }; /** @internal */ export const Progress$outboundSchema: z.ZodType< Progress$Outbound, z.ZodTypeDef, Progress > = z.object({ stage: Stage$outboundSchema, recordCount: z.number().int().optional(), completionCount: z.number().int().optional(), responseCount: z.number().int().optional(), parquetBytes: z.number().int().optional(), message: z.string(), }); export function progressToJSON(progress: Progress): string { return JSON.stringify(Progress$outboundSchema.parse(progress)); } export function progressFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => Progress$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'Progress' from JSON`, ); } /** @internal */ export const StartExportFeedbackResponse$inboundSchema: z.ZodType< StartExportFeedbackResponse, z.ZodTypeDef, unknown > = z.object({ started: z.boolean(), status: StartExportFeedbackResponseStatus$inboundSchema, progress: z.lazy(() => Progress$inboundSchema).optional(), }); /** @internal */ export type StartExportFeedbackResponse$Outbound = { started: boolean; status: string; progress?: Progress$Outbound | undefined; }; /** @internal */ export const StartExportFeedbackResponse$outboundSchema: z.ZodType< StartExportFeedbackResponse$Outbound, z.ZodTypeDef, StartExportFeedbackResponse > = z.object({ started: z.boolean(), status: StartExportFeedbackResponseStatus$outboundSchema, progress: z.lazy(() => Progress$outboundSchema).optional(), }); export function startExportFeedbackResponseToJSON( startExportFeedbackResponse: StartExportFeedbackResponse, ): string { return JSON.stringify( StartExportFeedbackResponse$outboundSchema.parse( startExportFeedbackResponse, ), ); } export function startExportFeedbackResponseFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => StartExportFeedbackResponse$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'StartExportFeedbackResponse' from JSON`, ); }