Interface PlatformConnection

    • Method Summary

      Modifier and Type Method Description
      void connect()
      Calls to connect to the platform.
      default Chat createChatFromIds​(java.util.Collection<java.lang.String> userIds)
      Creates a new chat with the specified participants.
      default Chat createChatFromUsers​(java.util.Collection<PlatformUser> users)
      Creates a new chat with the specified participants.
      default void disconnect()
      Calls to disconnect from the platform.
      default Chat getChat​(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.
      PlatformUser getPlatformUser​(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.
      PlatformUser getSelf()
      Gets the self user for the platform.
      default PlatformUser.Status getStatus()
      Gets the status of the current user on the platform.
      default UserRegistration getUserRegistration()
      Gets the default user registration system for this platform.
      default boolean isConnected()
      Finds if the platform connection holds a connection.
      default void setStatus​(PlatformUser.Status status)
      Sets the status of the current user on the platform.
    • Method Detail

      • connect

        void connect()
              throws PluginException
        Calls to connect to the platform. This process is called automatically upon registration.
        Throws:
        PluginException
      • disconnect

        default void disconnect()
                         throws java.lang.UnsupportedOperationException,
                                PluginException
        Calls to disconnect from the platform.
        Throws:
        java.lang.UnsupportedOperationException
        PluginException
      • 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.