PDBotLibClient
Inherits from: NSObject
Overview
智能客服基础类,用于连接服务器,使用单例模式,全局只有一个对象
Propertys
@property (nonatomic, weak) id<PDBotLibClientDelegate> delegate;
@property (nonatomic, assign) PDConnectionState connectionState;
@property (nonatomic, strong) NSString* accessKey;
@property (nonatomic, strong) NSString* robotName;
@property (nonatomic, assign) BOOL enableHuman;
Methods
+ (instancetype)sharedClient;
- (void)initWithAccessKey:(NSString*)accessKey;
参数 |
类型 |
说明 |
accessKey |
NSString* |
Access Key |
- (void)setSource:(NSString*)visitorSource;
参数 |
类型 |
说明 |
visitorSource |
NSString* |
访客来源 |
- (void)setVisitor:(PDVisitorInfo*)visitorInfo;
- (void)connect;
- (void)disconnect;
- (void)askSuggestion:(NSString*)text;
参数 |
类型 |
说明 |
text |
NSString* |
输入内容 |
- (void)askQuestion:(NSString*)text;
参数 |
类型 |
说明 |
text |
NSString* |
文本内容 |
- (void)askQuestionByMenu:(PDMenuItem*)item andType:(PDMessageMenuType)type;
- (void)askQuestionByImage:(NSURL*)file;
参数 |
类型 |
说明 |
file |
NSURL* |
图片文件路径 |
- (void)askQuestionByAudio:(NSURL*)file;
参数 |
类型 |
说明 |
file |
NSURL* |
音频文件路径 |
- (void)transferToHumanServices;
- (NSArray*)getMessageList;
- (NSArray*)getMessageListBrfore:(int)msgId maxSize:(int)size;
参数 |
类型 |
说明 |
msgId |
int |
之前获取的最早一条消息ID,首次获取传0 |
size |
int |
获取的最大数量 |
返回值 |
NSArray<PDMessage*>* |
符合条件的历史消息列表 |
- (void)removeMessage:(PDMessage*)message;
- (void)removeMessageBefore:(NSDate*)date;
参数 |
类型 |
说明 |
date |
NSDate* |
要删除的截止时间 |
- (void)removeAllMessages;
- (NSString*)getLeaveMessageUrl;
参数 |
类型 |
说明 |
返回值 |
NSString* |
留言页面地址 |