Skip to content

Commit

Permalink
chore(nextcloud): Deprecated WebDavFile in favor of WebDavResponseHel…
Browse files Browse the repository at this point in the history
…pers

Signed-off-by: provokateurin <[email protected]>
  • Loading branch information
provokateurin committed Oct 20, 2024
1 parent a6d2a30 commit 81ab415
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 0 deletions.
5 changes: 5 additions & 0 deletions packages/nextcloud/lib/src/api/webdav/models/webdav_file.dart
Original file line number Diff line number Diff line change
@@ -1,16 +1,21 @@
// ignore_for_file: deprecated_member_use_from_same_package
import 'package:nextcloud/src/api/webdav/webdav.dart';
import 'package:timezone/timezone.dart' as tz;

@Deprecated('Use WebDavResponseHelpers instead.')
// ignore: public_member_api_docs
extension WebDavMultistatusFile on WebDavMultistatus {
/// Convert the [WebDavMultistatus] into a [WebDavFile] for easier handling
@Deprecated('Use WebDavResponseHelpers instead.')
List<WebDavFile> toWebDavFiles() =>
responses.where((response) => response.href != null).map((response) => WebDavFile(response: response)).toList();
}

/// WebDavFile class
@Deprecated('Use WebDavResponseHelpers instead.')
class WebDavFile {
/// Creates a new WebDavFile object with the given path
@Deprecated('Use WebDavResponseHelpers instead.')
WebDavFile({
required WebDavResponse response,
}) : _response = response;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// ignore_for_file: deprecated_member_use_from_same_package
import 'package:nextcloud/src/api/webdav/models/models.dart';
import 'package:test/expect.dart';
import 'package:test/scaffolding.dart';
Expand Down
2 changes: 2 additions & 0 deletions packages/nextcloud/test/api/webdav/webdav_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -224,6 +224,7 @@ void main() {
ocsSharePermissions: true,
),
);
// ignore: deprecated_member_use_from_same_package
final response = result.toWebDavFiles().single;

expect(response.path, PathUri.parse('test/test.png'));
Expand Down Expand Up @@ -318,6 +319,7 @@ void main() {
),
depth: WebDavDepth.zero,
))
// ignore: deprecated_member_use_from_same_package
.toWebDavFiles()
.single;

Expand Down

0 comments on commit 81ab415

Please sign in to comment.