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

com.twilio.rest.insights.v1.call.CallSummary Maven / Gradle / Ivy

There is a newer version: 10.1.5
Show newest version
/*
 * 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.DateConverter;
import com.twilio.converter.Promoter;
import com.twilio.exception.ApiConnectionException;

import com.twilio.exception.ApiException;

import lombok.ToString;

import java.io.IOException;
import java.io.InputStream;
import java.net.URI;
import java.time.ZonedDateTime;

import java.util.List;
import java.util.Map;
import java.util.Objects;


import java.util.Map;

@JsonIgnoreProperties(ignoreUnknown = true)
@ToString
public class CallSummary extends Resource {
    private static final long serialVersionUID = 200007638188409L;

    public static CallSummaryFetcher fetcher(final String pathCallSid){
        return new CallSummaryFetcher(pathCallSid);
    }

    /**
    * Converts a JSON String into a CallSummary object using the provided ObjectMapper.
    *
    * @param json Raw JSON String
    * @param objectMapper Jackson ObjectMapper
    * @return CallSummary object represented by the provided JSON
    */
    public static CallSummary fromJson(final String json, final ObjectMapper objectMapper) {
        // Convert all checked exceptions to Runtime
        try {
            return objectMapper.readValue(json, CallSummary.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 CallSummary object using the provided
    * ObjectMapper.
    *
    * @param json Raw JSON InputStream
    * @param objectMapper Jackson ObjectMapper
    * @return CallSummary object represented by the provided JSON
    */
    public static CallSummary fromJson(final InputStream json, final ObjectMapper objectMapper) {
        // Convert all checked exceptions to Runtime
        try {
            return objectMapper.readValue(json, CallSummary.class);
        } catch (final JsonMappingException | JsonParseException e) {
            throw new ApiException(e.getMessage(), e);
        } catch (final IOException e) {
            throw new ApiConnectionException(e.getMessage(), e);
        }
    }
    public enum AnsweredBy {
        UNKNOWN("unknown"),
        MACHINE_START("machine_start"),
        MACHINE_END_BEEP("machine_end_beep"),
        MACHINE_END_SILENCE("machine_end_silence"),
        MACHINE_END_OTHER("machine_end_other"),
        HUMAN("human"),
        FAX("fax");

        private final String value;

        private AnsweredBy(final String value) {
            this.value = value;
        }

        public String toString() {
            return value;
        }

        @JsonCreator
        public static AnsweredBy forValue(final String value) {
            return Promoter.enumFromString(value, AnsweredBy.values());
        }
    }
    public enum CallState {
        RINGING("ringing"),
        COMPLETED("completed"),
        BUSY("busy"),
        FAIL("fail"),
        NOANSWER("noanswer"),
        CANCELED("canceled"),
        ANSWERED("answered"),
        UNDIALED("undialed");

        private final String value;

        private CallState(final String value) {
            this.value = value;
        }

        public String toString() {
            return value;
        }

        @JsonCreator
        public static CallState forValue(final String value) {
            return Promoter.enumFromString(value, CallState.values());
        }
    }
    public enum CallType {
        CARRIER("carrier"),
        SIP("sip"),
        TRUNKING("trunking"),
        CLIENT("client");

        private final String value;

        private CallType(final String value) {
            this.value = value;
        }

        public String toString() {
            return value;
        }

        @JsonCreator
        public static CallType forValue(final String value) {
            return Promoter.enumFromString(value, CallType.values());
        }
    }
    public enum ProcessingState {
        COMPLETE("complete"),
        PARTIAL("partial");

        private final String value;

        private ProcessingState(final String value) {
            this.value = value;
        }

        public String toString() {
            return value;
        }

        @JsonCreator
        public static ProcessingState forValue(final String value) {
            return Promoter.enumFromString(value, ProcessingState.values());
        }
    }

    private final String accountSid;
    private final String callSid;
    private final CallSummary.CallType callType;
    private final CallSummary.CallState callState;
    private final CallSummary.AnsweredBy answeredBy;
    private final CallSummary.ProcessingState processingState;
    private final ZonedDateTime createdTime;
    private final ZonedDateTime startTime;
    private final ZonedDateTime endTime;
    private final Integer duration;
    private final Integer connectDuration;
    private final Map from;
    private final Map to;
    private final Map carrierEdge;
    private final Map clientEdge;
    private final Map sdkEdge;
    private final Map sipEdge;
    private final List tags;
    private final URI url;
    private final Map attributes;
    private final Map properties;
    private final Map trust;
    private final Map annotation;

    @JsonCreator
    private CallSummary(
        @JsonProperty("account_sid")
        final String accountSid,

        @JsonProperty("call_sid")
        final String callSid,

        @JsonProperty("call_type")
        final CallSummary.CallType callType,

        @JsonProperty("call_state")
        final CallSummary.CallState callState,

        @JsonProperty("answered_by")
        final CallSummary.AnsweredBy answeredBy,

        @JsonProperty("processing_state")
        final CallSummary.ProcessingState processingState,

        @JsonProperty("created_time")
        final String createdTime,

        @JsonProperty("start_time")
        final String startTime,

        @JsonProperty("end_time")
        final String endTime,

        @JsonProperty("duration")
        final Integer duration,

        @JsonProperty("connect_duration")
        final Integer connectDuration,

        @JsonProperty("from")
        final Map from,

        @JsonProperty("to")
        final Map to,

        @JsonProperty("carrier_edge")
        final Map carrierEdge,

        @JsonProperty("client_edge")
        final Map clientEdge,

        @JsonProperty("sdk_edge")
        final Map sdkEdge,

        @JsonProperty("sip_edge")
        final Map sipEdge,

        @JsonProperty("tags")
        final List tags,

        @JsonProperty("url")
        final URI url,

        @JsonProperty("attributes")
        final Map attributes,

        @JsonProperty("properties")
        final Map properties,

        @JsonProperty("trust")
        final Map trust,

        @JsonProperty("annotation")
        final Map annotation
    ) {
        this.accountSid = accountSid;
        this.callSid = callSid;
        this.callType = callType;
        this.callState = callState;
        this.answeredBy = answeredBy;
        this.processingState = processingState;
        this.createdTime = DateConverter.iso8601DateTimeFromString(createdTime);
        this.startTime = DateConverter.iso8601DateTimeFromString(startTime);
        this.endTime = DateConverter.iso8601DateTimeFromString(endTime);
        this.duration = duration;
        this.connectDuration = connectDuration;
        this.from = from;
        this.to = to;
        this.carrierEdge = carrierEdge;
        this.clientEdge = clientEdge;
        this.sdkEdge = sdkEdge;
        this.sipEdge = sipEdge;
        this.tags = tags;
        this.url = url;
        this.attributes = attributes;
        this.properties = properties;
        this.trust = trust;
        this.annotation = annotation;
    }

        public final String getAccountSid() {
            return this.accountSid;
        }
        public final String getCallSid() {
            return this.callSid;
        }
        public final CallSummary.CallType getCallType() {
            return this.callType;
        }
        public final CallSummary.CallState getCallState() {
            return this.callState;
        }
        public final CallSummary.AnsweredBy getAnsweredBy() {
            return this.answeredBy;
        }
        public final CallSummary.ProcessingState getProcessingState() {
            return this.processingState;
        }
        public final ZonedDateTime getCreatedTime() {
            return this.createdTime;
        }
        public final ZonedDateTime getStartTime() {
            return this.startTime;
        }
        public final ZonedDateTime getEndTime() {
            return this.endTime;
        }
        public final Integer getDuration() {
            return this.duration;
        }
        public final Integer getConnectDuration() {
            return this.connectDuration;
        }
        public final Map getFrom() {
            return this.from;
        }
        public final Map getTo() {
            return this.to;
        }
        public final Map getCarrierEdge() {
            return this.carrierEdge;
        }
        public final Map getClientEdge() {
            return this.clientEdge;
        }
        public final Map getSdkEdge() {
            return this.sdkEdge;
        }
        public final Map getSipEdge() {
            return this.sipEdge;
        }
        public final List getTags() {
            return this.tags;
        }
        public final URI getUrl() {
            return this.url;
        }
        public final Map getAttributes() {
            return this.attributes;
        }
        public final Map getProperties() {
            return this.properties;
        }
        public final Map getTrust() {
            return this.trust;
        }
        public final Map getAnnotation() {
            return this.annotation;
        }

    @Override
    public boolean equals(final Object o) {
        if (this==o) {
            return true;
        }

        if (o == null || getClass() != o.getClass()) {
            return false;
        }

        CallSummary other = (CallSummary) o;

        return Objects.equals(accountSid, other.accountSid) &&  Objects.equals(callSid, other.callSid) &&  Objects.equals(callType, other.callType) &&  Objects.equals(callState, other.callState) &&  Objects.equals(answeredBy, other.answeredBy) &&  Objects.equals(processingState, other.processingState) &&  Objects.equals(createdTime, other.createdTime) &&  Objects.equals(startTime, other.startTime) &&  Objects.equals(endTime, other.endTime) &&  Objects.equals(duration, other.duration) &&  Objects.equals(connectDuration, other.connectDuration) &&  Objects.equals(from, other.from) &&  Objects.equals(to, other.to) &&  Objects.equals(carrierEdge, other.carrierEdge) &&  Objects.equals(clientEdge, other.clientEdge) &&  Objects.equals(sdkEdge, other.sdkEdge) &&  Objects.equals(sipEdge, other.sipEdge) &&  Objects.equals(tags, other.tags) &&  Objects.equals(url, other.url) &&  Objects.equals(attributes, other.attributes) &&  Objects.equals(properties, other.properties) &&  Objects.equals(trust, other.trust) &&  Objects.equals(annotation, other.annotation)  ;
    }

    @Override
    public int hashCode() {
        return Objects.hash(accountSid, callSid, callType, callState, answeredBy, processingState, createdTime, startTime, endTime, duration, connectDuration, from, to, carrierEdge, clientEdge, sdkEdge, sipEdge, tags, url, attributes, properties, trust, annotation);
    }

}





© 2015 - 2024 Weber Informatics LLC | Privacy Policy