floo::BMXRosterService
Friend Service
#include <bmx_roster_service.h>
Public Types
Name | |
---|---|
enum class | ApplicationStatus { Pending, Accepted, Declined} Request state |
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 Get friend list, force pull from server-side if forceRefresh == true |
virtual BMXErrorCode | fetchRosterById(int64_t rosterId, bool forceRefresh, BMXRosterItemPtr & item) =0 Search for user by contact 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 Search for user by username |
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 Search for user in batch by contact id list |
virtual BMXErrorCode | search(const std::vector< int64_t > & rosterIdList, BMXRosterList & list, bool forceRefresh) =0 Deprecated. |
virtual BMXErrorCode | setItemLocalExtension(BMXRosterItemPtr item, const JSON & extension) =0 Update friend's local extension information |
virtual BMXErrorCode | setItemExtension(BMXRosterItemPtr item, const JSON & extension) =0 Update friend server extension information |
virtual BMXErrorCode | setItemAlias(BMXRosterItemPtr item, const JSON & alias) =0 Update friend's alias |
virtual BMXErrorCode | setItemMuteNotification(BMXRosterItemPtr item, bool status) =0 Set whether to reject user message |
virtual BMXErrorCode | getApplicationList(BMXRosterApplicationResultPagePtr & result, const std::string & cursor, int pageSize =10) =0 Get list of adding friend requests |
virtual BMXErrorCode | apply(int64_t rosterId, const std::string & message, const std::string & authAnswer ="") =0 Request to add friend |
virtual BMXErrorCode | remove(int64_t rosterId) =0 Delete friend |
virtual BMXErrorCode | accept(int64_t rosterId) =0 Accept adding friend request |
virtual BMXErrorCode | decline(int64_t rosterId, const std::string & reason) =0 Reject adding friend request |
virtual BMXErrorCode | block(int64_t rosterId) =0 Add to blacklist |
virtual BMXErrorCode | unblock(int64_t rosterId) =0 Remove from blacklist |
virtual BMXErrorCode | getBlockList(std::vector< int64_t > & list, bool forceRefresh) =0 Get blacklist, force pull from server-side if forceRefresh == true |
virtual BMXErrorCode | downloadAvatar(BMXRosterItemPtr item, bool thumbnail, Callback callback) =0 Download avatar |
virtual void | addRosterListener(BMXRosterServiceListener * listener) =0 Add friend change listener |
virtual void | removeRosterListener(BMXRosterServiceListener * listener) =0 Remove friend change listener |
Protected Functions
Name | |
---|---|
BMXRosterService() |
Public Types Documentation
enum ApplicationStatus
Enumerator | Value | Description |
---|---|---|
Pending | Request pending | |
Accepted | Request accepted | |
Declined | Request rejected |
Request state
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:
function get
virtual BMXErrorCode get(
std::vector< int64_t > & list,
bool forceRefresh
) =0
Get friend list, force pull from server-side if forceRefresh == true
Parameters:
- list List of friend ids, pass in an empty list function and fetch the returned friend id list here
- forceRefresh Whether to read data from server, true to force read from server, false to automatically read from server if the local read list is empty
Return: BMXErrorCode
Example:
if (__r.get() == nullptr)
_Tp1* __tmp = __r.get();
function fetchRosterById
virtual BMXErrorCode fetchRosterById(
int64_t rosterId,
bool forceRefresh,
BMXRosterItemPtr & item
) =0
Search for user by contact id
Parameters:
- rosterId Friend id to search
- forceRefresh True to force fetch from server, false to automatically fetch from server when query result is empty.
- item User information returned by query, passed in a pointing-to-empty shared_ptr objective function and assigned automatically after executed.
Return: BMXErrorCode
Example:
function search
virtual BMXErrorCode search(
int64_t rosterId,
bool forceRefresh,
BMXRosterItemPtr & item
) =0
Deprecated.
Parameters:
- rosterId Friend id to search
- forceRefresh True to force fetch from server, false to automatically fetch from server when query result is empty.
- item User information returned by query, passed in a pointing-to-empty shared_ptr objective function and assigned automatically after executed.
Return: BMXErrorCode
use fetchRosterById instead.
Search for users
Example:
function fetchRosterByName
virtual BMXErrorCode fetchRosterByName(
const std::string & name,
bool forceRefresh,
BMXRosterItemPtr & item
) =0
Search for user by username
Parameters:
- name Username to search
- forceRefresh True to force fetch from server, false to automatically fetch from server when query result is empty.
- item User information returned by query, passed in a pointing-to-empty shared_ptr objective function and assigned automatically after executed.
Return: BMXErrorCode
Example:
function search
virtual BMXErrorCode search(
const std::string & name,
bool forceRefresh,
BMXRosterItemPtr & item
) =0
Deprecated.
Parameters:
- name Username to search
- forceRefresh True to force fetch from server, false to automatically fetch from server when query result is empty.
- item User information returned by query, passed in a pointing-to-empty shared_ptr objective function and assigned automatically after executed.
Return: BMXErrorCode
use fetchRosterByName instead.
Search for users
Example:
function fetchRostersByIdList
virtual BMXErrorCode fetchRostersByIdList(
const std::vector< int64_t > & rosterIdList,
BMXRosterList & list,
bool forceRefresh
) =0
Search for user in batch by contact id list
Parameters:
- rosterIdList List of user ids to search
- list Returned friend information list, pass in an empty list function and fetch the returned result here
- forceRefresh Whether to force fetch from server, true to force fetch from server
Return: BMXErrorCode
Example:
function search
virtual BMXErrorCode search(
const std::vector< int64_t > & rosterIdList,
BMXRosterList & list,
bool forceRefresh
) =0
Deprecated.
Parameters:
- rosterIdList List of user ids to search
- list Returned friend information list, pass in an empty list function and fetch the returned result here
- forceRefresh Whether to force fetch from server, true to force fetch from server
Return: BMXErrorCode
use fetchRostersByIdList instead.
Batch search for users
Example:
function setItemLocalExtension
virtual BMXErrorCode setItemLocalExtension(
BMXRosterItemPtr item,
const JSON & extension
) =0
Update friend's local extension information
Parameters:
- item User information
- extension Local extension information
Return: BMXErrorCode
Example:
function setItemExtension
virtual BMXErrorCode setItemExtension(
BMXRosterItemPtr item,
const JSON & extension
) =0
Update friend server extension information
Parameters:
- item User information
- extension Server extension information
Return: BMXErrorCode
Example:
function setItemAlias
virtual BMXErrorCode setItemAlias(
BMXRosterItemPtr item,
const JSON & alias
) =0
Update friend's alias
Parameters:
- item User information
- alias Friend alias
Return: BMXErrorCode
Example:
function setItemMuteNotification
virtual BMXErrorCode setItemMuteNotification(
BMXRosterItemPtr item,
bool status
) =0
Set whether to reject user message
Parameters:
- item User information
- status Whether to reject user message, true to reject, false to accept
Return: BMXErrorCode
Example:
function getApplicationList
virtual BMXErrorCode getApplicationList(
BMXRosterApplicationResultPagePtr & result,
const std::string & cursor,
int pageSize =10
) =0
Get list of adding friend requests
Parameters:
- result Returned friend application list information, pass in a pointing-to-empty shared_ptr objective function which will be automatically assigned after executed.
- cursor Paged starting cursor, passed in as empty-valued first, followed by the cursor in the result returned by last operation
- pageSize Page size
Return: BMXErrorCode
Example:
function apply
virtual BMXErrorCode apply(
int64_t rosterId,
const std::string & message,
const std::string & authAnswer =""
) =0
Request to add friend
Parameters:
- rosterId User id requested to be added
- message Friend application information
Return: BMXErrorCode
Example:
BMXErrorCode errorCode = client->getRosterService().apply(rosterId, params[1]);
function remove
virtual BMXErrorCode remove(
int64_t rosterId
) =0
Delete friend
Parameters:
- rosterId Delete friend id
Return: BMXErrorCode
Example:
BMXErrorCode errorCode = client->getRosterService().remove(rosterId);
function accept
virtual BMXErrorCode accept(
int64_t rosterId
) =0
Accept adding friend request
Parameters:
- rosterId User id to be added as a friend
Return: BMXErrorCode
Example:
BMXErrorCode errorCode = client->getRosterService().accept(rosterId);
function decline
virtual BMXErrorCode decline(
int64_t rosterId,
const std::string & reason
) =0
Reject adding friend request
Parameters:
- rosterId User id to be added as a friend
- reason Reason for rejection
Return: BMXErrorCode
Example:
BMXErrorCode errorCode = client->getRosterService().decline(rosterId, params[1]);
function block
virtual BMXErrorCode block(
int64_t rosterId
) =0
Add to blacklist
Parameters:
- rosterId Blacklisted user id
Return: BMXErrorCode
Example:
function unblock
virtual BMXErrorCode unblock(
int64_t rosterId
) =0
Remove from blacklist
Parameters:
- rosterId Unblacklisted user id
Return: BMXErrorCode
Example:
function getBlockList
virtual BMXErrorCode getBlockList(
std::vector< int64_t > & list,
bool forceRefresh
) =0
Get blacklist, force pull from server-side if forceRefresh == true
Parameters:
- list List of friend ids, pass in an empty list function and fetch the returned blacklist id list here.
- forceRefresh Whether to read data from server, true to force read from server, false to automatically read from server if the local read list is empty
Return: BMXErrorCode
Example:
function downloadAvatar
virtual BMXErrorCode downloadAvatar(
BMXRosterItemPtr item,
bool thumbnail,
Callback callback
) =0
Download avatar
Parameters:
- item User information
- thumbnail Whether to download thumbnail, true for thumbnail, false for original
- callback Download callback function
Return: BMXErrorCode
Example:
function addRosterListener
virtual void addRosterListener(
BMXRosterServiceListener * listener
) =0
Add friend change listener
Parameters:
- listener Friend change listener
Example:
client->getRosterService().addRosterListener(rosterListener);
function removeRosterListener
virtual void removeRosterListener(
BMXRosterServiceListener * listener
) =0
Remove friend change listener
Parameters:
- listener Friend change listener
Protected Functions Documentation
Example:
mService->removeRosterListener(this);
client->getRosterService().removeRosterListener(rosterListener);
function BMXRosterService
inline BMXRosterService()
Example:
Updated on 2022-01-26 at 17:20:40 +0800