
com.twilio.rest.insights.v1.call.Event Maven / Gradle / Ivy
/**
* This code was generated by
* \ / _ _ _| _ _
* | (_)\/(_)(_|\/| |(/_ v1.0.0
* / /
*/
package com.twilio.rest.insights.v1.call;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.core.JsonParseException;
import com.fasterxml.jackson.databind.JsonMappingException;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.twilio.base.Resource;
import com.twilio.converter.Converter;
import com.twilio.converter.Promoter;
import com.twilio.exception.ApiConnectionException;
import com.twilio.exception.ApiException;
import com.twilio.exception.RestException;
import com.twilio.http.HttpMethod;
import com.twilio.http.Request;
import com.twilio.http.Response;
import com.twilio.http.TwilioRestClient;
import com.twilio.rest.Domains;
import lombok.ToString;
import java.io.IOException;
import java.io.InputStream;
import java.util.Map;
import java.util.Objects;
/**
* PLEASE NOTE that this class contains preview products that are subject to
* change. Use them with caution. If you currently do not have developer preview
* access, please contact [email protected].
*/
@JsonIgnoreProperties(ignoreUnknown = true)
@ToString
public class Event extends Resource {
private static final long serialVersionUID = 164982033524343L;
public enum TwilioEdge {
UNKNOWN_EDGE("unknown_edge"),
CARRIER_EDGE("carrier_edge"),
SIP_EDGE("sip_edge"),
SDK_EDGE("sdk_edge"),
CLIENT_EDGE("client_edge");
private final String value;
private TwilioEdge(final String value) {
this.value = value;
}
public String toString() {
return value;
}
/**
* Generate a TwilioEdge from a string.
* @param value string value
* @return generated TwilioEdge
*/
@JsonCreator
public static TwilioEdge forValue(final String value) {
return Promoter.enumFromString(value, TwilioEdge.values());
}
}
public enum Level {
UNKNOWN("UNKNOWN"),
DEBUG("DEBUG"),
INFO("INFO"),
WARNING("WARNING"),
ERROR("ERROR");
private final String value;
private Level(final String value) {
this.value = value;
}
public String toString() {
return value;
}
/**
* Generate a Level from a string.
* @param value string value
* @return generated Level
*/
@JsonCreator
public static Level forValue(final String value) {
return Promoter.enumFromString(value, Level.values());
}
}
/**
* Create a EventReader to execute read.
*
* @param pathCallSid The call_sid
* @return EventReader capable of executing the read
*/
public static EventReader reader(final String pathCallSid) {
return new EventReader(pathCallSid);
}
/**
* Converts a JSON String into a Event object using the provided ObjectMapper.
*
* @param json Raw JSON String
* @param objectMapper Jackson ObjectMapper
* @return Event object represented by the provided JSON
*/
public static Event fromJson(final String json, final ObjectMapper objectMapper) {
// Convert all checked exceptions to Runtime
try {
return objectMapper.readValue(json, Event.class);
} catch (final JsonMappingException | JsonParseException e) {
throw new ApiException(e.getMessage(), e);
} catch (final IOException e) {
throw new ApiConnectionException(e.getMessage(), e);
}
}
/**
* Converts a JSON InputStream into a Event object using the provided
* ObjectMapper.
*
* @param json Raw JSON InputStream
* @param objectMapper Jackson ObjectMapper
* @return Event object represented by the provided JSON
*/
public static Event fromJson(final InputStream json, final ObjectMapper objectMapper) {
// Convert all checked exceptions to Runtime
try {
return objectMapper.readValue(json, Event.class);
} catch (final JsonMappingException | JsonParseException e) {
throw new ApiException(e.getMessage(), e);
} catch (final IOException e) {
throw new ApiConnectionException(e.getMessage(), e);
}
}
private final String timestamp;
private final String callSid;
private final String accountSid;
private final Event.TwilioEdge edge;
private final String group;
private final Event.Level level;
private final String name;
private final Map carrierEdge;
private final Map sipEdge;
private final Map sdkEdge;
private final Map clientEdge;
@JsonCreator
private Event(@JsonProperty("timestamp")
final String timestamp,
@JsonProperty("call_sid")
final String callSid,
@JsonProperty("account_sid")
final String accountSid,
@JsonProperty("edge")
final Event.TwilioEdge edge,
@JsonProperty("group")
final String group,
@JsonProperty("level")
final Event.Level level,
@JsonProperty("name")
final String name,
@JsonProperty("carrier_edge")
final Map carrierEdge,
@JsonProperty("sip_edge")
final Map sipEdge,
@JsonProperty("sdk_edge")
final Map sdkEdge,
@JsonProperty("client_edge")
final Map clientEdge) {
this.timestamp = timestamp;
this.callSid = callSid;
this.accountSid = accountSid;
this.edge = edge;
this.group = group;
this.level = level;
this.name = name;
this.carrierEdge = carrierEdge;
this.sipEdge = sipEdge;
this.sdkEdge = sdkEdge;
this.clientEdge = clientEdge;
}
/**
* Returns The timestamp.
*
* @return The timestamp
*/
public final String getTimestamp() {
return this.timestamp;
}
/**
* Returns The call_sid.
*
* @return The call_sid
*/
public final String getCallSid() {
return this.callSid;
}
/**
* Returns The account_sid.
*
* @return The account_sid
*/
public final String getAccountSid() {
return this.accountSid;
}
/**
* Returns The edge.
*
* @return The edge
*/
public final Event.TwilioEdge getEdge() {
return this.edge;
}
/**
* Returns The group.
*
* @return The group
*/
public final String getGroup() {
return this.group;
}
/**
* Returns The level.
*
* @return The level
*/
public final Event.Level getLevel() {
return this.level;
}
/**
* Returns The name.
*
* @return The name
*/
public final String getName() {
return this.name;
}
/**
* Returns The carrier_edge.
*
* @return The carrier_edge
*/
public final Map getCarrierEdge() {
return this.carrierEdge;
}
/**
* Returns The sip_edge.
*
* @return The sip_edge
*/
public final Map getSipEdge() {
return this.sipEdge;
}
/**
* Returns The sdk_edge.
*
* @return The sdk_edge
*/
public final Map getSdkEdge() {
return this.sdkEdge;
}
/**
* Returns The client_edge.
*
* @return The client_edge
*/
public final Map getClientEdge() {
return this.clientEdge;
}
@Override
public boolean equals(final Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
Event other = (Event) o;
return Objects.equals(timestamp, other.timestamp) &&
Objects.equals(callSid, other.callSid) &&
Objects.equals(accountSid, other.accountSid) &&
Objects.equals(edge, other.edge) &&
Objects.equals(group, other.group) &&
Objects.equals(level, other.level) &&
Objects.equals(name, other.name) &&
Objects.equals(carrierEdge, other.carrierEdge) &&
Objects.equals(sipEdge, other.sipEdge) &&
Objects.equals(sdkEdge, other.sdkEdge) &&
Objects.equals(clientEdge, other.clientEdge);
}
@Override
public int hashCode() {
return Objects.hash(timestamp,
callSid,
accountSid,
edge,
group,
level,
name,
carrierEdge,
sipEdge,
sdkEdge,
clientEdge);
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy