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

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

package io.agora.rtm;

import io.agora.common.internal.CalledByNative;
import io.agora.rtm.RtmConstants.RtmChannelType;
import io.agora.rtm.RtmConstants.RtmMessageType;

/**
 * Publish message option
 */
public class PublishOptions {
  /**
   * the type of channel
   */
  private RtmChannelType channelType;

  /**
   * The custom type of the message, up to 32 bytes for customize.
   */
  private String customType = "";

  /**
   * Creates a new instance of {@code PublishOptions} with default parameters.
   */
  public PublishOptions() {
    this.channelType = RtmChannelType.MESSAGE;
  }

  /**
   * Creates a new instance of {@code PublishOptions} with specified channelType
   * and customType.
   *
   * @param channelType The type of channel
   * @param customType  The custom type of the message
   */
  public PublishOptions(RtmChannelType channelType, String customType) {
    this.channelType = channelType;
    this.customType = customType;
  }

  public void setCustomType(String customType) {
    this.customType = customType;
  }

  public void setChannelType(RtmChannelType channelType) {
    this.channelType = channelType;
  }

  @CalledByNative
  public String getCustomType() {
    return this.customType;
  }

  @CalledByNative
  public long getChannelType() {
    return RtmChannelType.getValue(this.channelType);
  }

  @Override
  public String toString() {
    return "PublishOptions {channelType: " + channelType + ", customType: " + customType + "}";
  }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy