File tree 5 files changed +47
-11
lines changed
5 files changed +47
-11
lines changed Original file line number Diff line number Diff line change 59
59
matrix :
60
60
# Add macos-latest and/or windows-latest if relevant for this package.
61
61
os : [ubuntu-latest]
62
- sdk : [2.19 .0, dev]
62
+ sdk : [3.0 .0, dev]
63
63
steps :
64
64
- uses : actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683
65
65
- uses : dart-lang/setup-dart@0a8a0fc875eb934c15d08629302413c671d3f672
Original file line number Diff line number Diff line change 1
1
## 0.8.16-wip
2
2
3
+ - ** Breaking** ` BucketEntry ` is now ` sealed ` anyone implementing or subclassing
4
+ will experience breakage.
5
+ - Feature ` BucketEntry ` objects returns from ` Bucket.list ` are now instances
6
+ of:
7
+ * ` BucketDirectoryEntry ` , or,
8
+ * ` BucketObjectEntry ` , which implements ` ObjectInfo ` exposing metadata.
9
+
10
+ This means that anyone using ` Bucket.list ` to find objects, does not need
11
+ to use ` Bucket.info ` to fetch metadata for an object.
12
+ - Minimum Dart SDK constraint bumped to ` ^3.0.0 ` .
13
+
3
14
## 0.8.15
4
15
5
16
- Update the pubspec repository field to reflect the repo move.
Original file line number Diff line number Diff line change @@ -349,9 +349,9 @@ class _ObjectPageImpl implements Page<BucketEntry> {
349
349
storage_api.Objects response)
350
350
: items = [
351
351
for (final item in response.prefixes ?? const < String > [])
352
- BucketEntry . _directory (item),
352
+ BucketDirectoryEntry ._ (item),
353
353
for (final item in response.items ?? const < storage_api.Object > [])
354
- BucketEntry . _object (item.name ! )
354
+ _BucketObjectEntry (item)
355
355
],
356
356
_nextPageToken = response.nextPageToken;
357
357
@@ -430,6 +430,16 @@ class _ObjectInfoImpl implements ObjectInfo {
430
430
ObjectMetadata get metadata => _metadata;
431
431
}
432
432
433
+ class _BucketObjectEntry extends _ObjectInfoImpl implements BucketObjectEntry {
434
+ _BucketObjectEntry (storage_api.Object object) : super (object);
435
+
436
+ @override
437
+ bool get isDirectory => false ;
438
+
439
+ @override
440
+ bool get isObject => true ;
441
+ }
442
+
433
443
class _ObjectMetadata implements ObjectMetadata {
434
444
final storage_api.Object _object;
435
445
Acl ? _cachedAcl;
Original file line number Diff line number Diff line change @@ -668,23 +668,38 @@ abstract class ObjectMetadata {
668
668
/// Listing operate like a directory listing, despite the object
669
669
/// namespace being flat.
670
670
///
671
+ /// Instances of [BucketEntry] are either instances of [BucketDirectoryEntry]
672
+ /// or [BucketObjectEntry] . Casting to [BucketObjectEntry] will give access to
673
+ /// object metadata.
674
+ ///
671
675
/// See [Bucket.list] for information on how the hierarchical structure
672
676
/// is determined.
673
- class BucketEntry {
677
+ sealed class BucketEntry {
674
678
/// Whether this is information on an object.
675
- final bool isObject;
679
+ bool get isObject;
676
680
677
681
/// Name of object or directory.
678
- final String name;
679
-
680
- BucketEntry ._object (this .name) : isObject = true ;
681
-
682
- BucketEntry ._directory (this .name) : isObject = false ;
682
+ String get name;
683
683
684
684
/// Whether this is a prefix.
685
685
bool get isDirectory => ! isObject;
686
686
}
687
687
688
+ /// Entry in [Bucket.list] representing a directory given the `delimiter`
689
+ /// passed.
690
+ class BucketDirectoryEntry extends BucketEntry {
691
+ @override
692
+ final String name;
693
+
694
+ BucketDirectoryEntry ._(this .name);
695
+
696
+ @override
697
+ bool get isObject => false ;
698
+ }
699
+
700
+ /// Entry in [Bucket.list] representing an object.
701
+ abstract class BucketObjectEntry implements BucketEntry , ObjectInfo {}
702
+
688
703
/// Access to operations on a specific cloud storage bucket.
689
704
abstract class Bucket {
690
705
/// Name of this bucket.
Original file line number Diff line number Diff line change 9
9
- gcp
10
10
11
11
environment :
12
- sdk : ' >=2.19.0 <4 .0.0'
12
+ sdk : ' ^3 .0.0'
13
13
14
14
dependencies :
15
15
_discoveryapis_commons : ^1.0.0
You can’t perform that action at this time.
0 commit comments