Browse Source

nextcloud: Format generated props

pull/278/head
jld3103 2 years ago
parent
commit
eeaa3c65be
No known key found for this signature in database
GPG Key ID: 9062417B9E8EB7B3
  1. 17
      packages/nextcloud/bin/generate_props.dart
  2. 567
      packages/nextcloud/lib/src/webdav/props.dart

17
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'),
);
}
@ -51,7 +50,7 @@ List<String> generateClass(
...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'),
'}',
];

567
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;
}

Loading…
Cancel
Save