OSSConstants.h 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104
  1. //
  2. // OSSConstants.h
  3. // AliyunOSSSDK
  4. //
  5. // Created by huaixu on 2018/1/22.
  6. // Copyright © 2018年 aliyun. All rights reserved.
  7. //
  8. #import <Foundation/Foundation.h>
  9. NS_ASSUME_NONNULL_BEGIN
  10. typedef NSString* _Nullable (^OSSCustomSignContentBlock) (NSString * contentToSign, NSError **error);
  11. typedef NSData * _Nullable (^OSSResponseDecoderBlock) (NSData * data);
  12. typedef void (^OSSNetworkingUploadProgressBlock) (int64_t bytesSent, int64_t totalBytesSent, int64_t totalBytesExpectedToSend);
  13. typedef void (^OSSNetworkingDownloadProgressBlock) (int64_t bytesWritten, int64_t totalBytesWritten, int64_t totalBytesExpectedToWrite);
  14. typedef void (^OSSNetworkingRetryBlock) (void);
  15. typedef void (^OSSNetworkingCompletionHandlerBlock) (id _Nullable responseObject, NSError * _Nullable error);
  16. typedef void (^OSSNetworkingOnRecieveDataBlock) (NSData * data);
  17. /**
  18. The flag of verification about crc64
  19. */
  20. typedef NS_ENUM(NSUInteger, OSSRequestCRCFlag) {
  21. OSSRequestCRCUninitialized,
  22. OSSRequestCRCOpen,
  23. OSSRequestCRCClosed
  24. };
  25. /**
  26. Retry type definition
  27. */
  28. typedef NS_ENUM(NSInteger, OSSNetworkingRetryType) {
  29. OSSNetworkingRetryTypeUnknown,
  30. OSSNetworkingRetryTypeShouldRetry,
  31. OSSNetworkingRetryTypeShouldNotRetry,
  32. OSSNetworkingRetryTypeShouldRefreshCredentialsAndRetry,
  33. OSSNetworkingRetryTypeShouldCorrectClockSkewAndRetry
  34. };
  35. /**
  36. * @brief: The following constants are provided by OSSNetworking as possible operation types.
  37. */
  38. typedef NS_ENUM(NSInteger, OSSOperationType) {
  39. OSSOperationTypePutObject,
  40. };
  41. /**
  42. * @brief: The following constants are provided by OSSClient as possible error codes.
  43. */
  44. typedef NS_ENUM(NSInteger, OSSClientErrorCODE) {
  45. OSSClientErrorCodeNetworkingFailWithResponseCode0,
  46. OSSClientErrorCodeSignFailed,
  47. OSSClientErrorCodeFileCantWrite,
  48. OSSClientErrorCodeInvalidArgument,
  49. OSSClientErrorCodeNilUploadid,
  50. OSSClientErrorCodeTaskCancelled,
  51. OSSClientErrorCodeNetworkError,
  52. OSSClientErrorCodeInvalidCRC,
  53. OSSClientErrorCodeCannotResumeUpload,
  54. OSSClientErrorCodeExcpetionCatched,
  55. OSSClientErrorCodeNotKnown
  56. };
  57. typedef NS_ENUM(NSInteger, OSSXMLDictionaryAttributesMode)
  58. {
  59. OSSXMLDictionaryAttributesModePrefixed = 0, //default
  60. OSSXMLDictionaryAttributesModeDictionary,
  61. OSSXMLDictionaryAttributesModeUnprefixed,
  62. OSSXMLDictionaryAttributesModeDiscard
  63. };
  64. typedef NS_ENUM(NSInteger, OSSXMLDictionaryNodeNameMode)
  65. {
  66. OSSXMLDictionaryNodeNameModeRootOnly = 0, //default
  67. OSSXMLDictionaryNodeNameModeAlways,
  68. OSSXMLDictionaryNodeNameModeNever
  69. };
  70. typedef NS_ENUM(NSInteger, OSSBucketStorageClass)
  71. {
  72. OSSBucketStorageClassStandard,
  73. OSSBucketStorageClassIA,
  74. OSSBucketStorageClassArchive
  75. };
  76. typedef NSString * OSSXMLDictionaryAttributeName NS_EXTENSIBLE_STRING_ENUM;
  77. OBJC_EXTERN OSSXMLDictionaryAttributeName const OSSXMLDictionaryAttributesKey;
  78. OBJC_EXTERN OSSXMLDictionaryAttributeName const OSSXMLDictionaryCommentsKey;
  79. OBJC_EXTERN OSSXMLDictionaryAttributeName const OSSXMLDictionaryTextKey;
  80. OBJC_EXTERN OSSXMLDictionaryAttributeName const OSSXMLDictionaryNodeNameKey;
  81. OBJC_EXTERN OSSXMLDictionaryAttributeName const OSSXMLDictionaryAttributePrefix;
  82. OBJC_EXTERN NSString * const OSSHTTPMethodHEAD;
  83. OBJC_EXTERN NSString * const OSSHTTPMethodGET;
  84. OBJC_EXTERN NSString * const OSSHTTPMethodPUT;
  85. OBJC_EXTERN NSString * const OSSHTTPMethodPOST;
  86. OBJC_EXTERN NSString * const OSSHTTPMethodDELETE;
  87. NS_ASSUME_NONNULL_END