filesbox/app/filesbox_ios/FilesBox/Pods/Weibo_SDK/libWeiboSDK/WeiboSDK.h

735 lines
21 KiB
C
Raw Normal View History

2023-09-21 02:53:23 +00:00
//
// WeiboSDKHeaders.h
// WeiboSDKDemo
//
// Created by Wade Cheng on 4/3/13.
// Copyright (c) 2013 SINA iOS Team. All rights reserved.
//
#import <Foundation/Foundation.h>
#import <UIKit/UIKit.h>
#import "WBHttpRequest.h"
typedef NS_ENUM(NSInteger, WeiboSDKResponseStatusCode)
{
WeiboSDKResponseStatusCodeSuccess = 0,//成功
WeiboSDKResponseStatusCodeUserCancel = -1,//用户取消发送
WeiboSDKResponseStatusCodeSentFail = -2,//发送失败
WeiboSDKResponseStatusCodeAuthDeny = -3,//授权失败
WeiboSDKResponseStatusCodeUserCancelInstall = -4,//用户取消安装微博客户端
WeiboSDKResponseStatusCodePasteboardUnenable = -6,//剪贴板未授权
WeiboSDKResponseStatusCodeShareInSDKFailed = -8,//分享失败 详情见response UserInfo
WeiboSDKResponseStatusCodeUnsupport = -99,//不支持的请求
WeiboSDKResponseStatusCodeUnknown = -100,
};
@protocol WeiboSDKDelegate;
@protocol WBHttpRequestDelegate;
@class WBBaseRequest;
@class WBBaseResponse;
@class WBMessageObject;
@class WBImageObject;
@class WBBaseMediaObject;
@class WBHttpRequest;
@class PHAsset;
@class WBNewVideoObject;
@class WBSuperGroupObject;
/**
SDK接口类
*/
@interface WeiboSDK : NSObject
/**
@return YESNO
*/
+ (BOOL)isWeiboAppInstalled;
/**
@return 使YES使NO
*/
+ (BOOL)isCanShareInWeiboAPP;
/**
使SSO授权
@return 使YES使NO
*/
+ (BOOL)isCanSSOInWeiboApp;
/**
@return YESNO
*/
+ (BOOL)openWeiboApp;
/**
itunes安装地址
@return itunes安装地址
*/
+ (NSString *_Nullable)getWeiboAppInstallUrl;
/**
getSDKVersion
sdk版本号使用 getWeiboSDKVersion
*/
+ (NSString *_Nullable)getSDKVersion;
/**
@param appKey appKey
@param universalLink Universal Link
@return YESNO
*/
+ (BOOL)registerApp:(NSString * __nonnull)appKey universalLink:(NSString * __nonnull)universalLink;
/**
URL启动第三方应用时传递的数据
application:openURL:sourceApplication:annotation:application:handleOpenURL中调用
@param url URL
@param delegate WeiboSDKDelegate对象
@see WeiboSDKDelegate
*/
+ (BOOL)handleOpenURL:(NSURL *_Nullable)url delegate:(id<WeiboSDKDelegate>_Nullable)delegate;
/*! @brief 处理微博通过Universal Link启动App时传递的数据
*
* application:continueUserActivity:restorationHandler:
* @param userActivity API传递过来的userActivity
* @param delegate WXApiDelegate对象
* @return YESNO
*/
+ (BOOL)handleOpenUniversalLink:(NSUserActivity *_Nullable)userActivity delegate:(nullable id<WeiboSDKDelegate>)delegate;
/**
[WeiboSDKDelegate didReceiveWeiboResponse:]
@param request
@see [WeiboSDKDelegate didReceiveWeiboResponse:]
@see WBBaseResponse
@param completion 线block
*/
+ (void)sendRequest:(WBBaseRequest *_Nullable)request completion:(void (^ __nullable)(BOOL success))completion;
/**
@param response
@see WBBaseRequest
@param completion 线block
*/
+ (void)sendResponse:(WBBaseResponse *_Nullable)response completion:(void (^ __nullable)(BOOL success))completion;
/**
WeiboSDK的调试模式
WeiboSDK会在控制台输出详细的日志信息 NO
@param enabled WeiboSDK的调试模式
*/
+ (void)enableDebugMode:(BOOL)enabled;
/**
WeiboSDK是否获取idfa
*/
+ (void)banGetIdfa:(BOOL)isBan;
/**
token将失效
@param token Token
@param delegate WBHttpRequestDelegate对象SDK对于发起的接口请求的请求的响应
@param tag TAG,WBHttpRequest实例的tag属性返回
*/
+ (void)logOutWithToken:(NSString *_Nonnull)token delegate:(id<WBHttpRequestDelegate>_Nullable)delegate withTag:(NSString*_Nullable)tag;
/**
H5页面SDK自动检测是否安装微博客户端SDK相关方法时
webView H5页面
@param uid id
@param mid id
@param aid id
*/
//连接到指定用户的微博个人主页,连接后可进行加关注等互动
+ (void)linkToUser:(NSString *_Nullable)uid;
//连接到指定的单条微博详情页,连接后可对这条微博进行转、评、赞等互动
+ (void)linkToSingleBlog:(NSString *_Nullable)uid blogID:(NSString *_Nullable)mid;
//连接到指定的微博头条文章页
+ (void)linkToArticle:(NSString *_Nullable)aid;
//分享到微博
+ (void)shareToWeibo:(NSString *_Nullable)content;
//评论指定的微博
+ (void)commentToWeibo:(NSString *_Nullable)mid;
//连接到微博搜索内容流
+ (void)linkToSearch:(NSString *_Nullable)keyword;
//连接到我的微博消息流
+ (void)linkToTimeLine;
//连接到我的微博个人主页
+ (void)linkToProfile;
@end
/**
*/
@protocol WeiboSDKDelegate <NSObject>
/**
[WeiboSDK sendResponse:]
@param request
*/
- (void)didReceiveWeiboRequest:(WBBaseRequest *_Nullable)request;
/**
WBBaseResponse.userInfo
@param response
*/
- (void)didReceiveWeiboResponse:(WBBaseResponse *_Nullable)response;
@end
#pragma mark - DataTransferObject and Base Request/Response
/**
*/
@interface WBDataTransferObject : NSObject
/**
request userInfo
@warning userInfo中的数据必须是实现了 `NSCoding`
@warning 10M
*/
@property (nonatomic, strong) NSDictionary * _Nullable userInfo;
/**
SDK版本号
sdkVersion为当前SDK的版本号sdkVersion为数据发送方SDK版本号
*/
@property (strong, nonatomic, readonly) NSString * _Nullable sdkVersion;
/**
YESAlert询问用户是否要打开微博App的安装页面YES
*/
@property (nonatomic, assign) BOOL shouldOpenWeiboAppInstallPageIfNotInstalled;
@end
/**
SDK所有请求类的基类
*/
@interface WBBaseRequest : WBDataTransferObject
/**
WBBaseRequest
@return **WBBaseRequest对象
*/
+ (id _Nonnull )request;
@end
/**
SDK所有响应类的基类
*/
@interface WBBaseResponse : WBDataTransferObject
/**
request
response requestUserInfo request.userInfo
@see WBBaseRequest.userInfo
*/
@property (strong, nonatomic, readonly) NSDictionary * _Nullable requestUserInfo;
/**
statusCode判断请求的处理结果
*/
@property (nonatomic, assign) WeiboSDKResponseStatusCode statusCode;
/**
WBBaseResponse
@return **WBBaseResponse对象
*/
+ (id _Nonnull )response;
@end
#pragma mark - Authorize Request/Response
/**
[WeiboSDK sendRequest:] WBAuthorizeRequest
WBAuthorizeResponse
*/
@interface WBAuthorizeRequest : WBBaseRequest
/**
`http://`
http://open.weibo.com/wiki/%E6%8E%88%E6%9D%83%E6%9C%BA%E5%88%B6%E8%AF%B4%E6%98%8E#.E5.AE.A2.E6.88.B7.E7.AB.AF.E9.BB.98.E8.AE.A4.E5.9B.9E.E8.B0.83.E9.A1.B5
@warning `http://`
@warning 1K
*/
@property (nonatomic, strong) NSString * _Nullable redirectURI;
/**
scopescrope用逗号分隔
http://open.weibo.com/wiki/%E6%8E%88%E6%9D%83%E6%9C%BA%E5%88%B6%E8%AF%B4%E6%98%8E#scope
@warning 1K
*/
@property (nonatomic, strong) NSString * _Nullable scope;
/**
SSO的时候是否弹出SDK自带的Webview进行授权
YESSSO的时候会自动弹出SDK自带的Webview进行授权
NO shouldOpenWeiboAppInstallPageIfNotInstalled /
YES
*/
@property (nonatomic, assign) BOOL shouldShowWebViewForAuthIfCannotSSO;
@end
/**
WBAuthorizeResponse userID accessToken expirationDate refresh_token userInfo
*/
@interface WBAuthorizeResponse : WBBaseResponse
/**
ID
*/
@property (nonatomic, strong) NSString * _Nullable userID;
/**
*/
@property (nonatomic, strong) NSString * _Nullable accessToken;
/**
*/
@property (nonatomic, strong) NSDate * _Nullable expirationDate;
/**
*/
@property (nonatomic, strong) NSString * _Nullable refreshToken;
@end
#pragma mark - ProvideMessageForWeibo Request/Response
/**
*/
@interface WBProvideMessageForWeiboRequest : WBBaseRequest
@end
/**
*/
@interface WBProvideMessageForWeiboResponse : WBBaseResponse
/**
*/
@property (nonatomic, strong) WBMessageObject * _Nonnull message;
/**
WBProvideMessageForWeiboResponse
@param message
@return **WBProvideMessageForWeiboResponse对象
*/
+ (id _Nullable )responseWithMessage:(WBMessageObject *_Nullable)message;
@end
#pragma mark - SendMessageToWeibo Request/Response
/**
*/
@interface WBSendMessageToWeiboRequest : WBBaseRequest
/**
*/
@property (nonatomic, strong) WBMessageObject * _Nonnull message;
/**
WBSendMessageToWeiboRequest
[WeiboSDK sendRequest:]
shouldOpenWeiboAppInstallPageIfNotInstalled /
@param message
@return **WBSendMessageToWeiboRequest对象
*/
+ (id _Nullable )requestWithMessage:(WBMessageObject *_Nullable)message;
/**
WBSendMessageToWeiboRequest
,
SDK內微博发布器
@param message
@param authRequest ,access_token二者至少有一个不为空,access_token为空并且需要弹出SDK內发布器时会通过此信息先进行授权后再分享
@param access_token Token,,使token进行分享
@return **WBSendMessageToWeiboRequest对象
*/
+ (id _Nullable )requestWithMessage:(WBMessageObject *_Nullable)message
authInfo:(WBAuthorizeRequest *_Nullable)authRequest
access_token:(NSString *_Nullable)access_token;
@end
/**
WBSendMessageToWeiboResponse
*/
@interface WBSendMessageToWeiboResponse : WBBaseResponse
/**
*/
@property (nonatomic,strong) WBAuthorizeResponse * _Nullable authResponse;
@end
#pragma mark - ShareMessageToContact Request/Response
/**
*/
@interface WBShareMessageToContactRequest : WBBaseRequest
/**
*/
@property (nonatomic, strong) WBMessageObject * _Nonnull message;
/**
WBShareMessageToContactRequest
[WeiboSDK sendRequest:]
@param message
@return **WBSendMessageToWeiboRequest对象
*/
+ (void)requestWithMessage:(WBMessageObject *_Nullable)message;
@end
/**
WBSendMessageToWeiboResponse
*/
@interface WBShareMessageToContactResponse : WBBaseResponse
/**
*/
@property (nonatomic,strong) WBAuthorizeResponse * _Nullable authResponse;
@end
#pragma mark - MessageObject / ImageObject
/**
()
*/
@interface WBMessageObject : NSObject
/**
@warning 2000
*/
@property (nonatomic, strong) NSString * _Nullable text;
/**
@see WBImageObject
*/
@property (nonatomic, strong) WBImageObject * _Nullable imageObject;
/**
@see WBBaseMediaObject
*/
@property (nonatomic, strong) WBBaseMediaObject * _Nullable mediaObject;
/**
@see WBVideoObject
*/
@property (nonatomic, strong) WBNewVideoObject * _Nullable videoObject;
/**
@see WBSuperGroupObject
*/
@property (nonatomic, strong)WBSuperGroupObject * _Nullable superTopicObject;
/**
WBMessageObject
@return **WBMessageObject对象
*/
+ (id _Nonnull )message;
@end
/**
*/
typedef NS_ENUM(NSInteger, WBSDKMediaTransferErrorCode)
{
WBSDKMediaTransferAlbumPermissionError = 0,//相册权限
WBSDKMediaTransferAlbumWriteError = 1,//相册写入错误
WBSDKMediaTransferAlbumAssetTypeError = 2,//资源类型错误
};
/**
*/
@protocol WBMediaTransferProtocol <NSObject>
/**
*/
-(void)wbsdk_TransferDidReceiveObject:(id _Nullable )object;
/**
*/
-(void)wbsdk_TransferDidFailWithErrorCode:(WBSDKMediaTransferErrorCode)errorCode andError:(NSError*_Nullable)error;
@end
/**
*/
@interface WBImageObject : NSObject
/**
finalAssetArray只能存在一项10M,
使
@warning 10M
*/
@property (nonatomic, strong) NSData * _Nullable imageData;
/**
story
*/
@property (nonatomic) BOOL isShareToStory DEPRECATED_MSG_ATTRIBUTE("shareToStory is no longer being maintained");
/**
WBImageObject
@return **WBImageObject对象
*/
+ (id _Nullable )object;
/**
UIImage
@return **UIImage对象
*/
- (UIImage *_Nullable)image;
/**
*/
@property(nonatomic,weak)id<WBMediaTransferProtocol> _Nullable delegate;
/**
30MB
*/
- (void)addImages:(NSArray<UIImage *>*_Nullable)imageArray;
/**
livePhoto图片 40MB ios9.1
*/
- (void)setLivePhotoAsset:(PHAsset *_Nonnull)livePhotoAsset completion:(void (^ __nullable)(NSString * _Nullable error))completion;
/**
livePhoto格式图片 image不能超过10MB video不能超过30MB_Nonnull
*/
- (void)setLivePhotoImageUrl:(NSURL *_Nonnull)imageUrl livePhotoVideoUrl:(NSURL *_Nonnull)videoUrl;
/**
*/
-(NSArray*_Nullable)finalAssetArray;
@end
@interface WBNewVideoObject : NSObject
/**
WBNewVideoObject
@return **WBNewVideoObject对象
*/
+ (id _Nullable )object;
/**
story
*/
@property (nonatomic) BOOL isShareToStory DEPRECATED_MSG_ATTRIBUTE("shareToStory is no longer being maintained");
/**
*/
@property(nonatomic,weak)id<WBMediaTransferProtocol> _Nullable delegate;
/**
50MB
*/
-(void)addVideo:(NSURL*_Nonnull)videoUrl;
/**
*/
-(NSString*_Nullable)finalAsset;
@end
/**
*/
@interface WBSuperGroupObject : NSObject
@property (nonatomic, strong) NSString * _Nonnull superGroup;//超话名称,长度不能超过150
@property (nonatomic, strong) NSString * _Nullable section;//版块名
@property (nonatomic, strong) NSDictionary * _Nullable extData;//自定义参数
/**
WBSuperGroupObject
@return **WBSuperGroupObject对象
*/
+ (id _Nonnull )object;
@end
#pragma mark - Message Media Objects
/**
api
,,linkcard样式,
*/
@interface WBBaseMediaObject : NSObject
/**
ID
@warning 255
*/
@property (nonatomic, strong) NSString * _Nonnull objectID;
/**
@warning 1k
*/
@property (nonatomic, strong) NSString * _Nonnull title;
/**
@warning 1k
*/
@property (nonatomic, strong) NSString * _Nullable description;
/**
@warning 32k
*/
@property (nonatomic, strong) NSData * _Nullable thumbnailData;
/**
scheme
@warning 255
*/
@property (nonatomic, strong) NSString * _Nullable scheme;
/**
WBBaseMediaObject
@return **WBBaseMediaObject对象
*/
+ (id _Nullable )object DEPRECATED_MSG_ATTRIBUTE("WBBaseMediaObject is no longer being maintained");
@end
#pragma mark - Message WebPage Objects
/**
api
*/
@interface WBWebpageObject : WBBaseMediaObject
/**
url地址
@warning 255
*/
@property (nonatomic, strong) NSString * _Nullable webpageUrl DEPRECATED_MSG_ATTRIBUTE("webpageUrl is no longer being maintained");
@end