FIRStorageDownloadTask_Private.h 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  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 "FirebaseStorageInternal/Sources/Public/FirebaseStorageInternal/FIRStorageDownloadTask.h"
  18. @class FIRIMPLStorageReference;
  19. @class GTMSessionFetcherService;
  20. NS_ASSUME_NONNULL_BEGIN
  21. @interface FIRIMPLStorageDownloadTask ()
  22. /**
  23. * Bytes which have been downloaded so far.
  24. */
  25. @property(readonly, nonatomic) NSData *downloadData;
  26. /**
  27. * The file on disk to write to.
  28. */
  29. @property(copy, nonatomic) NSURL *fileURL;
  30. /**
  31. * Initializes a download task with a base FIRIMPLStorageReference and GTMSessionFetcherService.
  32. * @param reference The base FIRIMPLStorageReference which fetchers use for configuration.
  33. * @param service The GTMSessionFetcherService which will create fetchers.
  34. * @param queue The shared queue to use for all Storage operations.
  35. * @param fileURL The system URL to download to. If nil, download in memory as bytes.
  36. * @return Returns an instance of FIRIMPLStorageDownloadTask
  37. */
  38. - (instancetype)initWithReference:(FIRIMPLStorageReference *)reference
  39. fetcherService:(GTMSessionFetcherService *)service
  40. dispatchQueue:(dispatch_queue_t)queue
  41. file:(nullable NSURL *)fileURL;
  42. /**
  43. * Cancels the download task and passes an appropriate error to the developer.
  44. * @param error NSError to propagate to the developer.
  45. */
  46. - (void)cancelWithError:(NSError *)error;
  47. @end
  48. NS_ASSUME_NONNULL_END