蓝莺开发者
Web & Mini ProgramiOSAndroidC++Server API

floo::BMXRosterService#

好友Service

#include <bmx_roster_service.h>

Public Types#

Name
enum classApplicationStatus { Pending, Accepted, Declined}
请求状态
typedef std::shared_ptr< [Application] >ApplicationPtr
typedef std::vector< ApplicationPtr >ApplicationList
typedef BMXResultPage< ApplicationPtr >BMXRosterApplicationResultPage
typedef std::shared_ptr< BMXRosterApplicationResultPage >BMXRosterApplicationResultPagePtr
typedef std::function< void(int percent)>Callback

Public Functions#

Name
virtual~BMXRosterService()
virtual BMXErrorCodeget(std::vector< int64_t > & list, bool forceRefresh) =0
获取好友列表,如果forceRefresh == true,则强制从服务端拉取
virtual BMXErrorCodefetchRosterById(int64_t rosterId, bool forceRefresh, BMXRosterItemPtr & item) =0
通过联系人id搜索用户
virtual BMXErrorCodesearch(int64_t rosterId, bool forceRefresh, BMXRosterItemPtr & item) =0
Deprecated.
virtual BMXErrorCodefetchRosterByName(const std::string & name, bool forceRefresh, BMXRosterItemPtr & item) =0
通过用户名搜索用户
virtual BMXErrorCodesearch(const std::string & name, bool forceRefresh, BMXRosterItemPtr & item) =0
Deprecated.
virtual BMXErrorCodefetchRostersByIdList(const std::vector< int64_t > & rosterIdList, BMXRosterList & list, bool forceRefresh) =0
通过联系人id列表批量搜索用户
virtual BMXErrorCodesearch(const std::vector< int64_t > & rosterIdList, BMXRosterList & list, bool forceRefresh) =0
Deprecated.
virtual BMXErrorCodesetItemLocalExtension(BMXRosterItemPtr item, const JSON & extension) =0
更新好友本地扩展信息
virtual BMXErrorCodesetItemExtension(BMXRosterItemPtr item, const JSON & extension) =0
更新好友服务器扩展信息
virtual BMXErrorCodesetItemAlias(BMXRosterItemPtr item, const JSON & alias) =0
更新好友别名
virtual BMXErrorCodesetItemMuteNotification(BMXRosterItemPtr item, bool status) =0
设置是否拒收用户消息
virtual BMXErrorCodegetApplicationList(BMXRosterApplicationResultPagePtr & result, const std::string & cursor, int pageSize =10) =0
获取申请添加好友列表
virtual BMXErrorCodeapply(int64_t rosterId, const std::string & message, const std::string & authAnswer ="") =0
申请添加好友
virtual BMXErrorCoderemove(int64_t rosterId) =0
删除好友
virtual BMXErrorCodeaccept(int64_t rosterId) =0
接受加好友申请
virtual BMXErrorCodedecline(int64_t rosterId, const std::string & reason) =0
拒绝加好友申请
virtual BMXErrorCodeblock(int64_t rosterId) =0
加入黑名单
virtual BMXErrorCodeunblock(int64_t rosterId) =0
从黑名单移除
virtual BMXErrorCodegetBlockList(std::vector< int64_t > & list, bool forceRefresh) =0
获取黑名单,如果forceRefresh == true,则强制从服务端拉取
virtual BMXErrorCodedownloadAvatar(BMXRosterItemPtr item, bool thumbnail, Callback callback) =0
下载头像
virtual voidaddRosterListener(BMXRosterServiceListener * listener) =0
添加好友变化监听者
virtual voidremoveRosterListener(BMXRosterServiceListener * listener) =0
移除好友变化监听者

Protected Functions#

Public Types Documentation#

enum ApplicationStatus#

EnumeratorValueDescription
Pending请求待处理
Accepted请求已接受
Declined请求已拒绝

请求状态

typedef ApplicationPtr#

typedef std::shared_ptr<Application> floo::BMXRosterService::ApplicationPtr;

typedef ApplicationList#

typedef std::vector<ApplicationPtr> floo::BMXRosterService::ApplicationList;

typedef BMXRosterApplicationResultPage#

typedef BMXResultPage<ApplicationPtr> floo::BMXRosterService::BMXRosterApplicationResultPage;

typedef BMXRosterApplicationResultPagePtr#

typedef std::shared_ptr<BMXRosterApplicationResultPage> floo::BMXRosterService::BMXRosterApplicationResultPagePtr;

typedef Callback#

typedef std::function<void(int percent)> floo::BMXRosterService::Callback;

Public Functions Documentation#

function ~BMXRosterService#

inline virtual ~BMXRosterService()

Example:

{% lanying_code_snippet repo="lanying-im-embedded",class="BMXRosterService",function="~BMXRosterService" %}{% endlanying_code_snippet %}

function get#

virtual BMXErrorCode get(
    std::vector< int64_t > & list,
    bool forceRefresh
) =0

获取好友列表,如果forceRefresh == true,则强制从服务端拉取

Parameters:

  • list 好友id列表,传入空列表函数返回后从此处获取返回的好友id列表
  • forceRefresh 是否从服务器读取数据,true为强制从服务器获取,false情况下本地读取列表为空的情况下会自动从服务器读取

Return: BMXErrorCode

Example:

{% lanying_code_snippet repo="lanying-im-embedded",class="BMXRosterService",function="get" %}{% endlanying_code_snippet %}

function fetchRosterById#

virtual BMXErrorCode fetchRosterById(
    int64_t rosterId,
    bool forceRefresh,
    BMXRosterItemPtr & item
) =0

通过联系人id搜索用户

Parameters:

  • rosterId 搜索的好友id
  • forceRefresh 为true强制从服务器获取,为false情况下查询结果为空时自动从服务器获取。
  • item 查询返回的用户的信息,传入指向为空的shared_ptr对象函数执行后会自动赋值。

Return: BMXErrorCode

Example:

{% lanying_code_snippet repo="lanying-im-embedded",class="BMXRosterService",function="fetchRosterById" %}{% endlanying_code_snippet %}
virtual BMXErrorCode search(
    int64_t rosterId,
    bool forceRefresh,
    BMXRosterItemPtr & item
) =0

Deprecated.

Parameters:

  • rosterId 搜索的好友id
  • forceRefresh 为true强制从服务器获取,为false情况下查询结果为空时自动从服务器获取。
  • item 查询返回的用户的信息,传入指向为空的shared_ptr对象函数执行后会自动赋值。

Return: BMXErrorCode

use fetchRosterById instead.

搜索用户

Example:

{% lanying_code_snippet repo="lanying-im-embedded",class="BMXRosterService",function="search" %}{% endlanying_code_snippet %}

function fetchRosterByName#

virtual BMXErrorCode fetchRosterByName(
    const std::string & name,
    bool forceRefresh,
    BMXRosterItemPtr & item
) =0

通过用户名搜索用户

Parameters:

  • name 搜索的用户名
  • forceRefresh 为true强制从服务器获取,为false情况下查询结果为空时自动从服务器获取。
  • item 查询返回的用户的信息,传入指向为空的shared_ptr对象函数执行后会自动赋值。

Return: BMXErrorCode

Example:

{% lanying_code_snippet repo="lanying-im-embedded",class="BMXRosterService",function="fetchRosterByName" %}{% endlanying_code_snippet %}

function search#

virtual BMXErrorCode search(
    const std::string & name,
    bool forceRefresh,
    BMXRosterItemPtr & item
) =0

Deprecated.

Parameters:

  • name 搜索的用户名
  • forceRefresh 为true强制从服务器获取,为false情况下查询结果为空时自动从服务器获取。
  • item 查询返回的用户的信息,传入指向为空的shared_ptr对象函数执行后会自动赋值。

Return: BMXErrorCode

use fetchRosterByName instead.

搜索用户

Example:

{% lanying_code_snippet repo="lanying-im-embedded",class="BMXRosterService",function="search" %}{% endlanying_code_snippet %}

function fetchRostersByIdList#

virtual BMXErrorCode fetchRostersByIdList(
    const std::vector< int64_t > & rosterIdList,
    BMXRosterList & list,
    bool forceRefresh
) =0

通过联系人id列表批量搜索用户

Parameters:

  • rosterIdList 需要搜索的用户id列表
  • list 返回的好友信息列表,传入空列表函数返回后从此处获取返回的好友信息列表
  • forceRefresh 是否强制从服务器获取,为true则强制从服务器获取

Return: BMXErrorCode

Example:

{% lanying_code_snippet repo="lanying-im-embedded",class="BMXRosterService",function="fetchRostersByIdList" %}{% endlanying_code_snippet %}

function search#

virtual BMXErrorCode search(
    const std::vector< int64_t > & rosterIdList,
    BMXRosterList & list,
    bool forceRefresh
) =0

Deprecated.

Parameters:

  • rosterIdList 需要搜索的用户id列表
  • list 返回的好友信息列表,传入空列表函数返回后从此处获取返回的好友信息列表
  • forceRefresh 是否强制从服务器获取,为true则强制从服务器获取

Return: BMXErrorCode

use fetchRostersByIdList instead.

批量搜索用户

Example:

{% lanying_code_snippet repo="lanying-im-embedded",class="BMXRosterService",function="search" %}{% endlanying_code_snippet %}

function setItemLocalExtension#

virtual BMXErrorCode setItemLocalExtension(
    BMXRosterItemPtr item,
    const JSON & extension
) =0

更新好友本地扩展信息

Parameters:

  • item 用户信息
  • extension 本地扩展信息

Return: BMXErrorCode

Example:

{% lanying_code_snippet repo="lanying-im-embedded",class="BMXRosterService",function="setItemLocalExtension" %}{% endlanying_code_snippet %}

function setItemExtension#

virtual BMXErrorCode setItemExtension(
    BMXRosterItemPtr item,
    const JSON & extension
) =0

更新好友服务器扩展信息

Parameters:

  • item 用户信息
  • extension 服务器扩展信息

Return: BMXErrorCode

Example:

{% lanying_code_snippet repo="lanying-im-embedded",class="BMXRosterService",function="setItemExtension" %}{% endlanying_code_snippet %}

function setItemAlias#

virtual BMXErrorCode setItemAlias(
    BMXRosterItemPtr item,
    const JSON & alias
) =0

更新好友别名

Parameters:

  • item 用户信息
  • alias 好友别名

Return: BMXErrorCode

Example:

{% lanying_code_snippet repo="lanying-im-embedded",class="BMXRosterService",function="setItemAlias" %}{% endlanying_code_snippet %}

function setItemMuteNotification#

virtual BMXErrorCode setItemMuteNotification(
    BMXRosterItemPtr item,
    bool status
) =0

设置是否拒收用户消息

Parameters:

  • item 用户信息
  • status 是否拒收用户消息,true拒收,false不拒收

Return: BMXErrorCode

Example:

{% lanying_code_snippet repo="lanying-im-embedded",class="BMXRosterService",function="setItemMuteNotification" %}{% endlanying_code_snippet %}

function getApplicationList#

virtual BMXErrorCode getApplicationList(
    BMXRosterApplicationResultPagePtr & result,
    const std::string & cursor,
    int pageSize =10
) =0

获取申请添加好友列表

Parameters:

  • result 返回的申请好友列表信息,传入指向为空的shared_ptr对象函数执行后会自动赋值。
  • cursor 分页获取的起始cursor,第一次传入为空,后续传入上次操作返回的result中的cursor
  • pageSize 分页大小

Return: BMXErrorCode

Example:

{% lanying_code_snippet repo="lanying-im-embedded",class="BMXRosterService",function="getApplicationList" %}{% endlanying_code_snippet %}

function apply#

virtual BMXErrorCode apply(
    int64_t rosterId,
    const std::string & message,
    const std::string & authAnswer =""
) =0

申请添加好友

Parameters:

  • rosterId 申请添加的用户id
  • message 好友申请信息

Return: BMXErrorCode

Example:

{% lanying_code_snippet repo="lanying-im-embedded",class="BMXRosterService",function="apply" %}{% endlanying_code_snippet %}

function remove#

virtual BMXErrorCode remove(
    int64_t rosterId
) =0

删除好友

Parameters:

  • rosterId 删除的好友id

Return: BMXErrorCode

Example:

{% lanying_code_snippet repo="lanying-im-embedded",class="BMXRosterService",function="remove" %}{% endlanying_code_snippet %}

function accept#

virtual BMXErrorCode accept(
    int64_t rosterId
) =0

接受加好友申请

Parameters:

  • rosterId 申请加为好友的用户id

Return: BMXErrorCode

Example:

{% lanying_code_snippet repo="lanying-im-embedded",class="BMXRosterService",function="accept" %}{% endlanying_code_snippet %}

function decline#

virtual BMXErrorCode decline(
    int64_t rosterId,
    const std::string & reason
) =0

拒绝加好友申请

Parameters:

  • rosterId 申请加为好友的用户id
  • reason 拒绝的原因

Return: BMXErrorCode

Example:

{% lanying_code_snippet repo="lanying-im-embedded",class="BMXRosterService",function="decline" %}{% endlanying_code_snippet %}

function block#

virtual BMXErrorCode block(
    int64_t rosterId
) =0

加入黑名单

Parameters:

  • rosterId 加入黑名单的用户id

Return: BMXErrorCode

Example:

{% lanying_code_snippet repo="lanying-im-embedded",class="BMXRosterService",function="block" %}{% endlanying_code_snippet %}

function unblock#

virtual BMXErrorCode unblock(
    int64_t rosterId
) =0

从黑名单移除

Parameters:

  • rosterId 从黑名单移除的用户id

Return: BMXErrorCode

Example:

{% lanying_code_snippet repo="lanying-im-embedded",class="BMXRosterService",function="unblock" %}{% endlanying_code_snippet %}

function getBlockList#

virtual BMXErrorCode getBlockList(
    std::vector< int64_t > & list,
    bool forceRefresh
) =0

获取黑名单,如果forceRefresh == true,则强制从服务端拉取

Parameters:

  • list 好友id列表,传入空列表函数返回后从此处获取返回的黑名单id列表
  • forceRefresh 是否从服务器读取数据,true为强制从服务器获取,false情况下本地读取列表为空的情况下会自动从服务器读取

Return: BMXErrorCode

Example:

{% lanying_code_snippet repo="lanying-im-embedded",class="BMXRosterService",function="getBlockList" %}{% endlanying_code_snippet %}

function downloadAvatar#

virtual BMXErrorCode downloadAvatar(
    BMXRosterItemPtr item,
    bool thumbnail,
    Callback callback
) =0

下载头像

Parameters:

  • item 用户信息
  • thumbnail 是否下载缩略图,ture为缩略图,false为原图
  • callback 下载回调函数

Return: BMXErrorCode

Example:

{% lanying_code_snippet repo="lanying-im-embedded",class="BMXRosterService",function="downloadAvatar" %}{% endlanying_code_snippet %}

function addRosterListener#

virtual void addRosterListener(
    BMXRosterServiceListener * listener
) =0

添加好友变化监听者

Parameters:

  • listener 好友变化监听者

Example:

{% lanying_code_snippet repo="lanying-im-embedded",class="BMXRosterService",function="addRosterListener" %}{% endlanying_code_snippet %}

function removeRosterListener#

virtual void removeRosterListener(
    BMXRosterServiceListener * listener
) =0

移除好友变化监听者

Parameters:

  • listener 好友变化监听者

Protected Functions Documentation#

Example:

{% lanying_code_snippet repo="lanying-im-embedded",class="BMXRosterService",function="removeRosterListener" %}{% endlanying_code_snippet %}

function BMXRosterService#

inline BMXRosterService()

Example:

{% lanying_code_snippet repo="lanying-im-embedded",class="BMXRosterService",function="BMXRosterService" %}{% endlanying_code_snippet %}

Updated on 2022-01-26 at 17:20:40 +0800

自动生成的 API 内容,仅在必要位置补充精简的 AI 解释。