Fix manifest issue, update download function and original file download support

This commit is contained in:
Anton Stubenbord
2023-02-14 21:02:51 +01:00
parent 219f1c7e1b
commit 42dbaaf855
7 changed files with 79 additions and 49 deletions

View File

@@ -23,7 +23,7 @@ abstract class PaperlessDocumentsApi {
Future<Iterable<int>> bulkAction(BulkAction action);
Future<Uint8List> getPreview(int docId);
String getThumbnailUrl(int docId);
Future<Uint8List> download(DocumentModel document);
Future<Uint8List> download(DocumentModel document, {bool original});
Future<FieldSuggestions> findSuggestions(DocumentModel document);
Future<List<String>> autocomplete(String query, [int limit = 10]);

View File

@@ -196,10 +196,14 @@ class PaperlessDocumentsApiImpl implements PaperlessDocumentsApi {
}
@override
Future<Uint8List> download(DocumentModel document) async {
Future<Uint8List> download(
DocumentModel document, {
bool original = false,
}) async {
try {
final response = await client.get(
"/api/documents/${document.id}/download/",
queryParameters: original ? {'original': true} : {},
options: Options(responseType: ResponseType.bytes),
);
return response.data;