floo::BMXRosterService#
好友Service
#include <bmx_roster_service.h>
Public Types#
| Name | |
|---|---|
| enum class | ApplicationStatus { 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 BMXErrorCode | get(std::vector< int64_t > & list, bool forceRefresh) =0 取得好友列表,如果forceRefresh == true,則強制從服務端拉取 |
| virtual BMXErrorCode | fetchRosterById(int64_t rosterId, bool forceRefresh, BMXRosterItemPtr & item) =0 通過聯繫人id搜索使用者 |
| virtual BMXErrorCode | search(int64_t rosterId, bool forceRefresh, BMXRosterItemPtr & item) =0 Deprecated. |
| virtual BMXErrorCode | fetchRosterByName(const std::string & name, bool forceRefresh, BMXRosterItemPtr & item) =0 通過使用者名搜索使用者 |
| virtual BMXErrorCode | search(const std::string & name, bool forceRefresh, BMXRosterItemPtr & item) =0 Deprecated. |
| virtual BMXErrorCode | fetchRostersByIdList(const std::vector< int64_t > & rosterIdList, BMXRosterList & list, bool forceRefresh) =0 通過聯繫人id列表批量搜索使用者 |
| virtual BMXErrorCode | search(const std::vector< int64_t > & rosterIdList, BMXRosterList & list, bool forceRefresh) =0 Deprecated. |
| virtual BMXErrorCode | setItemLocalExtension(BMXRosterItemPtr item, const JSON & extension) =0 更新好友本地擴展信息 |
| virtual BMXErrorCode | setItemExtension(BMXRosterItemPtr item, const JSON & extension) =0 更新好友伺服器擴展信息 |
| virtual BMXErrorCode | setItemAlias(BMXRosterItemPtr item, const JSON & alias) =0 更新好友別名 |
| virtual BMXErrorCode | setItemMuteNotification(BMXRosterItemPtr item, bool status) =0 設定是否拒收使用者訊息 |
| virtual BMXErrorCode | getApplicationList(BMXRosterApplicationResultPagePtr & result, const std::string & cursor, int pageSize =10) =0 取得申請添加好友列表 |
| virtual BMXErrorCode | apply(int64_t rosterId, const std::string & message, const std::string & authAnswer ="") =0 申請添加好友 |
| virtual BMXErrorCode | remove(int64_t rosterId) =0 刪除好友 |
| virtual BMXErrorCode | accept(int64_t rosterId) =0 接受加好友申請 |
| virtual BMXErrorCode | decline(int64_t rosterId, const std::string & reason) =0 拒絕加好友申請 |
| virtual BMXErrorCode | block(int64_t rosterId) =0 加入黑名單 |
| virtual BMXErrorCode | unblock(int64_t rosterId) =0 從黑名單移除 |
| virtual BMXErrorCode | getBlockList(std::vector< int64_t > & list, bool forceRefresh) =0 取得黑名單,如果forceRefresh == true,則強制從服務端拉取 |
| virtual BMXErrorCode | downloadAvatar(BMXRosterItemPtr item, bool thumbnail, Callback callback) =0 下載頭像 |
| virtual void | addRosterListener(BMXRosterServiceListener * listener) =0 添加好友變化監聽者 |
| virtual void | removeRosterListener(BMXRosterServiceListener * listener) =0 移除好友變化監聽者 |
Protected Functions#
| Name | |
|---|---|
| BMXRosterService() |
Public Types Documentation#
enum ApplicationStatus#
| Enumerator | Value | Description |
|---|---|---|
| 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 %}
function search#
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