Sendbird Chat SDK for Unreal
Static Public Member Functions | List of all members
SBDMain Class Referencefinal

#include <Sendbird.h>

Static Public Member Functions

static std::wstring GetApplicationId ()
 
static std::wstring GetSdkVersion ()
 
static bool IsInitialized ()
 
static void Init (std::wstring application_id)
 
static SBDConnectionState GetConnectionState ()
 
static void AddConnectionHandler (std::wstring identifier, SBDConnectionHandler *handler)
 
static void RemoveConnectionHandler (std::wstring identifier)
 
static void RemoveAllConnectionHandlers ()
 
static void AddUserEventHandler (std::wstring identifier, SBDUserEventHandler *handler)
 
static void RemoveUserEventHandler (std::wstring identifier)
 
static void RemoveAllUserEventHandlers ()
 
static void AddChannelHandler (std::wstring identifier, SBDChannelHandler *handler)
 
static void RemoveChannelHandler (std::wstring identifier)
 
static void RemoveAllChannelHandlers ()
 
static void Connect (std::wstring user_id, std::wstring access_token, std::function< void(SBDUser *, SBDError *)> completion_handler)
 
static void Disconnect (std::function< void()> completion_handler)
 
static SBDUserGetCurrentUser ()
 
static void UpdateCurrentUserInfo (std::wstring nickname, std::wstring profile_url, std::function< void(SBDError *)> completion_handler)
 
static void UpdateCurrentUserInfoWithBinaryProfileImage (std::wstring nickname, std::wstring profile_image_file_path, std::wstring mime_type, std::function< void(SBDError *)> completion_handler)
 
static SBDUserListQueryCreateAllUserListQuery ()
 
static SBDUserListQueryCreateUserListQuery (std::vector< std::wstring > user_ids)
 
static SBDUserListQueryCreateBlockedUserListQuery ()
 
static void BlockUser (const SBDUser &user, std::function< void(SBDUser *blocked_user, SBDError *)> completion_handler)
 
static void UnblockUser (const SBDUser &user, std::function< void(SBDError *)> completion_handler)
 
static bool Reconnect ()
 
static void SetChannelInvitationPreference (bool auto_accept, std::function< void(SBDError *)> completion_handler)
 
static void GetChannelInvitationPreference (std::function< void(bool is_auto_accept, SBDError *)> completion_handler)
 
static void GetTotalUnreadChannelCount (std::function< void(int total_unread_channel_count, SBDError *)> completion_handler)
 
static void GetTotalUnreadMessageCount (SBDGroupChannelTotalUnreadMessageCountParams &params, std::function< void(int total_unread_message_count, SBDError *)> completion_handler)
 
static int GetSubscribedTotalUnreadMessageCount ()
 
static int GetSubscribedCustomTypeTotalUnreadMessageCount ()
 
static int GetSubscribedCustomTypeUnreadMessageCount (std::wstring custom_type)
 
static void RegisterPushTokenForCurrentUser (SBDPushTokenType type, std::wstring token, bool unique, std::function< void(SBDPushTokenRegistrationStatus, SBDError *)> completion_handler)
 
static std::wstring GetPendingPushToken ()
 
static void UnregisterPushTokenForCurrentUser (SBDPushTokenType type, std::wstring token, std::function< void(SBDError *)> completion_handler)
 
static void UnregisterPushTokenAllForCurrentUser (std::function< void(SBDError *)> completion_handler)
 

Detailed Description

The SBDMain is the core class for Sendbird. This class is singletone instance which is initialized by Application ID. This class provides the methods for overall. The methods include SBDConnectionHandler registration for receiving events are related to channels, SBDConnectionHandler for managing the connection status, updating the current user's information, and blocking other users.

Member Function Documentation

◆ AddChannelHandler()

static void SBDMain::AddChannelHandler ( std::wstring  identifier,
SBDChannelHandler handler 
)
static

Adds the SBDChannelHandler.

Parameters
identifierThe identifier for handler.
handlerSBDChannelHandler handler.

◆ AddConnectionHandler()

static void SBDMain::AddConnectionHandler ( std::wstring  identifier,
SBDConnectionHandler handler 
)
static

Adds the SBDConnectionHandler.

Parameters
identifierThe identifier for the handler.
handlerSBDConnectionHandler handler.

◆ AddUserEventHandler()

static void SBDMain::AddUserEventHandler ( std::wstring  identifier,
SBDUserEventHandler handler 
)
static

Adds a user event handler. All added handlers will be notified when events occur.

Parameters
identifierID of handler to be added.
handlerHandler to be added.
Since
3.0.37

◆ BlockUser()

static void SBDMain::BlockUser ( const SBDUser user,
std::function< void(SBDUser *blocked_user, SBDError *)>  completion_handler 
)
static

Blocks the specified user.

Parameters
userThe user to be blocked.
completion_handlerThe handler interface to execute. blockedUser is the blocked user by the current user.

◆ Connect()

static void SBDMain::Connect ( std::wstring  user_id,
std::wstring  access_token,
std::function< void(SBDUser *, SBDError *)>  completion_handler 
)
static

Performs a connection to Sendbird with the user ID and the access token.

Parameters
user_idThe user ID.
access_tokenThe access token. If the user doesn't have access token, set nil.
completion_handlerThe handler interface to execute. user is the object to represent the current user.

◆ CreateAllUserListQuery()

static SBDUserListQuery * SBDMain::CreateAllUserListQuery ( )
static

Creates SBDUserListQuery instance for getting a list of all users of this application.

Returns
SBDUserListQuery instance.

◆ CreateBlockedUserListQuery()

static SBDUserListQuery * SBDMain::CreateBlockedUserListQuery ( )
static

Creates SBDUserListQuery instance for getting a list of blocked users by the current user.

Returns
SBDUserListQuery instance.

◆ CreateUserListQuery()

static SBDUserListQuery * SBDMain::CreateUserListQuery ( std::vector< std::wstring >  user_ids)
static

Creates SBDUserListQuery instance for gettting a list of users of this application with user IDs.

Parameters
user_idsThe user IDs to get user objects.
Returns
SBDUserListQuery instance.

◆ Disconnect()

static void SBDMain::Disconnect ( std::function< void()>  completion_handler)
static

Disconnects from Sendbird. If this method is invoked, the current user will be invalidated.

Parameters
completion_handlerThe handler interface to execute.

◆ GetApplicationId()

static std::wstring SBDMain::GetApplicationId ( )
static

Gets the Application ID which was used for initialization.

Returns
The Application ID.

◆ GetChannelInvitationPreference()

static void SBDMain::GetChannelInvitationPreference ( std::function< void(bool is_auto_accept, SBDError *)>  completion_handler)
static

Gets group channel inviation preference for auto acceptance.

Parameters
completion_handlerThe handler interface to execute.

◆ GetConnectionState()

static SBDConnectionState SBDMain::GetConnectionState ( )
static

Gets the WebSocket server connection state.

  • Connecting - Connecting to the chat server
  • Open - Connected to the chat server
  • Closing - Disconnecting from the chat server
  • Closed - Disconnected from the chat server
Returns
SBDConnectionState

◆ GetCurrentUser()

static SBDUser * SBDMain::GetCurrentUser ( )
static

Gets the current user.

Returns
The current user.
Since
3.0.20

◆ GetPendingPushToken()

static std::wstring SBDMain::GetPendingPushToken ( )
static

Gets the pending push token.

Returns
Returns the pending push token. Returns empty string if there is no registration pending token.
Since
3.0.46

◆ GetSdkVersion()

static std::wstring SBDMain::GetSdkVersion ( )
static

Retrieves the SDK version.

Returns
The SDK version.

◆ GetSubscribedCustomTypeTotalUnreadMessageCount()

static int SBDMain::GetSubscribedCustomTypeTotalUnreadMessageCount ( )
static

Gets the total number of unread message of GroupChannels with subscribed custom types.

Returns
The subscribed custom type total unread message count.
Since
3.0.37

◆ GetSubscribedCustomTypeUnreadMessageCount()

static int SBDMain::GetSubscribedCustomTypeUnreadMessageCount ( std::wstring  custom_type)
static

Gets the number of unread message of GroupChannel with subscribed custom type.

Parameters
custom_typeThe subscribed custom type.
Returns
The subscribed custom type unread message count.
Since
3.0.37

◆ GetSubscribedTotalUnreadMessageCount()

static int SBDMain::GetSubscribedTotalUnreadMessageCount ( )
static

Gets the subscribed total number of unread message of all GroupChannels the current user has joined.

Returns
The subscribed total unread message count.
Since
3.0.37

◆ GetTotalUnreadChannelCount()

static void SBDMain::GetTotalUnreadChannelCount ( std::function< void(int total_unread_channel_count, SBDError *)>  completion_handler)
static

Gets total unread channel count.

Parameters
completion_handlerThe handler interface to execute.
Since
3.0.37

◆ GetTotalUnreadMessageCount()

static void SBDMain::GetTotalUnreadMessageCount ( SBDGroupChannelTotalUnreadMessageCountParams params,
std::function< void(int total_unread_message_count, SBDError *)>  completion_handler 
)
static

Gets total unread message count.

Parameters
paramsSBDGroupChannelTotalUnreadMessageCountParams.
completion_handlerThe handler interface to execute.
Since
3.0.37

◆ Init()

static void SBDMain::Init ( std::wstring  application_id)
static

Initializes SBDMain singleton instance with Sendbird Application ID. The Application ID is on Sendbird dashboard. This method has to be run first in order to user Sendbird.

Parameters
applicationIdThe Applicatin ID of Sendbird. It can be founded on Sendbird Dashboard.

◆ IsInitialized()

static bool SBDMain::IsInitialized ( )
static

Gets initializing state.

Returns
If true, SBDMain instance is initialized.

◆ Reconnect()

static bool SBDMain::Reconnect ( )
static

Starts reconnection explictly. The SBDConnectionHandler handlers will be invoked by the reconnection process.

Returns
Returns true if there is the data to be used for reconnection.

◆ RegisterPushTokenForCurrentUser()

static void SBDMain::RegisterPushTokenForCurrentUser ( SBDPushTokenType  type,
std::wstring  token,
bool  unique,
std::function< void(SBDPushTokenRegistrationStatus, SBDError *)>  completion_handler 
)
static

Registers push token for the current SBDUser to receive push notification. Push token registration succeeds only when the connection is made. Otherwise, callback will return with SBDPushTokenRegistrationStatus::Pending<code> status. Then, you can register push token again by calling this function after the connection is done.

Parameters
typePush token type.
tokenPush token.
uniqueIf true, all the previously registered token for the current SBDUser will be deleted and this token will be the unique one.
handlerCallback handler.
Since
3.0.46

◆ RemoveAllChannelHandlers()

static void SBDMain::RemoveAllChannelHandlers ( )
static

Removes all channel handlers.

◆ RemoveAllConnectionHandlers()

static void SBDMain::RemoveAllConnectionHandlers ( )
static

Removes all reconnection handlers.

◆ RemoveAllUserEventHandlers()

static void SBDMain::RemoveAllUserEventHandlers ( )
static

Removes all user event handlers.

Since
3.0.37

◆ RemoveChannelHandler()

static void SBDMain::RemoveChannelHandler ( std::wstring  identifier)
static

Removes the SBDChannelHandler by identifier.

Parameters
identifierThe identifier for the handler to be removed.

◆ RemoveConnectionHandler()

static void SBDMain::RemoveConnectionHandler ( std::wstring  identifier)
static

Removes the SBDConnectionHandler by identifier.

Parameters
identifierThe identifier for the handler to be removed.

◆ RemoveUserEventHandler()

static void SBDMain::RemoveUserEventHandler ( std::wstring  identifier)
static

Removes a user event handler. The deleted handler no longer be notified.

Parameters
identifierID of handler to be removed.
Since
3.0.37

◆ SetChannelInvitationPreference()

static void SBDMain::SetChannelInvitationPreference ( bool  auto_accept,
std::function< void(SBDError *)>  completion_handler 
)
static

Sets group channel invitation preference for auto acceptance.

Parameters
auto_acceptIf true, the current user will accept the group channel invitation automatically.
completion_handlerThe handler interface to execute.

◆ UnblockUser()

static void SBDMain::UnblockUser ( const SBDUser user,
std::function< void(SBDError *)>  completion_handler 
)
static

Unblocks the specified user.

Parameters
userIdThe user ID which was blocked.
completion_handlerThe handler interface to execute.

◆ UnregisterPushTokenAllForCurrentUser()

static void SBDMain::UnregisterPushTokenAllForCurrentUser ( std::function< void(SBDError *)>  completion_handler)
static

Unregisters all push token bound to the current SBDUser.

Parameters
handlerCallback handler.
Since
3.0.46

◆ UnregisterPushTokenForCurrentUser()

static void SBDMain::UnregisterPushTokenForCurrentUser ( SBDPushTokenType  type,
std::wstring  token,
std::function< void(SBDError *)>  completion_handler 
)
static

Unregisters push token for the current SBDUser.

Parameters
typePush token type.
tokenPush token.
handlerCallback handler.
Since
3.0.46

◆ UpdateCurrentUserInfo()

static void SBDMain::UpdateCurrentUserInfo ( std::wstring  nickname,
std::wstring  profile_url,
std::function< void(SBDError *)>  completion_handler 
)
static

Updates the current user's information.

Parameters
nicknameNew nickname.
profile_urlNew profile image url.
completion_handlerThe handler interface to execute.

◆ UpdateCurrentUserInfoWithBinaryProfileImage()

static void SBDMain::UpdateCurrentUserInfoWithBinaryProfileImage ( std::wstring  nickname,
std::wstring  profile_image_file_path,
std::wstring  mime_type,
std::function< void(SBDError *)>  completion_handler 
)
static

Updates the current user's information.

Parameters
nicknameNew nickname.
profile_image_file_pathNew profile image file path.
mime_typeThe image file's mime type.
completion_handlerThe handler interface to execute.