software.amazon.awssdk.services.connect.model.AgentContactReference Maven / Gradle / Ivy
Show all versions of connect Show documentation
/*
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance with
* the License. A copy of the License is located at
*
* http://aws.amazon.com/apache2.0
*
* or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
* CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions
* and limitations under the License.
*/
package software.amazon.awssdk.services.connect.model;
import java.io.Serializable;
import java.time.Instant;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import java.util.Objects;
import java.util.Optional;
import java.util.function.BiConsumer;
import java.util.function.Consumer;
import java.util.function.Function;
import software.amazon.awssdk.annotations.Generated;
import software.amazon.awssdk.core.SdkField;
import software.amazon.awssdk.core.SdkPojo;
import software.amazon.awssdk.core.protocol.MarshallLocation;
import software.amazon.awssdk.core.protocol.MarshallingType;
import software.amazon.awssdk.core.traits.LocationTrait;
import software.amazon.awssdk.utils.ToString;
import software.amazon.awssdk.utils.builder.CopyableBuilder;
import software.amazon.awssdk.utils.builder.ToCopyableBuilder;
/**
*
* Information about the contact
* associated to the user.
*
*/
@Generated("software.amazon.awssdk:codegen")
public final class AgentContactReference implements SdkPojo, Serializable,
ToCopyableBuilder {
private static final SdkField CONTACT_ID_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("ContactId").getter(getter(AgentContactReference::contactId)).setter(setter(Builder::contactId))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("ContactId").build()).build();
private static final SdkField CHANNEL_FIELD = SdkField. builder(MarshallingType.STRING).memberName("Channel")
.getter(getter(AgentContactReference::channelAsString)).setter(setter(Builder::channel))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Channel").build()).build();
private static final SdkField INITIATION_METHOD_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("InitiationMethod").getter(getter(AgentContactReference::initiationMethodAsString))
.setter(setter(Builder::initiationMethod))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("InitiationMethod").build()).build();
private static final SdkField AGENT_CONTACT_STATE_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("AgentContactState").getter(getter(AgentContactReference::agentContactStateAsString))
.setter(setter(Builder::agentContactState))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("AgentContactState").build()).build();
private static final SdkField STATE_START_TIMESTAMP_FIELD = SdkField. builder(MarshallingType.INSTANT)
.memberName("StateStartTimestamp").getter(getter(AgentContactReference::stateStartTimestamp))
.setter(setter(Builder::stateStartTimestamp))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("StateStartTimestamp").build())
.build();
private static final SdkField CONNECTED_TO_AGENT_TIMESTAMP_FIELD = SdkField
. builder(MarshallingType.INSTANT).memberName("ConnectedToAgentTimestamp")
.getter(getter(AgentContactReference::connectedToAgentTimestamp)).setter(setter(Builder::connectedToAgentTimestamp))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("ConnectedToAgentTimestamp").build())
.build();
private static final SdkField QUEUE_FIELD = SdkField. builder(MarshallingType.SDK_POJO)
.memberName("Queue").getter(getter(AgentContactReference::queue)).setter(setter(Builder::queue))
.constructor(QueueReference::builder)
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Queue").build()).build();
private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(CONTACT_ID_FIELD,
CHANNEL_FIELD, INITIATION_METHOD_FIELD, AGENT_CONTACT_STATE_FIELD, STATE_START_TIMESTAMP_FIELD,
CONNECTED_TO_AGENT_TIMESTAMP_FIELD, QUEUE_FIELD));
private static final long serialVersionUID = 1L;
private final String contactId;
private final String channel;
private final String initiationMethod;
private final String agentContactState;
private final Instant stateStartTimestamp;
private final Instant connectedToAgentTimestamp;
private final QueueReference queue;
private AgentContactReference(BuilderImpl builder) {
this.contactId = builder.contactId;
this.channel = builder.channel;
this.initiationMethod = builder.initiationMethod;
this.agentContactState = builder.agentContactState;
this.stateStartTimestamp = builder.stateStartTimestamp;
this.connectedToAgentTimestamp = builder.connectedToAgentTimestamp;
this.queue = builder.queue;
}
/**
*
* The identifier of the contact in this instance of Amazon Connect.
*
*
* @return The identifier of the contact in this instance of Amazon Connect.
*/
public final String contactId() {
return contactId;
}
/**
*
* The channel of the contact.
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #channel} will
* return {@link Channel#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available from
* {@link #channelAsString}.
*
*
* @return The channel of the contact.
* @see Channel
*/
public final Channel channel() {
return Channel.fromValue(channel);
}
/**
*
* The channel of the contact.
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #channel} will
* return {@link Channel#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available from
* {@link #channelAsString}.
*
*
* @return The channel of the contact.
* @see Channel
*/
public final String channelAsString() {
return channel;
}
/**
*
* How the contact was initiated.
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #initiationMethod}
* will return {@link ContactInitiationMethod#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is
* available from {@link #initiationMethodAsString}.
*
*
* @return How the contact was initiated.
* @see ContactInitiationMethod
*/
public final ContactInitiationMethod initiationMethod() {
return ContactInitiationMethod.fromValue(initiationMethod);
}
/**
*
* How the contact was initiated.
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #initiationMethod}
* will return {@link ContactInitiationMethod#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is
* available from {@link #initiationMethodAsString}.
*
*
* @return How the contact was initiated.
* @see ContactInitiationMethod
*/
public final String initiationMethodAsString() {
return initiationMethod;
}
/**
*
* The state of the
* contact.
*
*
*
* When AgentContactState
is set to CONNECTED_ONHOLD
, StateStartTimestamp
is
* not changed. Instead, StateStartTimestamp
reflects the time the contact was CONNECTED
* to the agent.
*
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #agentContactState}
* will return {@link ContactState#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available from
* {@link #agentContactStateAsString}.
*
*
* @return The state of
* the contact.
*
* When AgentContactState
is set to CONNECTED_ONHOLD
,
* StateStartTimestamp
is not changed. Instead, StateStartTimestamp
reflects the
* time the contact was CONNECTED
to the agent.
*
* @see ContactState
*/
public final ContactState agentContactState() {
return ContactState.fromValue(agentContactState);
}
/**
*
* The state of the
* contact.
*
*
*
* When AgentContactState
is set to CONNECTED_ONHOLD
, StateStartTimestamp
is
* not changed. Instead, StateStartTimestamp
reflects the time the contact was CONNECTED
* to the agent.
*
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #agentContactState}
* will return {@link ContactState#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available from
* {@link #agentContactStateAsString}.
*
*
* @return The state of
* the contact.
*
* When AgentContactState
is set to CONNECTED_ONHOLD
,
* StateStartTimestamp
is not changed. Instead, StateStartTimestamp
reflects the
* time the contact was CONNECTED
to the agent.
*
* @see ContactState
*/
public final String agentContactStateAsString() {
return agentContactState;
}
/**
*
* The epoch timestamp when the contact state started.
*
*
* @return The epoch timestamp when the contact state started.
*/
public final Instant stateStartTimestamp() {
return stateStartTimestamp;
}
/**
*
* The time at which the contact was connected to an agent.
*
*
* @return The time at which the contact was connected to an agent.
*/
public final Instant connectedToAgentTimestamp() {
return connectedToAgentTimestamp;
}
/**
* Returns the value of the Queue property for this object.
*
* @return The value of the Queue property for this object.
*/
public final QueueReference queue() {
return queue;
}
@Override
public Builder toBuilder() {
return new BuilderImpl(this);
}
public static Builder builder() {
return new BuilderImpl();
}
public static Class extends Builder> serializableBuilderClass() {
return BuilderImpl.class;
}
@Override
public final int hashCode() {
int hashCode = 1;
hashCode = 31 * hashCode + Objects.hashCode(contactId());
hashCode = 31 * hashCode + Objects.hashCode(channelAsString());
hashCode = 31 * hashCode + Objects.hashCode(initiationMethodAsString());
hashCode = 31 * hashCode + Objects.hashCode(agentContactStateAsString());
hashCode = 31 * hashCode + Objects.hashCode(stateStartTimestamp());
hashCode = 31 * hashCode + Objects.hashCode(connectedToAgentTimestamp());
hashCode = 31 * hashCode + Objects.hashCode(queue());
return hashCode;
}
@Override
public final boolean equals(Object obj) {
return equalsBySdkFields(obj);
}
@Override
public final boolean equalsBySdkFields(Object obj) {
if (this == obj) {
return true;
}
if (obj == null) {
return false;
}
if (!(obj instanceof AgentContactReference)) {
return false;
}
AgentContactReference other = (AgentContactReference) obj;
return Objects.equals(contactId(), other.contactId()) && Objects.equals(channelAsString(), other.channelAsString())
&& Objects.equals(initiationMethodAsString(), other.initiationMethodAsString())
&& Objects.equals(agentContactStateAsString(), other.agentContactStateAsString())
&& Objects.equals(stateStartTimestamp(), other.stateStartTimestamp())
&& Objects.equals(connectedToAgentTimestamp(), other.connectedToAgentTimestamp())
&& Objects.equals(queue(), other.queue());
}
/**
* Returns a string representation of this object. This is useful for testing and debugging. Sensitive data will be
* redacted from this string using a placeholder value.
*/
@Override
public final String toString() {
return ToString.builder("AgentContactReference").add("ContactId", contactId()).add("Channel", channelAsString())
.add("InitiationMethod", initiationMethodAsString()).add("AgentContactState", agentContactStateAsString())
.add("StateStartTimestamp", stateStartTimestamp()).add("ConnectedToAgentTimestamp", connectedToAgentTimestamp())
.add("Queue", queue()).build();
}
public final Optional getValueForField(String fieldName, Class clazz) {
switch (fieldName) {
case "ContactId":
return Optional.ofNullable(clazz.cast(contactId()));
case "Channel":
return Optional.ofNullable(clazz.cast(channelAsString()));
case "InitiationMethod":
return Optional.ofNullable(clazz.cast(initiationMethodAsString()));
case "AgentContactState":
return Optional.ofNullable(clazz.cast(agentContactStateAsString()));
case "StateStartTimestamp":
return Optional.ofNullable(clazz.cast(stateStartTimestamp()));
case "ConnectedToAgentTimestamp":
return Optional.ofNullable(clazz.cast(connectedToAgentTimestamp()));
case "Queue":
return Optional.ofNullable(clazz.cast(queue()));
default:
return Optional.empty();
}
}
@Override
public final List> sdkFields() {
return SDK_FIELDS;
}
private static Function