FIRStorageMetadata.h 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140
  1. /*
  2. * Copyright 2017 Google
  3. *
  4. * Licensed under the Apache License, Version 2.0 (the "License");
  5. * you may not use this file except in compliance with the License.
  6. * You may obtain a copy of the License at
  7. *
  8. * http://www.apache.org/licenses/LICENSE-2.0
  9. *
  10. * Unless required by applicable law or agreed to in writing, software
  11. * distributed under the License is distributed on an "AS IS" BASIS,
  12. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  13. * See the License for the specific language governing permissions and
  14. * limitations under the License.
  15. */
  16. #import <Foundation/Foundation.h>
  17. @class FIRStorageReference;
  18. NS_ASSUME_NONNULL_BEGIN
  19. /**
  20. * Class which represents the metadata on an object in Firebase Storage. This metadata is
  21. * returned on successful operations, and can be used to retrieve download URLs, content types,
  22. * and a FIRStorage reference to the object in question. Full documentation can be found at the GCS
  23. * Objects#resource docs.
  24. * @see https://cloud.google.com/storage/docs/json_api/v1/objects#resource
  25. */
  26. NS_SWIFT_NAME(StorageMetadata)
  27. @interface FIRStorageMetadata : NSObject <NSCopying>
  28. /**
  29. * The name of the bucket containing this object.
  30. */
  31. @property(copy, nonatomic, readonly) NSString *bucket;
  32. /**
  33. * Cache-Control directive for the object data.
  34. */
  35. @property(copy, nonatomic, nullable) NSString *cacheControl;
  36. /**
  37. * Content-Disposition of the object data.
  38. */
  39. @property(copy, nonatomic, nullable) NSString *contentDisposition;
  40. /**
  41. * Content-Encoding of the object data.
  42. */
  43. @property(copy, nonatomic, nullable) NSString *contentEncoding;
  44. /**
  45. * Content-Language of the object data.
  46. */
  47. @property(copy, nonatomic, nullable) NSString *contentLanguage;
  48. /**
  49. * Content-Type of the object data.
  50. */
  51. @property(copy, nonatomic, nullable) NSString *contentType;
  52. /**
  53. * MD5 hash of the data; encoded using base64.
  54. */
  55. @property(copy, nonatomic, nullable, readonly) NSString *md5Hash;
  56. /**
  57. * The content generation of this object. Used for object versioning.
  58. */
  59. @property(readonly) int64_t generation;
  60. /**
  61. * User-provided metadata, in key/value pairs.
  62. */
  63. @property(copy, nonatomic, nullable) NSDictionary<NSString *, NSString *> *customMetadata;
  64. /**
  65. * The version of the metadata for this object at this generation. Used
  66. * for preconditions and for detecting changes in metadata. A metageneration number is only
  67. * meaningful in the context of a particular generation of a particular object.
  68. */
  69. @property(readonly) int64_t metageneration;
  70. /**
  71. * The name of this object, in gs://bucket/path/to/object.txt, this is object.txt.
  72. */
  73. @property(copy, nonatomic, readonly, nullable) NSString *name;
  74. /**
  75. * The full path of this object, in gs://bucket/path/to/object.txt, this is path/to/object.txt.
  76. */
  77. @property(copy, nonatomic, readonly, nullable) NSString *path;
  78. /**
  79. * Content-Length of the data in bytes.
  80. */
  81. @property(readonly) int64_t size;
  82. /**
  83. * The creation time of the object in RFC 3339 format.
  84. */
  85. @property(copy, nonatomic, readonly, nullable) NSDate *timeCreated;
  86. /**
  87. * The modification time of the object metadata in RFC 3339 format.
  88. */
  89. @property(copy, nonatomic, readonly, nullable) NSDate *updated;
  90. /**
  91. * A reference to the object in Firebase Storage.
  92. */
  93. @property(strong, nonatomic, readonly, nullable) FIRStorageReference *storageReference;
  94. /**
  95. * Creates an instance of FIRStorageMetadata from the contents of a dictionary.
  96. * @return An instance of FIRStorageMetadata that represents the contents of a dictionary.
  97. */
  98. - (nullable instancetype)initWithDictionary:(NSDictionary<NSString *, id> *)dictionary
  99. NS_DESIGNATED_INITIALIZER;
  100. /**
  101. * Creates an NSDictionary from the contents of the metadata.
  102. * @return An NSDictionary that represents the contents of the metadata.
  103. */
  104. - (NSDictionary<NSString *, id> *)dictionaryRepresentation;
  105. /**
  106. * Determines if the current metadata represents a "file".
  107. */
  108. @property(readonly, getter=isFile) BOOL file;
  109. /**
  110. * Determines if the current metadata represents a "folder".
  111. */
  112. @property(readonly, getter=isFolder) BOOL folder;
  113. @end
  114. NS_ASSUME_NONNULL_END