|
| 1 | +/* |
| 2 | + * This code was generated by |
| 3 | + * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ |
| 4 | + * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ |
| 5 | + * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ |
| 6 | + * |
| 7 | + * Twilio - Marketplace |
| 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.marketplace.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.exception.ApiConnectionException; |
| 25 | +import com.twilio.exception.ApiException; |
| 26 | +import java.io.IOException; |
| 27 | +import java.io.InputStream; |
| 28 | +import java.net.URI; |
| 29 | +import java.util.List; |
| 30 | +import java.util.Map; |
| 31 | +import java.util.Map; |
| 32 | +import java.util.Objects; |
| 33 | +import lombok.ToString; |
| 34 | +import lombok.ToString; |
| 35 | + |
| 36 | +@JsonIgnoreProperties(ignoreUnknown = true) |
| 37 | +@ToString |
| 38 | +public class ModuleData extends Resource { |
| 39 | + |
| 40 | + private static final long serialVersionUID = 132859226086963L; |
| 41 | + |
| 42 | + public static ModuleDataCreator creator() { |
| 43 | + return new ModuleDataCreator(); |
| 44 | + } |
| 45 | + |
| 46 | + public static ModuleDataFetcher fetcher() { |
| 47 | + return new ModuleDataFetcher(); |
| 48 | + } |
| 49 | + |
| 50 | + /** |
| 51 | + * Converts a JSON String into a ModuleData object using the provided ObjectMapper. |
| 52 | + * |
| 53 | + * @param json Raw JSON String |
| 54 | + * @param objectMapper Jackson ObjectMapper |
| 55 | + * @return ModuleData object represented by the provided JSON |
| 56 | + */ |
| 57 | + public static ModuleData fromJson( |
| 58 | + final String json, |
| 59 | + final ObjectMapper objectMapper |
| 60 | + ) { |
| 61 | + // Convert all checked exceptions to Runtime |
| 62 | + try { |
| 63 | + return objectMapper.readValue(json, ModuleData.class); |
| 64 | + } catch (final JsonMappingException | JsonParseException e) { |
| 65 | + throw new ApiException(e.getMessage(), e); |
| 66 | + } catch (final IOException e) { |
| 67 | + throw new ApiConnectionException(e.getMessage(), e); |
| 68 | + } |
| 69 | + } |
| 70 | + |
| 71 | + /** |
| 72 | + * Converts a JSON InputStream into a ModuleData object using the provided |
| 73 | + * ObjectMapper. |
| 74 | + * |
| 75 | + * @param json Raw JSON InputStream |
| 76 | + * @param objectMapper Jackson ObjectMapper |
| 77 | + * @return ModuleData object represented by the provided JSON |
| 78 | + */ |
| 79 | + public static ModuleData fromJson( |
| 80 | + final InputStream json, |
| 81 | + final ObjectMapper objectMapper |
| 82 | + ) { |
| 83 | + // Convert all checked exceptions to Runtime |
| 84 | + try { |
| 85 | + return objectMapper.readValue(json, ModuleData.class); |
| 86 | + } catch (final JsonMappingException | JsonParseException e) { |
| 87 | + throw new ApiException(e.getMessage(), e); |
| 88 | + } catch (final IOException e) { |
| 89 | + throw new ApiConnectionException(e.getMessage(), e); |
| 90 | + } |
| 91 | + } |
| 92 | + |
| 93 | + private final URI url; |
| 94 | + private final String sid; |
| 95 | + private final Map<String, Object> description; |
| 96 | + private final Map<String, Object> support; |
| 97 | + private final Map<String, Object> policies; |
| 98 | + private final Map<String, Object> moduleInfo; |
| 99 | + private final Map<String, Object> documentation; |
| 100 | + private final Map<String, Object> configuration; |
| 101 | + private final Map<String, Object> pricing; |
| 102 | + private final List<Map<String, Object>> listings; |
| 103 | + |
| 104 | + @JsonCreator |
| 105 | + private ModuleData( |
| 106 | + @JsonProperty("url") final URI url, |
| 107 | + @JsonProperty("sid") final String sid, |
| 108 | + @JsonProperty("description") final Map<String, Object> description, |
| 109 | + @JsonProperty("support") final Map<String, Object> support, |
| 110 | + @JsonProperty("policies") final Map<String, Object> policies, |
| 111 | + @JsonProperty("module_info") final Map<String, Object> moduleInfo, |
| 112 | + @JsonProperty("documentation") final Map<String, Object> documentation, |
| 113 | + @JsonProperty("configuration") final Map<String, Object> configuration, |
| 114 | + @JsonProperty("pricing") final Map<String, Object> pricing, |
| 115 | + @JsonProperty("listings") final List<Map<String, Object>> listings |
| 116 | + ) { |
| 117 | + this.url = url; |
| 118 | + this.sid = sid; |
| 119 | + this.description = description; |
| 120 | + this.support = support; |
| 121 | + this.policies = policies; |
| 122 | + this.moduleInfo = moduleInfo; |
| 123 | + this.documentation = documentation; |
| 124 | + this.configuration = configuration; |
| 125 | + this.pricing = pricing; |
| 126 | + this.listings = listings; |
| 127 | + } |
| 128 | + |
| 129 | + public final URI getUrl() { |
| 130 | + return this.url; |
| 131 | + } |
| 132 | + |
| 133 | + public final String getSid() { |
| 134 | + return this.sid; |
| 135 | + } |
| 136 | + |
| 137 | + public final Map<String, Object> getDescription() { |
| 138 | + return this.description; |
| 139 | + } |
| 140 | + |
| 141 | + public final Map<String, Object> getSupport() { |
| 142 | + return this.support; |
| 143 | + } |
| 144 | + |
| 145 | + public final Map<String, Object> getPolicies() { |
| 146 | + return this.policies; |
| 147 | + } |
| 148 | + |
| 149 | + public final Map<String, Object> getModuleInfo() { |
| 150 | + return this.moduleInfo; |
| 151 | + } |
| 152 | + |
| 153 | + public final Map<String, Object> getDocumentation() { |
| 154 | + return this.documentation; |
| 155 | + } |
| 156 | + |
| 157 | + public final Map<String, Object> getConfiguration() { |
| 158 | + return this.configuration; |
| 159 | + } |
| 160 | + |
| 161 | + public final Map<String, Object> getPricing() { |
| 162 | + return this.pricing; |
| 163 | + } |
| 164 | + |
| 165 | + public final List<Map<String, Object>> getListings() { |
| 166 | + return this.listings; |
| 167 | + } |
| 168 | + |
| 169 | + @Override |
| 170 | + public boolean equals(final Object o) { |
| 171 | + if (this == o) { |
| 172 | + return true; |
| 173 | + } |
| 174 | + |
| 175 | + if (o == null || getClass() != o.getClass()) { |
| 176 | + return false; |
| 177 | + } |
| 178 | + |
| 179 | + ModuleData other = (ModuleData) o; |
| 180 | + |
| 181 | + return ( |
| 182 | + Objects.equals(url, other.url) && |
| 183 | + Objects.equals(sid, other.sid) && |
| 184 | + Objects.equals(description, other.description) && |
| 185 | + Objects.equals(support, other.support) && |
| 186 | + Objects.equals(policies, other.policies) && |
| 187 | + Objects.equals(moduleInfo, other.moduleInfo) && |
| 188 | + Objects.equals(documentation, other.documentation) && |
| 189 | + Objects.equals(configuration, other.configuration) && |
| 190 | + Objects.equals(pricing, other.pricing) && |
| 191 | + Objects.equals(listings, other.listings) |
| 192 | + ); |
| 193 | + } |
| 194 | + |
| 195 | + @Override |
| 196 | + public int hashCode() { |
| 197 | + return Objects.hash( |
| 198 | + url, |
| 199 | + sid, |
| 200 | + description, |
| 201 | + support, |
| 202 | + policies, |
| 203 | + moduleInfo, |
| 204 | + documentation, |
| 205 | + configuration, |
| 206 | + pricing, |
| 207 | + listings |
| 208 | + ); |
| 209 | + } |
| 210 | +} |
0 commit comments