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

com.twilio.rest.api.v2010.account.recording.addonresult.Payload Maven / Gradle / Ivy

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

package com.twilio.rest.api.v2010.account.recording.addonresult;

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.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.time.ZonedDateTime;
import java.util.Map;
import java.util.Objects;

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

    /**
     * Create a PayloadFetcher to execute fetch.
     *
     * @param pathAccountSid The SID of the Account that created the resource to
     *                       fetch
     * @param pathReferenceSid The SID of the recording to which the AddOnResult
     *                         resource that contains the payload to fetch belongs
     * @param pathAddOnResultSid The SID of the AddOnResult to which the payload to
     *                           fetch belongs
     * @param pathSid The unique string that identifies the resource to fetch
     * @return PayloadFetcher capable of executing the fetch
     */
    public static PayloadFetcher fetcher(final String pathAccountSid,
                                         final String pathReferenceSid,
                                         final String pathAddOnResultSid,
                                         final String pathSid) {
        return new PayloadFetcher(pathAccountSid, pathReferenceSid, pathAddOnResultSid, pathSid);
    }

    /**
     * Create a PayloadFetcher to execute fetch.
     *
     * @param pathReferenceSid The SID of the recording to which the AddOnResult
     *                         resource that contains the payload to fetch belongs
     * @param pathAddOnResultSid The SID of the AddOnResult to which the payload to
     *                           fetch belongs
     * @param pathSid The unique string that identifies the resource to fetch
     * @return PayloadFetcher capable of executing the fetch
     */
    public static PayloadFetcher fetcher(final String pathReferenceSid,
                                         final String pathAddOnResultSid,
                                         final String pathSid) {
        return new PayloadFetcher(pathReferenceSid, pathAddOnResultSid, pathSid);
    }

    /**
     * Create a PayloadReader to execute read.
     *
     * @param pathAccountSid The SID of the Account that created the resources to
     *                       read
     * @param pathReferenceSid The SID of the recording to which the AddOnResult
     *                         resource that contains the payloads to read belongs
     * @param pathAddOnResultSid The SID of the AddOnResult to which the payloads
     *                           to read belongs
     * @return PayloadReader capable of executing the read
     */
    public static PayloadReader reader(final String pathAccountSid,
                                       final String pathReferenceSid,
                                       final String pathAddOnResultSid) {
        return new PayloadReader(pathAccountSid, pathReferenceSid, pathAddOnResultSid);
    }

    /**
     * Create a PayloadReader to execute read.
     *
     * @param pathReferenceSid The SID of the recording to which the AddOnResult
     *                         resource that contains the payloads to read belongs
     * @param pathAddOnResultSid The SID of the AddOnResult to which the payloads
     *                           to read belongs
     * @return PayloadReader capable of executing the read
     */
    public static PayloadReader reader(final String pathReferenceSid,
                                       final String pathAddOnResultSid) {
        return new PayloadReader(pathReferenceSid, pathAddOnResultSid);
    }

    /**
     * Create a PayloadDeleter to execute delete.
     *
     * @param pathAccountSid The SID of the Account that created the resources to
     *                       delete
     * @param pathReferenceSid The SID of the recording to which the AddOnResult
     *                         resource that contains the payloads to delete belongs
     * @param pathAddOnResultSid The SID of the AddOnResult to which the payloads
     *                           to delete belongs
     * @param pathSid The unique string that identifies the resource
     * @return PayloadDeleter capable of executing the delete
     */
    public static PayloadDeleter deleter(final String pathAccountSid,
                                         final String pathReferenceSid,
                                         final String pathAddOnResultSid,
                                         final String pathSid) {
        return new PayloadDeleter(pathAccountSid, pathReferenceSid, pathAddOnResultSid, pathSid);
    }

    /**
     * Create a PayloadDeleter to execute delete.
     *
     * @param pathReferenceSid The SID of the recording to which the AddOnResult
     *                         resource that contains the payloads to delete belongs
     * @param pathAddOnResultSid The SID of the AddOnResult to which the payloads
     *                           to delete belongs
     * @param pathSid The unique string that identifies the resource
     * @return PayloadDeleter capable of executing the delete
     */
    public static PayloadDeleter deleter(final String pathReferenceSid,
                                         final String pathAddOnResultSid,
                                         final String pathSid) {
        return new PayloadDeleter(pathReferenceSid, pathAddOnResultSid, pathSid);
    }

    /**
     * Converts a JSON String into a Payload object using the provided ObjectMapper.
     *
     * @param json Raw JSON String
     * @param objectMapper Jackson ObjectMapper
     * @return Payload object represented by the provided JSON
     */
    public static Payload fromJson(final String json, final ObjectMapper objectMapper) {
        // Convert all checked exceptions to Runtime
        try {
            return objectMapper.readValue(json, Payload.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 Payload object using the provided
     * ObjectMapper.
     *
     * @param json Raw JSON InputStream
     * @param objectMapper Jackson ObjectMapper
     * @return Payload object represented by the provided JSON
     */
    public static Payload fromJson(final InputStream json, final ObjectMapper objectMapper) {
        // Convert all checked exceptions to Runtime
        try {
            return objectMapper.readValue(json, Payload.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 addOnResultSid;
    private final String accountSid;
    private final String label;
    private final String addOnSid;
    private final String addOnConfigurationSid;
    private final String contentType;
    private final ZonedDateTime dateCreated;
    private final ZonedDateTime dateUpdated;
    private final String referenceSid;
    private final Map subresourceUris;

    @JsonCreator
    private Payload(@JsonProperty("sid")
                    final String sid,
                    @JsonProperty("add_on_result_sid")
                    final String addOnResultSid,
                    @JsonProperty("account_sid")
                    final String accountSid,
                    @JsonProperty("label")
                    final String label,
                    @JsonProperty("add_on_sid")
                    final String addOnSid,
                    @JsonProperty("add_on_configuration_sid")
                    final String addOnConfigurationSid,
                    @JsonProperty("content_type")
                    final String contentType,
                    @JsonProperty("date_created")
                    final String dateCreated,
                    @JsonProperty("date_updated")
                    final String dateUpdated,
                    @JsonProperty("reference_sid")
                    final String referenceSid,
                    @JsonProperty("subresource_uris")
                    final Map subresourceUris) {
        this.sid = sid;
        this.addOnResultSid = addOnResultSid;
        this.accountSid = accountSid;
        this.label = label;
        this.addOnSid = addOnSid;
        this.addOnConfigurationSid = addOnConfigurationSid;
        this.contentType = contentType;
        this.dateCreated = DateConverter.rfc2822DateTimeFromString(dateCreated);
        this.dateUpdated = DateConverter.rfc2822DateTimeFromString(dateUpdated);
        this.referenceSid = referenceSid;
        this.subresourceUris = subresourceUris;
    }

    /**
     * Returns The unique string that identifies the resource.
     *
     * @return The unique string that identifies the resource
     */
    public final String getSid() {
        return this.sid;
    }

    /**
     * Returns The SID of the AddOnResult to which the payload belongs.
     *
     * @return The SID of the AddOnResult to which the payload belongs
     */
    public final String getAddOnResultSid() {
        return this.addOnResultSid;
    }

    /**
     * Returns The SID of the Account that created the resource.
     *
     * @return The SID of the Account that created the resource
     */
    public final String getAccountSid() {
        return this.accountSid;
    }

    /**
     * Returns The string that describes the payload.
     *
     * @return The string that describes the payload
     */
    public final String getLabel() {
        return this.label;
    }

    /**
     * Returns The SID of the Add-on to which the result belongs.
     *
     * @return The SID of the Add-on to which the result belongs
     */
    public final String getAddOnSid() {
        return this.addOnSid;
    }

    /**
     * Returns The SID of the Add-on configuration.
     *
     * @return The SID of the Add-on configuration
     */
    public final String getAddOnConfigurationSid() {
        return this.addOnConfigurationSid;
    }

    /**
     * Returns The MIME type of the payload.
     *
     * @return The MIME type of the payload
     */
    public final String getContentType() {
        return this.contentType;
    }

    /**
     * Returns The RFC 2822 date and time in GMT that the resource was created.
     *
     * @return The RFC 2822 date and time in GMT that the resource was created
     */
    public final ZonedDateTime getDateCreated() {
        return this.dateCreated;
    }

    /**
     * Returns The RFC 2822 date and time in GMT that the resource was last updated.
     *
     * @return The RFC 2822 date and time in GMT that the resource was last updated
     */
    public final ZonedDateTime getDateUpdated() {
        return this.dateUpdated;
    }

    /**
     * Returns The SID of the recording to which the AddOnResult resource that
     * contains the payload belongs.
     *
     * @return The SID of the recording to which the AddOnResult resource that
     *         contains the payload belongs
     */
    public final String getReferenceSid() {
        return this.referenceSid;
    }

    /**
     * Returns A list of related resources identified by their relative URIs.
     *
     * @return A list of related resources identified by their relative URIs
     */
    public final Map getSubresourceUris() {
        return this.subresourceUris;
    }

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

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

        Payload other = (Payload) o;

        return Objects.equals(sid, other.sid) &&
               Objects.equals(addOnResultSid, other.addOnResultSid) &&
               Objects.equals(accountSid, other.accountSid) &&
               Objects.equals(label, other.label) &&
               Objects.equals(addOnSid, other.addOnSid) &&
               Objects.equals(addOnConfigurationSid, other.addOnConfigurationSid) &&
               Objects.equals(contentType, other.contentType) &&
               Objects.equals(dateCreated, other.dateCreated) &&
               Objects.equals(dateUpdated, other.dateUpdated) &&
               Objects.equals(referenceSid, other.referenceSid) &&
               Objects.equals(subresourceUris, other.subresourceUris);
    }

    @Override
    public int hashCode() {
        return Objects.hash(sid,
                            addOnResultSid,
                            accountSid,
                            label,
                            addOnSid,
                            addOnConfigurationSid,
                            contentType,
                            dateCreated,
                            dateUpdated,
                            referenceSid,
                            subresourceUris);
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy