|
| 1 | +/* |
| 2 | + * This code was generated by |
| 3 | + * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ |
| 4 | + * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ |
| 5 | + * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ |
| 6 | + * |
| 7 | + * Twilio - Numbers |
| 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.numbers.v1; |
| 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 | + |
| 30 | +import lombok.ToString; |
| 31 | + |
| 32 | +import java.io.IOException; |
| 33 | +import java.io.InputStream; |
| 34 | +import java.net.URI; |
| 35 | +import java.time.ZonedDateTime; |
| 36 | + |
| 37 | +import java.util.List; |
| 38 | +import java.util.Map; |
| 39 | +import java.util.Objects; |
| 40 | + |
| 41 | + |
| 42 | +import java.util.Map; |
| 43 | + |
| 44 | +@JsonIgnoreProperties(ignoreUnknown = true) |
| 45 | +@ToString |
| 46 | +public class PortingBulkPortability extends Resource { |
| 47 | + private static final long serialVersionUID = 54521824330020L; |
| 48 | + |
| 49 | + public static PortingBulkPortabilityCreator creator(final List<String> phoneNumbers){ |
| 50 | + return new PortingBulkPortabilityCreator(phoneNumbers); |
| 51 | + } |
| 52 | + |
| 53 | + public static PortingBulkPortabilityFetcher fetcher(final String pathSid){ |
| 54 | + return new PortingBulkPortabilityFetcher(pathSid); |
| 55 | + } |
| 56 | + |
| 57 | + /** |
| 58 | + * Converts a JSON String into a PortingBulkPortability object using the provided ObjectMapper. |
| 59 | + * |
| 60 | + * @param json Raw JSON String |
| 61 | + * @param objectMapper Jackson ObjectMapper |
| 62 | + * @return PortingBulkPortability object represented by the provided JSON |
| 63 | + */ |
| 64 | + public static PortingBulkPortability fromJson(final String json, final ObjectMapper objectMapper) { |
| 65 | + // Convert all checked exceptions to Runtime |
| 66 | + try { |
| 67 | + return objectMapper.readValue(json, PortingBulkPortability.class); |
| 68 | + } catch (final JsonMappingException | JsonParseException e) { |
| 69 | + throw new ApiException(e.getMessage(), e); |
| 70 | + } catch (final IOException e) { |
| 71 | + throw new ApiConnectionException(e.getMessage(), e); |
| 72 | + } |
| 73 | + } |
| 74 | + |
| 75 | + /** |
| 76 | + * Converts a JSON InputStream into a PortingBulkPortability object using the provided |
| 77 | + * ObjectMapper. |
| 78 | + * |
| 79 | + * @param json Raw JSON InputStream |
| 80 | + * @param objectMapper Jackson ObjectMapper |
| 81 | + * @return PortingBulkPortability object represented by the provided JSON |
| 82 | + */ |
| 83 | + public static PortingBulkPortability fromJson(final InputStream json, final ObjectMapper objectMapper) { |
| 84 | + // Convert all checked exceptions to Runtime |
| 85 | + try { |
| 86 | + return objectMapper.readValue(json, PortingBulkPortability.class); |
| 87 | + } catch (final JsonMappingException | JsonParseException e) { |
| 88 | + throw new ApiException(e.getMessage(), e); |
| 89 | + } catch (final IOException e) { |
| 90 | + throw new ApiConnectionException(e.getMessage(), e); |
| 91 | + } |
| 92 | + } |
| 93 | + public enum Status { |
| 94 | + IN_PROGRESS("in-progress"), |
| 95 | + COMPLETED("completed"), |
| 96 | + EXPIRED("expired"); |
| 97 | + |
| 98 | + private final String value; |
| 99 | + |
| 100 | + private Status(final String value) { |
| 101 | + this.value = value; |
| 102 | + } |
| 103 | + |
| 104 | + public String toString() { |
| 105 | + return value; |
| 106 | + } |
| 107 | + |
| 108 | + @JsonCreator |
| 109 | + public static Status forValue(final String value) { |
| 110 | + return Promoter.enumFromString(value, Status.values()); |
| 111 | + } |
| 112 | + } |
| 113 | + |
| 114 | + private final String sid; |
| 115 | + private final PortingBulkPortability.Status status; |
| 116 | + private final ZonedDateTime datetimeCreated; |
| 117 | + private final List<Map<String, Object>> phoneNumbers; |
| 118 | + private final URI url; |
| 119 | + |
| 120 | + @JsonCreator |
| 121 | + private PortingBulkPortability( |
| 122 | + @JsonProperty("sid") |
| 123 | + final String sid, |
| 124 | + |
| 125 | + @JsonProperty("status") |
| 126 | + final PortingBulkPortability.Status status, |
| 127 | + |
| 128 | + @JsonProperty("datetime_created") |
| 129 | + final String datetimeCreated, |
| 130 | + |
| 131 | + @JsonProperty("phone_numbers") |
| 132 | + final List<Map<String, Object>> phoneNumbers, |
| 133 | + |
| 134 | + @JsonProperty("url") |
| 135 | + final URI url |
| 136 | + ) { |
| 137 | + this.sid = sid; |
| 138 | + this.status = status; |
| 139 | + this.datetimeCreated = DateConverter.iso8601DateTimeFromString(datetimeCreated); |
| 140 | + this.phoneNumbers = phoneNumbers; |
| 141 | + this.url = url; |
| 142 | + } |
| 143 | + |
| 144 | + public final String getSid() { |
| 145 | + return this.sid; |
| 146 | + } |
| 147 | + public final PortingBulkPortability.Status getStatus() { |
| 148 | + return this.status; |
| 149 | + } |
| 150 | + public final ZonedDateTime getDatetimeCreated() { |
| 151 | + return this.datetimeCreated; |
| 152 | + } |
| 153 | + public final List<Map<String, Object>> getPhoneNumbers() { |
| 154 | + return this.phoneNumbers; |
| 155 | + } |
| 156 | + public final URI getUrl() { |
| 157 | + return this.url; |
| 158 | + } |
| 159 | + |
| 160 | + @Override |
| 161 | + public boolean equals(final Object o) { |
| 162 | + if (this==o) { |
| 163 | + return true; |
| 164 | + } |
| 165 | + |
| 166 | + if (o == null || getClass() != o.getClass()) { |
| 167 | + return false; |
| 168 | + } |
| 169 | + |
| 170 | + PortingBulkPortability other = (PortingBulkPortability) o; |
| 171 | + |
| 172 | + return Objects.equals(sid, other.sid) && Objects.equals(status, other.status) && Objects.equals(datetimeCreated, other.datetimeCreated) && Objects.equals(phoneNumbers, other.phoneNumbers) && Objects.equals(url, other.url) ; |
| 173 | + } |
| 174 | + |
| 175 | + @Override |
| 176 | + public int hashCode() { |
| 177 | + return Objects.hash(sid, status, datetimeCreated, phoneNumbers, url); |
| 178 | + } |
| 179 | + |
| 180 | +} |
| 181 | + |
0 commit comments