StorageListResult.swift 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. // Copyright 2022 Google LLC
  2. //
  3. // Licensed under the Apache License, Version 2.0 (the "License");
  4. // you may not use this file except in compliance with the License.
  5. // You may obtain a copy of the License at
  6. //
  7. // http://www.apache.org/licenses/LICENSE-2.0
  8. //
  9. // Unless required by applicable law or agreed to in writing, software
  10. // distributed under the License is distributed on an "AS IS" BASIS,
  11. // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  12. // See the License for the specific language governing permissions and
  13. // limitations under the License.
  14. import Foundation
  15. import FirebaseStorageInternal
  16. /** Contains the prefixes and items returned by a `StorageReference.list()` call. */
  17. @objc(FIRStorageListResult) open class StorageListResult: NSObject {
  18. /**
  19. * The prefixes (folders) returned by a `list()` operation.
  20. *
  21. * - Returns: A list of prefixes (folders).
  22. */
  23. @objc public let prefixes: [StorageReference]
  24. /**
  25. * The objects (files) returned by a `list()` operation.
  26. *
  27. * - Returns: A page token if more results are available.
  28. */
  29. @objc public let items: [StorageReference]
  30. /**
  31. * Returns a token that can be used to resume a previous `list()` operation. `nil`
  32. * indicates that there are no more results.
  33. *
  34. * - Returns: A page token if more results are available.
  35. */
  36. @objc public let pageToken: String?
  37. // MARK: - NSObject overrides
  38. @objc override open func copy() -> Any {
  39. return StorageListResult(impl.copy() as! FIRIMPLStorageListResult)
  40. }
  41. // MARK: - Internal APIs
  42. internal let impl: FIRIMPLStorageListResult
  43. internal init(_ impl: FIRIMPLStorageListResult) {
  44. self.impl = impl
  45. prefixes = impl.prefixes.map { StorageReference($0) }
  46. items = impl.items.map { StorageReference($0) }
  47. pageToken = impl.pageToken
  48. }
  49. }