.
This commit is contained in:
@@ -0,0 +1,19 @@
|
||||
import 'package:nextcloud/nextcloud.dart';
|
||||
|
||||
class ServerDetails {
|
||||
String name;
|
||||
String description;
|
||||
|
||||
ServerDetails({
|
||||
required this.name,
|
||||
required this.description,
|
||||
});
|
||||
|
||||
factory ServerDetails.fromTheme(Map _themeValues) {
|
||||
//
|
||||
DynamiteResponse icon = _themeValues['icon'];
|
||||
DynamiteResponse theme = _themeValues['systemtheme'];
|
||||
|
||||
return ServerDetails(name: '', description: '');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,53 @@
|
||||
import 'package:nextcloud/webdav.dart';
|
||||
|
||||
class Files {
|
||||
String? path;
|
||||
String? name;
|
||||
String? resourceType;
|
||||
String? contentType;
|
||||
DateTime? creationDate;
|
||||
DateTime? modifiedDate;
|
||||
int? size;
|
||||
|
||||
Files({
|
||||
required this.path,
|
||||
required this.name,
|
||||
required this.resourceType,
|
||||
required this.contentType,
|
||||
required this.creationDate,
|
||||
required this.modifiedDate,
|
||||
required this.size,
|
||||
});
|
||||
|
||||
factory Files.fromWebDavResponse(WebDavResponse _response) {
|
||||
//
|
||||
var _name;
|
||||
var _resourceType;
|
||||
var _size;
|
||||
|
||||
var _tempPath = _response.href!.split("/");
|
||||
var _length = _tempPath.length;
|
||||
var _collection = _response.propstats[0].prop.davResourcetype!.collection;
|
||||
if (_collection == null) {
|
||||
_resourceType = 'file';
|
||||
_name = _tempPath[_length - 1];
|
||||
_size = _response.propstats[0].prop.davGetcontentlength;
|
||||
} else {
|
||||
_resourceType = 'folder';
|
||||
_name = _tempPath[_length - 2].contains("dav")
|
||||
? ".."
|
||||
: _tempPath[_length - 2];
|
||||
_size = _response.propstats[0].prop.davQuotaUsedBytes;
|
||||
}
|
||||
|
||||
return Files(
|
||||
path: _response.href ?? '',
|
||||
name: Uri.decodeFull(_name),
|
||||
contentType: _response.propstats[0].prop.davGetcontenttype ?? '',
|
||||
creationDate: DateTime.now(),
|
||||
modifiedDate: _response.propstats[0].prop.davGetlastmodified,
|
||||
size: _size,
|
||||
resourceType: _resourceType,
|
||||
);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user