getDocumentVersions method
Retrieves a paginated list of versions for a specific document.
Each DocumentVersion in the result will have its data field
populated with the reconstructed document data at that version.
documentId - The ID of the document to get versions for
limit - Maximum number of versions to return (default: 20)
offset - Number of versions to skip for pagination (default: 0)
Returns a DocumentVersionList containing the versions and pagination info.
Throws DeskDataSourceException if the operation fails.
Implementation
@override
Future<DocumentVersionList> getDocumentVersions(
String documentId, {
int limit = 20,
int offset = 0,
}) async {
final versions = (_versions[documentId]?.values ?? []).toList()
..sort((a, b) => a.versionNumber.compareTo(b.versionNumber));
return DocumentVersionList(
versions: versions.skip(offset).take(limit).toList(),
total: versions.length,
page: (offset ~/ limit) + 1,
pageSize: limit,
);
}