|
| 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.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.core.JsonParseException; |
| 22 | +import com.fasterxml.jackson.core.JsonProcessingException; |
| 23 | +import com.fasterxml.jackson.databind.JsonMappingException; |
| 24 | +import com.fasterxml.jackson.databind.ObjectMapper; |
| 25 | +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; |
| 26 | +import com.twilio.base.Resource; |
| 27 | +import com.twilio.base.Resource; |
| 28 | +import com.twilio.exception.ApiConnectionException; |
| 29 | +import com.twilio.exception.ApiException; |
| 30 | +import com.twilio.type.*; |
| 31 | +import java.io.IOException; |
| 32 | +import java.io.IOException; |
| 33 | +import java.io.InputStream; |
| 34 | +import java.net.URI; |
| 35 | +import java.time.ZonedDateTime; |
| 36 | +import java.util.Objects; |
| 37 | +import lombok.Getter; |
| 38 | +import lombok.ToString; |
| 39 | + |
| 40 | +@JsonIgnoreProperties(ignoreUnknown = true) |
| 41 | +@ToString |
| 42 | +public class DomainCerts extends Resource { |
| 43 | + |
| 44 | + public static DomainCertsFetcher fetcher(final String pathDomainSid) { |
| 45 | + return new DomainCertsFetcher(pathDomainSid); |
| 46 | + } |
| 47 | + |
| 48 | + /** |
| 49 | + * Converts a JSON String into a DomainCerts object using the provided ObjectMapper. |
| 50 | + * |
| 51 | + * @param json Raw JSON String |
| 52 | + * @param objectMapper Jackson ObjectMapper |
| 53 | + * @return DomainCerts object represented by the provided JSON |
| 54 | + */ |
| 55 | + public static DomainCerts fromJson( |
| 56 | + final String json, |
| 57 | + final ObjectMapper objectMapper |
| 58 | + ) { |
| 59 | + // Convert all checked exceptions to Runtime |
| 60 | + try { |
| 61 | + return objectMapper.readValue(json, DomainCerts.class); |
| 62 | + } catch (final JsonMappingException | JsonParseException e) { |
| 63 | + throw new ApiException(e.getMessage(), e); |
| 64 | + } catch (final IOException e) { |
| 65 | + throw new ApiConnectionException(e.getMessage(), e); |
| 66 | + } |
| 67 | + } |
| 68 | + |
| 69 | + /** |
| 70 | + * Converts a JSON InputStream into a DomainCerts object using the provided |
| 71 | + * ObjectMapper. |
| 72 | + * |
| 73 | + * @param json Raw JSON InputStream |
| 74 | + * @param objectMapper Jackson ObjectMapper |
| 75 | + * @return DomainCerts object represented by the provided JSON |
| 76 | + */ |
| 77 | + public static DomainCerts fromJson( |
| 78 | + final InputStream json, |
| 79 | + final ObjectMapper objectMapper |
| 80 | + ) { |
| 81 | + // Convert all checked exceptions to Runtime |
| 82 | + try { |
| 83 | + return objectMapper.readValue(json, DomainCerts.class); |
| 84 | + } catch (final JsonMappingException | JsonParseException e) { |
| 85 | + throw new ApiException(e.getMessage(), e); |
| 86 | + } catch (final IOException e) { |
| 87 | + throw new ApiConnectionException(e.getMessage(), e); |
| 88 | + } |
| 89 | + } |
| 90 | + |
| 91 | + public static String toJson(Object object, ObjectMapper mapper) { |
| 92 | + try { |
| 93 | + return mapper.writeValueAsString(object); |
| 94 | + } catch (final JsonMappingException e) { |
| 95 | + throw new ApiException(e.getMessage(), e); |
| 96 | + } catch (JsonProcessingException e) { |
| 97 | + throw new ApiException(e.getMessage(), e); |
| 98 | + } catch (final IOException e) { |
| 99 | + throw new ApiConnectionException(e.getMessage(), e); |
| 100 | + } |
| 101 | + } |
| 102 | + |
| 103 | + @Getter |
| 104 | + private final Object certInValidation; |
| 105 | + |
| 106 | + @Getter |
| 107 | + private final String certificateSid; |
| 108 | + |
| 109 | + @Getter |
| 110 | + private final ZonedDateTime dateCreated; |
| 111 | + |
| 112 | + @Getter |
| 113 | + private final ZonedDateTime dateExpires; |
| 114 | + |
| 115 | + @Getter |
| 116 | + private final ZonedDateTime dateUpdated; |
| 117 | + |
| 118 | + @Getter |
| 119 | + private final URI domainName; |
| 120 | + |
| 121 | + @Getter |
| 122 | + private final String domainSid; |
| 123 | + |
| 124 | + @Getter |
| 125 | + private final Boolean managed; |
| 126 | + |
| 127 | + @Getter |
| 128 | + private final Boolean requesting; |
| 129 | + |
| 130 | + @Getter |
| 131 | + private final URI url; |
| 132 | + |
| 133 | + @JsonCreator |
| 134 | + private DomainCerts( |
| 135 | + @JsonProperty("cert_in_validation") final Object certInValidation, |
| 136 | + @JsonProperty("certificate_sid") final String certificateSid, |
| 137 | + @JsonProperty("date_created") @JsonDeserialize( |
| 138 | + using = com.twilio.converter.ISO8601Deserializer.class |
| 139 | + ) final ZonedDateTime dateCreated, |
| 140 | + @JsonProperty("date_expires") @JsonDeserialize( |
| 141 | + using = com.twilio.converter.ISO8601Deserializer.class |
| 142 | + ) final ZonedDateTime dateExpires, |
| 143 | + @JsonProperty("date_updated") @JsonDeserialize( |
| 144 | + using = com.twilio.converter.ISO8601Deserializer.class |
| 145 | + ) final ZonedDateTime dateUpdated, |
| 146 | + @JsonProperty("domain_name") final URI domainName, |
| 147 | + @JsonProperty("domain_sid") final String domainSid, |
| 148 | + @JsonProperty("managed") final Boolean managed, |
| 149 | + @JsonProperty("requesting") final Boolean requesting, |
| 150 | + @JsonProperty("url") final URI url |
| 151 | + ) { |
| 152 | + this.certInValidation = certInValidation; |
| 153 | + this.certificateSid = certificateSid; |
| 154 | + this.dateCreated = dateCreated; |
| 155 | + this.dateExpires = dateExpires; |
| 156 | + this.dateUpdated = dateUpdated; |
| 157 | + this.domainName = domainName; |
| 158 | + this.domainSid = domainSid; |
| 159 | + this.managed = managed; |
| 160 | + this.requesting = requesting; |
| 161 | + this.url = url; |
| 162 | + } |
| 163 | + |
| 164 | + @Override |
| 165 | + public boolean equals(final Object o) { |
| 166 | + if (this == o) { |
| 167 | + return true; |
| 168 | + } |
| 169 | + |
| 170 | + if (o == null || getClass() != o.getClass()) { |
| 171 | + return false; |
| 172 | + } |
| 173 | + |
| 174 | + DomainCerts other = (DomainCerts) o; |
| 175 | + return ( |
| 176 | + Objects.equals(certInValidation, other.certInValidation) && |
| 177 | + Objects.equals(certificateSid, other.certificateSid) && |
| 178 | + Objects.equals(dateCreated, other.dateCreated) && |
| 179 | + Objects.equals(dateExpires, other.dateExpires) && |
| 180 | + Objects.equals(dateUpdated, other.dateUpdated) && |
| 181 | + Objects.equals(domainName, other.domainName) && |
| 182 | + Objects.equals(domainSid, other.domainSid) && |
| 183 | + Objects.equals(managed, other.managed) && |
| 184 | + Objects.equals(requesting, other.requesting) && |
| 185 | + Objects.equals(url, other.url) |
| 186 | + ); |
| 187 | + } |
| 188 | + |
| 189 | + @Override |
| 190 | + public int hashCode() { |
| 191 | + return Objects.hash( |
| 192 | + certInValidation, |
| 193 | + certificateSid, |
| 194 | + dateCreated, |
| 195 | + dateExpires, |
| 196 | + dateUpdated, |
| 197 | + domainName, |
| 198 | + domainSid, |
| 199 | + managed, |
| 200 | + requesting, |
| 201 | + url |
| 202 | + ); |
| 203 | + } |
| 204 | +} |
0 commit comments