FIRNetworkConstants.h 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  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. /// Error codes in Firebase Network error domain.
  18. /// Note: these error codes should never change. It would make it harder to decode the errors if
  19. /// we inadvertently altered any of these codes in a future SDK version.
  20. typedef NS_ENUM(NSInteger, FIRNetworkErrorCode) {
  21. /// Unknown error.
  22. FIRNetworkErrorCodeUnknown = 0,
  23. /// Error occurs when the request URL is invalid.
  24. FIRErrorCodeNetworkInvalidURL = 1,
  25. /// Error occurs when request cannot be constructed.
  26. FIRErrorCodeNetworkRequestCreation = 2,
  27. /// Error occurs when payload cannot be compressed.
  28. FIRErrorCodeNetworkPayloadCompression = 3,
  29. /// Error occurs when session task cannot be created.
  30. FIRErrorCodeNetworkSessionTaskCreation = 4,
  31. /// Error occurs when there is no response.
  32. FIRErrorCodeNetworkInvalidResponse = 5
  33. };
  34. #pragma mark - Network constants
  35. /// The prefix of the ID of the background session.
  36. extern NSString *const kFIRNetworkBackgroundSessionConfigIDPrefix;
  37. /// The sub directory to store the files of data that is being uploaded in the background.
  38. extern NSString *const kFIRNetworkApplicationSupportSubdirectory;
  39. /// Name of the temporary directory that stores files for background uploading.
  40. extern NSString *const kFIRNetworkTempDirectoryName;
  41. /// The period when the temporary uploading file can stay.
  42. extern const NSTimeInterval kFIRNetworkTempFolderExpireTime;
  43. /// The default network request timeout interval.
  44. extern const NSTimeInterval kFIRNetworkTimeOutInterval;
  45. /// The host to check the reachability of the network.
  46. extern NSString *const kFIRNetworkReachabilityHost;
  47. /// The key to get the error context of the UserInfo.
  48. extern NSString *const kFIRNetworkErrorContext;
  49. #pragma mark - Network Status Code
  50. extern const int kFIRNetworkHTTPStatusOK;
  51. extern const int kFIRNetworkHTTPStatusNoContent;
  52. extern const int kFIRNetworkHTTPStatusCodeMultipleChoices;
  53. extern const int kFIRNetworkHTTPStatusCodeMovedPermanently;
  54. extern const int kFIRNetworkHTTPStatusCodeFound;
  55. extern const int kFIRNetworkHTTPStatusCodeNotModified;
  56. extern const int kFIRNetworkHTTPStatusCodeMovedTemporarily;
  57. extern const int kFIRNetworkHTTPStatusCodeNotFound;
  58. extern const int kFIRNetworkHTTPStatusCodeCannotAcceptTraffic;
  59. extern const int kFIRNetworkHTTPStatusCodeUnavailable;
  60. #pragma mark - Error Domain
  61. extern NSString *const kFIRNetworkErrorDomain;