QCloudGetObjectRequest.h 6.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120
  1. //
  2. // GetObject.h
  3. // GetObject
  4. //
  5. // Created by tencent
  6. // Copyright (c) 2015年 tencent. All rights reserved.
  7. //
  8. // ██████╗ ██████╗██╗ ██████╗ ██╗ ██╗██████╗ ████████╗███████╗██████╗ ███╗ ███╗██╗███╗ ██╗ █████╗ ██╗ ██╗ █████╗ ██████╗
  9. // ██╔═══██╗██╔════╝██║ ██╔═══██╗██║ ██║██╔══██╗ ╚══██╔══╝██╔════╝██╔══██╗████╗ ████║██║████╗ ██║██╔══██╗██║ ██║ ██╔══██╗██╔══██╗
  10. // ██║ ██║██║ ██║ ██║ ██║██║ ██║██║ ██║ ██║ █████╗ ██████╔╝██╔████╔██║██║██╔██╗ ██║███████║██║ ██║ ███████║██████╔╝
  11. // ██║▄▄ ██║██║ ██║ ██║ ██║██║ ██║██║ ██║ ██║ ██╔══╝ ██╔══██╗██║╚██╔╝██║██║██║╚██╗██║██╔══██║██║ ██║ ██╔══██║██╔══██╗
  12. // ╚██████╔╝╚██████╗███████╗╚██████╔╝╚██████╔╝██████╔╝ ██║ ███████╗██║ ██║██║ ╚═╝ ██║██║██║ ╚████║██║ ██║███████╗ ███████╗██║ ██║██████╔╝
  13. // ╚══▀▀═╝ ╚═════╝╚══════╝ ╚═════╝ ╚═════╝ ╚═════╝ ╚═╝ ╚══════╝╚═╝ ╚═╝╚═╝ ╚═╝╚═╝╚═╝ ╚═══╝╚═╝ ╚═╝╚══════╝ ╚══════╝╚═╝ ╚═╝╚═════╝
  14. //
  15. //
  16. // _ __ _ _
  17. // (_) / _| | | | |
  18. // ___ ___ _ ____ ___ ___ ___ | |_ ___ _ __ __| | _____ _____| | ___ _ __ ___ _ __ ___
  19. // / __|/ _ \ '__\ \ / / |/ __/ _ \ | _/ _ \| '__| / _` |/ _ \ \ / / _ \ |/ _ \| '_ \ / _ \ '__/ __|
  20. // \__ \ __/ | \ V /| | (_| __/ | || (_) | | | (_| | __/\ V / __/ | (_) | |_) | __/ | \__
  21. // |___/\___|_| \_/ |_|\___\___| |_| \___/|_| \__,_|\___| \_/ \___|_|\___/| .__/ \___|_| |___/
  22. // ______ ______ ______ ______ ______ ______ ______ ______ | |
  23. // |______|______|______|______|______|______|______|______| |_|
  24. //
  25. #import <Foundation/Foundation.h>
  26. #import <QCloudCore/QCloudCore.h>
  27. NS_ASSUME_NONNULL_BEGIN
  28. /**
  29. 下载 COS 对象的方法.
  30. 可以直接发起 GET 请求获取 COS 中完整的对象数据, 或者在 GET 请求 中传入 Range 请求头部获取对象的部分内容. 获取COS 对象的同时,对象的元数据将会作为 HTTP 响应头部随对象内容一同返回,COS 支持GET 请求时 使用 URL 参数的方式覆盖响应的部分元数据值,例如覆盖 Content-iDisposition 的响应值.
  31. 关于获取 COS 对象的具体描述,请查看 https://cloud.tencent.com/document/product/436/14115.
  32. 关于获取 COS 对象的接口描述,请查看 https://cloud.tencent.com/document/product/436/7753.
  33. cos iOS SDK 中获取 COS 对象请求的方法具体步骤如下:
  34. 1. 实例化 QCloudGetObjectRequest,填入需要的参数。
  35. 2. 调用 QCloudCOSXMLService 对象中的 GetObject 方法发出请求。
  36. 3. 从回调的 finishBlock 中的 outputObject 获取具体内容。
  37. 示例:
  38. @code
  39. QCloudGetObjectRequest* request = [[QCloudGetObjectRequest alloc] init];
  40. request.bucket = @"bucketName"; //存储桶名称(cos v5 的 bucket格式为:xxx-appid, 如 test-1253960454)
  41. request.object = @"objectName";;
  42. [request setFinishBlock:^(id outputObject, NSError *error) {
  43. //additional actions after finishing
  44. }];
  45. [[QCloudCOSXMLService defaultCOSXML] GetObject:request];
  46. @endcode
  47. */
  48. @interface QCloudGetObjectRequest : QCloudBizHTTPRequest
  49. /**
  50. 设置响应头部中的 Content-Type参数
  51. */
  52. @property (strong, nonatomic) NSString *responseContentType;
  53. /**
  54. 设置响应头部中的Content-Language参数
  55. */
  56. @property (strong, nonatomic) NSString *responseContentLanguage;
  57. /**
  58. 设置响应头部中的Content-Expires参数
  59. */
  60. @property (strong, nonatomic) NSString *responseContentExpires;
  61. /**
  62. 设置响应头部中的Cache-Control参数
  63. */
  64. @property (strong, nonatomic) NSString *responseCacheControl;
  65. /**
  66. 设置响应头部中的 Content-Disposition 参数。
  67. */
  68. @property (strong, nonatomic) NSString *responseContentDisposition;
  69. /**
  70. 设置响应头部中的 Content-Encoding 参数。
  71. */
  72. @property (strong, nonatomic) NSString *responseContentEncoding;
  73. /**
  74. RFC 2616 中定义的指定文件下载范围,以字节(bytes)为单位
  75. */
  76. @property (strong, nonatomic) NSString *range;
  77. /**
  78. 如果文件修改时间晚于指定时间,才返回文件内容。否则返回 412 (not modified)
  79. */
  80. @property (strong, nonatomic) NSString *ifModifiedSince;
  81. /**
  82. 如果文件修改时间早于或等于指定时间,才返回文件内容。否则返回 412 (precondition failed)
  83. */
  84. @property (strong, nonatomic) NSString *ifUnmodifiedModifiedSince;
  85. /**
  86. 当 ETag 与指定的内容一致,才返回文件。否则返回 412 (precondition failed)
  87. */
  88. @property (strong, nonatomic) NSString *ifMatch;
  89. /**
  90. 当 ETag 与指定的内容不一致,才返回文件。否则返回 304 (not modified)
  91. */
  92. @property (strong, nonatomic) NSString *ifNoneMatch;
  93. /**
  94. 对象名
  95. */
  96. @property (strong, nonatomic) NSString *object;
  97. /**
  98. 存储桶名
  99. */
  100. @property (strong, nonatomic) NSString *bucket;
  101. /*
  102. 在进行HTTP请求的时候,可以通过设置该参数来设置自定义的一些头部信息。
  103. 通常情况下,携带特定的额外HTTP头部可以使用某项功能,如果是这类需求,可以通过设置该属性来实现。
  104. */
  105. @property (strong, nonatomic) NSDictionary* customHeaders;
  106. @end
  107. NS_ASSUME_NONNULL_END