
com.twilio.rest.insights.v1.call.Metric Maven / Gradle / Ivy
/*
* This code was generated by
* ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __
* | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/
* | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \
*
* Twilio - Insights
* This is the public Twilio REST API.
*
* NOTE: This class is auto generated by OpenAPI Generator.
* https://openapi-generator.tech
* Do not edit the class manually.
*/
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.Promoter;
import com.twilio.exception.ApiConnectionException;
import com.twilio.exception.ApiException;
import java.io.IOException;
import java.io.InputStream;
import java.util.Map;
import java.util.Map;
import java.util.Objects;
import lombok.ToString;
import lombok.ToString;
@JsonIgnoreProperties(ignoreUnknown = true)
@ToString
public class Metric extends Resource {
private static final long serialVersionUID = 250651350148240L;
public static MetricReader reader(final String pathCallSid) {
return new MetricReader(pathCallSid);
}
/**
* Converts a JSON String into a Metric object using the provided ObjectMapper.
*
* @param json Raw JSON String
* @param objectMapper Jackson ObjectMapper
* @return Metric object represented by the provided JSON
*/
public static Metric fromJson(
final String json,
final ObjectMapper objectMapper
) {
// Convert all checked exceptions to Runtime
try {
return objectMapper.readValue(json, Metric.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 Metric object using the provided
* ObjectMapper.
*
* @param json Raw JSON InputStream
* @param objectMapper Jackson ObjectMapper
* @return Metric object represented by the provided JSON
*/
public static Metric fromJson(
final InputStream json,
final ObjectMapper objectMapper
) {
// Convert all checked exceptions to Runtime
try {
return objectMapper.readValue(json, Metric.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 Metric.TwilioEdge edge;
private final Metric.StreamDirection direction;
private final Map carrierEdge;
private final Map sipEdge;
private final Map sdkEdge;
private final Map clientEdge;
@JsonCreator
private Metric(
@JsonProperty("timestamp") final String timestamp,
@JsonProperty("call_sid") final String callSid,
@JsonProperty("account_sid") final String accountSid,
@JsonProperty("edge") final Metric.TwilioEdge edge,
@JsonProperty("direction") final Metric.StreamDirection direction,
@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.direction = direction;
this.carrierEdge = carrierEdge;
this.sipEdge = sipEdge;
this.sdkEdge = sdkEdge;
this.clientEdge = clientEdge;
}
public final String getTimestamp() {
return this.timestamp;
}
public final String getCallSid() {
return this.callSid;
}
public final String getAccountSid() {
return this.accountSid;
}
public final Metric.TwilioEdge getEdge() {
return this.edge;
}
public final Metric.StreamDirection getDirection() {
return this.direction;
}
public final Map getCarrierEdge() {
return this.carrierEdge;
}
public final Map getSipEdge() {
return this.sipEdge;
}
public final Map getSdkEdge() {
return this.sdkEdge;
}
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;
}
Metric other = (Metric) o;
return (
Objects.equals(timestamp, other.timestamp) &&
Objects.equals(callSid, other.callSid) &&
Objects.equals(accountSid, other.accountSid) &&
Objects.equals(edge, other.edge) &&
Objects.equals(direction, other.direction) &&
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,
direction,
carrierEdge,
sipEdge,
sdkEdge,
clientEdge
);
}
public enum StreamDirection {
UNKNOWN("unknown"),
INBOUND("inbound"),
OUTBOUND("outbound"),
BOTH("both");
private final String value;
private StreamDirection(final String value) {
this.value = value;
}
public String toString() {
return value;
}
@JsonCreator
public static StreamDirection forValue(final String value) {
return Promoter.enumFromString(value, StreamDirection.values());
}
}
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;
}
@JsonCreator
public static TwilioEdge forValue(final String value) {
return Promoter.enumFromString(value, TwilioEdge.values());
}
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy