|
| 1 | +/* |
| 2 | + * This code was generated by |
| 3 | + * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ |
| 4 | + * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ |
| 5 | + * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ |
| 6 | + * |
| 7 | + * Twilio - Messaging |
| 8 | + * This is the public Twilio REST API. |
| 9 | + * |
| 10 | + * NOTE: This class is auto generated by OpenAPI Generator. |
| 11 | + * https://openapi-generator.tech |
| 12 | + * Do not edit the class manually. |
| 13 | + */ |
| 14 | + |
| 15 | +package com.twilio.rest.messaging.v1.service; |
| 16 | + |
| 17 | +import com.fasterxml.jackson.annotation.JsonCreator; |
| 18 | +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; |
| 19 | +import com.fasterxml.jackson.annotation.JsonProperty; |
| 20 | +import com.fasterxml.jackson.core.JsonParseException; |
| 21 | +import com.fasterxml.jackson.databind.JsonMappingException; |
| 22 | +import com.fasterxml.jackson.databind.ObjectMapper; |
| 23 | +import com.twilio.base.Resource; |
| 24 | +import com.twilio.converter.DateConverter; |
| 25 | +import com.twilio.exception.ApiConnectionException; |
| 26 | +import com.twilio.exception.ApiException; |
| 27 | +import java.io.IOException; |
| 28 | +import java.io.InputStream; |
| 29 | +import java.net.URI; |
| 30 | +import java.time.ZonedDateTime; |
| 31 | +import java.util.List; |
| 32 | +import java.util.Objects; |
| 33 | +import lombok.ToString; |
| 34 | +import lombok.ToString; |
| 35 | + |
| 36 | +@JsonIgnoreProperties(ignoreUnknown = true) |
| 37 | +@ToString |
| 38 | +public class DestinationAlphaSender extends Resource { |
| 39 | + |
| 40 | + private static final long serialVersionUID = 148729356404048L; |
| 41 | + |
| 42 | + public static DestinationAlphaSenderCreator creator( |
| 43 | + final String pathServiceSid, |
| 44 | + final String alphaSender |
| 45 | + ) { |
| 46 | + return new DestinationAlphaSenderCreator(pathServiceSid, alphaSender); |
| 47 | + } |
| 48 | + |
| 49 | + public static DestinationAlphaSenderDeleter deleter( |
| 50 | + final String pathServiceSid, |
| 51 | + final String pathSid |
| 52 | + ) { |
| 53 | + return new DestinationAlphaSenderDeleter(pathServiceSid, pathSid); |
| 54 | + } |
| 55 | + |
| 56 | + public static DestinationAlphaSenderFetcher fetcher( |
| 57 | + final String pathServiceSid, |
| 58 | + final String pathSid |
| 59 | + ) { |
| 60 | + return new DestinationAlphaSenderFetcher(pathServiceSid, pathSid); |
| 61 | + } |
| 62 | + |
| 63 | + public static DestinationAlphaSenderReader reader( |
| 64 | + final String pathServiceSid |
| 65 | + ) { |
| 66 | + return new DestinationAlphaSenderReader(pathServiceSid); |
| 67 | + } |
| 68 | + |
| 69 | + /** |
| 70 | + * Converts a JSON String into a DestinationAlphaSender object using the provided ObjectMapper. |
| 71 | + * |
| 72 | + * @param json Raw JSON String |
| 73 | + * @param objectMapper Jackson ObjectMapper |
| 74 | + * @return DestinationAlphaSender object represented by the provided JSON |
| 75 | + */ |
| 76 | + public static DestinationAlphaSender fromJson( |
| 77 | + final String json, |
| 78 | + final ObjectMapper objectMapper |
| 79 | + ) { |
| 80 | + // Convert all checked exceptions to Runtime |
| 81 | + try { |
| 82 | + return objectMapper.readValue(json, DestinationAlphaSender.class); |
| 83 | + } catch (final JsonMappingException | JsonParseException e) { |
| 84 | + throw new ApiException(e.getMessage(), e); |
| 85 | + } catch (final IOException e) { |
| 86 | + throw new ApiConnectionException(e.getMessage(), e); |
| 87 | + } |
| 88 | + } |
| 89 | + |
| 90 | + /** |
| 91 | + * Converts a JSON InputStream into a DestinationAlphaSender object using the provided |
| 92 | + * ObjectMapper. |
| 93 | + * |
| 94 | + * @param json Raw JSON InputStream |
| 95 | + * @param objectMapper Jackson ObjectMapper |
| 96 | + * @return DestinationAlphaSender object represented by the provided JSON |
| 97 | + */ |
| 98 | + public static DestinationAlphaSender fromJson( |
| 99 | + final InputStream json, |
| 100 | + final ObjectMapper objectMapper |
| 101 | + ) { |
| 102 | + // Convert all checked exceptions to Runtime |
| 103 | + try { |
| 104 | + return objectMapper.readValue(json, DestinationAlphaSender.class); |
| 105 | + } catch (final JsonMappingException | JsonParseException e) { |
| 106 | + throw new ApiException(e.getMessage(), e); |
| 107 | + } catch (final IOException e) { |
| 108 | + throw new ApiConnectionException(e.getMessage(), e); |
| 109 | + } |
| 110 | + } |
| 111 | + |
| 112 | + private final String sid; |
| 113 | + private final String accountSid; |
| 114 | + private final String serviceSid; |
| 115 | + private final ZonedDateTime dateCreated; |
| 116 | + private final ZonedDateTime dateUpdated; |
| 117 | + private final String alphaSender; |
| 118 | + private final List<String> capabilities; |
| 119 | + private final URI url; |
| 120 | + private final String isoCountryCode; |
| 121 | + |
| 122 | + @JsonCreator |
| 123 | + private DestinationAlphaSender( |
| 124 | + @JsonProperty("sid") final String sid, |
| 125 | + @JsonProperty("account_sid") final String accountSid, |
| 126 | + @JsonProperty("service_sid") final String serviceSid, |
| 127 | + @JsonProperty("date_created") final String dateCreated, |
| 128 | + @JsonProperty("date_updated") final String dateUpdated, |
| 129 | + @JsonProperty("alpha_sender") final String alphaSender, |
| 130 | + @JsonProperty("capabilities") final List<String> capabilities, |
| 131 | + @JsonProperty("url") final URI url, |
| 132 | + @JsonProperty("iso_country_code") final String isoCountryCode |
| 133 | + ) { |
| 134 | + this.sid = sid; |
| 135 | + this.accountSid = accountSid; |
| 136 | + this.serviceSid = serviceSid; |
| 137 | + this.dateCreated = DateConverter.iso8601DateTimeFromString(dateCreated); |
| 138 | + this.dateUpdated = DateConverter.iso8601DateTimeFromString(dateUpdated); |
| 139 | + this.alphaSender = alphaSender; |
| 140 | + this.capabilities = capabilities; |
| 141 | + this.url = url; |
| 142 | + this.isoCountryCode = isoCountryCode; |
| 143 | + } |
| 144 | + |
| 145 | + public final String getSid() { |
| 146 | + return this.sid; |
| 147 | + } |
| 148 | + |
| 149 | + public final String getAccountSid() { |
| 150 | + return this.accountSid; |
| 151 | + } |
| 152 | + |
| 153 | + public final String getServiceSid() { |
| 154 | + return this.serviceSid; |
| 155 | + } |
| 156 | + |
| 157 | + public final ZonedDateTime getDateCreated() { |
| 158 | + return this.dateCreated; |
| 159 | + } |
| 160 | + |
| 161 | + public final ZonedDateTime getDateUpdated() { |
| 162 | + return this.dateUpdated; |
| 163 | + } |
| 164 | + |
| 165 | + public final String getAlphaSender() { |
| 166 | + return this.alphaSender; |
| 167 | + } |
| 168 | + |
| 169 | + public final List<String> getCapabilities() { |
| 170 | + return this.capabilities; |
| 171 | + } |
| 172 | + |
| 173 | + public final URI getUrl() { |
| 174 | + return this.url; |
| 175 | + } |
| 176 | + |
| 177 | + public final String getIsoCountryCode() { |
| 178 | + return this.isoCountryCode; |
| 179 | + } |
| 180 | + |
| 181 | + @Override |
| 182 | + public boolean equals(final Object o) { |
| 183 | + if (this == o) { |
| 184 | + return true; |
| 185 | + } |
| 186 | + |
| 187 | + if (o == null || getClass() != o.getClass()) { |
| 188 | + return false; |
| 189 | + } |
| 190 | + |
| 191 | + DestinationAlphaSender other = (DestinationAlphaSender) o; |
| 192 | + |
| 193 | + return ( |
| 194 | + Objects.equals(sid, other.sid) && |
| 195 | + Objects.equals(accountSid, other.accountSid) && |
| 196 | + Objects.equals(serviceSid, other.serviceSid) && |
| 197 | + Objects.equals(dateCreated, other.dateCreated) && |
| 198 | + Objects.equals(dateUpdated, other.dateUpdated) && |
| 199 | + Objects.equals(alphaSender, other.alphaSender) && |
| 200 | + Objects.equals(capabilities, other.capabilities) && |
| 201 | + Objects.equals(url, other.url) && |
| 202 | + Objects.equals(isoCountryCode, other.isoCountryCode) |
| 203 | + ); |
| 204 | + } |
| 205 | + |
| 206 | + @Override |
| 207 | + public int hashCode() { |
| 208 | + return Objects.hash( |
| 209 | + sid, |
| 210 | + accountSid, |
| 211 | + serviceSid, |
| 212 | + dateCreated, |
| 213 | + dateUpdated, |
| 214 | + alphaSender, |
| 215 | + capabilities, |
| 216 | + url, |
| 217 | + isoCountryCode |
| 218 | + ); |
| 219 | + } |
| 220 | +} |
0 commit comments