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

com.twilio.rest.preview.trustedComms.CurrentCall Maven / Gradle / Ivy

There is a newer version: 10.6.4
Show newest version
/**
 * This code was generated by
 * \ / _    _  _|   _  _
 *  | (_)\/(_)(_|\/| |(/_  v1.0.0
 *       /       /
 */

package com.twilio.rest.preview.trustedComms;

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.google.common.base.MoreObjects;
import com.twilio.base.Resource;
import com.twilio.converter.DateConverter;
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 org.joda.time.DateTime;

import java.io.IOException;
import java.io.InputStream;
import java.net.URI;
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)
public class CurrentCall extends Resource {
    private static final long serialVersionUID = 212286172550611L;

    /**
     * Create a CurrentCallFetcher to execute fetch.
     *
     * @return CurrentCallFetcher capable of executing the fetch
     */
    public static CurrentCallFetcher fetcher() {
        return new CurrentCallFetcher();
    }

    /**
     * Converts a JSON String into a CurrentCall object using the provided
     * ObjectMapper.
     *
     * @param json Raw JSON String
     * @param objectMapper Jackson ObjectMapper
     * @return CurrentCall object represented by the provided JSON
     */
    public static CurrentCall fromJson(final String json, final ObjectMapper objectMapper) {
        // Convert all checked exceptions to Runtime
        try {
            return objectMapper.readValue(json, CurrentCall.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 CurrentCall object using the provided
     * ObjectMapper.
     *
     * @param json Raw JSON InputStream
     * @param objectMapper Jackson ObjectMapper
     * @return CurrentCall object represented by the provided JSON
     */
    public static CurrentCall fromJson(final InputStream json, final ObjectMapper objectMapper) {
        // Convert all checked exceptions to Runtime
        try {
            return objectMapper.readValue(json, CurrentCall.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 sid;
    private final String from;
    private final String to;
    private final String status;
    private final String reason;
    private final DateTime createdAt;
    private final String caller;
    private final String logo;
    private final String bgColor;
    private final String fontColor;
    private final String useCase;
    private final String manager;
    private final String shieldImg;
    private final URI url;

    @JsonCreator
    private CurrentCall(@JsonProperty("sid")
                        final String sid,
                        @JsonProperty("from")
                        final String from,
                        @JsonProperty("to")
                        final String to,
                        @JsonProperty("status")
                        final String status,
                        @JsonProperty("reason")
                        final String reason,
                        @JsonProperty("created_at")
                        final String createdAt,
                        @JsonProperty("caller")
                        final String caller,
                        @JsonProperty("logo")
                        final String logo,
                        @JsonProperty("bg_color")
                        final String bgColor,
                        @JsonProperty("font_color")
                        final String fontColor,
                        @JsonProperty("use_case")
                        final String useCase,
                        @JsonProperty("manager")
                        final String manager,
                        @JsonProperty("shield_img")
                        final String shieldImg,
                        @JsonProperty("url")
                        final URI url) {
        this.sid = sid;
        this.from = from;
        this.to = to;
        this.status = status;
        this.reason = reason;
        this.createdAt = DateConverter.iso8601DateTimeFromString(createdAt);
        this.caller = caller;
        this.logo = logo;
        this.bgColor = bgColor;
        this.fontColor = fontColor;
        this.useCase = useCase;
        this.manager = manager;
        this.shieldImg = shieldImg;
        this.url = url;
    }

    /**
     * Returns The A string that uniquely identifies this current phone call..
     *
     * @return A string that uniquely identifies this current phone call.
     */
    public final String getSid() {
        return this.sid;
    }

    /**
     * Returns The The originating phone number.
     *
     * @return The originating phone number
     */
    public final String getFrom() {
        return this.from;
    }

    /**
     * Returns The The terminating phone number.
     *
     * @return The terminating phone number
     */
    public final String getTo() {
        return this.to;
    }

    /**
     * Returns The The status of the current phone call.
     *
     * @return The status of the current phone call
     */
    public final String getStatus() {
        return this.status;
    }

    /**
     * Returns The The business reason for this current phone call.
     *
     * @return The business reason for this current phone call
     */
    public final String getReason() {
        return this.reason;
    }

    /**
     * Returns The The date this current phone call was created.
     *
     * @return The date this current phone call was created
     */
    public final DateTime getCreatedAt() {
        return this.createdAt;
    }

    /**
     * Returns The Caller name of the current phone call.
     *
     * @return Caller name of the current phone call
     */
    public final String getCaller() {
        return this.caller;
    }

    /**
     * Returns The Logo URL of the caller.
     *
     * @return Logo URL of the caller
     */
    public final String getLogo() {
        return this.logo;
    }

    /**
     * Returns The Background color of the current phone call.
     *
     * @return Background color of the current phone call
     */
    public final String getBgColor() {
        return this.bgColor;
    }

    /**
     * Returns The Font color of the current phone call.
     *
     * @return Font color of the current phone call
     */
    public final String getFontColor() {
        return this.fontColor;
    }

    /**
     * Returns The The use case for the current phone call.
     *
     * @return The use case for the current phone call
     */
    public final String getUseCase() {
        return this.useCase;
    }

    /**
     * Returns The The name of the CPS organization.
     *
     * @return The name of the CPS organization
     */
    public final String getManager() {
        return this.manager;
    }

    /**
     * Returns The Shield image URL that serves as authenticity proof of the current
     * phone call.
     *
     * @return Shield image URL that serves as authenticity proof of the current
     *         phone call
     */
    public final String getShieldImg() {
        return this.shieldImg;
    }

    /**
     * Returns The The URL of this resource..
     *
     * @return The URL of this resource.
     */
    public final URI getUrl() {
        return this.url;
    }

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

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

        CurrentCall other = (CurrentCall) o;

        return Objects.equals(sid, other.sid) &&
               Objects.equals(from, other.from) &&
               Objects.equals(to, other.to) &&
               Objects.equals(status, other.status) &&
               Objects.equals(reason, other.reason) &&
               Objects.equals(createdAt, other.createdAt) &&
               Objects.equals(caller, other.caller) &&
               Objects.equals(logo, other.logo) &&
               Objects.equals(bgColor, other.bgColor) &&
               Objects.equals(fontColor, other.fontColor) &&
               Objects.equals(useCase, other.useCase) &&
               Objects.equals(manager, other.manager) &&
               Objects.equals(shieldImg, other.shieldImg) &&
               Objects.equals(url, other.url);
    }

    @Override
    public int hashCode() {
        return Objects.hash(sid,
                            from,
                            to,
                            status,
                            reason,
                            createdAt,
                            caller,
                            logo,
                            bgColor,
                            fontColor,
                            useCase,
                            manager,
                            shieldImg,
                            url);
    }

    @Override
    public String toString() {
        return MoreObjects.toStringHelper(this)
                          .add("sid", sid)
                          .add("from", from)
                          .add("to", to)
                          .add("status", status)
                          .add("reason", reason)
                          .add("createdAt", createdAt)
                          .add("caller", caller)
                          .add("logo", logo)
                          .add("bgColor", bgColor)
                          .add("fontColor", fontColor)
                          .add("useCase", useCase)
                          .add("manager", manager)
                          .add("shieldImg", shieldImg)
                          .add("url", url)
                          .toString();
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy