com.salesforce.einsteinbot.sdk.model.InitMessage Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of einstein-bot-sdk-java Show documentation
Show all versions of einstein-bot-sdk-java Show documentation
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
/*
* 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.Referrer;
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;
/**
* Initial message that begins a conversation session
*/
@ApiModel(description = "Initial message that begins a conversation session")
@JsonPropertyOrder({
InitMessage.JSON_PROPERTY_TYPE,
InitMessage.JSON_PROPERTY_SEQUENCE_ID,
InitMessage.JSON_PROPERTY_TEXT,
InitMessage.JSON_PROPERTY_TZ,
InitMessage.JSON_PROPERTY_VARIABLES,
InitMessage.JSON_PROPERTY_REFERRERS
})
@JsonTypeName("InitMessage")
@javax.annotation.Generated(value = "com.salesforce.einsteinbot.openapi.codegen.EinsteinBotCodeGenerator", date = "2022-03-24T00:55:11.933462Z[Etc/UTC]")
public class InitMessage implements AnyRequestMessage {
/**
* Message type
*/
public enum TypeEnum {
INIT("init");
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_TEXT = "text";
private String text;
public static final String JSON_PROPERTY_TZ = "tz";
private JsonNullable tz = JsonNullable.undefined();
public static final String JSON_PROPERTY_VARIABLES = "variables";
private JsonNullable> variables = JsonNullable.>undefined();
public static final String JSON_PROPERTY_REFERRERS = "referrers";
private JsonNullable> referrers = JsonNullable.>undefined();
public InitMessage() {
}
public InitMessage type(TypeEnum type) {
this.type = type;
return this;
}
/**
* Message type
* @return type
**/
@javax.annotation.Nonnull
@ApiModelProperty(example = "init", 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 InitMessage 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 InitMessage text(String text) {
this.text = text;
return this;
}
/**
* Initial text input from user
* @return text
**/
@javax.annotation.Nullable
@ApiModelProperty(value = "Initial text input from user")
@JsonProperty(JSON_PROPERTY_TEXT)
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
public String getText() {
return text;
}
@JsonProperty(JSON_PROPERTY_TEXT)
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
public void setText(String text) {
this.text = text;
}
public InitMessage tz(String tz) {
this.tz = JsonNullable.of(tz);
return this;
}
/**
* Client timezone
* @return tz
**/
@javax.annotation.Nullable
@ApiModelProperty(value = "Client timezone")
@JsonIgnore
public String getTz() {
return tz.orElse(null);
}
@JsonProperty(JSON_PROPERTY_TZ)
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
public JsonNullable getTz_JsonNullable() {
return tz;
}
@JsonProperty(JSON_PROPERTY_TZ)
public void setTz_JsonNullable(JsonNullable tz) {
this.tz = tz;
}
public void setTz(String tz) {
this.tz = JsonNullable.of(tz);
}
public InitMessage variables(List variables) {
this.variables = JsonNullable.>of(variables);
return this;
}
public InitMessage 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 InitMessage referrers(List referrers) {
this.referrers = JsonNullable.>of(referrers);
return this;
}
public InitMessage addReferrersItem(Referrer referrersItem) {
if (this.referrers == null || !this.referrers.isPresent()) {
this.referrers = JsonNullable.>of(new ArrayList<>());
}
try {
this.referrers.get().add(referrersItem);
} catch (java.util.NoSuchElementException e) {
// this can never happen, as we make sure above that the value is present
}
return this;
}
/**
* Referrers (mostly for bot to bot transfers)
* @return referrers
**/
@javax.annotation.Nullable
@ApiModelProperty(value = "Referrers (mostly for bot to bot transfers)")
@JsonIgnore
public List getReferrers() {
return referrers.orElse(null);
}
@JsonProperty(JSON_PROPERTY_REFERRERS)
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
public JsonNullable> getReferrers_JsonNullable() {
return referrers;
}
@JsonProperty(JSON_PROPERTY_REFERRERS)
public void setReferrers_JsonNullable(JsonNullable> referrers) {
this.referrers = referrers;
}
public void setReferrers(List referrers) {
this.referrers = JsonNullable.>of(referrers);
}
@Override
public boolean equals(Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
InitMessage initMessage = (InitMessage) o;
return Objects.equals(this.type, initMessage.type) &&
Objects.equals(this.sequenceId, initMessage.sequenceId) &&
Objects.equals(this.text, initMessage.text) &&
equalsNullable(this.tz, initMessage.tz) &&
equalsNullable(this.variables, initMessage.variables) &&
equalsNullable(this.referrers, initMessage.referrers);
}
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, text, hashCodeNullable(tz), hashCodeNullable(variables), hashCodeNullable(referrers));
}
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 InitMessage {\n");
sb.append(" type: ").append(toIndentedString(type)).append("\n");
sb.append(" sequenceId: ").append(toIndentedString(sequenceId)).append("\n");
sb.append(" text: ").append(toIndentedString(text)).append("\n");
sb.append(" tz: ").append(toIndentedString(tz)).append("\n");
sb.append(" variables: ").append(toIndentedString(variables)).append("\n");
sb.append(" referrers: ").append(toIndentedString(referrers)).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