PDBotLibClient

Inherits from: NSObject

Overview

智能客服基础类,用于连接服务器,使用单例模式,全局只有一个对象

Propertys

  • 消息代理

@property (nonatomic, weak) id<PDBotLibClientDelegate> delegate;

  • 当前链接状态

@property (nonatomic, assign) PDConnectionState connectionState;

  • Access Key

@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;
参数 类型 说明
visitorInfo PDVisitorInfo* 访客信息对象
  • 建立连接
- (void)connect;
  • 断开链接
- (void)disconnect;
  • 获取输入提示
- (void)askSuggestion:(NSString*)text;
参数 类型 说明
text NSString* 输入内容
  • 发送文本消息
- (void)askQuestion:(NSString*)text;
参数 类型 说明
text NSString* 文本内容
  • 发送菜单消息
- (void)askQuestionByMenu:(PDMenuItem*)item andType:(PDMessageMenuType)type;
参数 类型 说明
item PDMenuItem* 菜单项目
type PDMessageMenuType 菜单类型
  • 发送图片消息
- (void)askQuestionByImage:(NSURL*)file;
参数 类型 说明
file NSURL* 图片文件路径
  • 发送音频消息
- (void)askQuestionByAudio:(NSURL*)file;
参数 类型 说明
file NSURL* 音频文件路径
  • 转接人工客服
- (void)transferToHumanServices;
  • 获取全部历史消息
- (NSArray*)getMessageList;
参数 类型 说明
返回值 NSArray<PDMessage*>* 历史消息列表
  • 获取分页历史消息
- (NSArray*)getMessageListBrfore:(int)msgId maxSize:(int)size;
参数 类型 说明
msgId int 之前获取的最早一条消息ID,首次获取传0
size int 获取的最大数量
返回值 NSArray<PDMessage*>* 符合条件的历史消息列表
  • 删除一条消息
- (void)removeMessage:(PDMessage*)message;
参数 类型 说明
message PDMessage* 要删除消息
  • 删除指定时间之前的历史消息
- (void)removeMessageBefore:(NSDate*)date;
参数 类型 说明
date NSDate* 要删除的截止时间
  • 删除全部历史消息
- (void)removeAllMessages;
  • 获取留言页面地址
- (NSString*)getLeaveMessageUrl;
参数 类型 说明
返回值 NSString* 留言页面地址

results matching ""

    No results matching ""