All Downloads are FREE. Search and download functionalities are using the official Maven repository.

io.github.robertograham.fortnite2.xmpp.resource.ChatResource Maven / Gradle / Ivy

package io.github.robertograham.fortnite2.xmpp.resource;

import io.github.robertograham.fortnite2.domain.Account;
import io.github.robertograham.fortnite2.xmpp.domain.enumeration.Status;

import java.io.IOException;
import java.util.Objects;

/**
 * an object from which chat-related actions can be performed
 *
 * @since 1.0.0
 */
public interface ChatResource {

    /**
     * @param account     the account to send this chat message to
     * @param messageBody the body of this chat message
     * @throws IOException          if an error occurs when sending the chat message
     * @throws NullPointerException if the {@code account} is {@code null}
     * @throws NullPointerException if the {@code messageBody} is {@code null}
     * @since 1.0.0
     */
    default void sendMessageToAccount(final Account account, final String messageBody) throws IOException {
        Objects.requireNonNull(account, "account cannot be null");
        sendMessageToAccountId(account.accountId(), messageBody);
    }

    /**
     * @param accountId   ID of the account to send this chat message to
     * @param messageBody the body of this chat message
     * @throws IOException          if an error occurs when sending the chat message
     * @throws NullPointerException if the {@code accountId} is {@code null}
     * @throws NullPointerException if the {@code messageBody} is {@code null}
     * @since 1.0.0
     */
    void sendMessageToAccountId(final String accountId, final String messageBody) throws IOException;

    /**
     * @param status How you will appear to friends
     * @throws IOException          if an error occurs sending a presence update
     * @throws NullPointerException is {@code status} is {@code null}
     * @since 1.2.0
     */
    void updateStatus(final Status status) throws IOException;
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy