jld3103
2 years ago
12 changed files with 3205 additions and 615 deletions
@ -0,0 +1,73 @@ |
|||||||
|
import 'dart:io'; |
||||||
|
|
||||||
|
void main() { |
||||||
|
final props = File('lib/src/webdav/props.csv').readAsLinesSync().map((final line) => line.split(',')); |
||||||
|
final valueProps = <String>[]; |
||||||
|
final findProps = <String>[]; |
||||||
|
final variables = <String>[]; |
||||||
|
for (final prop in props) { |
||||||
|
final namespacePrefix = prop[0]; |
||||||
|
final namespaceVariable = convertNamespace(namespacePrefix); |
||||||
|
final type = prop[2]; |
||||||
|
final name = prop[1]; |
||||||
|
final variable = namespacePrefix + name.toLowerCase().replaceAll(RegExp('[^a-z]'), ''); |
||||||
|
valueProps.addAll([ |
||||||
|
"@annotation.XmlElement(name: '$name', namespace: $namespaceVariable, includeIfNull: false)", |
||||||
|
'$type? $variable;', |
||||||
|
]); |
||||||
|
findProps.addAll([ |
||||||
|
"@annotation.XmlElement(name: '$name', namespace: $namespaceVariable, includeIfNull: false)", |
||||||
|
'bool? $variable;', |
||||||
|
]); |
||||||
|
variables.add(variable); |
||||||
|
} |
||||||
|
File('lib/src/webdav/props.dart').writeAsStringSync( |
||||||
|
[ |
||||||
|
'// ignore_for_file: public_member_api_docs', |
||||||
|
"import 'package:nextcloud/src/webdav/webdav.dart';", |
||||||
|
"import 'package:xml/xml.dart';", |
||||||
|
"import 'package:xml_annotation/xml_annotation.dart' as annotation;", |
||||||
|
"part 'props.g.dart';", |
||||||
|
'', |
||||||
|
...generateClass('WebDavPropfindProp', 'prop', 'namespaceDav', findProps, variables), |
||||||
|
...generateClass('WebDavProp', 'prop', 'namespaceDav', valueProps, variables), |
||||||
|
...generateClass('WebDavOcFilterRules', 'filter-rules', 'namespaceOwncloud', valueProps, variables), |
||||||
|
].join('\n'), |
||||||
|
); |
||||||
|
} |
||||||
|
|
||||||
|
List<String> generateClass( |
||||||
|
final String name, |
||||||
|
final String elementName, |
||||||
|
final String namespace, |
||||||
|
final List<String> props, |
||||||
|
final List<String> variables, |
||||||
|
) => |
||||||
|
[ |
||||||
|
'@annotation.XmlSerializable(createMixin: true)', |
||||||
|
"@annotation.XmlRootElement(name: '$elementName', namespace: $namespace)", |
||||||
|
'class $name with _\$${name}XmlSerializableMixin {', |
||||||
|
' $name({', |
||||||
|
...variables.map((final variable) => ' this.$variable,'), |
||||||
|
' });', |
||||||
|
' factory $name.fromXmlElement(final XmlElement element) => _\$${name}FromXmlElement(element);', |
||||||
|
...props.map((final prop) => ' $prop'), |
||||||
|
'}', |
||||||
|
]; |
||||||
|
|
||||||
|
String convertNamespace(final String namespacePrefix) { |
||||||
|
switch (namespacePrefix) { |
||||||
|
case 'dav': |
||||||
|
return 'namespaceDav'; |
||||||
|
case 'oc': |
||||||
|
return 'namespaceOwncloud'; |
||||||
|
case 'nc': |
||||||
|
return 'namespaceNextcloud'; |
||||||
|
case 'ocs': |
||||||
|
return 'namespaceOpenCollaborationServices'; |
||||||
|
case 'ocm': |
||||||
|
return 'namespaceOpenCloudMesh'; |
||||||
|
default: |
||||||
|
throw Exception('Unknown namespace prefix "$namespacePrefix"'); |
||||||
|
} |
||||||
|
} |
|
@ -1,166 +1,263 @@ |
|||||||
part of '../../nextcloud.dart'; |
// ignore_for_file: public_member_api_docs |
||||||
|
import 'package:nextcloud/src/webdav/webdav.dart'; |
||||||
/// Mapping of all WebDAV properties. |
import 'package:xml/xml.dart'; |
||||||
enum WebDavProps { |
import 'package:xml_annotation/xml_annotation.dart' as annotation; |
||||||
/// Contains the Last-Modified header value . |
part 'props.g.dart'; |
||||||
davLastModified('d:getlastmodified'), |
|
||||||
|
@annotation.XmlSerializable(createMixin: true) |
||||||
/// Contains the ETag header value. |
@annotation.XmlRootElement(name: 'prop', namespace: namespaceDav) |
||||||
davETag('d:getetag'), |
class WebDavPropfindProp with _$WebDavPropfindPropXmlSerializableMixin { |
||||||
|
WebDavPropfindProp({ |
||||||
/// Contains the Content-Type header value. |
this.davgetlastmodified, |
||||||
davContentType('d:getcontenttype'), |
this.davgetetag, |
||||||
|
this.davgetcontenttype, |
||||||
/// Specifies the nature of the resource. |
this.davgetcontentlength, |
||||||
davResourceType('d:resourcetype'), |
this.ocid, |
||||||
|
this.ocfileid, |
||||||
/// Contains the Content-Length header. |
this.ocfavorite, |
||||||
davContentLength('d:getcontentlength'), |
this.occommentshref, |
||||||
|
this.occommentscount, |
||||||
/// The fileid namespaced by the instance id, globally unique |
this.occommentsunread, |
||||||
ocId('oc:id'), |
this.ocdownloadurl, |
||||||
|
this.ocownerid, |
||||||
/// The unique id for the file within the instance |
this.ocownerdisplayname, |
||||||
ocFileId('oc:fileid'), |
this.ocsize, |
||||||
|
this.ocpermissions, |
||||||
/// List of user specified tags. Can be modified. |
this.ncnote, |
||||||
ocTags('oc:tags'), |
this.ncdatafingerprint, |
||||||
|
this.nchaspreview, |
||||||
/// Whether a resource is tagged as favorite. |
this.ncmounttype, |
||||||
/// Can be modified and reported on with list-files. |
this.ncisencrypted, |
||||||
ocFavorite('oc:favorite'), |
this.ncmetadataetag, |
||||||
|
this.ncuploadtime, |
||||||
/// List of collaborative tags. Can be reported on with list-files. |
this.nccreationtime, |
||||||
/// |
this.ncrichworkspace, |
||||||
/// Valid system tags are: |
this.ocssharepermissions, |
||||||
/// - oc:id |
this.ocmsharepermissions, |
||||||
/// - oc:display-name |
}); |
||||||
/// - oc:user-visible |
factory WebDavPropfindProp.fromXmlElement(final XmlElement element) => _$WebDavPropfindPropFromXmlElement(element); |
||||||
/// - oc:user-assignable |
@annotation.XmlElement(name: 'getlastmodified', namespace: namespaceDav, includeIfNull: false) |
||||||
/// - oc:groups |
bool? davgetlastmodified; |
||||||
/// - oc:can-assign |
@annotation.XmlElement(name: 'getetag', namespace: namespaceDav, includeIfNull: false) |
||||||
ocSystemTag('oc:systemtag'), |
bool? davgetetag; |
||||||
|
@annotation.XmlElement(name: 'getcontenttype', namespace: namespaceDav, includeIfNull: false) |
||||||
/// Can be reported on with list-files. |
bool? davgetcontenttype; |
||||||
ocCircle('oc:circle'), |
@annotation.XmlElement(name: 'getcontentlength', namespace: namespaceDav, includeIfNull: false) |
||||||
|
bool? davgetcontentlength; |
||||||
/// Link to the comments for this resource. |
@annotation.XmlElement(name: 'id', namespace: namespaceOwncloud, includeIfNull: false) |
||||||
ocCommentsHref('oc:comments-href'), |
bool? ocid; |
||||||
|
@annotation.XmlElement(name: 'fileid', namespace: namespaceOwncloud, includeIfNull: false) |
||||||
/// Number of comments. |
bool? ocfileid; |
||||||
ocCommentsCount('oc:comments-count'), |
@annotation.XmlElement(name: 'favorite', namespace: namespaceOwncloud, includeIfNull: false) |
||||||
|
bool? ocfavorite; |
||||||
/// Number of unread comments. |
@annotation.XmlElement(name: 'comments-href', namespace: namespaceOwncloud, includeIfNull: false) |
||||||
ocCommentsUnread('oc:comments-unread'), |
bool? occommentshref; |
||||||
|
@annotation.XmlElement(name: 'comments-count', namespace: namespaceOwncloud, includeIfNull: false) |
||||||
/// Download URL. |
bool? occommentscount; |
||||||
ocDownloadURL('oc:downloadURL'), |
@annotation.XmlElement(name: 'comments-unread', namespace: namespaceOwncloud, includeIfNull: false) |
||||||
|
bool? occommentsunread; |
||||||
/// The user id of the owner of a shared file |
@annotation.XmlElement(name: 'downloadURL', namespace: namespaceOwncloud, includeIfNull: false) |
||||||
ocOwnerId('oc:owner-id'), |
bool? ocdownloadurl; |
||||||
|
@annotation.XmlElement(name: 'owner-id', namespace: namespaceOwncloud, includeIfNull: false) |
||||||
/// The display name of the owner of a shared file |
bool? ocownerid; |
||||||
ocOwnerDisplayName('oc:owner-display-name'), |
@annotation.XmlElement(name: 'owner-display-name', namespace: namespaceOwncloud, includeIfNull: false) |
||||||
|
bool? ocownerdisplayname; |
||||||
/// Share types of this file. |
@annotation.XmlElement(name: 'size', namespace: namespaceOwncloud, includeIfNull: false) |
||||||
/// |
bool? ocsize; |
||||||
/// Returns a list of share-type objects where: |
@annotation.XmlElement(name: 'permissions', namespace: namespaceOwncloud, includeIfNull: false) |
||||||
/// - 0: user share |
bool? ocpermissions; |
||||||
/// - 1: group share |
@annotation.XmlElement(name: 'note', namespace: namespaceNextcloud, includeIfNull: false) |
||||||
/// - 2: usergroup share |
bool? ncnote; |
||||||
/// - 3: public link |
@annotation.XmlElement(name: 'data-fingerprint', namespace: namespaceNextcloud, includeIfNull: false) |
||||||
/// - 4: email |
bool? ncdatafingerprint; |
||||||
/// - 5: contact |
@annotation.XmlElement(name: 'has-preview', namespace: namespaceNextcloud, includeIfNull: false) |
||||||
/// - 6: remote (federated cloud) |
bool? nchaspreview; |
||||||
/// - 7: circle |
@annotation.XmlElement(name: 'mount-type', namespace: namespaceNextcloud, includeIfNull: false) |
||||||
/// - 8: guest |
bool? ncmounttype; |
||||||
/// - 9: remote group |
@annotation.XmlElement(name: 'is-encrypted', namespace: namespaceNextcloud, includeIfNull: false) |
||||||
/// - 10: room (talk conversation) |
bool? ncisencrypted; |
||||||
/// - 11: userroom |
@annotation.XmlElement(name: 'metadata_etag', namespace: namespaceNextcloud, includeIfNull: false) |
||||||
/// See also [OCS Share API](https://docs.nextcloud.com/server/19/developer_manual/client_apis/OCS/ocs-share-api.html) |
bool? ncmetadataetag; |
||||||
ocShareTypes('oc:share-types'), |
@annotation.XmlElement(name: 'upload_time', namespace: namespaceNextcloud, includeIfNull: false) |
||||||
|
bool? ncuploadtime; |
||||||
/// List of users this file is shared with. |
@annotation.XmlElement(name: 'creation_time', namespace: namespaceNextcloud, includeIfNull: false) |
||||||
/// |
bool? nccreationtime; |
||||||
/// Returns a list of sharee objects with: |
@annotation.XmlElement(name: 'rich-workspace', namespace: namespaceNextcloud, includeIfNull: false) |
||||||
/// - id |
bool? ncrichworkspace; |
||||||
/// - display-name |
@annotation.XmlElement(name: 'share-permissions', namespace: namespaceOpenCollaborationServices, includeIfNull: false) |
||||||
/// - type (share type) |
bool? ocssharepermissions; |
||||||
ncShareees('nc:sharees'), |
@annotation.XmlElement(name: 'share-permissions', namespace: namespaceOpenCloudMesh, includeIfNull: false) |
||||||
|
bool? ocmsharepermissions; |
||||||
/// Share note. |
} |
||||||
ncNote('nc:note'), |
|
||||||
|
|
||||||
/// Checksums as provided during upload. |
|
||||||
/// |
|
||||||
/// Returns a list of checksum objects. |
|
||||||
ocChecksums('oc:checksums'), |
|
||||||
|
|
||||||
/// Unlike [[davContentLength]], this property also works for folders |
|
||||||
/// reporting the size of everything in the folder. |
|
||||||
ocSize('oc:size'), |
|
||||||
|
|
||||||
/// WebDAV permissions: |
|
||||||
/// |
|
||||||
/// - S: shared |
|
||||||
/// - R: shareable |
|
||||||
/// - M: mounted |
|
||||||
/// - G: readable |
|
||||||
/// - D: deletable |
|
||||||
/// - NV: updateable, renameable, moveble |
|
||||||
/// - W: updateable (file) |
|
||||||
/// - CK: creatable |
|
||||||
ocPermissions('oc:permissions'), |
|
||||||
|
|
||||||
/// Nextcloud CRUDS permissions: |
|
||||||
/// |
|
||||||
/// - 1: read |
|
||||||
/// - 2: update |
|
||||||
/// - 4: create |
|
||||||
/// - 8: delete |
|
||||||
/// - 16: share |
|
||||||
/// - 31: all |
|
||||||
ocsSharePermissions('ocs:share-permissions'), |
|
||||||
|
|
||||||
/// OCM permissions: |
|
||||||
/// |
|
||||||
/// - share |
|
||||||
/// - read |
|
||||||
/// - write |
|
||||||
ocmSharePermissions('ocm:share-permissions'), |
|
||||||
|
|
||||||
/// system data-fingerprint |
|
||||||
ncDataFingerprint('nc:data-fingerprint'), |
|
||||||
|
|
||||||
/// Whether a preview is available. |
|
||||||
ncHasPreview('nc:has-preview'), |
|
||||||
|
|
||||||
/// Mount type, e.g. global, group, user, personal, shared, shared-root, external |
|
||||||
ncMountType('nc:mount-type'), |
|
||||||
|
|
||||||
/// Is this file is encrypted, 0 for false or 1 for true. |
|
||||||
ncIsEncrypted('nc:is-encrypted'), |
|
||||||
|
|
||||||
// ignore: public_member_api_docs |
|
||||||
ncMetadataETag('nc:metadata_etag'), |
|
||||||
|
|
||||||
/// Date this file was uploaded. |
|
||||||
ncUploadTime('nc:upload_time'), |
|
||||||
|
|
||||||
/// Creation time of the file as provided during upload. |
|
||||||
ncCreationTime('nc:creation_time'), |
|
||||||
|
|
||||||
// ignore: public_member_api_docs |
|
||||||
ncRichWorkspace('nc:rich-workspace'); |
|
||||||
|
|
||||||
// ignore: public_member_api_docs |
|
||||||
const WebDavProps(this.name); |
|
||||||
|
|
||||||
/// Name of the prop |
@annotation.XmlSerializable(createMixin: true) |
||||||
final String name; |
@annotation.XmlRootElement(name: 'prop', namespace: namespaceDav) |
||||||
|
class WebDavProp with _$WebDavPropXmlSerializableMixin { |
||||||
|
WebDavProp({ |
||||||
|
this.davgetlastmodified, |
||||||
|
this.davgetetag, |
||||||
|
this.davgetcontenttype, |
||||||
|
this.davgetcontentlength, |
||||||
|
this.ocid, |
||||||
|
this.ocfileid, |
||||||
|
this.ocfavorite, |
||||||
|
this.occommentshref, |
||||||
|
this.occommentscount, |
||||||
|
this.occommentsunread, |
||||||
|
this.ocdownloadurl, |
||||||
|
this.ocownerid, |
||||||
|
this.ocownerdisplayname, |
||||||
|
this.ocsize, |
||||||
|
this.ocpermissions, |
||||||
|
this.ncnote, |
||||||
|
this.ncdatafingerprint, |
||||||
|
this.nchaspreview, |
||||||
|
this.ncmounttype, |
||||||
|
this.ncisencrypted, |
||||||
|
this.ncmetadataetag, |
||||||
|
this.ncuploadtime, |
||||||
|
this.nccreationtime, |
||||||
|
this.ncrichworkspace, |
||||||
|
this.ocssharepermissions, |
||||||
|
this.ocmsharepermissions, |
||||||
|
}); |
||||||
|
factory WebDavProp.fromXmlElement(final XmlElement element) => _$WebDavPropFromXmlElement(element); |
||||||
|
@annotation.XmlElement(name: 'getlastmodified', namespace: namespaceDav, includeIfNull: false) |
||||||
|
String? davgetlastmodified; |
||||||
|
@annotation.XmlElement(name: 'getetag', namespace: namespaceDav, includeIfNull: false) |
||||||
|
String? davgetetag; |
||||||
|
@annotation.XmlElement(name: 'getcontenttype', namespace: namespaceDav, includeIfNull: false) |
||||||
|
String? davgetcontenttype; |
||||||
|
@annotation.XmlElement(name: 'getcontentlength', namespace: namespaceDav, includeIfNull: false) |
||||||
|
int? davgetcontentlength; |
||||||
|
@annotation.XmlElement(name: 'id', namespace: namespaceOwncloud, includeIfNull: false) |
||||||
|
String? ocid; |
||||||
|
@annotation.XmlElement(name: 'fileid', namespace: namespaceOwncloud, includeIfNull: false) |
||||||
|
String? ocfileid; |
||||||
|
@annotation.XmlElement(name: 'favorite', namespace: namespaceOwncloud, includeIfNull: false) |
||||||
|
int? ocfavorite; |
||||||
|
@annotation.XmlElement(name: 'comments-href', namespace: namespaceOwncloud, includeIfNull: false) |
||||||
|
String? occommentshref; |
||||||
|
@annotation.XmlElement(name: 'comments-count', namespace: namespaceOwncloud, includeIfNull: false) |
||||||
|
int? occommentscount; |
||||||
|
@annotation.XmlElement(name: 'comments-unread', namespace: namespaceOwncloud, includeIfNull: false) |
||||||
|
int? occommentsunread; |
||||||
|
@annotation.XmlElement(name: 'downloadURL', namespace: namespaceOwncloud, includeIfNull: false) |
||||||
|
String? ocdownloadurl; |
||||||
|
@annotation.XmlElement(name: 'owner-id', namespace: namespaceOwncloud, includeIfNull: false) |
||||||
|
String? ocownerid; |
||||||
|
@annotation.XmlElement(name: 'owner-display-name', namespace: namespaceOwncloud, includeIfNull: false) |
||||||
|
String? ocownerdisplayname; |
||||||
|
@annotation.XmlElement(name: 'size', namespace: namespaceOwncloud, includeIfNull: false) |
||||||
|
int? ocsize; |
||||||
|
@annotation.XmlElement(name: 'permissions', namespace: namespaceOwncloud, includeIfNull: false) |
||||||
|
String? ocpermissions; |
||||||
|
@annotation.XmlElement(name: 'note', namespace: namespaceNextcloud, includeIfNull: false) |
||||||
|
String? ncnote; |
||||||
|
@annotation.XmlElement(name: 'data-fingerprint', namespace: namespaceNextcloud, includeIfNull: false) |
||||||
|
String? ncdatafingerprint; |
||||||
|
@annotation.XmlElement(name: 'has-preview', namespace: namespaceNextcloud, includeIfNull: false) |
||||||
|
bool? nchaspreview; |
||||||
|
@annotation.XmlElement(name: 'mount-type', namespace: namespaceNextcloud, includeIfNull: false) |
||||||
|
String? ncmounttype; |
||||||
|
@annotation.XmlElement(name: 'is-encrypted', namespace: namespaceNextcloud, includeIfNull: false) |
||||||
|
int? ncisencrypted; |
||||||
|
@annotation.XmlElement(name: 'metadata_etag', namespace: namespaceNextcloud, includeIfNull: false) |
||||||
|
String? ncmetadataetag; |
||||||
|
@annotation.XmlElement(name: 'upload_time', namespace: namespaceNextcloud, includeIfNull: false) |
||||||
|
int? ncuploadtime; |
||||||
|
@annotation.XmlElement(name: 'creation_time', namespace: namespaceNextcloud, includeIfNull: false) |
||||||
|
int? nccreationtime; |
||||||
|
@annotation.XmlElement(name: 'rich-workspace', namespace: namespaceNextcloud, includeIfNull: false) |
||||||
|
String? ncrichworkspace; |
||||||
|
@annotation.XmlElement(name: 'share-permissions', namespace: namespaceOpenCollaborationServices, includeIfNull: false) |
||||||
|
int? ocssharepermissions; |
||||||
|
@annotation.XmlElement(name: 'share-permissions', namespace: namespaceOpenCloudMesh, includeIfNull: false) |
||||||
|
String? ocmsharepermissions; |
||||||
|
} |
||||||
|
|
||||||
// coverage:ignore-start |
@annotation.XmlSerializable(createMixin: true) |
||||||
@override |
@annotation.XmlRootElement(name: 'filter-rules', namespace: namespaceOwncloud) |
||||||
String toString() => name; |
class WebDavOcFilterRules with _$WebDavOcFilterRulesXmlSerializableMixin { |
||||||
// coverage:ignore-end |
WebDavOcFilterRules({ |
||||||
|
this.davgetlastmodified, |
||||||
|
this.davgetetag, |
||||||
|
this.davgetcontenttype, |
||||||
|
this.davgetcontentlength, |
||||||
|
this.ocid, |
||||||
|
this.ocfileid, |
||||||
|
this.ocfavorite, |
||||||
|
this.occommentshref, |
||||||
|
this.occommentscount, |
||||||
|
this.occommentsunread, |
||||||
|
this.ocdownloadurl, |
||||||
|
this.ocownerid, |
||||||
|
this.ocownerdisplayname, |
||||||
|
this.ocsize, |
||||||
|
this.ocpermissions, |
||||||
|
this.ncnote, |
||||||
|
this.ncdatafingerprint, |
||||||
|
this.nchaspreview, |
||||||
|
this.ncmounttype, |
||||||
|
this.ncisencrypted, |
||||||
|
this.ncmetadataetag, |
||||||
|
this.ncuploadtime, |
||||||
|
this.nccreationtime, |
||||||
|
this.ncrichworkspace, |
||||||
|
this.ocssharepermissions, |
||||||
|
this.ocmsharepermissions, |
||||||
|
}); |
||||||
|
factory WebDavOcFilterRules.fromXmlElement(final XmlElement element) => _$WebDavOcFilterRulesFromXmlElement(element); |
||||||
|
@annotation.XmlElement(name: 'getlastmodified', namespace: namespaceDav, includeIfNull: false) |
||||||
|
String? davgetlastmodified; |
||||||
|
@annotation.XmlElement(name: 'getetag', namespace: namespaceDav, includeIfNull: false) |
||||||
|
String? davgetetag; |
||||||
|
@annotation.XmlElement(name: 'getcontenttype', namespace: namespaceDav, includeIfNull: false) |
||||||
|
String? davgetcontenttype; |
||||||
|
@annotation.XmlElement(name: 'getcontentlength', namespace: namespaceDav, includeIfNull: false) |
||||||
|
int? davgetcontentlength; |
||||||
|
@annotation.XmlElement(name: 'id', namespace: namespaceOwncloud, includeIfNull: false) |
||||||
|
String? ocid; |
||||||
|
@annotation.XmlElement(name: 'fileid', namespace: namespaceOwncloud, includeIfNull: false) |
||||||
|
String? ocfileid; |
||||||
|
@annotation.XmlElement(name: 'favorite', namespace: namespaceOwncloud, includeIfNull: false) |
||||||
|
int? ocfavorite; |
||||||
|
@annotation.XmlElement(name: 'comments-href', namespace: namespaceOwncloud, includeIfNull: false) |
||||||
|
String? occommentshref; |
||||||
|
@annotation.XmlElement(name: 'comments-count', namespace: namespaceOwncloud, includeIfNull: false) |
||||||
|
int? occommentscount; |
||||||
|
@annotation.XmlElement(name: 'comments-unread', namespace: namespaceOwncloud, includeIfNull: false) |
||||||
|
int? occommentsunread; |
||||||
|
@annotation.XmlElement(name: 'downloadURL', namespace: namespaceOwncloud, includeIfNull: false) |
||||||
|
String? ocdownloadurl; |
||||||
|
@annotation.XmlElement(name: 'owner-id', namespace: namespaceOwncloud, includeIfNull: false) |
||||||
|
String? ocownerid; |
||||||
|
@annotation.XmlElement(name: 'owner-display-name', namespace: namespaceOwncloud, includeIfNull: false) |
||||||
|
String? ocownerdisplayname; |
||||||
|
@annotation.XmlElement(name: 'size', namespace: namespaceOwncloud, includeIfNull: false) |
||||||
|
int? ocsize; |
||||||
|
@annotation.XmlElement(name: 'permissions', namespace: namespaceOwncloud, includeIfNull: false) |
||||||
|
String? ocpermissions; |
||||||
|
@annotation.XmlElement(name: 'note', namespace: namespaceNextcloud, includeIfNull: false) |
||||||
|
String? ncnote; |
||||||
|
@annotation.XmlElement(name: 'data-fingerprint', namespace: namespaceNextcloud, includeIfNull: false) |
||||||
|
String? ncdatafingerprint; |
||||||
|
@annotation.XmlElement(name: 'has-preview', namespace: namespaceNextcloud, includeIfNull: false) |
||||||
|
bool? nchaspreview; |
||||||
|
@annotation.XmlElement(name: 'mount-type', namespace: namespaceNextcloud, includeIfNull: false) |
||||||
|
String? ncmounttype; |
||||||
|
@annotation.XmlElement(name: 'is-encrypted', namespace: namespaceNextcloud, includeIfNull: false) |
||||||
|
int? ncisencrypted; |
||||||
|
@annotation.XmlElement(name: 'metadata_etag', namespace: namespaceNextcloud, includeIfNull: false) |
||||||
|
String? ncmetadataetag; |
||||||
|
@annotation.XmlElement(name: 'upload_time', namespace: namespaceNextcloud, includeIfNull: false) |
||||||
|
int? ncuploadtime; |
||||||
|
@annotation.XmlElement(name: 'creation_time', namespace: namespaceNextcloud, includeIfNull: false) |
||||||
|
int? nccreationtime; |
||||||
|
@annotation.XmlElement(name: 'rich-workspace', namespace: namespaceNextcloud, includeIfNull: false) |
||||||
|
String? ncrichworkspace; |
||||||
|
@annotation.XmlElement(name: 'share-permissions', namespace: namespaceOpenCollaborationServices, includeIfNull: false) |
||||||
|
int? ocssharepermissions; |
||||||
|
@annotation.XmlElement(name: 'share-permissions', namespace: namespaceOpenCloudMesh, includeIfNull: false) |
||||||
|
String? ocmsharepermissions; |
||||||
} |
} |
||||||
|
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,137 @@ |
|||||||
|
// ignore_for_file: public_member_api_docs |
||||||
|
|
||||||
|
import 'package:intl/intl.dart'; |
||||||
|
import 'package:nextcloud/src/webdav/props.dart'; |
||||||
|
import 'package:xml/xml.dart'; |
||||||
|
import 'package:xml_annotation/xml_annotation.dart' as annotation; |
||||||
|
|
||||||
|
part 'webdav.g.dart'; |
||||||
|
|
||||||
|
/// Format used in WebDAV |
||||||
|
final webdavDateFormat = DateFormat('E, d MMM yyyy HH:mm:ss', 'en_US'); |
||||||
|
|
||||||
|
const namespaceDav = 'DAV:'; |
||||||
|
const namespaceOwncloud = 'http://owncloud.org/ns'; |
||||||
|
const namespaceNextcloud = 'http://nextcloud.org/ns'; |
||||||
|
const namespaceOpenCollaborationServices = 'http://open-collaboration-services.org/ns'; |
||||||
|
const namespaceOpenCloudMesh = 'http://open-cloud-mesh.org/ns'; |
||||||
|
|
||||||
|
final Map<String, String> namespaces = { |
||||||
|
namespaceDav: 'd', |
||||||
|
namespaceOwncloud: 'oc', |
||||||
|
namespaceNextcloud: 'nc', |
||||||
|
namespaceOpenCollaborationServices: 'ocs', |
||||||
|
namespaceOpenCloudMesh: 'ocm', |
||||||
|
}; |
||||||
|
|
||||||
|
@annotation.XmlSerializable(createMixin: true) |
||||||
|
@annotation.XmlRootElement(name: 'multistatus', namespace: namespaceDav) |
||||||
|
class WebDavMultistatus with _$WebDavMultistatusXmlSerializableMixin { |
||||||
|
WebDavMultistatus({ |
||||||
|
required this.responses, |
||||||
|
}); |
||||||
|
|
||||||
|
factory WebDavMultistatus.fromXmlElement(final XmlElement element) => _$WebDavMultistatusFromXmlElement(element); |
||||||
|
|
||||||
|
@annotation.XmlElement(name: 'response', namespace: namespaceDav) |
||||||
|
final List<WebDavResponse> responses; |
||||||
|
} |
||||||
|
|
||||||
|
@annotation.XmlSerializable(createMixin: true) |
||||||
|
@annotation.XmlRootElement(name: 'response', namespace: namespaceDav) |
||||||
|
class WebDavResponse with _$WebDavResponseXmlSerializableMixin { |
||||||
|
WebDavResponse({ |
||||||
|
required this.href, |
||||||
|
required this.propstats, |
||||||
|
}); |
||||||
|
|
||||||
|
factory WebDavResponse.fromXmlElement(final XmlElement element) => _$WebDavResponseFromXmlElement(element); |
||||||
|
|
||||||
|
@annotation.XmlElement(name: 'href', namespace: namespaceDav) |
||||||
|
final String? href; |
||||||
|
|
||||||
|
@annotation.XmlElement(name: 'propstat', namespace: namespaceDav) |
||||||
|
final List<WebDavPropstat> propstats; |
||||||
|
} |
||||||
|
|
||||||
|
@annotation.XmlSerializable(createMixin: true) |
||||||
|
@annotation.XmlRootElement(name: 'propstat', namespace: namespaceDav) |
||||||
|
class WebDavPropstat with _$WebDavPropstatXmlSerializableMixin { |
||||||
|
WebDavPropstat({ |
||||||
|
required this.status, |
||||||
|
required this.prop, |
||||||
|
}); |
||||||
|
|
||||||
|
factory WebDavPropstat.fromXmlElement(final XmlElement element) => _$WebDavPropstatFromXmlElement(element); |
||||||
|
|
||||||
|
@annotation.XmlElement(name: 'status', namespace: namespaceDav) |
||||||
|
final String status; |
||||||
|
|
||||||
|
@annotation.XmlElement(name: 'prop', namespace: namespaceDav) |
||||||
|
final WebDavProp prop; |
||||||
|
} |
||||||
|
|
||||||
|
@annotation.XmlSerializable(createMixin: true) |
||||||
|
@annotation.XmlRootElement(name: 'propertyupdate', namespace: namespaceDav) |
||||||
|
class WebDavPropertyupdate with _$WebDavPropertyupdateXmlSerializableMixin { |
||||||
|
WebDavPropertyupdate({ |
||||||
|
required this.set, |
||||||
|
}); |
||||||
|
|
||||||
|
factory WebDavPropertyupdate.fromXmlElement(final XmlElement element) => |
||||||
|
_$WebDavPropertyupdateFromXmlElement(element); |
||||||
|
|
||||||
|
@annotation.XmlElement(name: 'set', namespace: namespaceDav) |
||||||
|
final WebDavSet set; |
||||||
|
} |
||||||
|
|
||||||
|
@annotation.XmlSerializable(createMixin: true) |
||||||
|
@annotation.XmlRootElement(name: 'propertyupdate', namespace: namespaceDav) |
||||||
|
class WebDavSet with _$WebDavSetXmlSerializableMixin { |
||||||
|
WebDavSet({ |
||||||
|
required this.prop, |
||||||
|
}); |
||||||
|
|
||||||
|
factory WebDavSet.fromXmlElement(final XmlElement element) => _$WebDavSetFromXmlElement(element); |
||||||
|
|
||||||
|
@annotation.XmlElement(name: 'prop', namespace: namespaceDav) |
||||||
|
final WebDavProp prop; |
||||||
|
} |
||||||
|
|
||||||
|
@annotation.XmlSerializable(createMixin: true) |
||||||
|
@annotation.XmlRootElement(name: 'propfind', namespace: namespaceDav) |
||||||
|
class WebDavPropfind with _$WebDavPropfindXmlSerializableMixin { |
||||||
|
WebDavPropfind({ |
||||||
|
required this.prop, |
||||||
|
}); |
||||||
|
|
||||||
|
factory WebDavPropfind.fromXmlElement(final XmlElement element) => _$WebDavPropfindFromXmlElement(element); |
||||||
|
|
||||||
|
@annotation.XmlElement(name: 'prop', namespace: namespaceDav) |
||||||
|
final WebDavPropfindProp prop; |
||||||
|
} |
||||||
|
|
||||||
|
@annotation.XmlSerializable(createMixin: true) |
||||||
|
@annotation.XmlRootElement(name: 'filter-files', namespace: namespaceOwncloud) |
||||||
|
class WebDavOcFilterFiles with _$WebDavOcFilterFilesXmlSerializableMixin { |
||||||
|
WebDavOcFilterFiles({ |
||||||
|
required this.filterRules, |
||||||
|
required this.prop, |
||||||
|
}); |
||||||
|
|
||||||
|
factory WebDavOcFilterFiles.fromXmlElement(final XmlElement element) => _$WebDavOcFilterFilesFromXmlElement(element); |
||||||
|
|
||||||
|
@annotation.XmlElement(name: 'filter-rules', namespace: namespaceOwncloud) |
||||||
|
final WebDavOcFilterRules filterRules; |
||||||
|
|
||||||
|
@annotation.XmlElement(name: 'prop', namespace: namespaceDav) |
||||||
|
final WebDavPropfindProp prop; |
||||||
|
} |
||||||
|
|
||||||
|
// TODO: d:resourcetype |
||||||
|
// TODO: oc:checksum |
||||||
|
// TODO: oc:tags |
||||||
|
// TODO: oc:systemtag |
||||||
|
// TODO: oc:circle |
||||||
|
// TODO: oc:share-types |
||||||
|
// TODO: nc:sharees |
@ -0,0 +1,477 @@ |
|||||||
|
// GENERATED CODE - DO NOT MODIFY BY HAND |
||||||
|
|
||||||
|
part of 'webdav.dart'; |
||||||
|
|
||||||
|
// ************************************************************************** |
||||||
|
// XmlSerializableGenerator |
||||||
|
// ************************************************************************** |
||||||
|
|
||||||
|
void _$WebDavMultistatusBuildXmlChildren(WebDavMultistatus instance, XmlBuilder builder, |
||||||
|
{Map<String, String> namespaces = const {}}) { |
||||||
|
final responses = instance.responses; |
||||||
|
final responsesSerialized = responses; |
||||||
|
for (final value in responsesSerialized) { |
||||||
|
builder.element('response', namespace: 'DAV:', nest: () { |
||||||
|
value.buildXmlChildren(builder, namespaces: namespaces); |
||||||
|
}); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
void _$WebDavMultistatusBuildXmlElement(WebDavMultistatus instance, XmlBuilder builder, |
||||||
|
{Map<String, String> namespaces = const {}}) { |
||||||
|
builder.element('multistatus', namespace: 'DAV:', namespaces: namespaces, nest: () { |
||||||
|
instance.buildXmlChildren(builder, namespaces: namespaces); |
||||||
|
}); |
||||||
|
} |
||||||
|
|
||||||
|
WebDavMultistatus _$WebDavMultistatusFromXmlElement(XmlElement element) { |
||||||
|
final responses = element.getElements('response', namespace: 'DAV:')!; |
||||||
|
return WebDavMultistatus(responses: responses.map((e) => WebDavResponse.fromXmlElement(e)).toList()); |
||||||
|
} |
||||||
|
|
||||||
|
List<XmlAttribute> _$WebDavMultistatusToXmlAttributes(WebDavMultistatus instance, |
||||||
|
{Map<String, String?> namespaces = const {}}) { |
||||||
|
final attributes = <XmlAttribute>[]; |
||||||
|
return attributes; |
||||||
|
} |
||||||
|
|
||||||
|
List<XmlNode> _$WebDavMultistatusToXmlChildren(WebDavMultistatus instance, |
||||||
|
{Map<String, String?> namespaces = const {}}) { |
||||||
|
final children = <XmlNode>[]; |
||||||
|
final responses = instance.responses; |
||||||
|
final responsesSerialized = responses; |
||||||
|
final responsesConstructed = responsesSerialized.map((e) => XmlElement(XmlName('response', namespaces['DAV:']), |
||||||
|
e.toXmlAttributes(namespaces: namespaces), e.toXmlChildren(namespaces: namespaces))); |
||||||
|
children.addAll(responsesConstructed); |
||||||
|
return children; |
||||||
|
} |
||||||
|
|
||||||
|
XmlElement _$WebDavMultistatusToXmlElement(WebDavMultistatus instance, {Map<String, String?> namespaces = const {}}) { |
||||||
|
return XmlElement( |
||||||
|
XmlName('multistatus', namespaces['DAV:']), |
||||||
|
[...namespaces.toXmlAttributes(), ...instance.toXmlAttributes(namespaces: namespaces)], |
||||||
|
instance.toXmlChildren(namespaces: namespaces)); |
||||||
|
} |
||||||
|
|
||||||
|
mixin _$WebDavMultistatusXmlSerializableMixin { |
||||||
|
void buildXmlChildren(XmlBuilder builder, {Map<String, String> namespaces = const {}}) => |
||||||
|
_$WebDavMultistatusBuildXmlChildren(this as WebDavMultistatus, builder, namespaces: namespaces); |
||||||
|
|
||||||
|
void buildXmlElement(XmlBuilder builder, {Map<String, String> namespaces = const {}}) => |
||||||
|
_$WebDavMultistatusBuildXmlElement(this as WebDavMultistatus, builder, namespaces: namespaces); |
||||||
|
|
||||||
|
List<XmlAttribute> toXmlAttributes({Map<String, String?> namespaces = const {}}) => |
||||||
|
_$WebDavMultistatusToXmlAttributes(this as WebDavMultistatus, namespaces: namespaces); |
||||||
|
|
||||||
|
List<XmlNode> toXmlChildren({Map<String, String?> namespaces = const {}}) => |
||||||
|
_$WebDavMultistatusToXmlChildren(this as WebDavMultistatus, namespaces: namespaces); |
||||||
|
|
||||||
|
XmlElement toXmlElement({Map<String, String?> namespaces = const {}}) => |
||||||
|
_$WebDavMultistatusToXmlElement(this as WebDavMultistatus, namespaces: namespaces); |
||||||
|
} |
||||||
|
|
||||||
|
void _$WebDavResponseBuildXmlChildren(WebDavResponse instance, XmlBuilder builder, |
||||||
|
{Map<String, String> namespaces = const {}}) { |
||||||
|
final href = instance.href; |
||||||
|
final hrefSerialized = href; |
||||||
|
builder.element('href', namespace: 'DAV:', nest: () { |
||||||
|
if (hrefSerialized != null) { |
||||||
|
builder.text(hrefSerialized); |
||||||
|
} |
||||||
|
}); |
||||||
|
final propstats = instance.propstats; |
||||||
|
final propstatsSerialized = propstats; |
||||||
|
for (final value in propstatsSerialized) { |
||||||
|
builder.element('propstat', namespace: 'DAV:', nest: () { |
||||||
|
value.buildXmlChildren(builder, namespaces: namespaces); |
||||||
|
}); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
void _$WebDavResponseBuildXmlElement(WebDavResponse instance, XmlBuilder builder, |
||||||
|
{Map<String, String> namespaces = const {}}) { |
||||||
|
builder.element('response', namespace: 'DAV:', namespaces: namespaces, nest: () { |
||||||
|
instance.buildXmlChildren(builder, namespaces: namespaces); |
||||||
|
}); |
||||||
|
} |
||||||
|
|
||||||
|
WebDavResponse _$WebDavResponseFromXmlElement(XmlElement element) { |
||||||
|
final href = element.getElement('href', namespace: 'DAV:')?.getText(); |
||||||
|
final propstats = element.getElements('propstat', namespace: 'DAV:')!; |
||||||
|
return WebDavResponse(href: href, propstats: propstats.map((e) => WebDavPropstat.fromXmlElement(e)).toList()); |
||||||
|
} |
||||||
|
|
||||||
|
List<XmlAttribute> _$WebDavResponseToXmlAttributes(WebDavResponse instance, |
||||||
|
{Map<String, String?> namespaces = const {}}) { |
||||||
|
final attributes = <XmlAttribute>[]; |
||||||
|
return attributes; |
||||||
|
} |
||||||
|
|
||||||
|
List<XmlNode> _$WebDavResponseToXmlChildren(WebDavResponse instance, {Map<String, String?> namespaces = const {}}) { |
||||||
|
final children = <XmlNode>[]; |
||||||
|
final href = instance.href; |
||||||
|
final hrefSerialized = href; |
||||||
|
final hrefConstructed = |
||||||
|
XmlElement(XmlName('href', namespaces['DAV:']), [], hrefSerialized != null ? [XmlText(hrefSerialized)] : []); |
||||||
|
children.add(hrefConstructed); |
||||||
|
final propstats = instance.propstats; |
||||||
|
final propstatsSerialized = propstats; |
||||||
|
final propstatsConstructed = propstatsSerialized.map((e) => XmlElement(XmlName('propstat', namespaces['DAV:']), |
||||||
|
e.toXmlAttributes(namespaces: namespaces), e.toXmlChildren(namespaces: namespaces))); |
||||||
|
children.addAll(propstatsConstructed); |
||||||
|
return children; |
||||||
|
} |
||||||
|
|
||||||
|
XmlElement _$WebDavResponseToXmlElement(WebDavResponse instance, {Map<String, String?> namespaces = const {}}) { |
||||||
|
return XmlElement( |
||||||
|
XmlName('response', namespaces['DAV:']), |
||||||
|
[...namespaces.toXmlAttributes(), ...instance.toXmlAttributes(namespaces: namespaces)], |
||||||
|
instance.toXmlChildren(namespaces: namespaces)); |
||||||
|
} |
||||||
|
|
||||||
|
mixin _$WebDavResponseXmlSerializableMixin { |
||||||
|
void buildXmlChildren(XmlBuilder builder, {Map<String, String> namespaces = const {}}) => |
||||||
|
_$WebDavResponseBuildXmlChildren(this as WebDavResponse, builder, namespaces: namespaces); |
||||||
|
|
||||||
|
void buildXmlElement(XmlBuilder builder, {Map<String, String> namespaces = const {}}) => |
||||||
|
_$WebDavResponseBuildXmlElement(this as WebDavResponse, builder, namespaces: namespaces); |
||||||
|
|
||||||
|
List<XmlAttribute> toXmlAttributes({Map<String, String?> namespaces = const {}}) => |
||||||
|
_$WebDavResponseToXmlAttributes(this as WebDavResponse, namespaces: namespaces); |
||||||
|
|
||||||
|
List<XmlNode> toXmlChildren({Map<String, String?> namespaces = const {}}) => |
||||||
|
_$WebDavResponseToXmlChildren(this as WebDavResponse, namespaces: namespaces); |
||||||
|
|
||||||
|
XmlElement toXmlElement({Map<String, String?> namespaces = const {}}) => |
||||||
|
_$WebDavResponseToXmlElement(this as WebDavResponse, namespaces: namespaces); |
||||||
|
} |
||||||
|
|
||||||
|
void _$WebDavPropstatBuildXmlChildren(WebDavPropstat instance, XmlBuilder builder, |
||||||
|
{Map<String, String> namespaces = const {}}) { |
||||||
|
final status = instance.status; |
||||||
|
final statusSerialized = status; |
||||||
|
builder.element('status', namespace: 'DAV:', nest: () { |
||||||
|
builder.text(statusSerialized); |
||||||
|
}); |
||||||
|
final prop = instance.prop; |
||||||
|
final propSerialized = prop; |
||||||
|
builder.element('prop', namespace: 'DAV:', nest: () { |
||||||
|
propSerialized.buildXmlChildren(builder, namespaces: namespaces); |
||||||
|
}); |
||||||
|
} |
||||||
|
|
||||||
|
void _$WebDavPropstatBuildXmlElement(WebDavPropstat instance, XmlBuilder builder, |
||||||
|
{Map<String, String> namespaces = const {}}) { |
||||||
|
builder.element('propstat', namespace: 'DAV:', namespaces: namespaces, nest: () { |
||||||
|
instance.buildXmlChildren(builder, namespaces: namespaces); |
||||||
|
}); |
||||||
|
} |
||||||
|
|
||||||
|
WebDavPropstat _$WebDavPropstatFromXmlElement(XmlElement element) { |
||||||
|
final status = element.getElement('status', namespace: 'DAV:')!.getText()!; |
||||||
|
final prop = element.getElement('prop', namespace: 'DAV:')!; |
||||||
|
return WebDavPropstat(status: status, prop: WebDavProp.fromXmlElement(prop)); |
||||||
|
} |
||||||
|
|
||||||
|
List<XmlAttribute> _$WebDavPropstatToXmlAttributes(WebDavPropstat instance, |
||||||
|
{Map<String, String?> namespaces = const {}}) { |
||||||
|
final attributes = <XmlAttribute>[]; |
||||||
|
return attributes; |
||||||
|
} |
||||||
|
|
||||||
|
List<XmlNode> _$WebDavPropstatToXmlChildren(WebDavPropstat instance, {Map<String, String?> namespaces = const {}}) { |
||||||
|
final children = <XmlNode>[]; |
||||||
|
final status = instance.status; |
||||||
|
final statusSerialized = status; |
||||||
|
final statusConstructed = XmlElement(XmlName('status', namespaces['DAV:']), [], [XmlText(statusSerialized)]); |
||||||
|
children.add(statusConstructed); |
||||||
|
final prop = instance.prop; |
||||||
|
final propSerialized = prop; |
||||||
|
final propConstructed = XmlElement(XmlName('prop', namespaces['DAV:']), |
||||||
|
propSerialized.toXmlAttributes(namespaces: namespaces), propSerialized.toXmlChildren(namespaces: namespaces)); |
||||||
|
children.add(propConstructed); |
||||||
|
return children; |
||||||
|
} |
||||||
|
|
||||||
|
XmlElement _$WebDavPropstatToXmlElement(WebDavPropstat instance, {Map<String, String?> namespaces = const {}}) { |
||||||
|
return XmlElement( |
||||||
|
XmlName('propstat', namespaces['DAV:']), |
||||||
|
[...namespaces.toXmlAttributes(), ...instance.toXmlAttributes(namespaces: namespaces)], |
||||||
|
instance.toXmlChildren(namespaces: namespaces)); |
||||||
|
} |
||||||
|
|
||||||
|
mixin _$WebDavPropstatXmlSerializableMixin { |
||||||
|
void buildXmlChildren(XmlBuilder builder, {Map<String, String> namespaces = const {}}) => |
||||||
|
_$WebDavPropstatBuildXmlChildren(this as WebDavPropstat, builder, namespaces: namespaces); |
||||||
|
|
||||||
|
void buildXmlElement(XmlBuilder builder, {Map<String, String> namespaces = const {}}) => |
||||||
|
_$WebDavPropstatBuildXmlElement(this as WebDavPropstat, builder, namespaces: namespaces); |
||||||
|
|
||||||
|
List<XmlAttribute> toXmlAttributes({Map<String, String?> namespaces = const {}}) => |
||||||
|
_$WebDavPropstatToXmlAttributes(this as WebDavPropstat, namespaces: namespaces); |
||||||
|
|
||||||
|
List<XmlNode> toXmlChildren({Map<String, String?> namespaces = const {}}) => |
||||||
|
_$WebDavPropstatToXmlChildren(this as WebDavPropstat, namespaces: namespaces); |
||||||
|
|
||||||
|
XmlElement toXmlElement({Map<String, String?> namespaces = const {}}) => |
||||||
|
_$WebDavPropstatToXmlElement(this as WebDavPropstat, namespaces: namespaces); |
||||||
|
} |
||||||
|
|
||||||
|
void _$WebDavPropertyupdateBuildXmlChildren(WebDavPropertyupdate instance, XmlBuilder builder, |
||||||
|
{Map<String, String> namespaces = const {}}) { |
||||||
|
final set = instance.set; |
||||||
|
final setSerialized = set; |
||||||
|
builder.element('set', namespace: 'DAV:', nest: () { |
||||||
|
setSerialized.buildXmlChildren(builder, namespaces: namespaces); |
||||||
|
}); |
||||||
|
} |
||||||
|
|
||||||
|
void _$WebDavPropertyupdateBuildXmlElement(WebDavPropertyupdate instance, XmlBuilder builder, |
||||||
|
{Map<String, String> namespaces = const {}}) { |
||||||
|
builder.element('propertyupdate', namespace: 'DAV:', namespaces: namespaces, nest: () { |
||||||
|
instance.buildXmlChildren(builder, namespaces: namespaces); |
||||||
|
}); |
||||||
|
} |
||||||
|
|
||||||
|
WebDavPropertyupdate _$WebDavPropertyupdateFromXmlElement(XmlElement element) { |
||||||
|
final set = element.getElement('set', namespace: 'DAV:')!; |
||||||
|
return WebDavPropertyupdate(set: WebDavSet.fromXmlElement(set)); |
||||||
|
} |
||||||
|
|
||||||
|
List<XmlAttribute> _$WebDavPropertyupdateToXmlAttributes(WebDavPropertyupdate instance, |
||||||
|
{Map<String, String?> namespaces = const {}}) { |
||||||
|
final attributes = <XmlAttribute>[]; |
||||||
|
return attributes; |
||||||
|
} |
||||||
|
|
||||||
|
List<XmlNode> _$WebDavPropertyupdateToXmlChildren(WebDavPropertyupdate instance, |
||||||
|
{Map<String, String?> namespaces = const {}}) { |
||||||
|
final children = <XmlNode>[]; |
||||||
|
final set = instance.set; |
||||||
|
final setSerialized = set; |
||||||
|
final setConstructed = XmlElement(XmlName('set', namespaces['DAV:']), |
||||||
|
setSerialized.toXmlAttributes(namespaces: namespaces), setSerialized.toXmlChildren(namespaces: namespaces)); |
||||||
|
children.add(setConstructed); |
||||||
|
return children; |
||||||
|
} |
||||||
|
|
||||||
|
XmlElement _$WebDavPropertyupdateToXmlElement(WebDavPropertyupdate instance, |
||||||
|
{Map<String, String?> namespaces = const {}}) { |
||||||
|
return XmlElement( |
||||||
|
XmlName('propertyupdate', namespaces['DAV:']), |
||||||
|
[...namespaces.toXmlAttributes(), ...instance.toXmlAttributes(namespaces: namespaces)], |
||||||
|
instance.toXmlChildren(namespaces: namespaces)); |
||||||
|
} |
||||||
|
|
||||||
|
mixin _$WebDavPropertyupdateXmlSerializableMixin { |
||||||
|
void buildXmlChildren(XmlBuilder builder, {Map<String, String> namespaces = const {}}) => |
||||||
|
_$WebDavPropertyupdateBuildXmlChildren(this as WebDavPropertyupdate, builder, namespaces: namespaces); |
||||||
|
|
||||||
|
void buildXmlElement(XmlBuilder builder, {Map<String, String> namespaces = const {}}) => |
||||||
|
_$WebDavPropertyupdateBuildXmlElement(this as WebDavPropertyupdate, builder, namespaces: namespaces); |
||||||
|
|
||||||
|
List<XmlAttribute> toXmlAttributes({Map<String, String?> namespaces = const {}}) => |
||||||
|
_$WebDavPropertyupdateToXmlAttributes(this as WebDavPropertyupdate, namespaces: namespaces); |
||||||
|
|
||||||
|
List<XmlNode> toXmlChildren({Map<String, String?> namespaces = const {}}) => |
||||||
|
_$WebDavPropertyupdateToXmlChildren(this as WebDavPropertyupdate, namespaces: namespaces); |
||||||
|
|
||||||
|
XmlElement toXmlElement({Map<String, String?> namespaces = const {}}) => |
||||||
|
_$WebDavPropertyupdateToXmlElement(this as WebDavPropertyupdate, namespaces: namespaces); |
||||||
|
} |
||||||
|
|
||||||
|
void _$WebDavSetBuildXmlChildren(WebDavSet instance, XmlBuilder builder, {Map<String, String> namespaces = const {}}) { |
||||||
|
final prop = instance.prop; |
||||||
|
final propSerialized = prop; |
||||||
|
builder.element('prop', namespace: 'DAV:', nest: () { |
||||||
|
propSerialized.buildXmlChildren(builder, namespaces: namespaces); |
||||||
|
}); |
||||||
|
} |
||||||
|
|
||||||
|
void _$WebDavSetBuildXmlElement(WebDavSet instance, XmlBuilder builder, {Map<String, String> namespaces = const {}}) { |
||||||
|
builder.element('propertyupdate', namespace: 'DAV:', namespaces: namespaces, nest: () { |
||||||
|
instance.buildXmlChildren(builder, namespaces: namespaces); |
||||||
|
}); |
||||||
|
} |
||||||
|
|
||||||
|
WebDavSet _$WebDavSetFromXmlElement(XmlElement element) { |
||||||
|
final prop = element.getElement('prop', namespace: 'DAV:')!; |
||||||
|
return WebDavSet(prop: WebDavProp.fromXmlElement(prop)); |
||||||
|
} |
||||||
|
|
||||||
|
List<XmlAttribute> _$WebDavSetToXmlAttributes(WebDavSet instance, {Map<String, String?> namespaces = const {}}) { |
||||||
|
final attributes = <XmlAttribute>[]; |
||||||
|
return attributes; |
||||||
|
} |
||||||
|
|
||||||
|
List<XmlNode> _$WebDavSetToXmlChildren(WebDavSet instance, {Map<String, String?> namespaces = const {}}) { |
||||||
|
final children = <XmlNode>[]; |
||||||
|
final prop = instance.prop; |
||||||
|
final propSerialized = prop; |
||||||
|
final propConstructed = XmlElement(XmlName('prop', namespaces['DAV:']), |
||||||
|
propSerialized.toXmlAttributes(namespaces: namespaces), propSerialized.toXmlChildren(namespaces: namespaces)); |
||||||
|
children.add(propConstructed); |
||||||
|
return children; |
||||||
|
} |
||||||
|
|
||||||
|
XmlElement _$WebDavSetToXmlElement(WebDavSet instance, {Map<String, String?> namespaces = const {}}) { |
||||||
|
return XmlElement( |
||||||
|
XmlName('propertyupdate', namespaces['DAV:']), |
||||||
|
[...namespaces.toXmlAttributes(), ...instance.toXmlAttributes(namespaces: namespaces)], |
||||||
|
instance.toXmlChildren(namespaces: namespaces)); |
||||||
|
} |
||||||
|
|
||||||
|
mixin _$WebDavSetXmlSerializableMixin { |
||||||
|
void buildXmlChildren(XmlBuilder builder, {Map<String, String> namespaces = const {}}) => |
||||||
|
_$WebDavSetBuildXmlChildren(this as WebDavSet, builder, namespaces: namespaces); |
||||||
|
|
||||||
|
void buildXmlElement(XmlBuilder builder, {Map<String, String> namespaces = const {}}) => |
||||||
|
_$WebDavSetBuildXmlElement(this as WebDavSet, builder, namespaces: namespaces); |
||||||
|
|
||||||
|
List<XmlAttribute> toXmlAttributes({Map<String, String?> namespaces = const {}}) => |
||||||
|
_$WebDavSetToXmlAttributes(this as WebDavSet, namespaces: namespaces); |
||||||
|
|
||||||
|
List<XmlNode> toXmlChildren({Map<String, String?> namespaces = const {}}) => |
||||||
|
_$WebDavSetToXmlChildren(this as WebDavSet, namespaces: namespaces); |
||||||
|
|
||||||
|
XmlElement toXmlElement({Map<String, String?> namespaces = const {}}) => |
||||||
|
_$WebDavSetToXmlElement(this as WebDavSet, namespaces: namespaces); |
||||||
|
} |
||||||
|
|
||||||
|
void _$WebDavPropfindBuildXmlChildren(WebDavPropfind instance, XmlBuilder builder, |
||||||
|
{Map<String, String> namespaces = const {}}) { |
||||||
|
final prop = instance.prop; |
||||||
|
final propSerialized = prop; |
||||||
|
builder.element('prop', namespace: 'DAV:', nest: () { |
||||||
|
propSerialized.buildXmlChildren(builder, namespaces: namespaces); |
||||||
|
}); |
||||||
|
} |
||||||
|
|
||||||
|
void _$WebDavPropfindBuildXmlElement(WebDavPropfind instance, XmlBuilder builder, |
||||||
|
{Map<String, String> namespaces = const {}}) { |
||||||
|
builder.element('propfind', namespace: 'DAV:', namespaces: namespaces, nest: () { |
||||||
|
instance.buildXmlChildren(builder, namespaces: namespaces); |
||||||
|
}); |
||||||
|
} |
||||||
|
|
||||||
|
WebDavPropfind _$WebDavPropfindFromXmlElement(XmlElement element) { |
||||||
|
final prop = element.getElement('prop', namespace: 'DAV:')!; |
||||||
|
return WebDavPropfind(prop: WebDavPropfindProp.fromXmlElement(prop)); |
||||||
|
} |
||||||
|
|
||||||
|
List<XmlAttribute> _$WebDavPropfindToXmlAttributes(WebDavPropfind instance, |
||||||
|
{Map<String, String?> namespaces = const {}}) { |
||||||
|
final attributes = <XmlAttribute>[]; |
||||||
|
return attributes; |
||||||
|
} |
||||||
|
|
||||||
|
List<XmlNode> _$WebDavPropfindToXmlChildren(WebDavPropfind instance, {Map<String, String?> namespaces = const {}}) { |
||||||
|
final children = <XmlNode>[]; |
||||||
|
final prop = instance.prop; |
||||||
|
final propSerialized = prop; |
||||||
|
final propConstructed = XmlElement(XmlName('prop', namespaces['DAV:']), |
||||||
|
propSerialized.toXmlAttributes(namespaces: namespaces), propSerialized.toXmlChildren(namespaces: namespaces)); |
||||||
|
children.add(propConstructed); |
||||||
|
return children; |
||||||
|
} |
||||||
|
|
||||||
|
XmlElement _$WebDavPropfindToXmlElement(WebDavPropfind instance, {Map<String, String?> namespaces = const {}}) { |
||||||
|
return XmlElement( |
||||||
|
XmlName('propfind', namespaces['DAV:']), |
||||||
|
[...namespaces.toXmlAttributes(), ...instance.toXmlAttributes(namespaces: namespaces)], |
||||||
|
instance.toXmlChildren(namespaces: namespaces)); |
||||||
|
} |
||||||
|
|
||||||
|
mixin _$WebDavPropfindXmlSerializableMixin { |
||||||
|
void buildXmlChildren(XmlBuilder builder, {Map<String, String> namespaces = const {}}) => |
||||||
|
_$WebDavPropfindBuildXmlChildren(this as WebDavPropfind, builder, namespaces: namespaces); |
||||||
|
|
||||||
|
void buildXmlElement(XmlBuilder builder, {Map<String, String> namespaces = const {}}) => |
||||||
|
_$WebDavPropfindBuildXmlElement(this as WebDavPropfind, builder, namespaces: namespaces); |
||||||
|
|
||||||
|
List<XmlAttribute> toXmlAttributes({Map<String, String?> namespaces = const {}}) => |
||||||
|
_$WebDavPropfindToXmlAttributes(this as WebDavPropfind, namespaces: namespaces); |
||||||
|
|
||||||
|
List<XmlNode> toXmlChildren({Map<String, String?> namespaces = const {}}) => |
||||||
|
_$WebDavPropfindToXmlChildren(this as WebDavPropfind, namespaces: namespaces); |
||||||
|
|
||||||
|
XmlElement toXmlElement({Map<String, String?> namespaces = const {}}) => |
||||||
|
_$WebDavPropfindToXmlElement(this as WebDavPropfind, namespaces: namespaces); |
||||||
|
} |
||||||
|
|
||||||
|
void _$WebDavOcFilterFilesBuildXmlChildren(WebDavOcFilterFiles instance, XmlBuilder builder, |
||||||
|
{Map<String, String> namespaces = const {}}) { |
||||||
|
final filterRules = instance.filterRules; |
||||||
|
final filterRulesSerialized = filterRules; |
||||||
|
builder.element('filter-rules', namespace: 'http://owncloud.org/ns', nest: () { |
||||||
|
filterRulesSerialized.buildXmlChildren(builder, namespaces: namespaces); |
||||||
|
}); |
||||||
|
final prop = instance.prop; |
||||||
|
final propSerialized = prop; |
||||||
|
builder.element('prop', namespace: 'DAV:', nest: () { |
||||||
|
propSerialized.buildXmlChildren(builder, namespaces: namespaces); |
||||||
|
}); |
||||||
|
} |
||||||
|
|
||||||
|
void _$WebDavOcFilterFilesBuildXmlElement(WebDavOcFilterFiles instance, XmlBuilder builder, |
||||||
|
{Map<String, String> namespaces = const {}}) { |
||||||
|
builder.element('filter-files', namespace: 'http://owncloud.org/ns', namespaces: namespaces, nest: () { |
||||||
|
instance.buildXmlChildren(builder, namespaces: namespaces); |
||||||
|
}); |
||||||
|
} |
||||||
|
|
||||||
|
WebDavOcFilterFiles _$WebDavOcFilterFilesFromXmlElement(XmlElement element) { |
||||||
|
final filterRules = element.getElement('filter-rules', namespace: 'http://owncloud.org/ns')!; |
||||||
|
final prop = element.getElement('prop', namespace: 'DAV:')!; |
||||||
|
return WebDavOcFilterFiles( |
||||||
|
filterRules: WebDavOcFilterRules.fromXmlElement(filterRules), prop: WebDavPropfindProp.fromXmlElement(prop)); |
||||||
|
} |
||||||
|
|
||||||
|
List<XmlAttribute> _$WebDavOcFilterFilesToXmlAttributes(WebDavOcFilterFiles instance, |
||||||
|
{Map<String, String?> namespaces = const {}}) { |
||||||
|
final attributes = <XmlAttribute>[]; |
||||||
|
return attributes; |
||||||
|
} |
||||||
|
|
||||||
|
List<XmlNode> _$WebDavOcFilterFilesToXmlChildren(WebDavOcFilterFiles instance, |
||||||
|
{Map<String, String?> namespaces = const {}}) { |
||||||
|
final children = <XmlNode>[]; |
||||||
|
final filterRules = instance.filterRules; |
||||||
|
final filterRulesSerialized = filterRules; |
||||||
|
final filterRulesConstructed = XmlElement( |
||||||
|
XmlName('filter-rules', namespaces['http://owncloud.org/ns']), |
||||||
|
filterRulesSerialized.toXmlAttributes(namespaces: namespaces), |
||||||
|
filterRulesSerialized.toXmlChildren(namespaces: namespaces)); |
||||||
|
children.add(filterRulesConstructed); |
||||||
|
final prop = instance.prop; |
||||||
|
final propSerialized = prop; |
||||||
|
final propConstructed = XmlElement(XmlName('prop', namespaces['DAV:']), |
||||||
|
propSerialized.toXmlAttributes(namespaces: namespaces), propSerialized.toXmlChildren(namespaces: namespaces)); |
||||||
|
children.add(propConstructed); |
||||||
|
return children; |
||||||
|
} |
||||||
|
|
||||||
|
XmlElement _$WebDavOcFilterFilesToXmlElement(WebDavOcFilterFiles instance, |
||||||
|
{Map<String, String?> namespaces = const {}}) { |
||||||
|
return XmlElement( |
||||||
|
XmlName('filter-files', namespaces['http://owncloud.org/ns']), |
||||||
|
[...namespaces.toXmlAttributes(), ...instance.toXmlAttributes(namespaces: namespaces)], |
||||||
|
instance.toXmlChildren(namespaces: namespaces)); |
||||||
|
} |
||||||
|
|
||||||
|
mixin _$WebDavOcFilterFilesXmlSerializableMixin { |
||||||
|
void buildXmlChildren(XmlBuilder builder, {Map<String, String> namespaces = const {}}) => |
||||||
|
_$WebDavOcFilterFilesBuildXmlChildren(this as WebDavOcFilterFiles, builder, namespaces: namespaces); |
||||||
|
|
||||||
|
void buildXmlElement(XmlBuilder builder, {Map<String, String> namespaces = const {}}) => |
||||||
|
_$WebDavOcFilterFilesBuildXmlElement(this as WebDavOcFilterFiles, builder, namespaces: namespaces); |
||||||
|
|
||||||
|
List<XmlAttribute> toXmlAttributes({Map<String, String?> namespaces = const {}}) => |
||||||
|
_$WebDavOcFilterFilesToXmlAttributes(this as WebDavOcFilterFiles, namespaces: namespaces); |
||||||
|
|
||||||
|
List<XmlNode> toXmlChildren({Map<String, String?> namespaces = const {}}) => |
||||||
|
_$WebDavOcFilterFilesToXmlChildren(this as WebDavOcFilterFiles, namespaces: namespaces); |
||||||
|
|
||||||
|
XmlElement toXmlElement({Map<String, String?> namespaces = const {}}) => |
||||||
|
_$WebDavOcFilterFilesToXmlElement(this as WebDavOcFilterFiles, namespaces: namespaces); |
||||||
|
} |
Loading…
Reference in new issue