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

com.salesforce.einsteinbot.sdk.model.ChoiceMessage Maven / Gradle / Ivy

Go to download

Java SDK to interact with Einstein Bots Runtime. This SDK is a wrapper around the Einstein Bots Runtime API that provides a few added features out of the box like Auth support, Session management

There is a newer version: 2.3.0
Show newest version
/*
 * Einstein Bots API (BETA)
 * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
 *
 * The version of the OpenAPI document: v4
 * 
 *
 * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
 * https://openapi-generator.tech
 * Do not edit the class manually.
 */


package com.salesforce.einsteinbot.sdk.model;

import java.util.Objects;
import java.util.Arrays;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonTypeName;
import com.fasterxml.jackson.annotation.JsonValue;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import org.openapitools.jackson.nullable.JsonNullable;
import com.fasterxml.jackson.annotation.JsonIgnore;
import org.openapitools.jackson.nullable.JsonNullable;
import java.util.NoSuchElementException;
import com.fasterxml.jackson.annotation.JsonPropertyOrder;
import com.fasterxml.jackson.annotation.JsonTypeName;

/**
 * Choice selection
 */
@ApiModel(description = "Choice selection")
@JsonPropertyOrder({
  ChoiceMessage.JSON_PROPERTY_TYPE,
  ChoiceMessage.JSON_PROPERTY_SEQUENCE_ID,
  ChoiceMessage.JSON_PROPERTY_IN_REPLY_TO_MESSAGE_ID,
  ChoiceMessage.JSON_PROPERTY_CHOICE_INDEX,
  ChoiceMessage.JSON_PROPERTY_CHOICE_ID
})
@JsonTypeName("ChoiceMessage")
@javax.annotation.Generated(value = "com.salesforce.einsteinbot.openapi.codegen.EinsteinBotCodeGenerator", date = "2022-03-24T00:55:11.933462Z[Etc/UTC]")
public class ChoiceMessage   implements AnyRequestMessage  {
  /**
   * Message type
   */
  public enum TypeEnum {
    CHOICE("choice");

    private String value;

    TypeEnum(String value) {
      this.value = value;
    }

    @JsonValue
    public String getValue() {
      return value;
    }

    @Override
    public String toString() {
      return String.valueOf(value);
    }

    @JsonCreator
    public static TypeEnum fromValue(String value) {
      for (TypeEnum b : TypeEnum.values()) {
        if (b.value.equals(value)) {
          return b;
        }
      }
      throw new IllegalArgumentException("Unexpected value '" + value + "'");
    }
  }

  public static final String JSON_PROPERTY_TYPE = "type";
  private TypeEnum type;

  public static final String JSON_PROPERTY_SEQUENCE_ID = "sequenceId";
  private Long sequenceId;

  public static final String JSON_PROPERTY_IN_REPLY_TO_MESSAGE_ID = "inReplyToMessageId";
  private String inReplyToMessageId;

  public static final String JSON_PROPERTY_CHOICE_INDEX = "choiceIndex";
  private JsonNullable choiceIndex = JsonNullable.undefined();

  public static final String JSON_PROPERTY_CHOICE_ID = "choiceId";
  private JsonNullable choiceId = JsonNullable.undefined();

  public ChoiceMessage() { 
  }

  public ChoiceMessage type(TypeEnum type) {
    
    this.type = type;
    return this;
  }

   /**
   * Message type
   * @return type
  **/
  @javax.annotation.Nonnull
  @ApiModelProperty(example = "choice", required = true, value = "Message type")
  @JsonProperty(JSON_PROPERTY_TYPE)
  @JsonInclude(value = JsonInclude.Include.ALWAYS)

  public TypeEnum getType() {
    return type;
  }


  @JsonProperty(JSON_PROPERTY_TYPE)
  @JsonInclude(value = JsonInclude.Include.ALWAYS)
  public void setType(TypeEnum type) {
    this.type = type;
  }


  public ChoiceMessage sequenceId(Long sequenceId) {
    
    this.sequenceId = sequenceId;
    return this;
  }

   /**
   * Client generated message number (must be ever increasing within the same session)
   * @return sequenceId
  **/
  @javax.annotation.Nonnull
  @ApiModelProperty(example = "1", required = true, value = "Client generated message number (must be ever increasing within the same session)")
  @JsonProperty(JSON_PROPERTY_SEQUENCE_ID)
  @JsonInclude(value = JsonInclude.Include.ALWAYS)

  public Long getSequenceId() {
    return sequenceId;
  }


  @JsonProperty(JSON_PROPERTY_SEQUENCE_ID)
  @JsonInclude(value = JsonInclude.Include.ALWAYS)
  public void setSequenceId(Long sequenceId) {
    this.sequenceId = sequenceId;
  }


  public ChoiceMessage inReplyToMessageId(String inReplyToMessageId) {
    
    this.inReplyToMessageId = inReplyToMessageId;
    return this;
  }

   /**
   * Message ID from the previous response you are replying to
   * @return inReplyToMessageId
  **/
  @javax.annotation.Nullable
  @ApiModelProperty(example = "a133c185-73a7-4adf-b6d9-b7fd62babb4e", value = "Message ID from the previous response you are replying to")
  @JsonProperty(JSON_PROPERTY_IN_REPLY_TO_MESSAGE_ID)
  @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)

  public String getInReplyToMessageId() {
    return inReplyToMessageId;
  }


  @JsonProperty(JSON_PROPERTY_IN_REPLY_TO_MESSAGE_ID)
  @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
  public void setInReplyToMessageId(String inReplyToMessageId) {
    this.inReplyToMessageId = inReplyToMessageId;
  }


  public ChoiceMessage choiceIndex(Integer choiceIndex) {
    this.choiceIndex = JsonNullable.of(choiceIndex);
    
    return this;
  }

   /**
   * Zero-based index of the selected choice. Either choiceIndex or choiceId is required.
   * @return choiceIndex
  **/
  @javax.annotation.Nullable
  @ApiModelProperty(example = "0", value = "Zero-based index of the selected choice. Either choiceIndex or choiceId is required.")
  @JsonIgnore

  public Integer getChoiceIndex() {
        return choiceIndex.orElse(null);
  }

  @JsonProperty(JSON_PROPERTY_CHOICE_INDEX)
  @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)

  public JsonNullable getChoiceIndex_JsonNullable() {
    return choiceIndex;
  }
  
  @JsonProperty(JSON_PROPERTY_CHOICE_INDEX)
  public void setChoiceIndex_JsonNullable(JsonNullable choiceIndex) {
    this.choiceIndex = choiceIndex;
  }

  public void setChoiceIndex(Integer choiceIndex) {
    this.choiceIndex = JsonNullable.of(choiceIndex);
  }


  public ChoiceMessage choiceId(String choiceId) {
    this.choiceId = JsonNullable.of(choiceId);
    
    return this;
  }

   /**
   * Id of the selected choice. Either choiceIndex or choiceId is required.
   * @return choiceId
  **/
  @javax.annotation.Nullable
  @ApiModelProperty(example = "8a9a745f-0c09-4b13-955c-1ab9e06c7ad7", value = "Id of the selected choice. Either choiceIndex or choiceId is required.")
  @JsonIgnore

  public String getChoiceId() {
        return choiceId.orElse(null);
  }

  @JsonProperty(JSON_PROPERTY_CHOICE_ID)
  @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)

  public JsonNullable getChoiceId_JsonNullable() {
    return choiceId;
  }
  
  @JsonProperty(JSON_PROPERTY_CHOICE_ID)
  public void setChoiceId_JsonNullable(JsonNullable choiceId) {
    this.choiceId = choiceId;
  }

  public void setChoiceId(String choiceId) {
    this.choiceId = JsonNullable.of(choiceId);
  }


  @Override
  public boolean equals(Object o) {
    if (this == o) {
      return true;
    }
    if (o == null || getClass() != o.getClass()) {
      return false;
    }
    ChoiceMessage choiceMessage = (ChoiceMessage) o;
    return Objects.equals(this.type, choiceMessage.type) &&
        Objects.equals(this.sequenceId, choiceMessage.sequenceId) &&
        Objects.equals(this.inReplyToMessageId, choiceMessage.inReplyToMessageId) &&
        equalsNullable(this.choiceIndex, choiceMessage.choiceIndex) &&
        equalsNullable(this.choiceId, choiceMessage.choiceId);
  }

  private static  boolean equalsNullable(JsonNullable a, JsonNullable b) {
    return a == b || (a != null && b != null && a.isPresent() && b.isPresent() && Objects.deepEquals(a.get(), b.get()));
  }

  @Override
  public int hashCode() {
    return Objects.hash(type, sequenceId, inReplyToMessageId, hashCodeNullable(choiceIndex), hashCodeNullable(choiceId));
  }

  private static  int hashCodeNullable(JsonNullable a) {
    if (a == null) {
      return 1;
    }
    return a.isPresent() ? Arrays.deepHashCode(new Object[]{a.get()}) : 31;
  }

  @Override
  public String toString() {
    StringBuilder sb = new StringBuilder();
    sb.append("class ChoiceMessage {\n");
    sb.append("    type: ").append(toIndentedString(type)).append("\n");
    sb.append("    sequenceId: ").append(toIndentedString(sequenceId)).append("\n");
    sb.append("    inReplyToMessageId: ").append(toIndentedString(inReplyToMessageId)).append("\n");
    sb.append("    choiceIndex: ").append(toIndentedString(choiceIndex)).append("\n");
    sb.append("    choiceId: ").append(toIndentedString(choiceId)).append("\n");
    sb.append("}");
    return sb.toString();
  }

  /**
   * Convert the given object to string with each line indented by 4 spaces
   * (except the first line).
   */
  private String toIndentedString(Object o) {
    if (o == null) {
      return "null";
    }
    return o.toString().replace("\n", "\n    ");
  }

}





© 2015 - 2025 Weber Informatics LLC | Privacy Policy