QQApiInterfaceObject.h 24 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645
  1. ///
  2. /// \file QQApiInterfaceObject.h
  3. /// \brief QQApiInterface所依赖的请求及应答消息对象封装帮助类
  4. ///
  5. /// Created by Tencent on 12-5-15.
  6. /// Copyright (c) 2012年 Tencent. All rights reserved.
  7. ///
  8. #ifndef QQApiInterface_QQAPIOBJECT_h
  9. #define QQApiInterface_QQAPIOBJECT_h
  10. #import <Foundation/Foundation.h>
  11. typedef NS_ENUM(NSInteger,QQApiSendResultCode) {
  12. EQQAPISENDSUCESS = 0,
  13. EQQAPIQQNOTINSTALLED = 1, //QQ未安装
  14. EQQAPIQQNOTSUPPORTAPI = 2, // QQ api不支持
  15. EQQAPIMESSAGETYPEINVALID = 3,
  16. EQQAPIMESSAGECONTENTNULL = 4,
  17. EQQAPIMESSAGECONTENTINVALID = 5,
  18. EQQAPIAPPNOTREGISTED = 6,
  19. EQQAPIAPPSHAREASYNC = 7,
  20. EQQAPIQQNOTSUPPORTAPI_WITH_ERRORSHOW = 8, //QQ api不支持 && SDK显示error提示(已废弃)
  21. EQQAPIMESSAGEARKCONTENTNULL = 9, //ark内容为空
  22. EQQAPIMESSAGE_MINI_CONTENTNULL = 10, //小程序参数为空
  23. EQQAPISENDFAILD = -1, //发送失败
  24. EQQAPISHAREDESTUNKNOWN = -2, //未指定分享到QQ或TIM
  25. EQQAPITIMSENDFAILD = -3, //发送失败
  26. EQQAPITIMNOTINSTALLED = 11, //TIM未安装
  27. EQQAPITIMNOTSUPPORTAPI = 12, // TIM api不支持
  28. EQQAPI_INCOMING_PARAM_ERROR = 13, // 外部传参错误
  29. EQQAPI_THIRD_APP_GROUP_ERROR_APP_NOT_AUTHORIZIED = 14, // APP未获得授权
  30. EQQAPI_THIRD_APP_GROUP_ERROR_CGI_FAILED = 15, // CGI请求失败
  31. EQQAPI_THIRD_APP_GROUP_ERROR_HAS_BINDED = 16, // 该组织已经绑定群聊
  32. EQQAPI_THIRD_APP_GROUP_ERROR_NOT_BINDED = 17, // 该组织尚未绑定群聊
  33. EQQAPIQZONENOTSUPPORTTEXT = 10000, //qzone分享不支持text类型分享
  34. EQQAPIQZONENOTSUPPORTIMAGE = 10001, //qzone分享不支持image类型分享
  35. EQQAPIVERSIONNEEDUPDATE = 10002, //当前QQ版本太低,需要更新至新版本才可以支持
  36. ETIMAPIVERSIONNEEDUPDATE = 10004, //当前TIM版本太低,需要更新至新版本才可以支持
  37. };
  38. #pragma mark - QQApiObject(分享对象类型)
  39. // QQApiObject control flags
  40. typedef NS_ENUM(NSUInteger,kQQAPICtrlFlag) {
  41. kQQAPICtrlFlagQZoneShareOnStart = 0x01,
  42. kQQAPICtrlFlagQZoneShareForbid = 0x02,
  43. kQQAPICtrlFlagQQShare = 0x04,
  44. kQQAPICtrlFlagQQShareFavorites = 0x08, //收藏
  45. kQQAPICtrlFlagQQShareDataline = 0x10, //数据线
  46. kQQAPICtrlFlagQQShareEnableArk = 0x20, //支持ARK
  47. kQQAPICtrlFlagQQShareEnableMiniProgram = 0x40, //支持小程序
  48. };
  49. // 分享到QQ或TIM
  50. typedef NS_ENUM(NSUInteger, ShareDestType) {
  51. ShareDestTypeQQ = 0,
  52. ShareDestTypeTIM,
  53. };
  54. //小程序的类型
  55. typedef NS_ENUM(NSUInteger, MiniProgramType) {
  56. MiniProgramType_Develop=0, // 开发版
  57. MiniProgramType_Test=1, // 测试版
  58. MiniProgramType_Online=3, // 正式版,默认
  59. MiniProgramType_Preview=4, // 预览版
  60. };
  61. // QQApiObject
  62. /** \brief 所有在QQ及插件间发送的数据对象的根类。
  63. */
  64. __attribute__((visibility("default"))) @interface QQApiObject : NSObject
  65. @property(nonatomic, retain) NSString* title; ///< 标题,最长128个字符
  66. @property(nonatomic, retain) NSString* description; ///<简要描述,最长512个字符
  67. @property(nonatomic, retain) NSString* universalLink; ///(>=3.3.7)支持第三方传入在互联开放平台注册的universallink
  68. @property(nonatomic, assign) uint64_t cflag;
  69. /*
  70. * 分享到QQ/TIM
  71. * SDK根据是否安装对应客户端进行判断,判断顺序:QQ > TIM
  72. * 默认分享到QQ,如果QQ未安装检测TIM是否安装
  73. */
  74. @property (nonatomic, assign) ShareDestType shareDestType;
  75. @end
  76. // ArkObject
  77. /** \brief 支持Ark的根类。
  78. */
  79. __attribute__((visibility("default"))) @interface ArkObject : NSObject
  80. @property(nonatomic,retain) NSString* arkData; ///< 显示Ark所需的数据,json串,长度暂不限制
  81. @property(nonatomic,assign) QQApiObject* qqApiObject; ///<原有老版本的QQApiObject
  82. - (id)initWithData:(NSString *)arkData qqApiObject:(QQApiObject*)qqApiObject;
  83. + (id)objectWithData:(NSString *)arkData qqApiObject:(QQApiObject*)qqApiObject;
  84. @end
  85. #pragma mark QQ小程序
  86. //分享小程序消息 - QQ 8.0.8
  87. __attribute__((visibility("default"))) @interface QQApiMiniProgramObject : NSObject
  88. @property(nonatomic,retain) QQApiObject* qqApiObject; //原有老版本的QQApiObject
  89. @property(nonatomic,retain) NSString* miniAppID; //必填,小程序的AppId(注:必须在QQ互联平台中,将该小程序与分享的App绑定)
  90. @property(nonatomic,retain) NSString* miniPath; //必填,小程序的展示路径
  91. @property(nonatomic,retain) NSString* webpageUrl; //必填,兼容低版本的网页链接
  92. @property(nonatomic,assign) MiniProgramType miniprogramType; //非必填,小程序的类型,默认正式版(3),可选测试版(1)、预览版(4)
  93. @end
  94. //唤起小程序 - QQ 8.1.8
  95. __attribute__((visibility("default"))) @interface QQApiLaunchMiniProgramObject : QQApiObject
  96. @property(nonatomic,retain) NSString* miniAppID; //必填,小程序的AppId(注:必须在QQ互联平台中,将该小程序与分享的App绑定)
  97. @property(nonatomic,retain) NSString* miniPath; //必填,小程序的展示路径
  98. @property(nonatomic,assign) MiniProgramType miniprogramType; //非必填,小程序的类型,默认正式版(3),可选测试版(1)、开发版(0)
  99. @end
  100. // QQApiResultObject
  101. /** \brief 用于请求回应的数据类型。
  102. <h3>可能错误码及描述如下:</h3>
  103. <TABLE>
  104. <TR><TD>error</TD><TD>errorDescription</TD><TD>注释</TD></TR>
  105. <TR><TD>0</TD><TD>nil</TD><TD>成功</TD></TR>
  106. <TR><TD>-1</TD><TD>param error</TD><TD>参数错误</TD></TR>
  107. <TR><TD>-2</TD><TD>group code is invalid</TD><TD>该群不在自己的群列表里面</TD></TR>
  108. <TR><TD>-3</TD><TD>upload photo failed</TD><TD>上传图片失败</TD></TR>
  109. <TR><TD>-4</TD><TD>user give up the current operation</TD><TD>用户放弃当前操作</TD></TR>
  110. <TR><TD>-5</TD><TD>client internal error</TD><TD>客户端内部处理错误</TD></TR>
  111. </TABLE>
  112. */
  113. __attribute__((visibility("default"))) @interface QQApiResultObject : QQApiObject
  114. @property(nonatomic,retain) NSString* error; ///<错误
  115. @property(nonatomic,retain) NSString* errorDescription; ///<错误描述
  116. @property(nonatomic,retain) NSString* extendInfo; ///<扩展信息
  117. @end
  118. // QQApiTextObject
  119. /** \brief 文本对象
  120. */
  121. @interface QQApiTextObject : QQApiObject
  122. @property(nonatomic,retain)NSString* text; ///<文本内容,必填,最长1536个字符
  123. -(id)initWithText:(NSString*)text; ///<初始化方法
  124. +(id)objectWithText:(NSString*)text;///<工厂方法,获取一个QQApiTextObject对象.
  125. @end
  126. // QQApiURLObject
  127. typedef NS_ENUM(NSUInteger, QQApiURLTargetType) {
  128. QQApiURLTargetTypeNotSpecified = 0x00,
  129. QQApiURLTargetTypeAudio = 0x01,
  130. QQApiURLTargetTypeVideo = 0x02,
  131. QQApiURLTargetTypeNews = 0x03
  132. };
  133. /** @brief URL对象类型。
  134. 包括URL地址,URL地址所指向的目标类型及预览图像。
  135. */
  136. __attribute__((visibility("default"))) @interface QQApiURLObject : QQApiObject
  137. /**
  138. URL地址所指向的目标类型.
  139. @note 参见QQApi.h 中的 QQApiURLTargetType 定义.
  140. */
  141. @property(nonatomic)QQApiURLTargetType targetContentType;
  142. @property(nonatomic,retain)NSURL* url; ///<URL地址,必填,最长512个字符
  143. @property(nonatomic,retain)NSData* previewImageData;///<预览图像数据,最大1M字节
  144. @property(nonatomic, retain) NSURL *previewImageURL; ///<预览图像URL **预览图像数据与预览图像URL可二选一
  145. /**
  146. 初始化方法
  147. */
  148. -(id)initWithURL:(NSURL*)url title:(NSString*)title description:(NSString*)description previewImageData:(NSData*)data targetContentType:(QQApiURLTargetType)targetContentType;
  149. -(id)initWithURL:(NSURL*)url title:(NSString*)title description:(NSString*)description previewImageURL:(NSURL*)previewURL targetContentType:(QQApiURLTargetType)targetContentType;
  150. /**
  151. 工厂方法,获取一个QQApiURLObject对象
  152. */
  153. +(id)objectWithURL:(NSURL*)url title:(NSString*)title description:(NSString*)description previewImageData:(NSData*)data targetContentType:(QQApiURLTargetType)targetContentType;
  154. +(id)objectWithURL:(NSURL*)url title:(NSString*)title description:(NSString*)description previewImageURL:(NSURL*)previewURL targetContentType:(QQApiURLTargetType)targetContentType;
  155. @end
  156. // QQApiExtendObject
  157. /** @brief 扩展数据类型
  158. */
  159. @interface QQApiExtendObject : QQApiObject
  160. @property(nonatomic,retain) NSData* data;///<具体数据内容,必填,最大5M字节
  161. @property(nonatomic,retain) NSData* previewImageData;///<预览图像,最大1M字节
  162. @property(nonatomic,retain) NSArray* imageDataArray;///图片数组(多图暂只支持分享到手机QQ收藏功能)
  163. /**
  164. 初始化方法
  165. @param data 数据内容
  166. @param previewImageData 用于预览的图片
  167. @param title 标题
  168. @param description 此对象,分享的描述
  169. */
  170. - (id)initWithData:(NSData*)data previewImageData:(NSData*)previewImageData title:(NSString*)title description:(NSString*)description;
  171. /**
  172. 初始化方法
  173. @param data 数据内容
  174. @param title 标题
  175. @param description 此对象,分享的描述
  176. @param imageDataArray 发送的多张图片队列
  177. */
  178. - (id)initWithData:(NSData *)data previewImageData:(NSData*)previewImageData title:(NSString *)title description:(NSString *)description imageDataArray:(NSArray *)imageDataArray;
  179. /**
  180. helper方法获取一个autorelease的<code>QQApiExtendObject</code>对象
  181. @param data 数据内容
  182. @param previewImageData 用于预览的图片
  183. @param title 标题
  184. @param description 此对象,分享的描述
  185. @return
  186. 一个自动释放的<code>QQApiExtendObject</code>实例
  187. */
  188. + (id)objectWithData:(NSData*)data previewImageData:(NSData*)previewImageData title:(NSString*)title description:(NSString*)description;
  189. /**
  190. helper方法获取一个autorelease的<code>QQApiExtendObject</code>对象
  191. @param data 数据内容
  192. @param previewImageData 用于预览的图片
  193. @param title 标题
  194. @param description 此对象,分享的描述
  195. @param imageDataArray 发送的多张图片队列
  196. @return
  197. 一个自动释放的<code>QQApiExtendObject</code>实例
  198. */
  199. + (id)objectWithData:(NSData*)data previewImageData:(NSData*)previewImageData title:(NSString*)title description:(NSString*)description imageDataArray:(NSArray*)imageDataArray;
  200. @end
  201. // QQApiImageObject
  202. /** @brief 图片对象
  203. 用于分享图片内容的对象,是一个指定为图片类型的<code>QQApiExtendObject</code>
  204. */
  205. @interface QQApiImageObject : QQApiExtendObject
  206. @end
  207. // QQApiImageForQQAvatarObject
  208. /** @brief 图片对象
  209. 用于设置QQ头像内容的对象,是一个指定为图片类型的<code>QQApiExtendObject</code>
  210. */
  211. @interface QQApiImageForQQAvatarObject : QQApiExtendObject
  212. @end
  213. /**
  214. * @brief 视频对象
  215. * 用于设置动态头像
  216. * assetURL可传ALAsset的ALAssetPropertyAssetURL,或者PHAsset的localIdentifier
  217. 从手Q返回的错误码:
  218. //第三方设置动态头像结果
  219. @"ret=0"//设置成功
  220. @"ret=-10&error_des=user cancel"//用户取消设置
  221. @"ret=-11&error_des=pasteboard have no video data"//剪切板没有数据
  222. @"ret=-12&error_des=export data failed"//从剪切板导出数据到本地失败
  223. @"ret=-13&error_des=url param invalid"//sdk传递过来的数据有误
  224. @"ret=-14&error_des=video param invalid"//视频的参数不符合要求(检测第三方视频源方案:1、分辨率跟480*480保持一致;2、视频长度0.5s~8s)
  225. @"ret=-15&error_des=app authorised failed"//应用鉴权失败
  226. @"ret=-16&error_des=upload video failed"//设置头像,上传到后台失败
  227. @"ret=-17&error_des=account diff"//账号不一致
  228. */
  229. @interface QQApiVideoForQQAvatarObject : QQApiExtendObject
  230. @property(nonatomic, retain) NSString *assetURL;
  231. @end
  232. // QQApiImageArrayForFaceCollectionObject
  233. /** @brief 图片数组对象
  234. 用于分享图片组到表情收藏,是一个指定为图片类型的<code>QQApiObject</code>
  235. */
  236. @interface QQApiImageArrayForFaceCollectionObject : QQApiObject
  237. @property(nonatomic,retain) NSArray* imageDataArray;///图片数组
  238. /**
  239. 初始化方法
  240. @param imageDataArray 图片数组
  241. */
  242. - (id)initWithImageArrayData:(NSArray*)imageDataArray;
  243. /**
  244. helper方法获取一个autorelease的<code>QQApiObject</code>对象
  245. @param imageDataArray 发送的多张图片队列
  246. @return
  247. 一个自动释放的<code>QQApiObject</code>实例
  248. */
  249. + (id)objectWithimageDataArray:(NSArray *)imageDataArray;
  250. @end
  251. // QQApiImageArrayForQZoneObject
  252. /** @brief 图片对象
  253. 用于分享图片到空间,走写说说路径,是一个指定为图片类型的,当图片数组为空时,默认走文本写说说<code>QQApiObject</code>
  254. */
  255. @interface QQApiImageArrayForQZoneObject : QQApiObject
  256. @property(nonatomic,retain) NSArray* imageDataArray;///图片数组
  257. @property(nonatomic,retain) NSDictionary* extMap; // 扩展字段
  258. /**
  259. 初始化方法
  260. @param imageDataArray 图片数组
  261. @param title 写说说的内容,可以为空
  262. @param extMap 扩展字段
  263. */
  264. - (id)initWithImageArrayData:(NSArray*)imageDataArray title:(NSString*)title extMap:(NSDictionary *)extMap;
  265. /**
  266. helper方法获取一个autorelease的<code>QQApiExtendObject</code>对象
  267. @param title 写说说的内容,可以为空
  268. @param imageDataArray 发送的多张图片队列
  269. @param extMap 扩展字段
  270. @return
  271. 一个自动释放的<code>QQApiExtendObject</code>实例
  272. */
  273. + (id)objectWithimageDataArray:(NSArray*)imageDataArray title:(NSString*)title extMap:(NSDictionary *)extMap;
  274. @end
  275. // QQApiVideoForQZoneObject
  276. /** @brief 视频对象
  277. 用于分享视频到空间,走写说说路径<code>QQApiObject</code>,assetURL和videoData两个参数必须设置至少一个参数,如果assetURL设置了忽略videoData参数
  278. @param assetURL可传ALAsset的ALAssetPropertyAssetURL,或者PHAsset的localIdentifier
  279. @param extMap 扩展字段
  280. @param videoData 视频数据,大小不超过50M
  281. */
  282. @interface QQApiVideoForQZoneObject : QQApiObject
  283. @property(nonatomic, retain) NSString *assetURL;
  284. @property(nonatomic,retain) NSDictionary* extMap; // 扩展字段
  285. @property(nonatomic,retain) NSData* videoData;
  286. - (id)initWithAssetURL:(NSString*)assetURL title:(NSString*)title extMap:(NSDictionary *)extMap;
  287. + (id)objectWithAssetURL:(NSString*)assetURL title:(NSString*)title extMap:(NSDictionary *)extMap;
  288. - (id)initWithVideoData:(NSData*)videoData title:(NSString*)title extMap:(NSDictionary *)extMap;
  289. + (id)objectWithVideoData:(NSData*)videoData title:(NSString*)title extMap:(NSDictionary *)extMap;
  290. @end
  291. // QQApiWebImageObject
  292. /** @brief 图片对象
  293. 用于分享网络图片内容的对象,是一个指定网络图片url的: 该类型只在2.9.0的h5分享中才支持,
  294. 原有的手q分享是不支持该类型的。
  295. */
  296. @interface QQApiWebImageObject : QQApiObject
  297. @property(nonatomic, retain) NSURL *previewImageURL; ///<预览图像URL
  298. /**
  299. 初始化方法
  300. @param previewImageURL 用于预览的图片
  301. @param title 标题
  302. @param description 此对象,分享的描述
  303. */
  304. - (id)initWithPreviewImageURL:(NSURL*)previewImageURL title:(NSString*)title description:(NSString*)description;
  305. /**
  306. helper方法获取一个autorelease的<code>QQApiWebImageObject</code>对象
  307. @param previewImageURL 用于预览的图片
  308. @param title 标题
  309. @param description 此对象,分享的描述
  310. */
  311. + (id)objectWithPreviewImageURL:(NSURL*)previewImageURL title:(NSString*)title description:(NSString*)description;
  312. @end
  313. //QQApiFileObject
  314. /** @brief 本地文件对象(暂只支持分享到手机QQ数据线功能)
  315. 用于分享文件内容的对象,是一个指定为文件类型的<code>QQApiExtendObject</code>
  316. */
  317. @interface QQApiFileObject : QQApiExtendObject
  318. {
  319. NSString* _fileName;
  320. }
  321. @property(nonatomic, retain)NSString* fileName;
  322. @end
  323. // QQApiAudioObject
  324. /** @brief 音频URL对象
  325. 用于分享目标内容为音频的URL的对象
  326. */
  327. @interface QQApiAudioObject : QQApiURLObject
  328. @property (nonatomic, retain) NSURL *flashURL; ///<音频URL地址,最长512个字符
  329. /**
  330. 获取一个autorelease的<code>QQApiAudioObject</code>
  331. @param url 音频内容的目标URL
  332. @param title 分享内容的标题
  333. @param description 分享内容的描述
  334. @param data 分享内容的预览图像
  335. @note 如果url为空,调用<code>QQApi#sendMessage:</code>时将返回FALSE
  336. */
  337. +(id)objectWithURL:(NSURL*)url title:(NSString*)title description:(NSString*)description previewImageData:(NSData*)data;
  338. /**
  339. 获取一个autorelease的<code>QQApiAudioObject</code>
  340. @param url 音频内容的目标URL
  341. @param title 分享内容的标题
  342. @param description 分享内容的描述
  343. @param previewURL 分享内容的预览图像URL
  344. @note 如果url为空,调用<code>QQApi#sendMessage:</code>时将返回FALSE
  345. */
  346. +(id)objectWithURL:(NSURL*)url title:(NSString*)title description:(NSString*)description previewImageURL:(NSURL*)previewURL;
  347. @end
  348. // QQApiVideoObject
  349. /** @brief 视频URL对象
  350. 用于分享目标内容为视频的URL的对象
  351. QQApiVideoObject类型的分享,目前在Android和PC QQ上接收消息时,展现有待完善,待手机QQ版本以后更新支持
  352. 目前如果要分享视频,推荐使用 QQApiNewsObject 类型
  353. */
  354. @interface QQApiVideoObject : QQApiURLObject
  355. @property (nonatomic, retain) NSURL *flashURL; ///<视频URL地址,最长512个字符
  356. /**
  357. 获取一个autorelease的<code>QQApiVideoObject</code>
  358. @param url 视频内容的目标URL
  359. @param title 分享内容的标题
  360. @param description 分享内容的描述
  361. @param data 分享内容的预览图像
  362. @note 如果url为空,调用<code>QQApi#sendMessage:</code>时将返回FALSE
  363. */
  364. +(id)objectWithURL:(NSURL*)url title:(NSString*)title description:(NSString*)description previewImageData:(NSData*)data;
  365. /**
  366. 获取一个autorelease的<code>QQApiVideoObject</code>
  367. @param url 视频内容的目标URL
  368. @param title 分享内容的标题
  369. @param description 分享内容的描述
  370. @param previewURL 分享内容的预览图像URL
  371. @note 如果url为空,调用<code>QQApi#sendMessage:</code>时将返回FALSE
  372. */
  373. +(id)objectWithURL:(NSURL*)url title:(NSString*)title description:(NSString*)description previewImageURL:(NSURL*)previewURL;
  374. @end
  375. // QQApiNewsObject
  376. /** @brief 新闻URL对象
  377. 用于分享目标内容为新闻的URL的对象
  378. */
  379. @interface QQApiNewsObject : QQApiURLObject
  380. /**
  381. 获取一个autorelease的<code>QQApiNewsObject</code>
  382. @param url 视频内容的目标URL
  383. @param title 分享内容的标题
  384. @param description 分享内容的描述
  385. @param data 分享内容的预览图像
  386. @note 如果url为空,调用<code>QQApi#sendMessage:</code>时将返回FALSE
  387. */
  388. +(id)objectWithURL:(NSURL*)url title:(NSString*)title description:(NSString*)description previewImageData:(NSData*)data;
  389. /**
  390. 获取一个autorelease的<code>QQApiNewsObject</code>
  391. @param url 视频内容的目标URL
  392. @param title 分享内容的标题
  393. @param description 分享内容的描述
  394. @param previewURL 分享内容的预览图像URL
  395. @note 如果url为空,调用<code>QQApi#sendMessage:</code>时将返回FALSE
  396. */
  397. +(id)objectWithURL:(NSURL*)url title:(NSString*)title description:(NSString*)description previewImageURL:(NSURL*)previewURL;
  398. @end
  399. // QQApiCommonContentObject;
  400. /** @brief 通用模板类型对象
  401. 用于分享一个固定显示模板的图文混排对象
  402. @note 图片列表和文本列表不能同时为空
  403. */
  404. @interface QQApiCommonContentObject : QQApiObject
  405. /**
  406. 预定义的界面布局类型
  407. */
  408. @property(nonatomic,assign) unsigned int layoutType;
  409. @property(nonatomic,assign) NSData* previewImageData;///<预览图
  410. @property(nonatomic,retain) NSArray* textArray;///<文本列表
  411. @property(nonatomic,retain) NSArray* pictureDataArray;///<图片列表
  412. +(id)objectWithLayoutType:(int)layoutType textArray:(NSArray*)textArray pictureArray:(NSArray*)pictureArray previewImageData:(NSData*)data;
  413. /**
  414. 将一个NSDictionary对象转化为QQApiCommomContentObject,如果无法转换,则返回空
  415. */
  416. +(id)objectWithDictionary:(NSDictionary*)dic;
  417. -(NSDictionary*)toDictionary;
  418. @end
  419. // QQApiExtraServiceObject;
  420. /**
  421. @brief OpenSDK扩展支持的服务,通用接口,后续会扩充能力
  422. @param serviceID [必选] 扩展支持的服务类型ID,参考官方文档说明
  423. @param openID [必选] 授权登录后对该用户的唯一标识
  424. @param toUin [可选] 对方的QQ号码
  425. @param extraInfo [可选] 扩展字段
  426. @note 该接口的使用须先登录
  427. */
  428. @interface QQApiExtraServiceObject : QQApiObject
  429. @property (nonatomic,retain) NSString* serviceID;
  430. @property (nonatomic,retain) NSString* openID;
  431. @property (nonatomic,retain) NSString* toUin;
  432. @property (nonatomic,retain) NSDictionary* extraInfo;
  433. - (id)initWithOpenID:(NSString *)openID serviceID:(NSString *)serviceID;
  434. + (id)objecWithOpenID:(NSString *)openID serviceID:(NSString *)serviceID;
  435. @end
  436. ////////////////////////////////////////////////////////////////////////////////////////////////////////////
  437. // Ad item object definition
  438. ////////////////////////////////////////////////////////////////////////////////////////////////////////////
  439. /** @brief 广告数据对象
  440. */
  441. @interface QQApiAdItem : NSObject
  442. @property(nonatomic,retain) NSString* title; ///<名称
  443. @property(nonatomic,retain) NSString* description;///<描述
  444. @property(nonatomic,retain) NSData* imageData;///<广告图片
  445. @property(nonatomic,retain) NSURL* target;///<广告目标链接
  446. @end
  447. #pragma mark - QQApi请求消息类型
  448. /**
  449. QQApi请求消息类型
  450. */
  451. typedef NS_ENUM(NSUInteger, QQApiInterfaceReqType) {
  452. EGETMESSAGEFROMQQREQTYPE = 0, ///< 手Q -> 第三方应用,请求第三方应用向手Q发送消息
  453. ESENDMESSAGETOQQREQTYPE = 1, ///< 第三方应用 -> 手Q,第三方应用向手Q分享消息
  454. ESHOWMESSAGEFROMQQREQTYPE = 2, ///< 手Q -> 第三方应用,请求第三方应用展现消息中的数据
  455. ESENDMESSAGEARKTOQQREQTYPE = 3, ///< 第三方应用 -> 手Q,第三方应用向手Q分享Ark消息
  456. ESENDMESSAGE_MINI_TOQQREQTYPE = 4 ///< 第三方应用 -> 手Q,第三方应用向手Q分享小程序消息
  457. };
  458. /**
  459. QQApi应答消息类型
  460. */
  461. typedef NS_ENUM(NSUInteger, QQApiInterfaceRespType) {
  462. ESHOWMESSAGEFROMQQRESPTYPE = 0, ///< 第三方应用 -> 手Q,第三方应用应答消息展现结果
  463. EGETMESSAGEFROMQQRESPTYPE = 1, ///< 第三方应用 -> 手Q,第三方应用回应发往手Q的消息
  464. ESENDMESSAGETOQQRESPTYPE = 2 ///< 手Q -> 第三方应用,手Q应答处理分享消息的结果
  465. };
  466. /**
  467. QQApi请求消息基类
  468. */
  469. @interface QQBaseReq : NSObject
  470. /** 请求消息类型,参见\ref QQApiInterfaceReqType */
  471. @property (nonatomic, assign) int type;
  472. @end
  473. /**
  474. QQApi应答消息基类
  475. */
  476. @interface QQBaseResp : NSObject
  477. /** 请求处理结果 */
  478. @property (nonatomic, copy) NSString* result;
  479. /** 具体错误描述信息 */
  480. @property (nonatomic, copy) NSString* errorDescription;
  481. /** 应答消息类型,参见\ref QQApiInterfaceRespType */
  482. @property (nonatomic, assign) int type;
  483. /** 扩展信息 */
  484. @property (nonatomic, assign) NSString* extendInfo;
  485. @end
  486. /**
  487. GetMessageFromQQReq请求帮助类
  488. */
  489. @interface GetMessageFromQQReq : QQBaseReq
  490. /**
  491. 创建一个GetMessageFromQQReq请求实例
  492. */
  493. + (GetMessageFromQQReq *)req;
  494. @end
  495. @interface SendMessageToQQReq : QQBaseReq
  496. /**
  497. 创建一个SendMessageToQQReq请求实例
  498. \param message 具体分享消息实例
  499. \return 新创建的SendMessageToQQReq请求实例
  500. */
  501. + (SendMessageToQQReq *)reqWithContent:(QQApiObject *)message;
  502. /**
  503. 创建一个支持Ark的SendMessageToQQReq请求实例
  504. \param message 具体分享消息实例
  505. \return 新创建的SendMessageToQQReq请求实例
  506. */
  507. + (SendMessageToQQReq *)reqWithArkContent:(ArkObject *)message;
  508. /**
  509. * 创建一个支持小程序的消息请求实例
  510. * @param miniMessage 小程序实例对象
  511. * @return 消息请求实例
  512. */
  513. +(SendMessageToQQReq*) reqWithMiniContent:(QQApiMiniProgramObject *)miniMessage;
  514. /** 具体分享消息 */
  515. @property (nonatomic, retain) QQApiObject *message;
  516. /** 支持Ark的具体分享消息 */
  517. @property (nonatomic, retain) ArkObject *arkMessage;
  518. /** 支持小程序的具体分享消息 */
  519. @property (nonatomic, retain) QQApiMiniProgramObject *miniMessage;
  520. @end
  521. /**
  522. SendMessageToQQResp应答帮助类
  523. */
  524. @interface SendMessageToQQResp : QQBaseResp
  525. /**
  526. 创建一个SendMessageToQQResp应答实例
  527. \param result 请求处理结果
  528. \param errDesp 具体错误描述信息
  529. \param extendInfo 扩展信息
  530. \return 新创建的SendMessageToQQResp应答实例
  531. */
  532. + (SendMessageToQQResp *)respWithResult:(NSString *)result errorDescription:(NSString *)errDesp extendInfo:(NSString*)extendInfo;
  533. @end
  534. /**
  535. ShowMessageFromQQReq请求帮助类
  536. */
  537. @interface ShowMessageFromQQReq : QQBaseReq
  538. /**
  539. 创建一个ShowMessageFromQQReq请求实例
  540. \param message 具体待展现消息实例
  541. \return 新创建的ShowMessageFromQQReq请求实例
  542. */
  543. + (ShowMessageFromQQReq *)reqWithContent:(QQApiObject *)message;
  544. /** 具体待展现消息 */
  545. @property (nonatomic, retain) QQApiObject *message;
  546. @end
  547. #endif