import { APIResource } from "../core/resource.mjs"; import { APIPromise } from "../core/api-promise.mjs"; import { RequestOptions } from "../internal/request-options.mjs"; /** * File management */ export declare class Files extends APIResource { /** * DEPRECATED: This endpoint is deprecated and will be removed in a future release. * Retrieves a list of files associated with the authenticated project. Results can * be filtered by toolkit and tool slugs. Responses carry a `Deprecation` header * (RFC 9745) for client-side detection. * * @deprecated */ list(query?: FileListParams | null | undefined, options?: RequestOptions): APIPromise; /** * Generates a presigned URL for uploading a file to S3. This endpoint handles * deduplication by checking if a file with the same MD5 hash already exists. * * @example * ```ts * const response = await client.files.createPresignedURL({ * filename: 'quarterly_report.pdf', * md5: 'a1b2c3d4e5f6a7b8c9d0e1f2a3b4c5d6', * mimetype: 'application/pdf', * tool_slug: 'GMAIL_SEND_EMAIL', * toolkit_slug: 'gmail', * }); * ``` */ createPresignedURL(body: FileCreatePresignedURLParams, options?: RequestOptions): APIPromise; } export interface FileListResponse { current_page: number; items: Array; total_items: number; total_pages: number; next_cursor?: string | null; } export declare namespace FileListResponse { interface Item { /** * Name of the original file. Example: "document.docx" */ filename: string; /** * MD5 hash of the file for integrity verification. Example: * "d41d8cd98f00b204e9800998ecf8427e" */ md5: string; /** * Mime type of the original file. Example: * "application/vnd.openxmlformats-officedocument.wordprocessingml.document" */ mimetype: string; /** * Slug of the action where this file belongs to. Example: "convert-to-pdf" */ tool_slug: string; /** * Slug of the app where this file belongs to. Example: "file-converter" */ toolkit_slug: string; } } export interface FileCreatePresignedURLResponse { /** * ID of the request file. Example: "req_file_9mZn4qR8sXwT" */ id: string; /** * Object storage upload location. Example: * "projects/pr_1a2b3c4d5e6f/requests/slack/SLACK_UPLOAD_FILE/document_9mZn4q.docx" */ key: string; metadata: FileCreatePresignedURLResponse.Metadata; /** * Presigned URL for upload. Example: * "https://storage.composio.dev/projects/pr_1a2b3c4d5e6f/requests/slack/document_9mZn4q.docx?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Expires=3600..." */ new_presigned_url: string; /** * @deprecated [DEPRECATED] Use new_presigned_url instead. Presigned URL for * upload. Example: * "https://storage.composio.dev/projects/pr_1a2b3c4d5e6f/requests/slack/document_9mZn4q.docx?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Expires=3600..." */ newPresignedUrl: string; /** * @deprecated [DEPRECATED] Indicates this is a new file that needs to be uploaded */ type: 'new'; } export declare namespace FileCreatePresignedURLResponse { interface Metadata { /** * Storage backend used for the file. If this is azure, use `x-ms-blob-type` header * to set the blob type to `BlockBlob` while uploading the file */ storage_backend: 's3' | 'azure_blob_storage'; } } export interface FileListParams { /** * Cursor for pagination. The cursor is a base64 encoded string of the page and * limit. The page is the page number and the limit is the number of items per * page. The cursor is used to paginate through the items. The cursor is not * required for the first page. */ cursor?: string; /** * Number of items per page, max allowed is 1000 */ limit?: number | null; /** * Filter files by action slug. Example: "convert-to-pdf" */ tool_slug?: string; /** * Filter files by app slug. Example: "file-converter" */ toolkit_slug?: string; } export interface FileCreatePresignedURLParams { /** * Name of the original file. Example: "quarterly_report.pdf" */ filename: string; /** * MD5 hash of the file for deduplication and integrity verification. Example: * "a1b2c3d4e5f6a7b8c9d0e1f2a3b4c5d6" */ md5: string; /** * Mime type of the original file. Example: "application/pdf", "image/png" */ mimetype: string; /** * Slug of the action where this file belongs to. Example: "GMAIL_SEND_EMAIL", * "SLACK_UPLOAD_FILE" */ tool_slug: string; /** * Slug of the app where this file belongs to. Example: "gmail", "slack", "github" */ toolkit_slug: string; } export declare namespace Files { export { type FileListResponse as FileListResponse, type FileCreatePresignedURLResponse as FileCreatePresignedURLResponse, type FileListParams as FileListParams, type FileCreatePresignedURLParams as FileCreatePresignedURLParams, }; } //# sourceMappingURL=files.d.mts.map