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

io.agora.rtm.RtmPresence Maven / Gradle / Ivy

package io.agora.rtm;

import io.agora.rtm.GetOnlineUsersResult;
import io.agora.rtm.ResultCallback;
import io.agora.rtm.RtmConstants;
import io.agora.rtm.RtmConstants.RtmChannelType;
import io.agora.rtm.WhoNowResult;
import java.util.ArrayList;

/**
 * The RtmPresence class.
 *
 * This class provides the rtm presence methods that can be invoked by your app.
 */
public abstract class RtmPresence {
  /**
   * To query who joined this channel
   *
   * @param channelName    The name of the channel.
   * @param channelType    The type of the channel.
   * @param options        The query option.
   * @param resultCallback A {@link ResultCallback} object.
   *                       - Success: will receives the
   *                       {@link ResultCallback.onSuccess()} callback.
   *                       - Failure: will receives the
   *                       {@link ResultCallback.onFailure()} callback.
   */
  public abstract void whoNow(String channelName, RtmChannelType channelType,
      PresenceOptions options, ResultCallback resultCallback);

  /**
   * To query which channels the user joined
   *
   * @param userId         The id of the user.
   * @param resultCallback A {@link ResultCallback} object.
   *                       - Success: will receives the
   *                       {@link ResultCallback.onSuccess()} callback.
   *                       - Failure: will receives the
   *                       {@link ResultCallback.onFailure()} callback.
   */
  public abstract void whereNow(
      String userId, ResultCallback> resultCallback);

  /**
   * To query who joined this channel
   *
   * @param channelName    The name of the channel.
   * @param channelType    The type of the channel.
   * @param options        The query option.
   * @param resultCallback A {@link ResultCallback} object.
   *                       - Success: will receives the
   *                       {@link ResultCallback.onSuccess()} callback.
   *                       - Failure: will receives the
   *                       {@link ResultCallback.onFailure()} callback.
   */
  public abstract void getOnlineUsers(String channelName, RtmChannelType channelType,
      GetOnlineUsersOptions options, ResultCallback resultCallback);

  /**
   * To query which channels the user joined or subscribed
   *
   * @param userId         The id of the user.
   * @param resultCallback A {@link ResultCallback} object.
   *                       - Success: will receives the
   *                       {@link ResultCallback.onSuccess()} callback.
   *                       - Failure: will receives the
   *                       {@link ResultCallback.onFailure()} callback.
   */
  public abstract void getUserChannels(
      String userId, ResultCallback> resultCallback);

  /**
   * Set user state
   *
   * @param channelName    The name of the channel.
   * @param channelType    The type of the channel.
   * @param items          The states item of user.
   * @param resultCallback A {@link ResultCallback} object.
   *                       - Success: will receives the
   *                       {@link ResultCallback.onSuccess()} callback.
   *                       - Failure: will receives the
   *                       {@link ResultCallback.onFailure()} callback.
   */
  public abstract void setState(String channelName, RtmChannelType channelType,
      ArrayList items, ResultCallback resultCallback);

  /**
   * Delete user state
   *
   * @param channelName    The name of the channel.
   * @param channelType    The type of the channel.
   * @param keys           The keys of state item.
   * @param resultCallback A {@link ResultCallback} object.
   *                       - Success: will receives the
   *                       {@link ResultCallback.onSuccess()} callback.
   *                       - Failure: will receives the
   *                       {@link ResultCallback.onFailure()} callback.
   */
  public abstract void removeState(String channelName, RtmChannelType channelType,
      ArrayList keys, ResultCallback resultCallback);

  /**
   * Get user state
   *
   * @param channelName    The name of the channel.
   * @param channelType    The type of the channel.
   * @param userId         The id of the user.
   * @param resultCallback A {@link ResultCallback} object.
   *                       - Success: will receives the
   *                       {@link ResultCallback.onSuccess()} callback.
   *                       - Failure: will receives the
   *                       {@link ResultCallback.onFailure()} callback.
   */
  public abstract void getState(String channelName, RtmChannelType channelType, String userId,
      ResultCallback resultCallback);
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy