@@ -214,6 +214,8 @@ class API {
214
214
}
215
215
216
216
List <APICapability > getCapabilities () {
217
+ if (this .apiFlavour == "paperless-ng" )
218
+ return [APICapability .UPDATE_DOCUMENTS , APICapability .TAG_COLOR ];
217
219
return [];
218
220
}
219
221
@@ -281,7 +283,11 @@ class API {
281
283
{String ordering = "-created" , String ? search}) async {
282
284
var json =
283
285
await getAPIResource ("documents" , ordering: ordering, search: search);
284
- return ResponseList <Document >.fromJson (json! );
286
+ var docs = ResponseList <Document >.fromJson (json! );
287
+ if (docs.runtimeType != OgDocument ) {
288
+ this .apiFlavour = "paperless-ng" ;
289
+ }
290
+ return docs;
285
291
}
286
292
287
293
Future <ResponseList <Correspondent >> getCorrespondents () async {
@@ -342,7 +348,7 @@ class API {
342
348
}
343
349
344
350
Future <void > deleteResource (String type, int ? id) async {
345
- await dio.delete (getFullURL ("/api/$type /$id " ));
351
+ await dio.delete (getFullURL ("/api/${ type }s /$id / " ));
346
352
}
347
353
348
354
Future <void > deleteDocument (Document doc) async {
@@ -359,7 +365,8 @@ class API {
359
365
360
366
Future <void > updateResource (
361
367
String type, int ? id, Map <String , dynamic > newValue) async {
362
- await dio.put (getFullURL ("/api/$type /$id " ), data: jsonEncode (newValue));
368
+ await dio.patch (getFullURL ("/api/${type }s/$id /" ),
369
+ data: jsonEncode (newValue));
363
370
}
364
371
365
372
Future <void > updateDocument (int ? id, Map <String , dynamic > newDocument) async {
0 commit comments