Optionaloptions: DocumentFilesRequestOptional pagination and filtering parameters
Request parameters for listing files with pagination
Optionalpage?: numberPage number (1-indexed, default: 1)
Optionallimit?: numberNumber of files per page (1-1000, default: 100)
OptionalsourceId?: stringFilter by source ID
Optionalsearch?: stringSearch files by name
OptionalsortBy?: "name" | "date" | "size"Sort by field
OptionalsortOrder?: "asc" | "desc"Sort order
Promise resolving to DocumentFilesResponse:
files - Array of DocumentFileMinimal objectstotal - Total number of indexed files (for pagination UI)page - Current page numberlimit - Files per pagetotalPages - Total number of pagesimport { getDocumentFiles, searchDocuments } from "@cpod/sdk";
// Get first page of files
const { files, total, totalPages } = await getDocumentFiles();
console.log(`Found ${total} indexed files (${totalPages} pages)`);
// Search and paginate
const page2 = await getDocumentFiles({
page: 2,
limit: 50,
search: "report",
sortBy: "date",
sortOrder: "desc",
});
Get indexed document files (optimized for fast loading)
Retrieves file info with pagination, filtering, and sorting support.