uploadchunkop.ts•3.22 kB
/*
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
*/
import * as z from "zod";
import { ApiError, ApiError$zodSchema } from "./apierror.js";
import {
AsyncUploadResponse,
AsyncUploadResponse$zodSchema,
} from "./asyncuploadresponse.js";
import {
NonFinalChunkUploadResponse,
NonFinalChunkUploadResponse$zodSchema,
} from "./nonfinalchunkuploadresponse.js";
import { UploadRequest, UploadRequest$zodSchema } from "./uploadrequest.js";
import {
UploadResourceType,
UploadResourceType$zodSchema,
} from "./uploadresourcetype.js";
import { UploadResponse, UploadResponse$zodSchema } from "./uploadresponse.js";
export type UploadChunkGlobals = { cloud_name?: string | undefined };
export const UploadChunkGlobals$zodSchema: z.ZodType<
UploadChunkGlobals,
z.ZodTypeDef,
unknown
> = z.object({
cloud_name: z.string().describe("The cloud name of your product environment.")
.optional(),
});
export type UploadChunkRequest = {
resource_type?: UploadResourceType | undefined;
contentRange: string;
xUniqueUploadId: string;
upload_request: UploadRequest;
};
export const UploadChunkRequest$zodSchema: z.ZodType<
UploadChunkRequest,
z.ZodTypeDef,
unknown
> = z.object({
contentRange: z.string().describe(
"The range of bytes being uploaded in the current chunk, in the format \"bytes start-end/total\". For example, \"bytes 0-999999/3000000\" indicates the first 1MB chunk of a 3MB file.",
),
resource_type: UploadResourceType$zodSchema.default("auto"),
upload_request: UploadRequest$zodSchema,
xUniqueUploadId: z.string().describe(
"A unique identifier for the upload. Must be the same for all chunks of the same file.",
),
});
/**
* Chunk upload successful. For all but the final chunk, this returns upload status. For the final chunk, it returns the complete upload response.
*/
export type UploadChunkResponseBody =
| NonFinalChunkUploadResponse
| AsyncUploadResponse
| UploadResponse;
export const UploadChunkResponseBody$zodSchema: z.ZodType<
UploadChunkResponseBody,
z.ZodTypeDef,
unknown
> = z.union([
NonFinalChunkUploadResponse$zodSchema,
AsyncUploadResponse$zodSchema,
UploadResponse$zodSchema,
]).describe(
"Chunk upload successful. For all but the final chunk, this returns upload status. For the final chunk, it returns the complete upload response.",
);
export type UploadChunkResponse = {
ContentType: string;
StatusCode: number;
RawResponse: Response;
oneOf?:
| NonFinalChunkUploadResponse
| AsyncUploadResponse
| UploadResponse
| undefined;
html_redirect?: string | undefined;
api_error?: ApiError | undefined;
};
export const UploadChunkResponse$zodSchema: z.ZodType<
UploadChunkResponse,
z.ZodTypeDef,
unknown
> = z.object({
ContentType: z.string(),
RawResponse: z.instanceof(Response),
StatusCode: z.number().int(),
api_error: ApiError$zodSchema.optional(),
html_redirect: z.string().describe(
"Redirect to callback URL (when 'callback' parameter is provided and request is not XHR).",
).optional(),
oneOf: z.union([
NonFinalChunkUploadResponse$zodSchema,
AsyncUploadResponse$zodSchema,
UploadResponse$zodSchema,
]).optional(),
});