Add API to fetch sharees

This commit is contained in:
Vishnu Mohandas 2020-10-13 10:51:44 +05:30
parent 4c94a2b1d5
commit 40ebae5fa3

View file

@ -39,24 +39,23 @@ class CollectionsService {
}
}
Future<Collection> getFolder(String path) async {
Collection getCollectionForPath(String path) {
return _localCollections[path];
}
Future<List<String>> getSharees(int collectionID) {
return Dio()
.get(
Configuration.instance.getHttpEndpoint() + "/collections/folder/",
Configuration.instance.getHttpEndpoint() + "/collections/sharees",
queryParameters: {
"path": path,
"collectionID": collectionID,
},
options:
Options(headers: {"X-Auth-Token": Configuration.instance.getToken()}),
)
.then((response) {
return Collection.fromMap(response.data);
}).catchError((e) {
if (e.response.statusCode == HttpStatus.notFound) {
return Collection.emptyCollection();
} else {
throw e;
}
_logger.info(response.toString());
return response.data["emails"] as List<String>;
});
}
@ -119,7 +118,6 @@ class CollectionsService {
Sodium.bin2base64(encryptedPath.encryptedData),
Sodium.bin2base64(encryptedPath.nonce),
null,
null,
));
_cacheCollectionAttributes(collection);
return collection;