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

com.salesforce.einsteinbot.sdk.model.ResponseEnvelope 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 com.salesforce.einsteinbot.sdk.model.ChoicesResponseMessage;
import com.salesforce.einsteinbot.sdk.model.EscalateResponseMessage;
import com.salesforce.einsteinbot.sdk.model.SessionEndedResponseMessage;
import com.salesforce.einsteinbot.sdk.model.TextResponseMessage;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import java.util.ArrayList;
import java.util.List;
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;

/**
 * ResponseEnvelope
 */
@JsonPropertyOrder({
  ResponseEnvelope.JSON_PROPERTY_SESSION_ID,
  ResponseEnvelope.JSON_PROPERTY_ORG_ID,
  ResponseEnvelope.JSON_PROPERTY_BOT_ID,
  ResponseEnvelope.JSON_PROPERTY_BOT_VERSION,
  ResponseEnvelope.JSON_PROPERTY_PROCESSED_SEQUENCE_IDS,
  ResponseEnvelope.JSON_PROPERTY_MESSAGES,
  ResponseEnvelope.JSON_PROPERTY_VARIABLES,
  ResponseEnvelope.JSON_PROPERTY_METRICS
})
@JsonTypeName("ResponseEnvelope")
@javax.annotation.Generated(value = "com.salesforce.einsteinbot.openapi.codegen.EinsteinBotCodeGenerator", date = "2022-03-24T00:55:11.933462Z[Etc/UTC]")
public class ResponseEnvelope   {
  public static final String JSON_PROPERTY_SESSION_ID = "sessionId";
  private String sessionId;

  public static final String JSON_PROPERTY_ORG_ID = "orgId";
  private String orgId;

  public static final String JSON_PROPERTY_BOT_ID = "botId";
  private String botId;

  public static final String JSON_PROPERTY_BOT_VERSION = "botVersion";
  private String botVersion;

  public static final String JSON_PROPERTY_PROCESSED_SEQUENCE_IDS = "processedSequenceIds";
  private List processedSequenceIds = new ArrayList<>();

  public static final String JSON_PROPERTY_MESSAGES = "messages";
  private List messages = new ArrayList<>();

  public static final String JSON_PROPERTY_VARIABLES = "variables";
  private JsonNullable> variables = JsonNullable.>undefined();

  public static final String JSON_PROPERTY_METRICS = "metrics";
  private Object metrics;

  public ResponseEnvelope() { 
  }

  public ResponseEnvelope sessionId(String sessionId) {
    
    this.sessionId = sessionId;
    return this;
  }

   /**
   * Chatbot Runtime Session ID
   * @return sessionId
  **/
  @javax.annotation.Nonnull
  @ApiModelProperty(example = "57904eb6-5352-4c5e-adf6-5f100572cf5d", required = true, value = "Chatbot Runtime Session ID")
  @JsonProperty(JSON_PROPERTY_SESSION_ID)
  @JsonInclude(value = JsonInclude.Include.ALWAYS)

  public String getSessionId() {
    return sessionId;
  }


  @JsonProperty(JSON_PROPERTY_SESSION_ID)
  @JsonInclude(value = JsonInclude.Include.ALWAYS)
  public void setSessionId(String sessionId) {
    this.sessionId = sessionId;
  }


  public ResponseEnvelope orgId(String orgId) {
    
    this.orgId = orgId;
    return this;
  }

   /**
   * Salesforce Org ID
   * @return orgId
  **/
  @javax.annotation.Nonnull
  @ApiModelProperty(example = "00DRM0000006k892AA", required = true, value = "Salesforce Org ID")
  @JsonProperty(JSON_PROPERTY_ORG_ID)
  @JsonInclude(value = JsonInclude.Include.ALWAYS)

  public String getOrgId() {
    return orgId;
  }


  @JsonProperty(JSON_PROPERTY_ORG_ID)
  @JsonInclude(value = JsonInclude.Include.ALWAYS)
  public void setOrgId(String orgId) {
    this.orgId = orgId;
  }


  public ResponseEnvelope botId(String botId) {
    
    this.botId = botId;
    return this;
  }

   /**
   * Chatbot ID
   * @return botId
  **/
  @javax.annotation.Nonnull
  @ApiModelProperty(example = "0XxRM0000004Cyw0AE", required = true, value = "Chatbot ID")
  @JsonProperty(JSON_PROPERTY_BOT_ID)
  @JsonInclude(value = JsonInclude.Include.ALWAYS)

  public String getBotId() {
    return botId;
  }


  @JsonProperty(JSON_PROPERTY_BOT_ID)
  @JsonInclude(value = JsonInclude.Include.ALWAYS)
  public void setBotId(String botId) {
    this.botId = botId;
  }


  public ResponseEnvelope botVersion(String botVersion) {
    
    this.botVersion = botVersion;
    return this;
  }

   /**
   * Chatbot config version
   * @return botVersion
  **/
  @javax.annotation.Nullable
  @ApiModelProperty(example = "0X9RM0000004CD00AM", required = true, value = "Chatbot config version")
  @JsonProperty(JSON_PROPERTY_BOT_VERSION)
  @JsonInclude(value = JsonInclude.Include.ALWAYS)

  public String getBotVersion() {
    return botVersion;
  }


  @JsonProperty(JSON_PROPERTY_BOT_VERSION)
  @JsonInclude(value = JsonInclude.Include.ALWAYS)
  public void setBotVersion(String botVersion) {
    this.botVersion = botVersion;
  }


  public ResponseEnvelope processedSequenceIds(List processedSequenceIds) {
    
    this.processedSequenceIds = processedSequenceIds;
    return this;
  }

  public ResponseEnvelope addProcessedSequenceIdsItem(Long processedSequenceIdsItem) {
    this.processedSequenceIds.add(processedSequenceIdsItem);
    return this;
  }

   /**
   * Sequence IDs of processed messages
   * @return processedSequenceIds
  **/
  @javax.annotation.Nonnull
  @ApiModelProperty(required = true, value = "Sequence IDs of processed messages")
  @JsonProperty(JSON_PROPERTY_PROCESSED_SEQUENCE_IDS)
  @JsonInclude(value = JsonInclude.Include.ALWAYS)

  public List getProcessedSequenceIds() {
    return processedSequenceIds;
  }


  @JsonProperty(JSON_PROPERTY_PROCESSED_SEQUENCE_IDS)
  @JsonInclude(value = JsonInclude.Include.ALWAYS)
  public void setProcessedSequenceIds(List processedSequenceIds) {
    this.processedSequenceIds = processedSequenceIds;
  }


  public ResponseEnvelope messages(List messages) {
    
    this.messages = messages;
    return this;
  }

  public ResponseEnvelope addMessagesItem(AnyResponseMessage messagesItem) {
    this.messages.add(messagesItem);
    return this;
  }

   /**
   * Output messages
   * @return messages
  **/
  @javax.annotation.Nonnull
  @ApiModelProperty(required = true, value = "Output messages")
  @JsonProperty(JSON_PROPERTY_MESSAGES)
  @JsonInclude(value = JsonInclude.Include.ALWAYS)

  public List getMessages() {
    return messages;
  }


  @JsonProperty(JSON_PROPERTY_MESSAGES)
  @JsonInclude(value = JsonInclude.Include.ALWAYS)
  public void setMessages(List messages) {
    this.messages = messages;
  }


  public ResponseEnvelope variables(List variables) {
    this.variables = JsonNullable.>of(variables);
    
    return this;
  }

  public ResponseEnvelope addVariablesItem(AnyVariable variablesItem) {
    if (this.variables == null || !this.variables.isPresent()) {
      this.variables = JsonNullable.>of(new ArrayList<>());
    }
    try {
      this.variables.get().add(variablesItem);
    } catch (java.util.NoSuchElementException e) {
      // this can never happen, as we make sure above that the value is present
    }
    return this;
  }

   /**
   * Get variables
   * @return variables
  **/
  @javax.annotation.Nullable
  @ApiModelProperty(value = "")
  @JsonIgnore

  public List getVariables() {
        return variables.orElse(null);
  }

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

  public JsonNullable> getVariables_JsonNullable() {
    return variables;
  }
  
  @JsonProperty(JSON_PROPERTY_VARIABLES)
  public void setVariables_JsonNullable(JsonNullable> variables) {
    this.variables = variables;
  }

  public void setVariables(List variables) {
    this.variables = JsonNullable.>of(variables);
  }


  public ResponseEnvelope metrics(Object metrics) {
    
    this.metrics = metrics;
    return this;
  }

   /**
   * Session metrics
   * @return metrics
  **/
  @javax.annotation.Nullable
  @ApiModelProperty(value = "Session metrics")
  @JsonProperty(JSON_PROPERTY_METRICS)
  @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)

  public Object getMetrics() {
    return metrics;
  }


  @JsonProperty(JSON_PROPERTY_METRICS)
  @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
  public void setMetrics(Object metrics) {
    this.metrics = metrics;
  }


  @Override
  public boolean equals(Object o) {
    if (this == o) {
      return true;
    }
    if (o == null || getClass() != o.getClass()) {
      return false;
    }
    ResponseEnvelope responseEnvelope = (ResponseEnvelope) o;
    return Objects.equals(this.sessionId, responseEnvelope.sessionId) &&
        Objects.equals(this.orgId, responseEnvelope.orgId) &&
        Objects.equals(this.botId, responseEnvelope.botId) &&
        Objects.equals(this.botVersion, responseEnvelope.botVersion) &&
        Objects.equals(this.processedSequenceIds, responseEnvelope.processedSequenceIds) &&
        Objects.equals(this.messages, responseEnvelope.messages) &&
        equalsNullable(this.variables, responseEnvelope.variables) &&
        Objects.equals(this.metrics, responseEnvelope.metrics);
  }

  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(sessionId, orgId, botId, botVersion, processedSequenceIds, messages, hashCodeNullable(variables), metrics);
  }

  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 ResponseEnvelope {\n");
    sb.append("    sessionId: ").append(toIndentedString(sessionId)).append("\n");
    sb.append("    orgId: ").append(toIndentedString(orgId)).append("\n");
    sb.append("    botId: ").append(toIndentedString(botId)).append("\n");
    sb.append("    botVersion: ").append(toIndentedString(botVersion)).append("\n");
    sb.append("    processedSequenceIds: ").append(toIndentedString(processedSequenceIds)).append("\n");
    sb.append("    messages: ").append(toIndentedString(messages)).append("\n");
    sb.append("    variables: ").append(toIndentedString(variables)).append("\n");
    sb.append("    metrics: ").append(toIndentedString(metrics)).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