/* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ import * as z from "zod/v3"; import { remap as remap$ } from "../../lib/primitives.js"; import { lazySchema as lazySchema$, safeParse } from "../../lib/schemas.js"; import { Result as SafeParseResult } from "../../types/fp.js"; import * as types from "../../types/primitives.js"; import { SDKValidationError } from "../errors/sdkvalidationerror.js"; export type UploadSession = { /** * A unique identifier for an object. */ id?: string | undefined; /** * Indicates if the upload session was completed successfully. */ success?: boolean | undefined; /** * Size in bytes of each part of the file that you will upload. Uploaded parts need to be this size for the upload to be successful. */ partSize?: number | undefined; /** * Indicates if parts of the file can uploaded in parallel. */ parallelUploadSupported?: boolean | undefined; /** * The range of bytes that was successfully uploaded. */ uploadedByteRange?: string | undefined; expiresAt?: Date | null | undefined; }; /** @internal */ export const UploadSession$inboundSchema: z.ZodType< UploadSession, z.ZodTypeDef, unknown > = /* @__PURE__ */ lazySchema$(() => z.object({ id: types.optional(types.string()), success: types.optional(types.boolean()), part_size: types.optional(types.number()), parallel_upload_supported: types.optional(types.boolean()), uploaded_byte_range: types.optional(types.string()), expires_at: z.nullable(types.date()).optional(), }).transform((v) => { return remap$(v, { "part_size": "partSize", "parallel_upload_supported": "parallelUploadSupported", "uploaded_byte_range": "uploadedByteRange", "expires_at": "expiresAt", }); }) ); export function uploadSessionFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => UploadSession$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'UploadSession' from JSON`, ); }