//page 页码;limit:每页会话数(一般要包括所有会话)
[[HDClient sharedClient].chatManager asyncLoadConversationsWithPage:<#(NSInteger)#> limit:<#(NSInteger)#> completion:^(NSArray *conversations, HDError *error)
{
//conversations 会话【HDConversation *】
}];
//加载常用语
[[HDClient sharedClient].chatManager getQuickReplyCompletion:^(id responseObject, HDError *error) {
if (error == nil) {
}
}];
//增加常用语,parentId 父节点id,text 常用语内容,leaf 是否是叶子节点(0、1标识)
[[HDClient sharedClient].chatManager addQuickReplyWithParentId:<#(NSString *)#> text:<#(NSString *)#> leaf:<#(NSInteger )#> completion:^(id responseObject, HDError *error) {
}];
//更新常用语,qrid,常用语id
[[HDClient sharedClient].chatManager updateQuickReplyWithParentId:<#(NSString *)#> text:<#(NSString *)#> leaf:_<#(NSInteger )#> qrId:<#(NSString *)#> completion:^(id responseObject, HDError *error) {
}];
//删除常用语
[[HDClient sharedClient].chatManager deleteQuickReplyWithId:<#(NSString *)#> completion:^(id responseObject, HDError *error) {
}];
//下边用到的_conversation即是HDConversationManager
HDConversationManager *_conversation = [[HDConversationManager alloc] initWithSessionId:<#(NSString *)#> chatGroupId:<#(NSInteger)#>];
[_conversation loadMessageCompletion:^(NSArray<HDMessage *> *messages, HDError *error) {
//获取消息回调
}];
[_conversation markMessagesAsReadWithVisitorId:<#(NSString *)#> parameters:nil completion:^(id responseObject, HDError *error) {
if (error == nil) {
//标记已读成功
}
}];
[_conversation loadHistoryCompletion:^(NSArray<HDMessage *> *messages, HDError *error) {
}];
//构造消息体
HDTextMessageBody *body = [[HDTextMessageBody alloc] initWithText:<#(NSString *)#>];
HDMessage *message = [[HDMessage alloc] initWithSessionId:<#(NSString)#> to:<#(NSString *)#> messageBody:body];
//发送消息
[_conversation sendMessage:message progress:nil completion:^(HDMessage *aMessage, HDError *aError) {
//发送结束,回调
}];
</code>
//构造消息体
HDImageMessageBody *body = [[HDImageMessageBody alloc] initWithData:<#(NSData *)#> displayName:<#(NSString *)#>];
HDMessage *message = [[HDMessage alloc] initWithSessionId:<#(NSString *)#> to:<#(NSString *)#> messageBody:body];
[_conversation sendMessage:msg progress:nil completion:^(HDMessage *aMessage, HDError *aError) {
//发送结束,回调
}];
//构造消息体
HDVoiceMessageBody *body = [[HDVoiceMessageBody alloc] initWithLocalPath:<#(NSString *)#> displayName:<#(NSString *)#>];
HDMessage *message = [[HDMessage alloc] initWithSessionId:<#(NSString *)#> to:<#(NSString *)#> messageBody:body];
//发送消息
[_conversation sendMessage:msg progress:nil completion:^(HDMessage *aMessage, HDError *aError) {
//发送结束,回调
}];
==== 结束会话 ====
<code>
[_conversation endConversationWithVisitorId:<#(NSString *)#> parameters:nil completion:^(id responseObject, HDError *error) {
if (!error) {
//成功关闭
} else {
//关闭失败
}
}];
[HDClient sharedClient].currentAgentUser
[_conversation asyncGetTreeCompletion:^(id responseObject, HDError *error) {
if (!error) {
} else {
}
}];
[_conversation asyncGetSessionSummaryResultsCompletion:^(id responseObject, HDError *error) {
if (!error) {
} else {
}
}];
[_conversation asyncGetSessionCommentCompletion:^(id responseObject, HDError *error) {
if (!error) {
}
}];
[_conversation asyncSaveSessionCommentParameters:<#(NSDictionary *)#> completion:^(id responseObject, HDError *error) {
if (error) {
}
}];
[_conversation asyncSaveSessionSummaryResultsParameters:<#(NSDictionary *)#> completion:^(id responseObject, HDError *error) {
if (!error) {
}
}];
[_conversation getSkillGroupCompletion:^(id responseObject, HDError *error) {
}]
[[HDClient sharedClient].chatManager asyncGetAllCustomersCompletion:^(NSArray<HDConversation *> *customers, HDError *error) {
}];
[[HDClient sharedClient].chatManager customerSendMessage:<#(HDMessage *)#> completion:^(id responseObject, HDError *error) {
}];
/**
@param remoteUserId 客服userId
@param parameters 参数
@param completion 完成回调
*/
[[HDClient sharedClient].chatManager asyncGetAgentUnreadMessagesWithRemoteAgentUserId:<#(NSString *)#> parameters:<#(NSDictionary *)#> completion:^(NSArray <HDMessage *> *messages, HDError *error) {
}];
/**
查询客服同事聊天记录【包括已读、未读】
@param remoteUserId 对方userId
@param parameters 参数
@param completion 完成回调
*/
[[HDClient sharedClient].chatManager aysncGetAgentMessagesWithRemoteUserId:<#(NSString *)#> parameters:<#(NSDictionary *)#>
completion:^(NSArray<HDMessage *> *messages, HDError *error) {
}];
/**
@param userId 对方userId
@param createDateTime 最后一条消息的时间戳
@param completion 完成回调
*/
[[HDClient sharedClient].chatManager asyncMarkMessagesAsReadWithRemoteAgentUserId:<#(NSString *)#> lastCreateDateTime:<#(NSTimeInterval)#> completion:^(id responseObject, HDError *error) {
}];
/**=
@param page 页码
@param limit 每页的数量
@param parameters 参数
@param completion 完成回调
*/
[[HDClient sharedClient].chatManager asyncFetchHistoryConversationWithPage:<#(NSInteger)#> limit:<#(NSInteger)#> parameters:<#(NSDictionary *)#> completion:^(NSArray *conversations, HDError *error, NSInteger totalNum) {
}];
/**
@param vistorId 回呼用户的userId
@param completion 完成回调
*/
[[HDClient sharedClient].chatManager asyncFetchCreateSessionWithVistorId:<#(NSString *)#> completion:^(HDHistoryConversation *history, HDError *error) {
}];
/**
@param sessionServicesId 会话id
@param page 页码
@param completion 完成回调
*/
[[HDClient sharedClient].chatManager asyncFetchHistoryMessagesWithSessionServicesId:<#(NSString *)#> page:<#(NSInteger)#> completion:^(id responseObject, HDError *error) {
}];
[[HDClient sharedClient].chatManager getChannelsCompletion:^(id responseObject, HDError *error) {
}];
/**
@param pageIndex 第几页
@param pageSize 每页数据个数
@param parameters 预留参数,暂传nil
@param completion 请求完成的回调【error == nil,为请求成功】
*/
[[HDClient sharedClient].waitManager asyncGetWaitQueuesWithPage:<#(NSInteger)#> pageSize:<#(NSInteger)#> parameters:<#(NSDictionary *)#> completion:^(NSArray<HDWaitUser *> *waitUsers, HDError *error) {
}];
/**
@param userId 对方userId
@param completion 完成回调
*/
[[HDClient sharedClient].waitManager asyncFetchUserWaitQueuesWithUserId:<#(NSInteger)#> completion:^(id responseObject, HDError *error) {
}];
//参数为固定key的字典
[HDClient sharedClient].waitManager asyncScreenWaitQueuesWithParameters:<#(NSDictionary *)#> completion:^(NSArray<HDWaitUser *> *users, HDError *error) {}];
/**
修改最大接入数
@param userNum 人数NSString 类型
@param completion 完成回调
*/
[[HDClient sharedClient].setManager updateServiceUsersWithNum:<#(NSString*) #> completion:^(id responseObject, HDError *error) {
}];
//HDOnlineStatus 是状态的枚举
[[HDClient sharedClient].setManager updateOnLineStatusWithStatus:<#(HDOnlineStatus)#> completion:^(id responseObject, HDError *error) {
}];
//YES 为开启,NO 为关闭
[[HDClient sharedClient].setManager enableGreeting:<#(BOOL)#> completion:^(id responseObject, HDError *error) {
}];
[HDClient sharedClient].currentAgentUser.greetingContent
//问候语内容
[[HDClient sharedClient].setManager updateGreetingContent:<#(NSString *)#> completion:^(id responseObject, HDError *error) {
}];
//参数为key - value
[[HDClient sharedClient].setManager modifyInfoWithKey:<#(NSString *)#> value:<#(NSString *)#> completion:^(id responseObject, HDError *error) {
}];
//UIImage 类型
[[HDClient sharedClient].setManager asyncUploadImageWithFile:<#(NSData*)#> completion:^(NSString *url, HDError *error) {
}];
//参数:访客userId
[[HDClient sharedClient].setManager getVisitorUserTagsWithUserId:<#(NSString *)#> completion:^(id responseObject, HDError *error) {
}];
//tag实例
[[HDClient sharedClient].setManager updateVisitorUserTagWithUserTag:<#(HDUserTag *)#> completion:^(id responseObject, HDError *error) {
}];
/**
@param pageIndex 第几页
@param pageSize 每页数据个数
@param status 已读还是未读
@param type 消息类型
@param parameters 预留参数暂传nil
@param completion 完成请求的回调
*/
[[HDClient sharedClient].notiManager asyncGetNoticeWithPageIndex:<#(NSInteger)#> pageSize:<#(NSInteger)#> status:<#(HDNoticeStatus)#> type:<#(HDNoticeType)#> prameters:<#(NSDictionary *)#> completion:^(NSArray<HDNotifyModel *> *notices, HDError *error) {
}];
/**
@param ids 通知的id数组
@param parameters 预留参数暂传nil
@param completion 完成请求的回调
*/
[[HDClient sharedClient].notiManager asyncPUTMarkNoticeASReadWithUnreadNoticeIds:<#(NSArray <NSString *> *)#> parameters:<#(NSDictionary *)#> completion:^(id responseObjcet, HDError *error) {
}];
/**
@param visitorId visitorId
@param completion 完成回调
*/
[[HDClient sharedClient].notiManager asyncMessageCenterCreateSessionWithVisitorId:<#(NSString *)#> Completion:^(id responseObject, HDError *error) {
}];
/**
@param visitorId
@param completion 完成回调
*/
[[HDClient sharedClient].notiManager asyncFetchVisitorItemsWithVisitorId:<#(NSString *)#> completion:^(HDVisitorInfo *visitorInfo, HDError *error) {
}];
/**
@param customerId 访客id,获取访客资料的时候拿到
@param parameters 参数
@param completion 完成回调
*/
[[HDClient sharedClient].notiManager updateVisitorItemWithCustomerId:<#(NSString *)#> visitorId:<#(NSString *)#> parameters:<#(NSDictionary *)#> completion:^(id responseObject, HDError *error) {
}];
/**
获取不同状态的留言列表【例如:未处理,处理中,已处理也可自定义】
@param statusId 状态对应的Id【传nil为全部留言】
@param pageIndex 第几页
@param pageSize 每页数据个数
@param parameters 预留参数,暂传nil
@param completion 完成回调
*/
[[HDClient sharedClient].leaveMsgManager asyncGetLeaveMessagesWithStatusId:<#(NSString *)#> pageIndex:<#(NSInteger)#> pageSize:<#(NSInteger)#> parameters:<#(NSDictionary *)#> completion:^(NSArray<HDLeaveMessage *> *leaveMessages, HDError *error) {
}];
[[HDClient sharedClient].leaveMsgManager asyncGetAssigneesCompletion:^(NSArray<HDAssignee *> *assignees, HDError *error) {
}];
//获取留言状态【eg:未处理,处理中,已处理也可自定义】
[[HDClient sharedClient].leaveMsgManager asyncGetLeaveMsgStatusWithParameters:<#(NSDictionary *)#> completion:^(NSArray<HDStatus *> *statuses, HDError *error) {
}];
/**
@param leaveMsgId 留言id
@param completion 完成回调
*/[[HDClient sharedClient].leaveMsgManager asyncGetLeaveMsgDetailWithLeaveMsgId:<#(NSNumber *)#> completion:^(id responseObject, HDError *error) {
}];
/**
@param leaveMsgId 留言id
@param completion 完成回调
*/
[[HDClient sharedClient].leaveMsgManager asyncGetLeaveMsgCommentWithLeaveMsgId:<#(NSString *)#> completion:^(NSArray<HDLeaveMessage *> *comments, HDError *error) {
}];
/**
@param leaveMsgId 留言id
@param text 文字内容
@param attachments 附件
*/
[[HDClient sharedClient].leaveMsgManager asyncPostLeaveMsgCommentWithLeaveMsgId:<#(NSString *)#> text:<#(NSString *)#> attachments:<#(NSArray <HDAttachment *>*)#> completion:^(id responseObject, HDError *error) {
}];
/**
@param user 受让人
@param leaveMsgId leaveMsgId
@param completion 完成回调
*/
[[HDClient sharedClient].leaveMsgManager asyncAssignLeaveMsgWithUser:<#(UserModel *)#> leaveMsgId:<#(NSString *)#> completion:^(id responseObject, HDError *error) {
}];
/**
@param user 当前分配人id
@param leaveMsgId ID
@param completion 完成回调
*/
[[HDClient sharedClient].leaveMsgManager asyncUnAssignLeaveMsgWithUserId:<#(NSString *)#> leaveMsgId:<#(NSString *)#> completion:^(id responseObject, HDError *error) {
}];
/**
@param leaveMsgId ID
@param statusId 状态id
@param completion 完成回调
*/
[[HDClient sharedClient].leaveMsgManager asyncSetLeaveMsgStatusWithLeaveMsgId:<#(NSString *)#> statusId:<#(NSString *)#> completion:^(id responseObject, HDError *error) {
}];
/**
@param imageData 图片数据
@param completion 完成回调(附件实例)
*/
[[HDClient sharedClient].leaveMsgManager asyncUploadImageWithFile:data completion:^(HDAttachment *attachment, HDError *error) {
}];