FIRStorageMetadata.h 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139
  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 FIRIMPLStorageReference;
  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. @interface FIRIMPLStorageMetadata : NSObject <NSCopying>
  27. /**
  28. * The name of the bucket containing this object.
  29. */
  30. @property(copy, nonatomic, readonly) NSString *bucket;
  31. /**
  32. * Cache-Control directive for the object data.
  33. */
  34. @property(copy, nonatomic, nullable) NSString *cacheControl;
  35. /**
  36. * Content-Disposition of the object data.
  37. */
  38. @property(copy, nonatomic, nullable) NSString *contentDisposition;
  39. /**
  40. * Content-Encoding of the object data.
  41. */
  42. @property(copy, nonatomic, nullable) NSString *contentEncoding;
  43. /**
  44. * Content-Language of the object data.
  45. */
  46. @property(copy, nonatomic, nullable) NSString *contentLanguage;
  47. /**
  48. * Content-Type of the object data.
  49. */
  50. @property(copy, nonatomic, nullable) NSString *contentType;
  51. /**
  52. * MD5 hash of the data; encoded using base64.
  53. */
  54. @property(copy, nonatomic, nullable, readonly) NSString *md5Hash;
  55. /**
  56. * The content generation of this object. Used for object versioning.
  57. */
  58. @property(readonly) int64_t generation;
  59. /**
  60. * User-provided metadata, in key/value pairs.
  61. */
  62. @property(copy, nonatomic, nullable) NSDictionary<NSString *, NSString *> *customMetadata;
  63. /**
  64. * The version of the metadata for this object at this generation. Used
  65. * for preconditions and for detecting changes in metadata. A metageneration number is only
  66. * meaningful in the context of a particular generation of a particular object.
  67. */
  68. @property(readonly) int64_t metageneration;
  69. /**
  70. * The name of this object, in gs://bucket/path/to/object.txt, this is object.txt.
  71. */
  72. @property(copy, nonatomic, readonly, nullable) NSString *name;
  73. /**
  74. * The full path of this object, in gs://bucket/path/to/object.txt, this is path/to/object.txt.
  75. */
  76. @property(copy, nonatomic, readonly, nullable) NSString *path;
  77. /**
  78. * Content-Length of the data in bytes.
  79. */
  80. @property(readonly) int64_t size;
  81. /**
  82. * The creation time of the object in RFC 3339 format.
  83. */
  84. @property(copy, nonatomic, readonly, nullable) NSDate *timeCreated;
  85. /**
  86. * The modification time of the object metadata in RFC 3339 format.
  87. */
  88. @property(copy, nonatomic, readonly, nullable) NSDate *updated;
  89. /**
  90. * A reference to the object in Firebase Storage.
  91. */
  92. @property(strong, nonatomic, readonly, nullable) FIRIMPLStorageReference *storageReference;
  93. /**
  94. * Creates an instance of FIRIMPLStorageMetadata from the contents of a dictionary.
  95. * @return An instance of FIRIMPLStorageMetadata that represents the contents of a dictionary.
  96. */
  97. - (nullable instancetype)initWithDictionary:(NSDictionary<NSString *, id> *)dictionary
  98. NS_DESIGNATED_INITIALIZER;
  99. /**
  100. * Creates an NSDictionary from the contents of the metadata.
  101. * @return An NSDictionary that represents the contents of the metadata.
  102. */
  103. - (NSDictionary<NSString *, id> *)dictionaryRepresentation;
  104. /**
  105. * Determines if the current metadata represents a "file".
  106. */
  107. @property(readonly, getter=isFile) BOOL file;
  108. /**
  109. * Determines if the current metadata represents a "folder".
  110. */
  111. @property(readonly, getter=isFolder) BOOL folder;
  112. @end
  113. NS_ASSUME_NONNULL_END