com.twilio.sdk.resource.preview.wireless.RatePlan Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of twilio-java-sdk Show documentation
Show all versions of twilio-java-sdk Show documentation
Release Candidate for Next-Gen Twilio Java Helper Library
The newest version!
/**
* This code was generated by
* \ / _ _ _| _ _
* | (_)\/(_)(_|\/| |(/_ v1.0.0
* / /
*/
package com.twilio.sdk.resource.preview.wireless;
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.sdk.client.TwilioRestClient;
import com.twilio.sdk.converter.DateConverter;
import com.twilio.sdk.exception.ApiConnectionException;
import com.twilio.sdk.exception.ApiException;
import com.twilio.sdk.fetcher.preview.wireless.RatePlanFetcher;
import com.twilio.sdk.http.HttpMethod;
import com.twilio.sdk.http.Request;
import com.twilio.sdk.http.Response;
import com.twilio.sdk.reader.preview.wireless.RatePlanReader;
import com.twilio.sdk.resource.RestException;
import com.twilio.sdk.resource.SidResource;
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;
@JsonIgnoreProperties(ignoreUnknown = true)
public class RatePlan extends SidResource {
private static final long serialVersionUID = 159290993578774L;
/**
* Create a RatePlanReader to execute read.
*
* @return RatePlanReader capable of executing the read
*/
public static RatePlanReader read() {
return new RatePlanReader();
}
/**
* Create a RatePlanFetcher to execute fetch.
*
* @param sid The sid
* @return RatePlanFetcher capable of executing the fetch
*/
public static RatePlanFetcher fetch(final String sid) {
return new RatePlanFetcher(sid);
}
/**
* Converts a JSON String into a RatePlan object using the provided
* ObjectMapper.
*
* @param json Raw JSON String
* @param objectMapper Jackson ObjectMapper
* @return RatePlan object represented by the provided JSON
*/
public static RatePlan fromJson(final String json, final ObjectMapper objectMapper) {
// Convert all checked exceptions to Runtime
try {
return objectMapper.readValue(json, RatePlan.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 RatePlan object using the provided
* ObjectMapper.
*
* @param json Raw JSON InputStream
* @param objectMapper Jackson ObjectMapper
* @return RatePlan object represented by the provided JSON
*/
public static RatePlan fromJson(final InputStream json, final ObjectMapper objectMapper) {
// Convert all checked exceptions to Runtime
try {
return objectMapper.readValue(json, RatePlan.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 alias;
private final String accountSid;
private final String friendlyName;
private final String dataMetering;
private final Map capabilities;
private final Integer voiceCap;
private final Integer messagingCap;
private final Integer commandsCap;
private final Integer dataCap;
private final Integer capPeriod;
private final String capUnit;
private final DateTime dateCreated;
private final DateTime dateUpdated;
private final URI url;
@JsonCreator
private RatePlan(@JsonProperty("sid")
final String sid,
@JsonProperty("alias")
final String alias,
@JsonProperty("account_sid")
final String accountSid,
@JsonProperty("friendly_name")
final String friendlyName,
@JsonProperty("data_metering")
final String dataMetering,
@JsonProperty("capabilities")
final Map capabilities,
@JsonProperty("voice_cap")
final Integer voiceCap,
@JsonProperty("messaging_cap")
final Integer messagingCap,
@JsonProperty("commands_cap")
final Integer commandsCap,
@JsonProperty("data_cap")
final Integer dataCap,
@JsonProperty("cap_period")
final Integer capPeriod,
@JsonProperty("cap_unit")
final String capUnit,
@JsonProperty("date_created")
final String dateCreated,
@JsonProperty("date_updated")
final String dateUpdated,
@JsonProperty("url")
final URI url) {
this.sid = sid;
this.alias = alias;
this.accountSid = accountSid;
this.friendlyName = friendlyName;
this.dataMetering = dataMetering;
this.capabilities = capabilities;
this.voiceCap = voiceCap;
this.messagingCap = messagingCap;
this.commandsCap = commandsCap;
this.dataCap = dataCap;
this.capPeriod = capPeriod;
this.capUnit = capUnit;
this.dateCreated = DateConverter.iso8601DateTimeFromString(dateCreated);
this.dateUpdated = DateConverter.iso8601DateTimeFromString(dateUpdated);
this.url = url;
}
/**
* Returns The The sid.
*
* @return The sid
*/
public final String getSid() {
return this.sid;
}
/**
* Returns The The alias.
*
* @return The alias
*/
public final String getAlias() {
return this.alias;
}
/**
* Returns The The account_sid.
*
* @return The account_sid
*/
public final String getAccountSid() {
return this.accountSid;
}
/**
* Returns The The friendly_name.
*
* @return The friendly_name
*/
public final String getFriendlyName() {
return this.friendlyName;
}
/**
* Returns The The data_metering.
*
* @return The data_metering
*/
public final String getDataMetering() {
return this.dataMetering;
}
/**
* Returns The The capabilities.
*
* @return The capabilities
*/
public final Map getCapabilities() {
return this.capabilities;
}
/**
* Returns The The voice_cap.
*
* @return The voice_cap
*/
public final Integer getVoiceCap() {
return this.voiceCap;
}
/**
* Returns The The messaging_cap.
*
* @return The messaging_cap
*/
public final Integer getMessagingCap() {
return this.messagingCap;
}
/**
* Returns The The commands_cap.
*
* @return The commands_cap
*/
public final Integer getCommandsCap() {
return this.commandsCap;
}
/**
* Returns The The data_cap.
*
* @return The data_cap
*/
public final Integer getDataCap() {
return this.dataCap;
}
/**
* Returns The The cap_period.
*
* @return The cap_period
*/
public final Integer getCapPeriod() {
return this.capPeriod;
}
/**
* Returns The The cap_unit.
*
* @return The cap_unit
*/
public final String getCapUnit() {
return this.capUnit;
}
/**
* Returns The The date_created.
*
* @return The date_created
*/
public final DateTime getDateCreated() {
return this.dateCreated;
}
/**
* Returns The The date_updated.
*
* @return The date_updated
*/
public final DateTime getDateUpdated() {
return this.dateUpdated;
}
/**
* Returns The The url.
*
* @return The url
*/
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;
}
RatePlan other = (RatePlan) o;
return Objects.equals(sid, other.sid) &&
Objects.equals(alias, other.alias) &&
Objects.equals(accountSid, other.accountSid) &&
Objects.equals(friendlyName, other.friendlyName) &&
Objects.equals(dataMetering, other.dataMetering) &&
Objects.equals(capabilities, other.capabilities) &&
Objects.equals(voiceCap, other.voiceCap) &&
Objects.equals(messagingCap, other.messagingCap) &&
Objects.equals(commandsCap, other.commandsCap) &&
Objects.equals(dataCap, other.dataCap) &&
Objects.equals(capPeriod, other.capPeriod) &&
Objects.equals(capUnit, other.capUnit) &&
Objects.equals(dateCreated, other.dateCreated) &&
Objects.equals(dateUpdated, other.dateUpdated) &&
Objects.equals(url, other.url);
}
@Override
public int hashCode() {
return Objects.hash(sid,
alias,
accountSid,
friendlyName,
dataMetering,
capabilities,
voiceCap,
messagingCap,
commandsCap,
dataCap,
capPeriod,
capUnit,
dateCreated,
dateUpdated,
url);
}
@Override
public String toString() {
return MoreObjects.toStringHelper(this)
.add("sid", sid)
.add("alias", alias)
.add("accountSid", accountSid)
.add("friendlyName", friendlyName)
.add("dataMetering", dataMetering)
.add("capabilities", capabilities)
.add("voiceCap", voiceCap)
.add("messagingCap", messagingCap)
.add("commandsCap", commandsCap)
.add("dataCap", dataCap)
.add("capPeriod", capPeriod)
.add("capUnit", capUnit)
.add("dateCreated", dateCreated)
.add("dateUpdated", dateUpdated)
.add("url", url)
.toString();
}
}