NIM SDK API  9.0.0
Public Types | Static Public Member Functions | List of all members
nim::Friend Class Reference

NIM 好友相关接口 More...

#include <nim_cpp_friend.h>

Public Types

typedef std::function< void(const FriendChangeEvent &)> FriendChangeCallback
 
typedef std::function< void(NIMResCode res_code)> FriendOptCallback
 
typedef std::function< void(NIMResCode res_code, const std::list< nim::FriendProfile > &user_profile_list)> GetFriendsListCallback
 
typedef std::function< void(const std::string &accid, const nim::FriendProfile &user_profile)> GetFriendProfileCallback
 

Static Public Member Functions

static void RegChangeCb (const FriendChangeCallback &cb, const std::string &json_extension="")
 
static bool Request (const std::string &accid, NIMVerifyType verify_type, const std::string &msg, const FriendOptCallback &cb, const std::string &json_extension="")
 
static bool Delete (const std::string &accid, const FriendOptCallback &cb, const std::string &json_extension="")
 
static bool DeleteEx (const std::string &accid, const DeleteFriendOption &option, const FriendOptCallback &cb)
 
static bool Update (const FriendProfile &friend_profile, const FriendOptCallback &cb, const std::string &json_extension="")
 
static void GetList (const GetFriendsListCallback &cb, const std::string &json_extension="")
 
static void GetFriendProfile (const std::string &accid, const GetFriendProfileCallback &cb, const std::string &json_extension="")
 
static bool ParseFriendAddEvent (const FriendChangeEvent &change_event, FriendAddEvent &out_event)
 
static bool ParseFriendDelEvent (const FriendChangeEvent &change_event, FriendDelEvent &out_event)
 
static bool ParseFriendProfileUpdateEvent (const FriendChangeEvent &change_event, FriendProfileUpdateEvent &out_event)
 
static bool ParseFriendProfileSyncEvent (const FriendChangeEvent &change_event, FriendProfileSyncEvent &out_event)
 
static void UnregFriendCb ()
 
static bool QueryFriendshipBlock (const std::string &accid, const std::string &json_extension="")
 
static bool QueryFriendListByKeyword (const std::string &keyword, const GetFriendsListCallback &cb, const std::string &json_extension="")
 

Detailed Description

NIM 好友相关接口

Member Typedef Documentation

◆ FriendChangeCallback

typedef std::function<void(const FriendChangeEvent&)> nim::Friend::FriendChangeCallback

好友信息变更通知回调模板

◆ FriendOptCallback

typedef std::function<void(NIMResCode res_code)> nim::Friend::FriendOptCallback

变更好友信息回调模板

◆ GetFriendProfileCallback

typedef std::function<void(const std::string& accid, const nim::FriendProfile& user_profile)> nim::Friend::GetFriendProfileCallback

获取好友信息回调模板

◆ GetFriendsListCallback

typedef std::function<void(NIMResCode res_code, const std::list<nim::FriendProfile>& user_profile_list)> nim::Friend::GetFriendsListCallback

获取好友回调模板

Member Function Documentation

◆ Delete()

static bool nim::Friend::Delete ( const std::string &  accid,
const FriendOptCallback cb,
const std::string &  json_extension = "" 
)
static

删除好友

Parameters
[in]accid对方帐号
[in]cb删除好友回调函数
[in]json_extensionjson扩展参数(备用,目前不需要)
Returns
bool 检查参数如果不符合要求则返回失败
Note
错误码 200:成功 404:用户不存在 500:未知错误

◆ DeleteEx()

static bool nim::Friend::DeleteEx ( const std::string &  accid,
const DeleteFriendOption option,
const FriendOptCallback cb 
)
static

删除好友

Parameters
[in]accid对方帐号
[in]option删除好友选项,目前仅有是否删除备注信息选项
[in]cb删除好友回调函数
Returns
bool 检查参数如果不符合要求则返回失败
Note
错误码 200:成功 404:用户不存在 500:未知错误

◆ GetFriendProfile()

static void nim::Friend::GetFriendProfile ( const std::string &  accid,
const GetFriendProfileCallback cb,
const std::string &  json_extension = "" 
)
static

获取好友信息

Parameters
[in]accid对方帐号
[in]cb获取好友信息回调函数
[in]json_extensionjson扩展参数(备用,目前不需要)
Returns
void 无返回值

◆ GetList()

static void nim::Friend::GetList ( const GetFriendsListCallback cb,
const std::string &  json_extension = "" 
)
static

增量获取好友列表

Parameters
[in]cb获取好友列表回调函数
[in]json_extensionjson扩展参数(备用,目前不需要)
Returns
void 无返回值
Note
错误码 200:成功

◆ ParseFriendAddEvent()

static bool nim::Friend::ParseFriendAddEvent ( const FriendChangeEvent change_event,
FriendAddEvent out_event 
)
static

解析收到的好友添加请求通知

Parameters
[in]change_event好友添加请求通知
[out]out_event解析后结果
Returns
bool 解析是否成功

◆ ParseFriendDelEvent()

static bool nim::Friend::ParseFriendDelEvent ( const FriendChangeEvent change_event,
FriendDelEvent out_event 
)
static

解析收到的好友删除通知

Parameters
[in]change_event好友删除通知
[out]out_event解析后结果
Returns
bool 解析是否成功

◆ ParseFriendProfileSyncEvent()

static bool nim::Friend::ParseFriendProfileSyncEvent ( const FriendChangeEvent change_event,
FriendProfileSyncEvent out_event 
)
static

解析收到的好友简况同步通知

Parameters
[in]change_event好友简况同步通知
[out]out_event解析后结果
Returns
bool 解析是否成功

◆ ParseFriendProfileUpdateEvent()

static bool nim::Friend::ParseFriendProfileUpdateEvent ( const FriendChangeEvent change_event,
FriendProfileUpdateEvent out_event 
)
static

解析收到的好友简况更新通知

Parameters
[in]change_event好友用户信息更新通知
[out]out_event解析后结果
Returns
bool 解析是否成功

◆ QueryFriendListByKeyword()

static bool nim::Friend::QueryFriendListByKeyword ( const std::string &  keyword,
const GetFriendsListCallback cb,
const std::string &  json_extension = "" 
)
static

增量获取好友列表

Parameters
[in]keyword要查询的关键字
[in]cb获取好友列表回调函数
[in]json_extensionjson扩展参数(备用,目前不需要)
Returns
bool 返回 true 表示发送查询请求成功,返回 false 表示关键字为空
Note
错误码 200:成功

◆ QueryFriendshipBlock()

bool nim::Friend::QueryFriendshipBlock ( const std::string &  accid,
const std::string &  json_extension = "" 
)
static

在本地缓存数据中查询accid是否为自己的好友(同步接口,堵塞NIM内部线程,谨慎使用)

Parameters
[in]accid对方帐号
[in]json_extensionjson扩展参数(备用,目前不需要)
Returns
bool 当正向和反向好友关系都为好友时返回true

◆ RegChangeCb()

static void nim::Friend::RegChangeCb ( const FriendChangeCallback cb,
const std::string &  json_extension = "" 
)
static

(全局回调)统一注册好友变更通知回调函数(多端同步添加、删除、更新,好友列表同步)

Parameters
[in]cb好友变更通知回调函数
[in]json_extensionjson扩展参数(备用,目前不需要)
Returns
void 无返回值
Note
错误码 200:成功 404:用户不存在 500:未知错误

◆ Request()

static bool nim::Friend::Request ( const std::string &  accid,
NIMVerifyType  verify_type,
const std::string &  msg,
const FriendOptCallback cb,
const std::string &  json_extension = "" 
)
static

添加、验证好友

Parameters
[in]accid对方帐号
[in]verify_type好友验证类型
[in]msg接口扩展字段
[in]cb好友请求回调函数
[in]json_extensionjson扩展参数(备用,目前不需要)
Returns
bool 检查参数如果不符合要求则返回失败
Note
错误码 200:成功 404:用户不存在 500:未知错误

◆ UnregFriendCb()

void nim::Friend::UnregFriendCb ( )
static

反注册Friend提供的所有回调

Returns
void 无返回值

◆ Update()

static bool nim::Friend::Update ( const FriendProfile friend_profile,
const FriendOptCallback cb,
const std::string &  json_extension = "" 
)
static

更新好友资料

Parameters
[in]friend_profile好友资料
[in]cb更新好友资料回调函数
[in]json_extensionjson扩展参数(备用,目前不需要)
Returns
bool 检查参数如果不符合要求则返回失败
Note
错误码 200:成功 404:用户不存在 500:未知错误

The documentation for this class was generated from the following file: