From eeaa3c65be9419ed12b6302132e9ff7337a44313 Mon Sep 17 00:00:00 2001 From: jld3103 Date: Sun, 23 Apr 2023 17:40:45 +0200 Subject: [PATCH] nextcloud: Format generated props --- packages/nextcloud/bin/generate_props.dart | 19 +- packages/nextcloud/lib/src/webdav/props.dart | 567 ++++++++++++++++--- 2 files changed, 495 insertions(+), 91 deletions(-) diff --git a/packages/nextcloud/bin/generate_props.dart b/packages/nextcloud/bin/generate_props.dart index c2ae19fc..d9b467cd 100644 --- a/packages/nextcloud/bin/generate_props.dart +++ b/packages/nextcloud/bin/generate_props.dart @@ -11,14 +11,12 @@ void main() { 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;', - ]); + valueProps.add( + "@annotation.XmlElement(name: '$name', namespace: $namespaceVariable, includeIfNull: false,)\n $type? $variable;", + ); + findProps.add( + "@annotation.XmlElement(name: '$name', namespace: $namespaceVariable, includeIfNull: false,)\n bool? $variable;", + ); variables.add(variable); } File('lib/src/webdav/props.dart').writeAsStringSync( @@ -32,6 +30,7 @@ void main() { ...generateClass('WebDavPropfindProp', 'prop', 'namespaceDav', findProps, variables), ...generateClass('WebDavProp', 'prop', 'namespaceDav', valueProps, variables), ...generateClass('WebDavOcFilterRules', 'filter-rules', 'namespaceOwncloud', valueProps, variables), + '', ].join('\n'), ); } @@ -48,10 +47,10 @@ List generateClass( "@annotation.XmlRootElement(name: '$elementName', namespace: $namespace)", 'class $name with _\$${name}XmlSerializableMixin {', ' $name({', - ...variables.map((final variable) => ' this.$variable,'), + ...variables.map((final variable) => ' this.$variable,'), ' });', ' factory $name.fromXmlElement(final XmlElement element) => _\$${name}FromXmlElement(element);', - ...props.map((final prop) => ' $prop'), + ...props.map((final prop) => '\n $prop'), '}', ]; diff --git a/packages/nextcloud/lib/src/webdav/props.dart b/packages/nextcloud/lib/src/webdav/props.dart index 092f22b0..80a4f8ce 100644 --- a/packages/nextcloud/lib/src/webdav/props.dart +++ b/packages/nextcloud/lib/src/webdav/props.dart @@ -37,59 +37,194 @@ class WebDavPropfindProp with _$WebDavPropfindPropXmlSerializableMixin { this.ocmsharepermissions, }); factory WebDavPropfindProp.fromXmlElement(final XmlElement element) => _$WebDavPropfindPropFromXmlElement(element); - @annotation.XmlElement(name: 'getlastmodified', namespace: namespaceDav, includeIfNull: false) + + @annotation.XmlElement( + name: 'getlastmodified', + namespace: namespaceDav, + includeIfNull: false, + ) bool? davgetlastmodified; - @annotation.XmlElement(name: 'getetag', namespace: namespaceDav, includeIfNull: false) + + @annotation.XmlElement( + name: 'getetag', + namespace: namespaceDav, + includeIfNull: false, + ) bool? davgetetag; - @annotation.XmlElement(name: 'getcontenttype', namespace: namespaceDav, includeIfNull: false) + + @annotation.XmlElement( + name: 'getcontenttype', + namespace: namespaceDav, + includeIfNull: false, + ) bool? davgetcontenttype; - @annotation.XmlElement(name: 'getcontentlength', namespace: namespaceDav, includeIfNull: false) + + @annotation.XmlElement( + name: 'getcontentlength', + namespace: namespaceDav, + includeIfNull: false, + ) bool? davgetcontentlength; - @annotation.XmlElement(name: 'resourcetype', namespace: namespaceDav, includeIfNull: false) + + @annotation.XmlElement( + name: 'resourcetype', + namespace: namespaceDav, + includeIfNull: false, + ) bool? davresourcetype; - @annotation.XmlElement(name: 'id', namespace: namespaceOwncloud, includeIfNull: false) + + @annotation.XmlElement( + name: 'id', + namespace: namespaceOwncloud, + includeIfNull: false, + ) bool? ocid; - @annotation.XmlElement(name: 'fileid', namespace: namespaceOwncloud, includeIfNull: false) + + @annotation.XmlElement( + name: 'fileid', + namespace: namespaceOwncloud, + includeIfNull: false, + ) bool? ocfileid; - @annotation.XmlElement(name: 'favorite', namespace: namespaceOwncloud, includeIfNull: false) + + @annotation.XmlElement( + name: 'favorite', + namespace: namespaceOwncloud, + includeIfNull: false, + ) bool? ocfavorite; - @annotation.XmlElement(name: 'comments-href', namespace: namespaceOwncloud, includeIfNull: false) + + @annotation.XmlElement( + name: 'comments-href', + namespace: namespaceOwncloud, + includeIfNull: false, + ) bool? occommentshref; - @annotation.XmlElement(name: 'comments-count', namespace: namespaceOwncloud, includeIfNull: false) + + @annotation.XmlElement( + name: 'comments-count', + namespace: namespaceOwncloud, + includeIfNull: false, + ) bool? occommentscount; - @annotation.XmlElement(name: 'comments-unread', namespace: namespaceOwncloud, includeIfNull: false) + + @annotation.XmlElement( + name: 'comments-unread', + namespace: namespaceOwncloud, + includeIfNull: false, + ) bool? occommentsunread; - @annotation.XmlElement(name: 'downloadURL', namespace: namespaceOwncloud, includeIfNull: false) + + @annotation.XmlElement( + name: 'downloadURL', + namespace: namespaceOwncloud, + includeIfNull: false, + ) bool? ocdownloadurl; - @annotation.XmlElement(name: 'owner-id', namespace: namespaceOwncloud, includeIfNull: false) + + @annotation.XmlElement( + name: 'owner-id', + namespace: namespaceOwncloud, + includeIfNull: false, + ) bool? ocownerid; - @annotation.XmlElement(name: 'owner-display-name', namespace: namespaceOwncloud, includeIfNull: false) + + @annotation.XmlElement( + name: 'owner-display-name', + namespace: namespaceOwncloud, + includeIfNull: false, + ) bool? ocownerdisplayname; - @annotation.XmlElement(name: 'size', namespace: namespaceOwncloud, includeIfNull: false) + + @annotation.XmlElement( + name: 'size', + namespace: namespaceOwncloud, + includeIfNull: false, + ) bool? ocsize; - @annotation.XmlElement(name: 'permissions', namespace: namespaceOwncloud, includeIfNull: false) + + @annotation.XmlElement( + name: 'permissions', + namespace: namespaceOwncloud, + includeIfNull: false, + ) bool? ocpermissions; - @annotation.XmlElement(name: 'note', namespace: namespaceNextcloud, includeIfNull: false) + + @annotation.XmlElement( + name: 'note', + namespace: namespaceNextcloud, + includeIfNull: false, + ) bool? ncnote; - @annotation.XmlElement(name: 'data-fingerprint', namespace: namespaceNextcloud, includeIfNull: false) + + @annotation.XmlElement( + name: 'data-fingerprint', + namespace: namespaceNextcloud, + includeIfNull: false, + ) bool? ncdatafingerprint; - @annotation.XmlElement(name: 'has-preview', namespace: namespaceNextcloud, includeIfNull: false) + + @annotation.XmlElement( + name: 'has-preview', + namespace: namespaceNextcloud, + includeIfNull: false, + ) bool? nchaspreview; - @annotation.XmlElement(name: 'mount-type', namespace: namespaceNextcloud, includeIfNull: false) + + @annotation.XmlElement( + name: 'mount-type', + namespace: namespaceNextcloud, + includeIfNull: false, + ) bool? ncmounttype; - @annotation.XmlElement(name: 'is-encrypted', namespace: namespaceNextcloud, includeIfNull: false) + + @annotation.XmlElement( + name: 'is-encrypted', + namespace: namespaceNextcloud, + includeIfNull: false, + ) bool? ncisencrypted; - @annotation.XmlElement(name: 'metadata_etag', namespace: namespaceNextcloud, includeIfNull: false) + + @annotation.XmlElement( + name: 'metadata_etag', + namespace: namespaceNextcloud, + includeIfNull: false, + ) bool? ncmetadataetag; - @annotation.XmlElement(name: 'upload_time', namespace: namespaceNextcloud, includeIfNull: false) + + @annotation.XmlElement( + name: 'upload_time', + namespace: namespaceNextcloud, + includeIfNull: false, + ) bool? ncuploadtime; - @annotation.XmlElement(name: 'creation_time', namespace: namespaceNextcloud, includeIfNull: false) + + @annotation.XmlElement( + name: 'creation_time', + namespace: namespaceNextcloud, + includeIfNull: false, + ) bool? nccreationtime; - @annotation.XmlElement(name: 'rich-workspace', namespace: namespaceNextcloud, includeIfNull: false) + + @annotation.XmlElement( + name: 'rich-workspace', + namespace: namespaceNextcloud, + includeIfNull: false, + ) bool? ncrichworkspace; - @annotation.XmlElement(name: 'share-permissions', namespace: namespaceOpenCollaborationServices, includeIfNull: false) + + @annotation.XmlElement( + name: 'share-permissions', + namespace: namespaceOpenCollaborationServices, + includeIfNull: false, + ) bool? ocssharepermissions; - @annotation.XmlElement(name: 'share-permissions', namespace: namespaceOpenCloudMesh, includeIfNull: false) + + @annotation.XmlElement( + name: 'share-permissions', + namespace: namespaceOpenCloudMesh, + includeIfNull: false, + ) bool? ocmsharepermissions; } @@ -126,59 +261,194 @@ class WebDavProp with _$WebDavPropXmlSerializableMixin { this.ocmsharepermissions, }); factory WebDavProp.fromXmlElement(final XmlElement element) => _$WebDavPropFromXmlElement(element); - @annotation.XmlElement(name: 'getlastmodified', namespace: namespaceDav, includeIfNull: false) + + @annotation.XmlElement( + name: 'getlastmodified', + namespace: namespaceDav, + includeIfNull: false, + ) String? davgetlastmodified; - @annotation.XmlElement(name: 'getetag', namespace: namespaceDav, includeIfNull: false) + + @annotation.XmlElement( + name: 'getetag', + namespace: namespaceDav, + includeIfNull: false, + ) String? davgetetag; - @annotation.XmlElement(name: 'getcontenttype', namespace: namespaceDav, includeIfNull: false) + + @annotation.XmlElement( + name: 'getcontenttype', + namespace: namespaceDav, + includeIfNull: false, + ) String? davgetcontenttype; - @annotation.XmlElement(name: 'getcontentlength', namespace: namespaceDav, includeIfNull: false) + + @annotation.XmlElement( + name: 'getcontentlength', + namespace: namespaceDav, + includeIfNull: false, + ) int? davgetcontentlength; - @annotation.XmlElement(name: 'resourcetype', namespace: namespaceDav, includeIfNull: false) + + @annotation.XmlElement( + name: 'resourcetype', + namespace: namespaceDav, + includeIfNull: false, + ) WebDavResourcetype? davresourcetype; - @annotation.XmlElement(name: 'id', namespace: namespaceOwncloud, includeIfNull: false) + + @annotation.XmlElement( + name: 'id', + namespace: namespaceOwncloud, + includeIfNull: false, + ) String? ocid; - @annotation.XmlElement(name: 'fileid', namespace: namespaceOwncloud, includeIfNull: false) + + @annotation.XmlElement( + name: 'fileid', + namespace: namespaceOwncloud, + includeIfNull: false, + ) String? ocfileid; - @annotation.XmlElement(name: 'favorite', namespace: namespaceOwncloud, includeIfNull: false) + + @annotation.XmlElement( + name: 'favorite', + namespace: namespaceOwncloud, + includeIfNull: false, + ) int? ocfavorite; - @annotation.XmlElement(name: 'comments-href', namespace: namespaceOwncloud, includeIfNull: false) + + @annotation.XmlElement( + name: 'comments-href', + namespace: namespaceOwncloud, + includeIfNull: false, + ) String? occommentshref; - @annotation.XmlElement(name: 'comments-count', namespace: namespaceOwncloud, includeIfNull: false) + + @annotation.XmlElement( + name: 'comments-count', + namespace: namespaceOwncloud, + includeIfNull: false, + ) int? occommentscount; - @annotation.XmlElement(name: 'comments-unread', namespace: namespaceOwncloud, includeIfNull: false) + + @annotation.XmlElement( + name: 'comments-unread', + namespace: namespaceOwncloud, + includeIfNull: false, + ) int? occommentsunread; - @annotation.XmlElement(name: 'downloadURL', namespace: namespaceOwncloud, includeIfNull: false) + + @annotation.XmlElement( + name: 'downloadURL', + namespace: namespaceOwncloud, + includeIfNull: false, + ) String? ocdownloadurl; - @annotation.XmlElement(name: 'owner-id', namespace: namespaceOwncloud, includeIfNull: false) + + @annotation.XmlElement( + name: 'owner-id', + namespace: namespaceOwncloud, + includeIfNull: false, + ) String? ocownerid; - @annotation.XmlElement(name: 'owner-display-name', namespace: namespaceOwncloud, includeIfNull: false) + + @annotation.XmlElement( + name: 'owner-display-name', + namespace: namespaceOwncloud, + includeIfNull: false, + ) String? ocownerdisplayname; - @annotation.XmlElement(name: 'size', namespace: namespaceOwncloud, includeIfNull: false) + + @annotation.XmlElement( + name: 'size', + namespace: namespaceOwncloud, + includeIfNull: false, + ) int? ocsize; - @annotation.XmlElement(name: 'permissions', namespace: namespaceOwncloud, includeIfNull: false) + + @annotation.XmlElement( + name: 'permissions', + namespace: namespaceOwncloud, + includeIfNull: false, + ) String? ocpermissions; - @annotation.XmlElement(name: 'note', namespace: namespaceNextcloud, includeIfNull: false) + + @annotation.XmlElement( + name: 'note', + namespace: namespaceNextcloud, + includeIfNull: false, + ) String? ncnote; - @annotation.XmlElement(name: 'data-fingerprint', namespace: namespaceNextcloud, includeIfNull: false) + + @annotation.XmlElement( + name: 'data-fingerprint', + namespace: namespaceNextcloud, + includeIfNull: false, + ) String? ncdatafingerprint; - @annotation.XmlElement(name: 'has-preview', namespace: namespaceNextcloud, includeIfNull: false) + + @annotation.XmlElement( + name: 'has-preview', + namespace: namespaceNextcloud, + includeIfNull: false, + ) bool? nchaspreview; - @annotation.XmlElement(name: 'mount-type', namespace: namespaceNextcloud, includeIfNull: false) + + @annotation.XmlElement( + name: 'mount-type', + namespace: namespaceNextcloud, + includeIfNull: false, + ) String? ncmounttype; - @annotation.XmlElement(name: 'is-encrypted', namespace: namespaceNextcloud, includeIfNull: false) + + @annotation.XmlElement( + name: 'is-encrypted', + namespace: namespaceNextcloud, + includeIfNull: false, + ) int? ncisencrypted; - @annotation.XmlElement(name: 'metadata_etag', namespace: namespaceNextcloud, includeIfNull: false) + + @annotation.XmlElement( + name: 'metadata_etag', + namespace: namespaceNextcloud, + includeIfNull: false, + ) String? ncmetadataetag; - @annotation.XmlElement(name: 'upload_time', namespace: namespaceNextcloud, includeIfNull: false) + + @annotation.XmlElement( + name: 'upload_time', + namespace: namespaceNextcloud, + includeIfNull: false, + ) int? ncuploadtime; - @annotation.XmlElement(name: 'creation_time', namespace: namespaceNextcloud, includeIfNull: false) + + @annotation.XmlElement( + name: 'creation_time', + namespace: namespaceNextcloud, + includeIfNull: false, + ) int? nccreationtime; - @annotation.XmlElement(name: 'rich-workspace', namespace: namespaceNextcloud, includeIfNull: false) + + @annotation.XmlElement( + name: 'rich-workspace', + namespace: namespaceNextcloud, + includeIfNull: false, + ) String? ncrichworkspace; - @annotation.XmlElement(name: 'share-permissions', namespace: namespaceOpenCollaborationServices, includeIfNull: false) + + @annotation.XmlElement( + name: 'share-permissions', + namespace: namespaceOpenCollaborationServices, + includeIfNull: false, + ) int? ocssharepermissions; - @annotation.XmlElement(name: 'share-permissions', namespace: namespaceOpenCloudMesh, includeIfNull: false) + + @annotation.XmlElement( + name: 'share-permissions', + namespace: namespaceOpenCloudMesh, + includeIfNull: false, + ) String? ocmsharepermissions; } @@ -215,58 +485,193 @@ class WebDavOcFilterRules with _$WebDavOcFilterRulesXmlSerializableMixin { this.ocmsharepermissions, }); factory WebDavOcFilterRules.fromXmlElement(final XmlElement element) => _$WebDavOcFilterRulesFromXmlElement(element); - @annotation.XmlElement(name: 'getlastmodified', namespace: namespaceDav, includeIfNull: false) + + @annotation.XmlElement( + name: 'getlastmodified', + namespace: namespaceDav, + includeIfNull: false, + ) String? davgetlastmodified; - @annotation.XmlElement(name: 'getetag', namespace: namespaceDav, includeIfNull: false) + + @annotation.XmlElement( + name: 'getetag', + namespace: namespaceDav, + includeIfNull: false, + ) String? davgetetag; - @annotation.XmlElement(name: 'getcontenttype', namespace: namespaceDav, includeIfNull: false) + + @annotation.XmlElement( + name: 'getcontenttype', + namespace: namespaceDav, + includeIfNull: false, + ) String? davgetcontenttype; - @annotation.XmlElement(name: 'getcontentlength', namespace: namespaceDav, includeIfNull: false) + + @annotation.XmlElement( + name: 'getcontentlength', + namespace: namespaceDav, + includeIfNull: false, + ) int? davgetcontentlength; - @annotation.XmlElement(name: 'resourcetype', namespace: namespaceDav, includeIfNull: false) + + @annotation.XmlElement( + name: 'resourcetype', + namespace: namespaceDav, + includeIfNull: false, + ) WebDavResourcetype? davresourcetype; - @annotation.XmlElement(name: 'id', namespace: namespaceOwncloud, includeIfNull: false) + + @annotation.XmlElement( + name: 'id', + namespace: namespaceOwncloud, + includeIfNull: false, + ) String? ocid; - @annotation.XmlElement(name: 'fileid', namespace: namespaceOwncloud, includeIfNull: false) + + @annotation.XmlElement( + name: 'fileid', + namespace: namespaceOwncloud, + includeIfNull: false, + ) String? ocfileid; - @annotation.XmlElement(name: 'favorite', namespace: namespaceOwncloud, includeIfNull: false) + + @annotation.XmlElement( + name: 'favorite', + namespace: namespaceOwncloud, + includeIfNull: false, + ) int? ocfavorite; - @annotation.XmlElement(name: 'comments-href', namespace: namespaceOwncloud, includeIfNull: false) + + @annotation.XmlElement( + name: 'comments-href', + namespace: namespaceOwncloud, + includeIfNull: false, + ) String? occommentshref; - @annotation.XmlElement(name: 'comments-count', namespace: namespaceOwncloud, includeIfNull: false) + + @annotation.XmlElement( + name: 'comments-count', + namespace: namespaceOwncloud, + includeIfNull: false, + ) int? occommentscount; - @annotation.XmlElement(name: 'comments-unread', namespace: namespaceOwncloud, includeIfNull: false) + + @annotation.XmlElement( + name: 'comments-unread', + namespace: namespaceOwncloud, + includeIfNull: false, + ) int? occommentsunread; - @annotation.XmlElement(name: 'downloadURL', namespace: namespaceOwncloud, includeIfNull: false) + + @annotation.XmlElement( + name: 'downloadURL', + namespace: namespaceOwncloud, + includeIfNull: false, + ) String? ocdownloadurl; - @annotation.XmlElement(name: 'owner-id', namespace: namespaceOwncloud, includeIfNull: false) + + @annotation.XmlElement( + name: 'owner-id', + namespace: namespaceOwncloud, + includeIfNull: false, + ) String? ocownerid; - @annotation.XmlElement(name: 'owner-display-name', namespace: namespaceOwncloud, includeIfNull: false) + + @annotation.XmlElement( + name: 'owner-display-name', + namespace: namespaceOwncloud, + includeIfNull: false, + ) String? ocownerdisplayname; - @annotation.XmlElement(name: 'size', namespace: namespaceOwncloud, includeIfNull: false) + + @annotation.XmlElement( + name: 'size', + namespace: namespaceOwncloud, + includeIfNull: false, + ) int? ocsize; - @annotation.XmlElement(name: 'permissions', namespace: namespaceOwncloud, includeIfNull: false) + + @annotation.XmlElement( + name: 'permissions', + namespace: namespaceOwncloud, + includeIfNull: false, + ) String? ocpermissions; - @annotation.XmlElement(name: 'note', namespace: namespaceNextcloud, includeIfNull: false) + + @annotation.XmlElement( + name: 'note', + namespace: namespaceNextcloud, + includeIfNull: false, + ) String? ncnote; - @annotation.XmlElement(name: 'data-fingerprint', namespace: namespaceNextcloud, includeIfNull: false) + + @annotation.XmlElement( + name: 'data-fingerprint', + namespace: namespaceNextcloud, + includeIfNull: false, + ) String? ncdatafingerprint; - @annotation.XmlElement(name: 'has-preview', namespace: namespaceNextcloud, includeIfNull: false) + + @annotation.XmlElement( + name: 'has-preview', + namespace: namespaceNextcloud, + includeIfNull: false, + ) bool? nchaspreview; - @annotation.XmlElement(name: 'mount-type', namespace: namespaceNextcloud, includeIfNull: false) + + @annotation.XmlElement( + name: 'mount-type', + namespace: namespaceNextcloud, + includeIfNull: false, + ) String? ncmounttype; - @annotation.XmlElement(name: 'is-encrypted', namespace: namespaceNextcloud, includeIfNull: false) + + @annotation.XmlElement( + name: 'is-encrypted', + namespace: namespaceNextcloud, + includeIfNull: false, + ) int? ncisencrypted; - @annotation.XmlElement(name: 'metadata_etag', namespace: namespaceNextcloud, includeIfNull: false) + + @annotation.XmlElement( + name: 'metadata_etag', + namespace: namespaceNextcloud, + includeIfNull: false, + ) String? ncmetadataetag; - @annotation.XmlElement(name: 'upload_time', namespace: namespaceNextcloud, includeIfNull: false) + + @annotation.XmlElement( + name: 'upload_time', + namespace: namespaceNextcloud, + includeIfNull: false, + ) int? ncuploadtime; - @annotation.XmlElement(name: 'creation_time', namespace: namespaceNextcloud, includeIfNull: false) + + @annotation.XmlElement( + name: 'creation_time', + namespace: namespaceNextcloud, + includeIfNull: false, + ) int? nccreationtime; - @annotation.XmlElement(name: 'rich-workspace', namespace: namespaceNextcloud, includeIfNull: false) + + @annotation.XmlElement( + name: 'rich-workspace', + namespace: namespaceNextcloud, + includeIfNull: false, + ) String? ncrichworkspace; - @annotation.XmlElement(name: 'share-permissions', namespace: namespaceOpenCollaborationServices, includeIfNull: false) + + @annotation.XmlElement( + name: 'share-permissions', + namespace: namespaceOpenCollaborationServices, + includeIfNull: false, + ) int? ocssharepermissions; - @annotation.XmlElement(name: 'share-permissions', namespace: namespaceOpenCloudMesh, includeIfNull: false) + + @annotation.XmlElement( + name: 'share-permissions', + namespace: namespaceOpenCloudMesh, + includeIfNull: false, + ) String? ocmsharepermissions; }