|
| 1 | +/* |
| 2 | + * This code was generated by |
| 3 | + * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ |
| 4 | + * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ |
| 5 | + * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ |
| 6 | + * |
| 7 | + * Twilio - Intelligence |
| 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.intelligence.v2; |
| 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.converter.Promoter; |
| 26 | +import com.twilio.exception.ApiConnectionException; |
| 27 | + |
| 28 | +import com.twilio.exception.ApiException; |
| 29 | +import com.twilio.http.HttpMethod; |
| 30 | + |
| 31 | +import lombok.ToString; |
| 32 | + |
| 33 | +import java.io.IOException; |
| 34 | +import java.io.InputStream; |
| 35 | +import java.net.URI; |
| 36 | +import java.time.ZonedDateTime; |
| 37 | + |
| 38 | +import java.util.Objects; |
| 39 | + |
| 40 | + |
| 41 | + |
| 42 | +@JsonIgnoreProperties(ignoreUnknown = true) |
| 43 | +@ToString |
| 44 | +public class Service extends Resource { |
| 45 | + private static final long serialVersionUID = 160239821590245L; |
| 46 | + |
| 47 | + public static ServiceCreator creator(final String uniqueName){ |
| 48 | + return new ServiceCreator(uniqueName); |
| 49 | + } |
| 50 | + |
| 51 | + public static ServiceDeleter deleter(final String pathSid){ |
| 52 | + return new ServiceDeleter(pathSid); |
| 53 | + } |
| 54 | + |
| 55 | + public static ServiceFetcher fetcher(final String pathSid){ |
| 56 | + return new ServiceFetcher(pathSid); |
| 57 | + } |
| 58 | + |
| 59 | + public static ServiceReader reader(){ |
| 60 | + return new ServiceReader(); |
| 61 | + } |
| 62 | + |
| 63 | + public static ServiceUpdater updater(final String pathSid){ |
| 64 | + return new ServiceUpdater(pathSid); |
| 65 | + } |
| 66 | + |
| 67 | + /** |
| 68 | + * Converts a JSON String into a Service object using the provided ObjectMapper. |
| 69 | + * |
| 70 | + * @param json Raw JSON String |
| 71 | + * @param objectMapper Jackson ObjectMapper |
| 72 | + * @return Service object represented by the provided JSON |
| 73 | + */ |
| 74 | + public static Service fromJson(final String json, final ObjectMapper objectMapper) { |
| 75 | + // Convert all checked exceptions to Runtime |
| 76 | + try { |
| 77 | + return objectMapper.readValue(json, Service.class); |
| 78 | + } catch (final JsonMappingException | JsonParseException e) { |
| 79 | + throw new ApiException(e.getMessage(), e); |
| 80 | + } catch (final IOException e) { |
| 81 | + throw new ApiConnectionException(e.getMessage(), e); |
| 82 | + } |
| 83 | + } |
| 84 | + |
| 85 | + /** |
| 86 | + * Converts a JSON InputStream into a Service object using the provided |
| 87 | + * ObjectMapper. |
| 88 | + * |
| 89 | + * @param json Raw JSON InputStream |
| 90 | + * @param objectMapper Jackson ObjectMapper |
| 91 | + * @return Service object represented by the provided JSON |
| 92 | + */ |
| 93 | + public static Service fromJson(final InputStream json, final ObjectMapper objectMapper) { |
| 94 | + // Convert all checked exceptions to Runtime |
| 95 | + try { |
| 96 | + return objectMapper.readValue(json, Service.class); |
| 97 | + } catch (final JsonMappingException | JsonParseException e) { |
| 98 | + throw new ApiException(e.getMessage(), e); |
| 99 | + } catch (final IOException e) { |
| 100 | + throw new ApiConnectionException(e.getMessage(), e); |
| 101 | + } |
| 102 | + } |
| 103 | + public enum HttpMethod { |
| 104 | + GET("GET"), |
| 105 | + POST("POST"), |
| 106 | + NULL("NULL"); |
| 107 | + |
| 108 | + private final String value; |
| 109 | + |
| 110 | + private HttpMethod(final String value) { |
| 111 | + this.value = value; |
| 112 | + } |
| 113 | + |
| 114 | + public String toString() { |
| 115 | + return value; |
| 116 | + } |
| 117 | + |
| 118 | + @JsonCreator |
| 119 | + public static HttpMethod forValue(final String value) { |
| 120 | + return Promoter.enumFromString(value, HttpMethod.values()); |
| 121 | + } |
| 122 | + } |
| 123 | + |
| 124 | + private final String accountSid; |
| 125 | + private final Boolean autoRedaction; |
| 126 | + private final Boolean mediaRedaction; |
| 127 | + private final Boolean autoTranscribe; |
| 128 | + private final Boolean dataLogging; |
| 129 | + private final ZonedDateTime dateCreated; |
| 130 | + private final ZonedDateTime dateUpdated; |
| 131 | + private final String friendlyName; |
| 132 | + private final String languageCode; |
| 133 | + private final String sid; |
| 134 | + private final String uniqueName; |
| 135 | + private final URI url; |
| 136 | + private final String webhookUrl; |
| 137 | + private final Service.HttpMethod webhookHttpMethod; |
| 138 | + private final Integer version; |
| 139 | + |
| 140 | + @JsonCreator |
| 141 | + private Service( |
| 142 | + @JsonProperty("account_sid") |
| 143 | + final String accountSid, |
| 144 | + |
| 145 | + @JsonProperty("auto_redaction") |
| 146 | + final Boolean autoRedaction, |
| 147 | + |
| 148 | + @JsonProperty("media_redaction") |
| 149 | + final Boolean mediaRedaction, |
| 150 | + |
| 151 | + @JsonProperty("auto_transcribe") |
| 152 | + final Boolean autoTranscribe, |
| 153 | + |
| 154 | + @JsonProperty("data_logging") |
| 155 | + final Boolean dataLogging, |
| 156 | + |
| 157 | + @JsonProperty("date_created") |
| 158 | + final String dateCreated, |
| 159 | + |
| 160 | + @JsonProperty("date_updated") |
| 161 | + final String dateUpdated, |
| 162 | + |
| 163 | + @JsonProperty("friendly_name") |
| 164 | + final String friendlyName, |
| 165 | + |
| 166 | + @JsonProperty("language_code") |
| 167 | + final String languageCode, |
| 168 | + |
| 169 | + @JsonProperty("sid") |
| 170 | + final String sid, |
| 171 | + |
| 172 | + @JsonProperty("unique_name") |
| 173 | + final String uniqueName, |
| 174 | + |
| 175 | + @JsonProperty("url") |
| 176 | + final URI url, |
| 177 | + |
| 178 | + @JsonProperty("webhook_url") |
| 179 | + final String webhookUrl, |
| 180 | + |
| 181 | + @JsonProperty("webhook_http_method") |
| 182 | + final Service.HttpMethod webhookHttpMethod, |
| 183 | + |
| 184 | + @JsonProperty("version") |
| 185 | + final Integer version |
| 186 | + ) { |
| 187 | + this.accountSid = accountSid; |
| 188 | + this.autoRedaction = autoRedaction; |
| 189 | + this.mediaRedaction = mediaRedaction; |
| 190 | + this.autoTranscribe = autoTranscribe; |
| 191 | + this.dataLogging = dataLogging; |
| 192 | + this.dateCreated = DateConverter.iso8601DateTimeFromString(dateCreated); |
| 193 | + this.dateUpdated = DateConverter.iso8601DateTimeFromString(dateUpdated); |
| 194 | + this.friendlyName = friendlyName; |
| 195 | + this.languageCode = languageCode; |
| 196 | + this.sid = sid; |
| 197 | + this.uniqueName = uniqueName; |
| 198 | + this.url = url; |
| 199 | + this.webhookUrl = webhookUrl; |
| 200 | + this.webhookHttpMethod = webhookHttpMethod; |
| 201 | + this.version = version; |
| 202 | + } |
| 203 | + |
| 204 | + public final String getAccountSid() { |
| 205 | + return this.accountSid; |
| 206 | + } |
| 207 | + public final Boolean getAutoRedaction() { |
| 208 | + return this.autoRedaction; |
| 209 | + } |
| 210 | + public final Boolean getMediaRedaction() { |
| 211 | + return this.mediaRedaction; |
| 212 | + } |
| 213 | + public final Boolean getAutoTranscribe() { |
| 214 | + return this.autoTranscribe; |
| 215 | + } |
| 216 | + public final Boolean getDataLogging() { |
| 217 | + return this.dataLogging; |
| 218 | + } |
| 219 | + public final ZonedDateTime getDateCreated() { |
| 220 | + return this.dateCreated; |
| 221 | + } |
| 222 | + public final ZonedDateTime getDateUpdated() { |
| 223 | + return this.dateUpdated; |
| 224 | + } |
| 225 | + public final String getFriendlyName() { |
| 226 | + return this.friendlyName; |
| 227 | + } |
| 228 | + public final String getLanguageCode() { |
| 229 | + return this.languageCode; |
| 230 | + } |
| 231 | + public final String getSid() { |
| 232 | + return this.sid; |
| 233 | + } |
| 234 | + public final String getUniqueName() { |
| 235 | + return this.uniqueName; |
| 236 | + } |
| 237 | + public final URI getUrl() { |
| 238 | + return this.url; |
| 239 | + } |
| 240 | + public final String getWebhookUrl() { |
| 241 | + return this.webhookUrl; |
| 242 | + } |
| 243 | + public final Service.HttpMethod getWebhookHttpMethod() { |
| 244 | + return this.webhookHttpMethod; |
| 245 | + } |
| 246 | + public final Integer getVersion() { |
| 247 | + return this.version; |
| 248 | + } |
| 249 | + |
| 250 | + @Override |
| 251 | + public boolean equals(final Object o) { |
| 252 | + if (this==o) { |
| 253 | + return true; |
| 254 | + } |
| 255 | + |
| 256 | + if (o == null || getClass() != o.getClass()) { |
| 257 | + return false; |
| 258 | + } |
| 259 | + |
| 260 | + Service other = (Service) o; |
| 261 | + |
| 262 | + return Objects.equals(accountSid, other.accountSid) && Objects.equals(autoRedaction, other.autoRedaction) && Objects.equals(mediaRedaction, other.mediaRedaction) && Objects.equals(autoTranscribe, other.autoTranscribe) && Objects.equals(dataLogging, other.dataLogging) && Objects.equals(dateCreated, other.dateCreated) && Objects.equals(dateUpdated, other.dateUpdated) && Objects.equals(friendlyName, other.friendlyName) && Objects.equals(languageCode, other.languageCode) && Objects.equals(sid, other.sid) && Objects.equals(uniqueName, other.uniqueName) && Objects.equals(url, other.url) && Objects.equals(webhookUrl, other.webhookUrl) && Objects.equals(webhookHttpMethod, other.webhookHttpMethod) && Objects.equals(version, other.version) ; |
| 263 | + } |
| 264 | + |
| 265 | + @Override |
| 266 | + public int hashCode() { |
| 267 | + return Objects.hash(accountSid, autoRedaction, mediaRedaction, autoTranscribe, dataLogging, dateCreated, dateUpdated, friendlyName, languageCode, sid, uniqueName, url, webhookUrl, webhookHttpMethod, version); |
| 268 | + } |
| 269 | + |
| 270 | +} |
| 271 | + |
0 commit comments