aboutsummaryrefslogtreecommitdiffhomepage
path: root/Firebase/Storage/Public
diff options
context:
space:
mode:
authorGravatar Paul Beusterien <paulbeusterien@google.com>2017-06-29 12:03:45 -0700
committerGravatar GitHub <noreply@github.com>2017-06-29 12:03:45 -0700
commitc33bdff405b988ffa4e894809db73ade0f21e658 (patch)
tree3414b99a074290f8707b6aad2df6791f21a5f0a8 /Firebase/Storage/Public
parentacb7a32afa4ef10915fd33005ac5e5830cf7dd6c (diff)
Group public headers into Public directories (#112)
Diffstat (limited to 'Firebase/Storage/Public')
-rw-r--r--Firebase/Storage/Public/FIRStorage.h130
-rw-r--r--Firebase/Storage/Public/FIRStorageConstants.h173
-rw-r--r--Firebase/Storage/Public/FIRStorageDownloadTask.h39
-rw-r--r--Firebase/Storage/Public/FIRStorageMetadata.h149
-rw-r--r--Firebase/Storage/Public/FIRStorageObservableTask.h63
-rw-r--r--Firebase/Storage/Public/FIRStorageReference.h244
-rw-r--r--Firebase/Storage/Public/FIRStorageSwiftNameSupport.h29
-rw-r--r--Firebase/Storage/Public/FIRStorageTask.h76
-rw-r--r--Firebase/Storage/Public/FIRStorageTaskSnapshot.h68
-rw-r--r--Firebase/Storage/Public/FIRStorageUploadTask.h39
-rw-r--r--Firebase/Storage/Public/FirebaseStorage.h25
11 files changed, 1035 insertions, 0 deletions
diff --git a/Firebase/Storage/Public/FIRStorage.h b/Firebase/Storage/Public/FIRStorage.h
new file mode 100644
index 0000000..3b37a0e
--- /dev/null
+++ b/Firebase/Storage/Public/FIRStorage.h
@@ -0,0 +1,130 @@
+/*
+ * Copyright 2017 Google
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#import <Foundation/Foundation.h>
+
+#import "FIRStorageConstants.h"
+#import "FIRStorageSwiftNameSupport.h"
+
+@class FIRApp;
+@class FIRStorageReference;
+
+NS_ASSUME_NONNULL_BEGIN
+
+/** Project version string for FirebaseStorage. */
+FOUNDATION_EXPORT const unsigned char *const FIRStorageVersionString;
+
+/**
+ * FirebaseStorage is a service that supports uploading and downloading binary objects,
+ * such as images, videos, and other files to Google Cloud Storage.
+ *
+ * If you call [FIRStorage storage], the instance will initialize with the default FIRApp,
+ * [FIRApp defaultApp], and the storage location will come from the provided
+ * GoogleService-Info.plist.
+ *
+ * If you call [FIRStorage storageForApp:] and provide a custom instance of FIRApp,
+ * the storage location will be specified via the FIROptions#storageBucket property.
+ */
+FIR_SWIFT_NAME(Storage)
+@interface FIRStorage : NSObject
+
+/**
+ * Creates an instance of FIRStorage, configured with the default FIRApp.
+ * @return the FIRStorage instance, initialized with the default FIRApp.
+ */
++ (instancetype)storage FIR_SWIFT_NAME(storage());
+
+/**
+ * Creates an instance of FIRStorage, configured with the custom FIRApp @a app.
+ * @param app The custom FIRApp used for initialization.
+ * @return the FIRStorage instance, initialized with the custom FIRApp.
+ */
++ (instancetype)storageForApp:(FIRApp *)app FIR_SWIFT_NAME(storage(app:));
+
+/**
+ * Creates an instance of FIRStorage, configured with a custom storage bucket @a url.
+ * @param url The gs:// url to your Firebase Storage Bucket.
+ * @return the FIRStorage instance, initialized with the custom FIRApp.
+ */
++ (instancetype)storageWithURL:(NSString *)url FIR_SWIFT_NAME(storage(url:));
+
+/**
+ * Creates an instance of FIRStorage, configured with a custom FIRApp @a app and a custom storage
+ * bucket @a url.
+ * @param app The custom FIRApp used for initialization.
+ * @param url The gs:// url to your Firebase Storage Bucket.
+ * @return the FIRStorage instance, initialized with the custom FIRApp.
+ */
++ (instancetype)storageForApp:(FIRApp *)app
+ URL:(NSString *)url FIR_SWIFT_NAME(storage(app:url:));
+
+/**
+ * The Firebase App associated with this Firebase Storage instance.
+ */
+@property(strong, nonatomic, readonly) FIRApp *app;
+
+/**
+ * Maximum time in seconds to retry an upload if a failure occurs.
+ * Defaults to 10 minutes (600 seconds).
+ */
+@property NSTimeInterval maxUploadRetryTime;
+
+/**
+ * Maximum time in seconds to retry a download if a failure occurs.
+ * Defaults to 10 minutes (600 seconds).
+ */
+@property NSTimeInterval maxDownloadRetryTime;
+
+/**
+ * Maximum time in seconds to retry operations other than upload and download if a failure occurs.
+ * Defaults to 2 minutes (120 seconds).
+ */
+@property NSTimeInterval maxOperationRetryTime;
+
+/**
+ * Queue that all developer callbacks are fired on. Defaults to the main queue.
+ */
+@property(strong, nonatomic) dispatch_queue_t callbackQueue;
+
+/**
+ * Creates a FIRStorageReference initialized at the root Firebase Storage location.
+ * @return An instance of FIRStorageReference initialized at the root.
+ */
+- (FIRStorageReference *)reference;
+
+/**
+ * Creates a FIRStorageReference given a gs:// or https:// URL pointing to a Firebase Storage
+ * location. For example, you can pass in an https:// download URL retrieved from
+ * [FIRStorageReference downloadURLWithCompletion] or the gs:// URI from
+ * [FIRStorageReference description].
+ * @param string A gs:// or https:// URL to initialize the reference with.
+ * @return An instance of FIRStorageReference at the given child path.
+ * @throws Throws an exception if passed in URL is not associated with the FIRApp used to initialize
+ * this FIRStorage.
+ */
+- (FIRStorageReference *)referenceForURL:(NSString *)string;
+
+/**
+ * Creates a FIRStorageReference initialized at a child Firebase Storage location.
+ * @param string A relative path from the root to initialize the reference with,
+ * for instance @"path/to/object".
+ * @return An instance of FIRStorageReference at the given child path.
+ */
+- (FIRStorageReference *)referenceWithPath:(NSString *)string;
+
+@end
+
+NS_ASSUME_NONNULL_END
diff --git a/Firebase/Storage/Public/FIRStorageConstants.h b/Firebase/Storage/Public/FIRStorageConstants.h
new file mode 100644
index 0000000..cf6c3b8
--- /dev/null
+++ b/Firebase/Storage/Public/FIRStorageConstants.h
@@ -0,0 +1,173 @@
+/*
+ * Copyright 2017 Google
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#import <Foundation/Foundation.h>
+
+#import "FIRStorageSwiftNameSupport.h"
+
+@class FIRStorageDownloadTask;
+@class FIRStorageMetadata;
+@class FIRStorageTaskSnapshot;
+@class FIRStorageUploadTask;
+
+NS_ASSUME_NONNULL_BEGIN
+
+/**
+ * NSString typedef representing a task listener handle.
+ */
+typedef NSString *FIRStorageHandle FIR_SWIFT_NAME(StorageHandle);
+
+/**
+ * Block typedef typically used when downloading data.
+ * @param data The data returned by the download, or nil if no data available or download failed.
+ * @param error The error describing failure, if one occurred.
+ */
+typedef void (^FIRStorageVoidDataError)(NSData *_Nullable data, NSError *_Nullable error)
+ FIR_SWIFT_NAME(StorageVoidDataError);
+
+/**
+ * Block typedef typically used when performing "binary" async operations such as delete,
+ * where the operation either succeeds without an error or fails with an error.
+ * @param error The error describing failure, if one occurred.
+ */
+typedef void (^FIRStorageVoidError)(NSError *_Nullable error) FIR_SWIFT_NAME(StorageVoidError);
+
+/**
+ * Block typedef typically used when retrieving metadata.
+ * @param metadata The metadata returned by the operation, if metadata exists.
+ */
+typedef void (^FIRStorageVoidMetadata)(FIRStorageMetadata *_Nullable metadata)
+ FIR_SWIFT_NAME(StorageVoidMetadata);
+
+/**
+ * Block typedef typically used when retrieving metadata with the possibility of an error.
+ * @param metadata The metadata returned by the operation, if metadata exists.
+ * @param error The error describing failure, if one occurred.
+ */
+typedef void (^FIRStorageVoidMetadataError)(FIRStorageMetadata *_Nullable metadata,
+ NSError *_Nullable error)
+ FIR_SWIFT_NAME(StorageVoidMetadataError);
+
+/**
+ * Block typedef typically used to asynchronously return a storage task snapshot.
+ * @param snapshot The returned task snapshot.
+ */
+typedef void (^FIRStorageVoidSnapshot)(FIRStorageTaskSnapshot *snapshot)
+ FIR_SWIFT_NAME(StorageVoidSnapshot);
+
+/**
+ * Block typedef typically used when retrieving a download URL.
+ * @param URL The download URL associated with the operation.
+ * @param error The error describing failure, if one occurred.
+ */
+typedef void (^FIRStorageVoidURLError)(NSURL *_Nullable URL, NSError *_Nullable error)
+ FIR_SWIFT_NAME(StorageVoidURLError);
+
+/**
+ * Enum representing the upload and download task status.
+ */
+typedef NS_ENUM(NSInteger, FIRStorageTaskStatus) {
+ /**
+ * Unknown task status.
+ */
+ FIRStorageTaskStatusUnknown,
+
+ /**
+ * Task is being resumed.
+ */
+ FIRStorageTaskStatusResume,
+
+ /**
+ * Task reported a progress event.
+ */
+ FIRStorageTaskStatusProgress,
+
+ /**
+ * Task is paused.
+ */
+ FIRStorageTaskStatusPause,
+
+ /**
+ * Task has completed successfully.
+ */
+ FIRStorageTaskStatusSuccess,
+
+ /**
+ * Task has failed and is unrecoverable.
+ */
+ FIRStorageTaskStatusFailure
+} FIR_SWIFT_NAME(StorageTaskStatus);
+
+/**
+ * Firebase Storage error domain.
+ */
+FOUNDATION_EXPORT NSString *const FIRStorageErrorDomain FIR_SWIFT_NAME(StorageErrorDomain);
+
+/**
+ * Enum representing the errors raised by Firebase Storage.
+ */
+typedef NS_ENUM(NSInteger, FIRStorageErrorCode) {
+ /** An unknown error occurred. */
+ FIRStorageErrorCodeUnknown = -13000,
+
+ /** No object exists at the desired reference. */
+ FIRStorageErrorCodeObjectNotFound = -13010,
+
+ /** No bucket is configured for Firebase Storage. */
+ FIRStorageErrorCodeBucketNotFound = -13011,
+
+ /** No project is configured for Firebase Storage. */
+ FIRStorageErrorCodeProjectNotFound = -13012,
+
+ /**
+ * Quota on your Firebase Storage bucket has been exceeded.
+ * If you're on the free tier, upgrade to a paid plan.
+ * If you're on a paid plan, reach out to Firebase support.
+ */
+ FIRStorageErrorCodeQuotaExceeded = -13013,
+
+ /** User is unauthenticated. Authenticate and try again. */
+ FIRStorageErrorCodeUnauthenticated = -13020,
+
+ /**
+ * User is not authorized to perform the desired action.
+ * Check your rules to ensure they are correct.
+ */
+ FIRStorageErrorCodeUnauthorized = -13021,
+
+ /**
+ * The maximum time limit on an operation (upload, download, delete, etc.) has been exceeded.
+ * Try uploading again.
+ */
+ FIRStorageErrorCodeRetryLimitExceeded = -13030,
+
+ /**
+ * File on the client does not match the checksum of the file received by the server.
+ * Try uploading again.
+ */
+ FIRStorageErrorCodeNonMatchingChecksum = -13031,
+
+ /**
+ * Size of the downloaded file exceeds the amount of memory allocated for the download.
+ * Increase memory cap and try downloading again.
+ */
+ FIRStorageErrorCodeDownloadSizeExceeded = -13032,
+
+ /** User cancelled the operation. */
+ FIRStorageErrorCodeCancelled = -13040
+} FIR_SWIFT_NAME(StorageErrorCode);
+
+NS_ASSUME_NONNULL_END
diff --git a/Firebase/Storage/Public/FIRStorageDownloadTask.h b/Firebase/Storage/Public/FIRStorageDownloadTask.h
new file mode 100644
index 0000000..252b910
--- /dev/null
+++ b/Firebase/Storage/Public/FIRStorageDownloadTask.h
@@ -0,0 +1,39 @@
+/*
+ * Copyright 2017 Google
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#import <Foundation/Foundation.h>
+
+#import "FIRStorageObservableTask.h"
+#import "FIRStorageSwiftNameSupport.h"
+
+NS_ASSUME_NONNULL_BEGIN
+
+/**
+ * FIRStorageDownloadTask implements resumable downloads from an object in Firebase Storage.
+ * Downloads can be returned on completion with a completion handler, and can be monitored
+ * by attaching observers, or controlled by calling FIRStorageTask#pause, FIRStorageTask#resume,
+ * or FIRStorageTask#cancel.
+ * Downloads can currently be returned as NSData in memory, or as an NSURL to a file on disk.
+ * Downloads are performed on a background queue, and callbacks are raised on the developer
+ * specified callbackQueue in FIRStorage, or the main queue if left unspecified.
+ * Currently all uploads must be initiated and managed on the main queue.
+ */
+FIR_SWIFT_NAME(StorageDownloadTask)
+@interface FIRStorageDownloadTask : FIRStorageObservableTask<FIRStorageTaskManagement>
+
+@end
+
+NS_ASSUME_NONNULL_END
diff --git a/Firebase/Storage/Public/FIRStorageMetadata.h b/Firebase/Storage/Public/FIRStorageMetadata.h
new file mode 100644
index 0000000..8d844f7
--- /dev/null
+++ b/Firebase/Storage/Public/FIRStorageMetadata.h
@@ -0,0 +1,149 @@
+/*
+ * Copyright 2017 Google
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#import <Foundation/Foundation.h>
+
+#import "FIRStorageSwiftNameSupport.h"
+
+@class FIRStorageReference;
+
+NS_ASSUME_NONNULL_BEGIN
+
+/**
+ * Class which represents the metadata on an object in Firebase Storage. This metadata is
+ * returned on successful operations, and can be used to retrieve download URLs, content types,
+ * and a FIRStorage reference to the object in question. Full documentation can be found at the GCS
+ * Objects#resource docs.
+ * @see https://cloud.google.com/storage/docs/json_api/v1/objects#resource
+ */
+FIR_SWIFT_NAME(StorageMetadata)
+@interface FIRStorageMetadata : NSObject<NSCopying>
+
+/**
+ * The name of the bucket containing this object.
+ */
+@property(copy, nonatomic, readonly) NSString *bucket;
+
+/**
+ * Cache-Control directive for the object data.
+ */
+@property(copy, nonatomic, nullable) NSString *cacheControl;
+
+/**
+ * Content-Disposition of the object data.
+ */
+@property(copy, nonatomic, nullable) NSString *contentDisposition;
+
+/**
+ * Content-Encoding of the object data.
+ */
+@property(copy, nonatomic, nullable) NSString *contentEncoding;
+
+/**
+ * Content-Language of the object data.
+ */
+@property(copy, nonatomic, nullable) NSString *contentLanguage;
+
+/**
+ * Content-Type of the object data.
+ */
+@property(copy, nonatomic, nullable) NSString *contentType;
+
+/**
+ * The content generation of this object. Used for object versioning.
+ */
+@property(readonly) int64_t generation;
+
+/**
+ * User-provided metadata, in key/value pairs.
+ */
+@property(copy, nonatomic, nullable) NSDictionary<NSString *, NSString *> *customMetadata;
+
+/**
+ * The version of the metadata for this object at this generation. Used
+ * for preconditions and for detecting changes in metadata. A metageneration number is only
+ * meaningful in the context of a particular generation of a particular object.
+ */
+@property(readonly) int64_t metageneration;
+
+/**
+ * The name of this object, in gs://bucket/path/to/object.txt, this is object.txt.
+ */
+@property(copy, nonatomic, readonly, nullable) NSString *name;
+
+/**
+ * The full path of this object, in gs://bucket/path/to/object.txt, this is path/to/object.txt.
+ */
+@property(copy, nonatomic, readonly, nullable) NSString *path;
+
+/**
+ * Content-Length of the data in bytes.
+ */
+@property(readonly) int64_t size;
+
+/**
+ * The creation time of the object in RFC 3339 format.
+ */
+@property(copy, nonatomic, readonly, nullable) NSDate *timeCreated;
+
+/**
+ * The modification time of the object metadata in RFC 3339 format.
+ */
+@property(copy, nonatomic, readonly, nullable) NSDate *updated;
+
+/**
+ * A reference to the object in Firebase Storage.
+ */
+@property(strong, nonatomic, readonly, nullable) FIRStorageReference *storageReference;
+
+/**
+ * An array containing all download URLs available for the object.
+ */
+@property(strong, nonatomic, readonly, nullable) NSArray<NSURL *> *downloadURLs;
+
+/**
+ * Creates an instanece of FIRStorageMetadata from the contents of a dictionary.
+ * @return An instance of FIRStorageMetadata that represents the contents of a dictionary.
+ */
+- (nullable instancetype)initWithDictionary:(NSDictionary <NSString *, id>*)dictionary
+ NS_DESIGNATED_INITIALIZER;
+
+/**
+ * Creates an NSDictionary from the contents of the metadata.
+ * @return An NSDictionary that represents the contents of the metadata.
+ */
+- (NSDictionary <NSString *, id>*)dictionaryRepresentation;
+
+/**
+ * Determines if the current metadata represents a "file".
+ */
+@property(readonly, getter=isFile) BOOL file;
+
+/**
+ * Determines if the current metadata represents a "folder".
+ */
+@property(readonly, getter=isFolder) BOOL folder;
+
+/**
+ * Retrieves a download URL for the given object, or nil if none exist.
+ * Note that if there are many valid download tokens, this will always return the first
+ * valid token created.
+ */
+- (nullable NSURL *)downloadURL;
+
+@end
+
+NS_ASSUME_NONNULL_END
diff --git a/Firebase/Storage/Public/FIRStorageObservableTask.h b/Firebase/Storage/Public/FIRStorageObservableTask.h
new file mode 100644
index 0000000..502aba5
--- /dev/null
+++ b/Firebase/Storage/Public/FIRStorageObservableTask.h
@@ -0,0 +1,63 @@
+/*
+ * Copyright 2017 Google
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#import "FIRStorageSwiftNameSupport.h"
+#import "FIRStorageTask.h"
+
+NS_ASSUME_NONNULL_BEGIN
+
+@class FIRStorageReference;
+@class FIRStorageTaskSnapshot;
+
+/**
+ * Extends FIRStorageTask to provide observable semantics such as adding and removing observers.
+ * Observers produce a FIRStorageHandle, which is used to keep track of and remove specific
+ * observers at a later date.
+ * This class is currently not thread safe and can only be called on the main thread.
+ */
+FIR_SWIFT_NAME(StorageObservableTask)
+@interface FIRStorageObservableTask : FIRStorageTask
+
+/**
+ * Observes changes in the upload status: Resume, Pause, Progress, Success, and Failure.
+ * @param status The FIRStorageTaskStatus change to observe.
+ * @param handler A callback that fires every time the status event occurs,
+ * returns a FIRStorageTaskSnapshot containing the state of the task.
+ * @return A task handle that can be used to remove the observer at a later date.
+ */
+- (FIRStorageHandle)observeStatus:(FIRStorageTaskStatus)status
+ handler:(void (^)(FIRStorageTaskSnapshot *snapshot))handler;
+
+/**
+ * Removes the single observer with the provided handle.
+ * @param handle The handle of the task to remove.
+ */
+- (void)removeObserverWithHandle:(FIRStorageHandle)handle;
+
+/**
+ * Removes all observers for a single status.
+ * @param status A FIRStorageTaskStatus to remove listeners for.
+ */
+- (void)removeAllObserversForStatus:(FIRStorageTaskStatus)status;
+
+/**
+ * Removes all observers.
+ */
+- (void)removeAllObservers;
+
+@end
+
+NS_ASSUME_NONNULL_END
diff --git a/Firebase/Storage/Public/FIRStorageReference.h b/Firebase/Storage/Public/FIRStorageReference.h
new file mode 100644
index 0000000..0b85267
--- /dev/null
+++ b/Firebase/Storage/Public/FIRStorageReference.h
@@ -0,0 +1,244 @@
+/*
+ * Copyright 2017 Google
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#import <Foundation/Foundation.h>
+
+#import "FIRStorage.h"
+#import "FIRStorageConstants.h"
+#import "FIRStorageDownloadTask.h"
+#import "FIRStorageMetadata.h"
+#import "FIRStorageSwiftNameSupport.h"
+#import "FIRStorageTask.h"
+#import "FIRStorageUploadTask.h"
+
+NS_ASSUME_NONNULL_BEGIN
+
+/**
+ * FIRStorageReference represents a reference to a Google Cloud Storage object. Developers can
+ * upload and download objects, as well as get/set object metadata, and delete an object at the
+ * path.
+ * @see https://cloud.google.com/storage/
+ */
+FIR_SWIFT_NAME(StorageReference)
+@interface FIRStorageReference : NSObject
+
+/**
+ * The FIRStorage service object which created this reference.
+ */
+@property(nonatomic, readonly) FIRStorage *storage;
+
+/**
+ * The name of the Google Cloud Storage bucket associated with this reference,
+ * in gs://bucket/path/to/object.txt, the bucket would be: 'bucket'
+ */
+@property(nonatomic, readonly) NSString *bucket;
+
+/**
+ * The full path to this object, not including the Google Cloud Storage bucket.
+ * In gs://bucket/path/to/object.txt, the full path would be: 'path/to/object.txt'
+ */
+@property(nonatomic, readonly) NSString *fullPath;
+
+/**
+ * The short name of the object associated with this reference,
+ * in gs://bucket/path/to/object.txt, the name of the object would be: 'object.txt'
+ */
+@property(nonatomic, readonly) NSString *name;
+
+#pragma mark - Path Operations
+
+/**
+ * Creates a new FIRStorageReference pointing to the root object.
+ * @return A new FIRStorageReference pointing to the root object.
+ */
+- (FIRStorageReference *)root;
+
+/**
+ * Creates a new FIRStorageReference pointing to the parent of the current reference
+ * or nil if this instance references the root location.
+ * For example:
+ * path = foo/bar/baz parent = foo/bar
+ * path = foo parent = (root)
+ * path = (root) parent = nil
+ * @return A new FIRStorageReference pointing to the parent of the current reference.
+ */
+- (nullable FIRStorageReference *)parent;
+
+/**
+ * Creates a new FIRStorageReference pointing to a child object of the current reference.
+ * path = foo child = bar newPath = foo/bar
+ * path = foo/bar child = baz newPath = foo/bar/baz
+ * All leading and trailing slashes will be removed, and consecutive slashes will be
+ * compressed to single slashes. For example:
+ * child = /foo/bar newPath = foo/bar
+ * child = foo/bar/ newPath = foo/bar
+ * child = foo///bar newPath = foo/bar
+ * @param path Path to append to the current path.
+ * @return A new FIRStorageReference pointing to a child location of the current reference.
+ */
+- (FIRStorageReference *)child:(NSString *)path;
+
+#pragma mark - Uploads
+
+/**
+ * Asynchronously uploads data to the currently specified FIRStorageReference,
+ * without additional metadata.
+ * This is not recommended for large files, and one should instead upload a file from disk.
+ * @param uploadData The NSData to upload.
+ * @return An instance of FIRStorageUploadTask, which can be used to monitor or manage the upload.
+ */
+- (FIRStorageUploadTask *)putData:(NSData *)uploadData FIR_SWIFT_NAME(putData(_:));
+
+/**
+ * Asynchronously uploads data to the currently specified FIRStorageReference.
+ * This is not recommended for large files, and one should instead upload a file from disk.
+ * @param uploadData The NSData to upload.
+ * @param metadata FIRStorageMetadata containing additional information (MIME type, etc.)
+ * about the object being uploaded.
+ * @return An instance of FIRStorageUploadTask, which can be used to monitor or manage the upload.
+ */
+- (FIRStorageUploadTask *)putData:(NSData *)uploadData
+ metadata:(nullable FIRStorageMetadata *)metadata
+ FIR_SWIFT_NAME(putData(_:metadata:));
+
+/**
+ * Asynchronously uploads data to the currently specified FIRStorageReference.
+ * This is not recommended for large files, and one should instead upload a file from disk.
+ * @param uploadData The NSData to upload.
+ * @param metadata FIRStorageMetadata containing additional information (MIME type, etc.)
+ * about the object being uploaded.
+ * @param completion A completion block that either returns the object metadata on success,
+ * or an error on failure.
+ * @return An instance of FIRStorageUploadTask, which can be used to monitor or manage the upload.
+ */
+- (FIRStorageUploadTask *)putData:(NSData *)uploadData
+ metadata:(nullable FIRStorageMetadata *)metadata
+ completion:(nullable void (^)(FIRStorageMetadata *_Nullable metadata,
+ NSError *_Nullable error))completion
+ FIR_SWIFT_NAME(putData(_:metadata:completion:));
+
+/**
+ * Asynchronously uploads a file to the currently specified FIRStorageReference,
+ * without additional metadata.
+ * @param fileURL A URL representing the system file path of the object to be uploaded.
+ * @return An instance of FIRStorageUploadTask, which can be used to monitor or manage the upload.
+ */
+- (FIRStorageUploadTask *)putFile:(NSURL *)fileURL FIR_SWIFT_NAME(putFile(from:));
+
+/**
+ * Asynchronously uploads a file to the currently specified FIRStorageReference.
+ * @param fileURL A URL representing the system file path of the object to be uploaded.
+ * @param metadata FIRStorageMetadata containing additional information (MIME type, etc.)
+ * about the object being uploaded.
+ * @return An instance of FIRStorageUploadTask, which can be used to monitor or manage the upload.
+ */
+- (FIRStorageUploadTask *)putFile:(NSURL *)fileURL metadata:(nullable FIRStorageMetadata *)metadata
+ FIR_SWIFT_NAME(putFile(from:metadata:));
+
+/**
+ * Asynchronously uploads a file to the currently specified FIRStorageReference.
+ * @param fileURL A URL representing the system file path of the object to be uploaded.
+ * @param metadata FIRStorageMetadata containing additional information (MIME type, etc.)
+ * about the object being uploaded.
+ * @param completion A completion block that either returns the object metadata on success,
+ * or an error on failure.
+ * @return An instance of FIRStorageUploadTask, which can be used to monitor or manage the upload.
+ */
+- (FIRStorageUploadTask *)putFile:(NSURL *)fileURL
+ metadata:(nullable FIRStorageMetadata *)metadata
+ completion:(nullable void (^)(FIRStorageMetadata *_Nullable metadata,
+ NSError *_Nullable error))completion
+ FIR_SWIFT_NAME(putFile(from:metadata:completion:));
+
+#pragma mark - Downloads
+
+/**
+ * Asynchronously downloads the object at the FIRStorageReference to an NSData object in memory.
+ * An NSData of the provided max size will be allocated, so ensure that the device has enough free
+ * memory to complete the download. For downloading large files, writeToFile may be a better option.
+ * @param size The maximum size in bytes to download. If the download exceeds this size
+ * the task will be cancelled and an error will be returned.
+ * @param completion A completion block that either returns the object data on success,
+ * or an error on failure.
+ * @return An FIRStorageDownloadTask that can be used to monitor or manage the download.
+ */
+- (FIRStorageDownloadTask *)dataWithMaxSize:(int64_t)size
+ completion:(void (^)(NSData *_Nullable data,
+ NSError *_Nullable error))completion
+ FIR_SWIFT_NAME(getData(maxSize:completion:));
+
+/**
+ * Asynchronously retrieves a long lived download URL with a revokable token.
+ * This can be used to share the file with others, but can be revoked by a developer
+ * in the Firebase Console if desired.
+ * @param completion A completion block that either returns the URL on success,
+ * or an error on failure.
+ */
+- (void)downloadURLWithCompletion:(void (^)(NSURL *_Nullable URL,
+ NSError *_Nullable error))completion;
+
+/**
+ * Asynchronously downloads the object at the current path to a specified system filepath.
+ * @param fileURL A file system URL representing the path the object should be downloaded to.
+ * @return An FIRStorageDownloadTask that can be used to monitor or manage the download.
+ */
+- (FIRStorageDownloadTask *)writeToFile:(NSURL *)fileURL;
+
+/**
+ * Asynchronously downloads the object at the current path to a specified system filepath.
+ * @param fileURL A file system URL representing the path the object should be downloaded to.
+ * @param completion A completion block that fires when the file download completes.
+ * Returns an NSURL pointing to the file path of the downloaded file on success,
+ * or an error on failure.
+ * @return An FIRStorageDownloadTask that can be used to monitor or manage the download.
+ */
+- (FIRStorageDownloadTask *)writeToFile:(NSURL *)fileURL
+ completion:(nullable void (^)(NSURL *_Nullable URL,
+ NSError *_Nullable error))completion;
+
+#pragma mark - Metadata Operations
+
+/**
+ * Retrieves metadata associated with an object at the current path.
+ * @param completion A completion block which returns the object metadata on success,
+ * or an error on failure.
+ */
+- (void)metadataWithCompletion:(void (^)(FIRStorageMetadata *_Nullable metadata,
+ NSError *_Nullable error))completion
+ FIR_SWIFT_NAME(getMetadata(completion:));
+
+/**
+ * Updates the metadata associated with an object at the current path.
+ * @param metadata An FIRStorageMetadata object with the metadata to update.
+ * @param completion A completion block which returns the FIRStorageMetadata on success,
+ * or an error on failure.
+ */
+- (void)updateMetadata:(FIRStorageMetadata *)metadata
+ completion:(nullable void (^)(FIRStorageMetadata *_Nullable metadata,
+ NSError *_Nullable error))completion
+ FIR_SWIFT_NAME(updateMetadata(_:completion:));
+
+#pragma mark - Delete
+
+/**
+ * Deletes the object at the current path.
+ * @param completion A completion block which returns nil on success, or an error on failure.
+ */
+- (void)deleteWithCompletion:(nullable void (^)(NSError *_Nullable error))completion;
+
+@end
+
+NS_ASSUME_NONNULL_END
diff --git a/Firebase/Storage/Public/FIRStorageSwiftNameSupport.h b/Firebase/Storage/Public/FIRStorageSwiftNameSupport.h
new file mode 100644
index 0000000..55e1bcc
--- /dev/null
+++ b/Firebase/Storage/Public/FIRStorageSwiftNameSupport.h
@@ -0,0 +1,29 @@
+/*
+ * Copyright 2017 Google
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef FIR_SWIFT_NAME
+
+#import <Foundation/Foundation.h>
+
+// NS_SWIFT_NAME can only translate factory methods before the iOS 9.3 SDK.
+// Wrap it in our own macro if it's a non-compatible SDK.
+#ifdef __IPHONE_9_3
+#define FIR_SWIFT_NAME(X) NS_SWIFT_NAME(X)
+#else
+#define FIR_SWIFT_NAME(X) // Intentionally blank.
+#endif // #ifdef __IPHONE_9_3
+
+#endif // FIR_SWIFT_NAME
diff --git a/Firebase/Storage/Public/FIRStorageTask.h b/Firebase/Storage/Public/FIRStorageTask.h
new file mode 100644
index 0000000..0428220
--- /dev/null
+++ b/Firebase/Storage/Public/FIRStorageTask.h
@@ -0,0 +1,76 @@
+/*
+ * Copyright 2017 Google
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#import <Foundation/Foundation.h>
+
+#import "FIRStorageConstants.h"
+#import "FIRStorageMetadata.h"
+#import "FIRStorageSwiftNameSupport.h"
+
+NS_ASSUME_NONNULL_BEGIN
+
+/**
+ * A superclass to all FIRStorage*Tasks, including FIRStorageUploadTask
+ * and FIRStorageDownloadTask, to provide state transitions, event raising, and common storage
+ * or metadata and errors.
+ * Callbacks are always fired on the developer specified callback queue.
+ * If no queue is specified by the developer, it defaults to the main queue.
+ * Currently not thread safe, so only call methods on the main thread.
+ */
+FIR_SWIFT_NAME(StorageTask)
+@interface FIRStorageTask : NSObject
+
+/**
+ * An immutable view of the task and associated metadata, progress, error, etc.
+ */
+@property(strong, readonly, nonatomic, nonnull) FIRStorageTaskSnapshot *snapshot;
+
+@end
+
+/**
+ * Defines task operations such as pause, resume, cancel, and enqueue for all tasks.
+ * All tasks are required to implement enqueue, which begins the task, and may optionally
+ * implement pause, resume, and cancel, which operate on the task to pause, resume, and cancel
+ * operations.
+ */
+FIR_SWIFT_NAME(StorageTaskManagement)
+@protocol FIRStorageTaskManagement<NSObject>
+
+@required
+/**
+ * Prepares a task and begins execution.
+ */
+- (void)enqueue;
+
+@optional
+/**
+ * Pauses a task currently in progress.
+ */
+- (void)pause;
+
+/**
+ * Cancels a task currently in progress.
+ */
+- (void)cancel;
+
+/**
+ * Resumes a task that is paused.
+ */
+- (void)resume;
+
+@end
+
+NS_ASSUME_NONNULL_END
diff --git a/Firebase/Storage/Public/FIRStorageTaskSnapshot.h b/Firebase/Storage/Public/FIRStorageTaskSnapshot.h
new file mode 100644
index 0000000..b654c09
--- /dev/null
+++ b/Firebase/Storage/Public/FIRStorageTaskSnapshot.h
@@ -0,0 +1,68 @@
+/*
+ * Copyright 2017 Google
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#import <Foundation/Foundation.h>
+
+#import "FIRStorageConstants.h"
+#import "FIRStorageSwiftNameSupport.h"
+
+NS_ASSUME_NONNULL_BEGIN
+
+@class FIRStorageMetadata;
+@class FIRStorageReference;
+@class FIRStorageTask;
+
+/**
+ * FIRStorageTaskSnapshot represents an immutable view of a task.
+ * A Snapshot contains a task, storage reference, metadata (if it exists),
+ * progress, and an error (if one occurred).
+ */
+FIR_SWIFT_NAME(StorageTaskSnapshot)
+@interface FIRStorageTaskSnapshot : NSObject
+
+/**
+ * Subclass of FIRStorageTask this snapshot represents.
+ */
+@property(readonly, copy, nonatomic) __kindof FIRStorageTask *task;
+
+/**
+ * Metadata returned by the task, or nil if no metadata returned.
+ */
+@property(readonly, copy, nonatomic, nullable) FIRStorageMetadata *metadata;
+
+/**
+ * FIRStorageReference this task is operates on.
+ */
+@property(readonly, copy, nonatomic) FIRStorageReference *reference;
+
+/**
+ * NSProgress object which tracks the progess of an upload or download.
+ */
+@property(readonly, strong, nonatomic, nullable) NSProgress *progress;
+
+/**
+ * Error during task execution, or nil if no error occurred.
+ */
+@property(readonly, copy, nonatomic, nullable) NSError *error;
+
+/**
+ * Status of the task.
+ */
+@property(readonly, nonatomic) FIRStorageTaskStatus status;
+
+@end
+
+NS_ASSUME_NONNULL_END
diff --git a/Firebase/Storage/Public/FIRStorageUploadTask.h b/Firebase/Storage/Public/FIRStorageUploadTask.h
new file mode 100644
index 0000000..cdf1d29
--- /dev/null
+++ b/Firebase/Storage/Public/FIRStorageUploadTask.h
@@ -0,0 +1,39 @@
+/*
+ * Copyright 2017 Google
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#import <Foundation/Foundation.h>
+
+#import "FIRStorageObservableTask.h"
+#import "FIRStorageSwiftNameSupport.h"
+
+NS_ASSUME_NONNULL_BEGIN
+
+/**
+ * FIRStorageUploadTask implements resumable uploads to a file in Firebase Storage.
+ * Uploads can be returned on completion with a completion callback, and can be monitored
+ * by attaching observers, or controlled by calling FIRStorageTask#pause, FIRStorageTask#resume,
+ * or FIRStorageTask#cancel.
+ * Uploads can take NSData in memory, or an NSURL to a file on disk.
+ * Uploads are performed on a background queue, and callbacks are raised on the developer
+ * specified callbackQueue in FIRStorage, or the main queue if left unspecified.
+ * Currently all uploads must be initiated and managed on the main queue.
+ */
+FIR_SWIFT_NAME(StorageUploadTask)
+@interface FIRStorageUploadTask : FIRStorageObservableTask<FIRStorageTaskManagement>
+
+@end
+
+NS_ASSUME_NONNULL_END
diff --git a/Firebase/Storage/Public/FirebaseStorage.h b/Firebase/Storage/Public/FirebaseStorage.h
new file mode 100644
index 0000000..1e5dfa4
--- /dev/null
+++ b/Firebase/Storage/Public/FirebaseStorage.h
@@ -0,0 +1,25 @@
+/*
+ * Copyright 2017 Google
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#import "FIRStorage.h"
+#import "FIRStorageConstants.h"
+#import "FIRStorageDownloadTask.h"
+#import "FIRStorageMetadata.h"
+#import "FIRStorageObservableTask.h"
+#import "FIRStorageReference.h"
+#import "FIRStorageTask.h"
+#import "FIRStorageTaskSnapshot.h"
+#import "FIRStorageUploadTask.h"