import { APIResource } from "../../../core/resource.js"; import * as MaterialsAPI from "./materials.js"; import { APIPromise } from "../../../core/api-promise.js"; import { type Uploadable } from "../../../core/uploads.js"; import { RequestOptions } from "../../../internal/request-options.js"; export declare class Upload extends APIResource { /** * Complete upload after using presigned URL * * @example * ```ts * const materialResponse = * await client.v1.materials.upload.completeUpload({ * materialId: 'materialId', * s3Key: 's3Key', * }); * ``` */ completeUpload(body: UploadCompleteUploadParams, options?: RequestOptions): APIPromise; /** * Get presigned URL for direct S3 upload * * @example * ```ts * const response = * await client.v1.materials.upload.getPresignedURL({ * contentType: 'application/pdf', * filename: 'document.pdf', * name: 'Chapter 1 Notes', * }); * ``` */ getPresignedURL(body: UploadGetPresignedURLParams, options?: RequestOptions): APIPromise; /** * Upload a material file * * @example * ```ts * const materialResponse = * await client.v1.materials.upload.uploadFile({ * file: fs.createReadStream('path/to/file'), * name: 'name', * }); * ``` */ uploadFile(body: UploadUploadFileParams, options?: RequestOptions): APIPromise; /** * Uploads a file and waits for processing to finish before returning. Useful for * synchronous API usage. * * @example * ```ts * const materialResponse = * await client.v1.materials.upload.uploadFileAndProcess({ * file: fs.createReadStream('path/to/file'), * name: 'name', * }); * ``` */ uploadFileAndProcess(body: UploadUploadFileAndProcessParams, options?: RequestOptions): APIPromise; /** * Upload material from URL * * @example * ```ts * const materialResponse = * await client.v1.materials.upload.uploadFromURL({ * name: 'name', * url: 'url', * }); * ``` */ uploadFromURL(body: UploadUploadFromURLParams, options?: RequestOptions): APIPromise; /** * Fetches content from URL and waits for processing to finish before returning. * Useful for synchronous API usage. * * @example * ```ts * const materialResponse = * await client.v1.materials.upload.uploadFromURLAndProcess({ * name: 'My Document', * url: 'https://example.com/document.pdf', * }); * ``` */ uploadFromURLAndProcess(body: UploadUploadFromURLAndProcessParams, options?: RequestOptions): APIPromise; } export interface UploadGetPresignedURLResponse { /** * Material ID to use for completion */ materialId: string; /** * S3 key for the file */ s3Key: string; /** * Presigned URL for direct S3 upload */ uploadUrl: string; } export interface UploadCompleteUploadParams { /** * Material ID from presigned URL response */ materialId: string; /** * S3 key from presigned URL response */ s3Key: string; } export interface UploadGetPresignedURLParams { /** * MIME type of the file */ contentType: string; /** * Filename to upload */ filename: string; /** * Display name for the material */ name: string; /** * Whether to extract images from files */ extractImages?: boolean; /** * Folder ID to place the material in */ folderId?: string; /** * References that this material cites */ references?: Array; } export interface UploadUploadFileParams { file: Uploadable; /** * Material name */ name: string; /** * Content-Type/MIME type of the file (e.g., video/mp4, application/pdf). * If not provided, the uploadable's existing type is used. */ contentType?: string; /** * Whether to extract images from files (true/false, default: true) */ extractImages?: string; /** * Folder ID (optional). If folderPath is provided, folderId will be ignored. */ folderId?: string; /** * Relative folder path (e.g., "folder1/folder2"). Folders will be created if * they don't exist. The filename can be included and will be extracted * automatically. */ folderPath?: string; /** * JSON string of references array (optional) */ references?: string; } export interface UploadUploadFileAndProcessParams { file: Uploadable; /** * Material name */ name: string; /** * Content-Type/MIME type of the file (e.g., video/mp4, application/pdf). * If not provided, the uploadable's existing type is used. */ contentType?: string; /** * Whether to extract images from files (true/false, default: true) */ extractImages?: string; /** * Folder ID (optional). If folderPath is provided, folderId will be ignored. */ folderId?: string; /** * Relative folder path (e.g., "folder1/folder2"). Folders will be created if * they don't exist. The filename can be included and will be extracted * automatically. */ folderPath?: string; /** * Polling interval in milliseconds (default: 2000) */ pollIntervalMs?: number; /** * Processing timeout in milliseconds (default: 300000 - 5 minutes) */ timeoutMs?: number; } export interface UploadUploadFromURLParams { /** * Material name */ name: string; /** * URL to fetch content from */ url: string; /** * Folder ID (optional). If folderPath is provided, folderId will be ignored. */ folderId?: string; /** * Relative folder path (e.g., "folder1/folder2"). Folders will be created if * they don't exist. The filename can be included and will be extracted * automatically. */ folderPath?: string; } export interface UploadUploadFromURLAndProcessParams { /** * Material name */ name: string; /** * URL to fetch content from */ url: string; /** * Folder ID (optional). If folderPath is provided, folderId will be ignored. */ folderId?: string; /** * Relative folder path (e.g., "folder1/folder2"). Folders will be created if * they don't exist. The filename can be included and will be extracted * automatically. */ folderPath?: string; /** * Polling interval in milliseconds (default: 2 seconds) */ pollIntervalMs?: number; /** * References that this material cites */ references?: Array; /** * Maximum time to wait for processing in milliseconds (default: 5 minutes) */ timeoutMs?: number; } export declare namespace Upload { export { type UploadGetPresignedURLResponse as UploadGetPresignedURLResponse, type UploadCompleteUploadParams as UploadCompleteUploadParams, type UploadGetPresignedURLParams as UploadGetPresignedURLParams, type UploadUploadFileParams as UploadUploadFileParams, type UploadUploadFileAndProcessParams as UploadUploadFileAndProcessParams, type UploadUploadFromURLParams as UploadUploadFromURLParams, type UploadUploadFromURLAndProcessParams as UploadUploadFromURLAndProcessParams, }; } //# sourceMappingURL=upload.d.ts.map