FIRStorage.h 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130
  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. #import "FIRStorageConstants.h"
  18. #import "FIRStorageSwiftNameSupport.h"
  19. @class FIRApp;
  20. @class FIRStorageReference;
  21. NS_ASSUME_NONNULL_BEGIN
  22. /** Project version string for FirebaseStorage. */
  23. FOUNDATION_EXPORT const unsigned char *const FIRStorageVersionString;
  24. /**
  25. * FirebaseStorage is a service that supports uploading and downloading binary objects,
  26. * such as images, videos, and other files to Google Cloud Storage.
  27. *
  28. * If you call [FIRStorage storage], the instance will initialize with the default FIRApp,
  29. * [FIRApp defaultApp], and the storage location will come from the provided
  30. * GoogleService-Info.plist.
  31. *
  32. * If you call [FIRStorage storageForApp:] and provide a custom instance of FIRApp,
  33. * the storage location will be specified via the FIROptions#storageBucket property.
  34. */
  35. FIR_SWIFT_NAME(Storage)
  36. @interface FIRStorage : NSObject
  37. /**
  38. * Creates an instance of FIRStorage, configured with the default FIRApp.
  39. * @return the FIRStorage instance, initialized with the default FIRApp.
  40. */
  41. + (instancetype)storage FIR_SWIFT_NAME(storage());
  42. /**
  43. * Creates an instance of FIRStorage, configured with the custom FIRApp @a app.
  44. * @param app The custom FIRApp used for initialization.
  45. * @return the FIRStorage instance, initialized with the custom FIRApp.
  46. */
  47. + (instancetype)storageForApp:(FIRApp *)app FIR_SWIFT_NAME(storage(app:));
  48. /**
  49. * Creates an instance of FIRStorage, configured with a custom storage bucket @a url.
  50. * @param url The gs:// url to your Firebase Storage Bucket.
  51. * @return the FIRStorage instance, initialized with the custom FIRApp.
  52. */
  53. + (instancetype)storageWithURL:(NSString *)url FIR_SWIFT_NAME(storage(url:));
  54. /**
  55. * Creates an instance of FIRStorage, configured with a custom FIRApp @a app and a custom storage
  56. * bucket @a url.
  57. * @param app The custom FIRApp used for initialization.
  58. * @param url The gs:// url to your Firebase Storage Bucket.
  59. * @return the FIRStorage instance, initialized with the custom FIRApp.
  60. */
  61. + (instancetype)storageForApp:(FIRApp *)app
  62. URL:(NSString *)url FIR_SWIFT_NAME(storage(app:url:));
  63. /**
  64. * The Firebase App associated with this Firebase Storage instance.
  65. */
  66. @property(strong, nonatomic, readonly) FIRApp *app;
  67. /**
  68. * Maximum time in seconds to retry an upload if a failure occurs.
  69. * Defaults to 10 minutes (600 seconds).
  70. */
  71. @property NSTimeInterval maxUploadRetryTime;
  72. /**
  73. * Maximum time in seconds to retry a download if a failure occurs.
  74. * Defaults to 10 minutes (600 seconds).
  75. */
  76. @property NSTimeInterval maxDownloadRetryTime;
  77. /**
  78. * Maximum time in seconds to retry operations other than upload and download if a failure occurs.
  79. * Defaults to 2 minutes (120 seconds).
  80. */
  81. @property NSTimeInterval maxOperationRetryTime;
  82. /**
  83. * Queue that all developer callbacks are fired on. Defaults to the main queue.
  84. */
  85. @property(strong, nonatomic) dispatch_queue_t callbackQueue;
  86. /**
  87. * Creates a FIRStorageReference initialized at the root Firebase Storage location.
  88. * @return An instance of FIRStorageReference initialized at the root.
  89. */
  90. - (FIRStorageReference *)reference;
  91. /**
  92. * Creates a FIRStorageReference given a gs:// or https:// URL pointing to a Firebase Storage
  93. * location. For example, you can pass in an https:// download URL retrieved from
  94. * [FIRStorageReference downloadURLWithCompletion] or the gs:// URI from
  95. * [FIRStorageReference description].
  96. * @param string A gs:// or https:// URL to initialize the reference with.
  97. * @return An instance of FIRStorageReference at the given child path.
  98. * @throws Throws an exception if passed in URL is not associated with the FIRApp used to initialize
  99. * this FIRStorage.
  100. */
  101. - (FIRStorageReference *)referenceForURL:(NSString *)string;
  102. /**
  103. * Creates a FIRStorageReference initialized at a child Firebase Storage location.
  104. * @param string A relative path from the root to initialize the reference with,
  105. * for instance @"path/to/object".
  106. * @return An instance of FIRStorageReference at the given child path.
  107. */
  108. - (FIRStorageReference *)referenceWithPath:(NSString *)string;
  109. @end
  110. NS_ASSUME_NONNULL_END