You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

56 lines
2.6 KiB

  1. // Copyright 2019 Google
  2. //
  3. // Licensed under the Apache License, Version 2.0 (the "License");
  4. // you may not use this file except in compliance with the License.
  5. // You may obtain a copy of the License at
  6. //
  7. // http://www.apache.org/licenses/LICENSE-2.0
  8. //
  9. // Unless required by applicable law or agreed to in writing, software
  10. // distributed under the License is distributed on an "AS IS" BASIS,
  11. // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  12. // See the License for the specific language governing permissions and
  13. // limitations under the License.
  14. #import <Foundation/Foundation.h>
  15. OBJC_EXTERN const NSUInteger FIRCLSNetworkMaximumRetryCount;
  16. NS_ASSUME_NONNULL_BEGIN
  17. typedef void (^FIRCLSNetworkDataTaskCompletionHandlerBlock)(NSData *__nullable data,
  18. NSURLResponse *__nullable response,
  19. NSError *__nullable error);
  20. typedef void (^FIRCLSNetworkDownloadTaskCompletionHandlerBlock)(NSURL *__nullable location,
  21. NSURLResponse *__nullable response,
  22. NSError *__nullable error);
  23. @interface FIRCLSFABNetworkClient : NSObject
  24. - (instancetype)init;
  25. - (instancetype)initWithQueue:(nullable NSOperationQueue *)operationQueue;
  26. - (instancetype)initWithSessionConfiguration:(NSURLSessionConfiguration *)config
  27. queue:(nullable NSOperationQueue *)operationQueue
  28. NS_DESIGNATED_INITIALIZER;
  29. - (void)startDataTaskWithRequest:(NSURLRequest *)request
  30. retryLimit:(NSUInteger)retryLimit
  31. completionHandler:(FIRCLSNetworkDataTaskCompletionHandlerBlock)completionHandler;
  32. - (void)startDownloadTaskWithRequest:(NSURLRequest *)request
  33. retryLimit:(NSUInteger)retryLimit
  34. completionHandler:
  35. (FIRCLSNetworkDownloadTaskCompletionHandlerBlock)completionHandler;
  36. - (void)invalidateAndCancel;
  37. // Backwards compatibility (we cannot change an interface in Fabric Base that other kits rely on,
  38. // since we have no control of versioning dependencies)
  39. - (void)startDataTaskWithRequest:(NSURLRequest *)request
  40. completionHandler:(FIRCLSNetworkDataTaskCompletionHandlerBlock)completionHandler;
  41. - (void)startDownloadTaskWithRequest:(NSURLRequest *)request
  42. completionHandler:
  43. (FIRCLSNetworkDownloadTaskCompletionHandlerBlock)completionHandler;
  44. @end
  45. NS_ASSUME_NONNULL_END