Package io.manebot.platform
Interface PlatformConnection
-
- All Known Implementing Classes:
AbstractPlatformConnection
public interface PlatformConnection
-
-
Method Summary
Modifier and Type Method Description voidconnect()Calls to connect to the platform.default ChatcreateChatFromIds(java.util.Collection<java.lang.String> userIds)Creates a new chat with the specified participants.default ChatcreateChatFromUsers(java.util.Collection<PlatformUser> users)Creates a new chat with the specified participants.default voiddisconnect()Calls to disconnect from the platform.default ChatgetChat(java.lang.String id)Gets a chat by its user-specific ID.java.util.Collection<java.lang.String>getChatIds()Gets a list of chat IDs associated with this platform.java.util.Collection<Chat>getChats()Gets a list of chats associated with this platform.default java.util.Collection<Chat>getChatsByUser(PlatformUser member)Gets an immutable collection of chats where the specified user is a member.default java.util.Collection<Chat>getChatsByUser(User member)Gets an immutable collection of chats where the specified user is a member.PlatformUsergetPlatformUser(java.lang.String id)Gets a user on this platform by their platform-specific ID.java.util.Collection<java.lang.String>getPlatformUserIds()Gets a collection of known user IDs on this platform.java.util.Collection<PlatformUser>getPlatformUsers()Gets a collection of known platform users to this platform.PlatformUsergetSelf()Gets the self user for the platform.default PlatformUser.StatusgetStatus()Gets the status of the current user on the platform.default UserRegistrationgetUserRegistration()Gets the default user registration system for this platform.default booleanisConnected()Finds if the platform connection holds a connection.default voidsetStatus(PlatformUser.Status status)Sets the status of the current user on the platform.
-
-
-
Method Detail
-
connect
void connect() throws PluginExceptionCalls to connect to the platform. This process is called automatically upon registration.- Throws:
PluginException
-
disconnect
default void disconnect() throws java.lang.UnsupportedOperationException, PluginExceptionCalls to disconnect from the platform.- Throws:
java.lang.UnsupportedOperationExceptionPluginException
-
isConnected
default boolean isConnected()
Finds if the platform connection holds a connection.- Returns:
- true if a connection is held, false otherwise.
-
getStatus
default PlatformUser.Status getStatus()
Gets the status of the current user on the platform.- Returns:
- current status.
-
getUserRegistration
default UserRegistration getUserRegistration()
Gets the default user registration system for this platform.- Returns:
- platform user registration. If null, this defaults to Bot.getDefaultUserRegistration().
-
setStatus
default void setStatus(PlatformUser.Status status) throws java.lang.UnsupportedOperationException
Sets the status of the current user on the platform.- Parameters:
status- status to set.- Throws:
java.lang.UnsupportedOperationException
-
getSelf
PlatformUser getSelf()
Gets the self user for the platform.- Returns:
- self user.
-
getPlatformUser
PlatformUser getPlatformUser(java.lang.String id)
Gets a user on this platform by their platform-specific ID.- Parameters:
id- platform-specific Id.- Returns:
- PlatformUser instance if found, null otherwise.
-
getPlatformUsers
java.util.Collection<PlatformUser> getPlatformUsers()
Gets a collection of known platform users to this platform.- Returns:
- immutable list of platform users.
-
getPlatformUserIds
java.util.Collection<java.lang.String> getPlatformUserIds()
Gets a collection of known user IDs on this platform.- Returns:
- platform-specific user Id list.
-
getChats
java.util.Collection<Chat> getChats()
Gets a list of chats associated with this platform.- Returns:
- immutable collection of Chat instances associated with this platform.
-
getChatIds
java.util.Collection<java.lang.String> getChatIds()
Gets a list of chat IDs associated with this platform.- Returns:
- immutable collection of Chat identifiers associated with this platform.
-
createChatFromUsers
default Chat createChatFromUsers(java.util.Collection<PlatformUser> users) throws java.lang.UnsupportedOperationException
Creates a new chat with the specified participants.- Parameters:
users- users to create a chat with.- Returns:
- Chat instance created.
- Throws:
java.lang.UnsupportedOperationException
-
createChatFromIds
default Chat createChatFromIds(java.util.Collection<java.lang.String> userIds) throws java.lang.UnsupportedOperationException
Creates a new chat with the specified participants.- Parameters:
userIds- platform-specific user IDs to create a chat with.- Returns:
- Chat instance created.
- Throws:
java.lang.UnsupportedOperationException
-
getChat
default Chat getChat(java.lang.String id)
Gets a chat by its user-specific ID.- Parameters:
id- Chat ID to search for.- Returns:
- Chat instance if found, null otherwise.
-
getChatsByUser
default java.util.Collection<Chat> getChatsByUser(User member)
Gets an immutable collection of chats where the specified user is a member.- Parameters:
member- User member to search for.- Returns:
- Chat instances whose members contain the specified User.
-
getChatsByUser
default java.util.Collection<Chat> getChatsByUser(PlatformUser member)
Gets an immutable collection of chats where the specified user is a member.- Parameters:
member- User member to search for.- Returns:
- Chat instances whose members contain the specified User.
-
-