From d3f4f8884eb675d614b659185e142bcedda9d4c7 Mon Sep 17 00:00:00 2001 From: Twilio Date: Mon, 13 Jan 2025 11:43:53 +0000 Subject: [PATCH] [Librarian] Regenerated @ d9b0f7b0297f064eec2f219b29fd4193559c54f3 405f363a58346c6557d4194de16d9911b797e208 --- CHANGES.md | 6 + .../rest/iam/v1/{NewApiKey.java => Key.java} | 26 +-- ...{NewApiKeyCreator.java => KeyCreator.java} | 23 +- .../rest/marketplace/v1/ModuleData.java | 210 ++++++++++++++++++ .../marketplace/v1/ModuleDataCreator.java | 89 ++++++++ .../marketplace/v1/ModuleDataFetcher.java | 67 ++++++ ...okConfigurationFetch.java => Webhook.java} | 33 ++- ...nFetchFetcher.java => WebhookFetcher.java} | 16 +- 8 files changed, 413 insertions(+), 57 deletions(-) rename src/main/java/com/twilio/rest/iam/v1/{NewApiKey.java => Key.java} (87%) rename src/main/java/com/twilio/rest/iam/v1/{NewApiKeyCreator.java => KeyCreator.java} (81%) create mode 100644 src/main/java/com/twilio/rest/marketplace/v1/ModuleData.java create mode 100644 src/main/java/com/twilio/rest/marketplace/v1/ModuleDataCreator.java create mode 100644 src/main/java/com/twilio/rest/marketplace/v1/ModuleDataFetcher.java rename src/main/java/com/twilio/rest/numbers/v1/{PortingWebhookConfigurationFetch.java => Webhook.java} (82%) rename src/main/java/com/twilio/rest/numbers/v1/{PortingWebhookConfigurationFetchFetcher.java => WebhookFetcher.java} (79%) diff --git a/CHANGES.md b/CHANGES.md index 9cfcae796..d863fc464 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -1,6 +1,12 @@ twilio-java changelog ===================== +[2025-01-13] Version 10.6.7 +--------------------------- +**Messaging** +- Adds validity period Default value in service resource documentation + + [2025-01-09] Version 10.6.6 --------------------------- **Numbers** diff --git a/src/main/java/com/twilio/rest/iam/v1/NewApiKey.java b/src/main/java/com/twilio/rest/iam/v1/Key.java similarity index 87% rename from src/main/java/com/twilio/rest/iam/v1/NewApiKey.java rename to src/main/java/com/twilio/rest/iam/v1/Key.java index 366a2d71c..30eb55c8b 100644 --- a/src/main/java/com/twilio/rest/iam/v1/NewApiKey.java +++ b/src/main/java/com/twilio/rest/iam/v1/Key.java @@ -36,28 +36,28 @@ @JsonIgnoreProperties(ignoreUnknown = true) @ToString -public class NewApiKey extends Resource { +public class Key extends Resource { private static final long serialVersionUID = 217181042856619L; - public static NewApiKeyCreator creator(final String accountSid) { - return new NewApiKeyCreator(accountSid); + public static KeyCreator creator(final String accountSid) { + return new KeyCreator(accountSid); } /** - * Converts a JSON String into a NewApiKey object using the provided ObjectMapper. + * Converts a JSON String into a Key object using the provided ObjectMapper. * * @param json Raw JSON String * @param objectMapper Jackson ObjectMapper - * @return NewApiKey object represented by the provided JSON + * @return Key object represented by the provided JSON */ - public static NewApiKey fromJson( + public static Key fromJson( final String json, final ObjectMapper objectMapper ) { // Convert all checked exceptions to Runtime try { - return objectMapper.readValue(json, NewApiKey.class); + return objectMapper.readValue(json, Key.class); } catch (final JsonMappingException | JsonParseException e) { throw new ApiException(e.getMessage(), e); } catch (final IOException e) { @@ -66,20 +66,20 @@ public static NewApiKey fromJson( } /** - * Converts a JSON InputStream into a NewApiKey object using the provided + * Converts a JSON InputStream into a Key object using the provided * ObjectMapper. * * @param json Raw JSON InputStream * @param objectMapper Jackson ObjectMapper - * @return NewApiKey object represented by the provided JSON + * @return Key object represented by the provided JSON */ - public static NewApiKey fromJson( + public static Key fromJson( final InputStream json, final ObjectMapper objectMapper ) { // Convert all checked exceptions to Runtime try { - return objectMapper.readValue(json, NewApiKey.class); + return objectMapper.readValue(json, Key.class); } catch (final JsonMappingException | JsonParseException e) { throw new ApiException(e.getMessage(), e); } catch (final IOException e) { @@ -95,7 +95,7 @@ public static NewApiKey fromJson( private final Map policy; @JsonCreator - private NewApiKey( + private Key( @JsonProperty("sid") final String sid, @JsonProperty("friendly_name") final String friendlyName, @JsonProperty("date_created") final String dateCreated, @@ -145,7 +145,7 @@ public boolean equals(final Object o) { return false; } - NewApiKey other = (NewApiKey) o; + Key other = (Key) o; return ( Objects.equals(sid, other.sid) && diff --git a/src/main/java/com/twilio/rest/iam/v1/NewApiKeyCreator.java b/src/main/java/com/twilio/rest/iam/v1/KeyCreator.java similarity index 81% rename from src/main/java/com/twilio/rest/iam/v1/NewApiKeyCreator.java rename to src/main/java/com/twilio/rest/iam/v1/KeyCreator.java index bad41944a..5d002244d 100644 --- a/src/main/java/com/twilio/rest/iam/v1/NewApiKeyCreator.java +++ b/src/main/java/com/twilio/rest/iam/v1/KeyCreator.java @@ -29,39 +29,39 @@ import java.util.Map; import java.util.Map; -public class NewApiKeyCreator extends Creator { +public class KeyCreator extends Creator { private String accountSid; private String friendlyName; - private NewApiKey.Keytype keyType; + private Key.Keytype keyType; private Map policy; - public NewApiKeyCreator(final String accountSid) { + public KeyCreator(final String accountSid) { this.accountSid = accountSid; } - public NewApiKeyCreator setAccountSid(final String accountSid) { + public KeyCreator setAccountSid(final String accountSid) { this.accountSid = accountSid; return this; } - public NewApiKeyCreator setFriendlyName(final String friendlyName) { + public KeyCreator setFriendlyName(final String friendlyName) { this.friendlyName = friendlyName; return this; } - public NewApiKeyCreator setKeyType(final NewApiKey.Keytype keyType) { + public KeyCreator setKeyType(final Key.Keytype keyType) { this.keyType = keyType; return this; } - public NewApiKeyCreator setPolicy(final Map policy) { + public KeyCreator setPolicy(final Map policy) { this.policy = policy; return this; } @Override - public NewApiKey create(final TwilioRestClient client) { + public Key create(final TwilioRestClient client) { String path = "/v1/Keys"; path = @@ -77,7 +77,7 @@ public NewApiKey create(final TwilioRestClient client) { Response response = client.request(request); if (response == null) { throw new ApiConnectionException( - "NewApiKey creation failed: Unable to connect to server" + "Key creation failed: Unable to connect to server" ); } else if (!TwilioRestClient.SUCCESS.test(response.getStatusCode())) { RestException restException = RestException.fromJson( @@ -93,10 +93,7 @@ public NewApiKey create(final TwilioRestClient client) { throw new ApiException(restException); } - return NewApiKey.fromJson( - response.getStream(), - client.getObjectMapper() - ); + return Key.fromJson(response.getStream(), client.getObjectMapper()); } private void addPostParams(final Request request) { diff --git a/src/main/java/com/twilio/rest/marketplace/v1/ModuleData.java b/src/main/java/com/twilio/rest/marketplace/v1/ModuleData.java new file mode 100644 index 000000000..f76398f84 --- /dev/null +++ b/src/main/java/com/twilio/rest/marketplace/v1/ModuleData.java @@ -0,0 +1,210 @@ +/* + * This code was generated by + * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + * + * Twilio - Marketplace + * This is the public Twilio REST API. + * + * NOTE: This class is auto generated by OpenAPI Generator. + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.twilio.rest.marketplace.v1; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.core.JsonParseException; +import com.fasterxml.jackson.databind.JsonMappingException; +import com.fasterxml.jackson.databind.ObjectMapper; +import com.twilio.base.Resource; +import com.twilio.exception.ApiConnectionException; +import com.twilio.exception.ApiException; +import java.io.IOException; +import java.io.InputStream; +import java.net.URI; +import java.util.List; +import java.util.Map; +import java.util.Map; +import java.util.Objects; +import lombok.ToString; +import lombok.ToString; + +@JsonIgnoreProperties(ignoreUnknown = true) +@ToString +public class ModuleData extends Resource { + + private static final long serialVersionUID = 132859226086963L; + + public static ModuleDataCreator creator() { + return new ModuleDataCreator(); + } + + public static ModuleDataFetcher fetcher() { + return new ModuleDataFetcher(); + } + + /** + * Converts a JSON String into a ModuleData object using the provided ObjectMapper. + * + * @param json Raw JSON String + * @param objectMapper Jackson ObjectMapper + * @return ModuleData object represented by the provided JSON + */ + public static ModuleData fromJson( + final String json, + final ObjectMapper objectMapper + ) { + // Convert all checked exceptions to Runtime + try { + return objectMapper.readValue(json, ModuleData.class); + } catch (final JsonMappingException | JsonParseException e) { + throw new ApiException(e.getMessage(), e); + } catch (final IOException e) { + throw new ApiConnectionException(e.getMessage(), e); + } + } + + /** + * Converts a JSON InputStream into a ModuleData object using the provided + * ObjectMapper. + * + * @param json Raw JSON InputStream + * @param objectMapper Jackson ObjectMapper + * @return ModuleData object represented by the provided JSON + */ + public static ModuleData fromJson( + final InputStream json, + final ObjectMapper objectMapper + ) { + // Convert all checked exceptions to Runtime + try { + return objectMapper.readValue(json, ModuleData.class); + } catch (final JsonMappingException | JsonParseException e) { + throw new ApiException(e.getMessage(), e); + } catch (final IOException e) { + throw new ApiConnectionException(e.getMessage(), e); + } + } + + private final URI url; + private final String sid; + private final Map description; + private final Map support; + private final Map policies; + private final Map moduleInfo; + private final Map documentation; + private final Map configuration; + private final Map pricing; + private final List> listings; + + @JsonCreator + private ModuleData( + @JsonProperty("url") final URI url, + @JsonProperty("sid") final String sid, + @JsonProperty("description") final Map description, + @JsonProperty("support") final Map support, + @JsonProperty("policies") final Map policies, + @JsonProperty("module_info") final Map moduleInfo, + @JsonProperty("documentation") final Map documentation, + @JsonProperty("configuration") final Map configuration, + @JsonProperty("pricing") final Map pricing, + @JsonProperty("listings") final List> listings + ) { + this.url = url; + this.sid = sid; + this.description = description; + this.support = support; + this.policies = policies; + this.moduleInfo = moduleInfo; + this.documentation = documentation; + this.configuration = configuration; + this.pricing = pricing; + this.listings = listings; + } + + public final URI getUrl() { + return this.url; + } + + public final String getSid() { + return this.sid; + } + + public final Map getDescription() { + return this.description; + } + + public final Map getSupport() { + return this.support; + } + + public final Map getPolicies() { + return this.policies; + } + + public final Map getModuleInfo() { + return this.moduleInfo; + } + + public final Map getDocumentation() { + return this.documentation; + } + + public final Map getConfiguration() { + return this.configuration; + } + + public final Map getPricing() { + return this.pricing; + } + + public final List> getListings() { + return this.listings; + } + + @Override + public boolean equals(final Object o) { + if (this == o) { + return true; + } + + if (o == null || getClass() != o.getClass()) { + return false; + } + + ModuleData other = (ModuleData) o; + + return ( + Objects.equals(url, other.url) && + Objects.equals(sid, other.sid) && + Objects.equals(description, other.description) && + Objects.equals(support, other.support) && + Objects.equals(policies, other.policies) && + Objects.equals(moduleInfo, other.moduleInfo) && + Objects.equals(documentation, other.documentation) && + Objects.equals(configuration, other.configuration) && + Objects.equals(pricing, other.pricing) && + Objects.equals(listings, other.listings) + ); + } + + @Override + public int hashCode() { + return Objects.hash( + url, + sid, + description, + support, + policies, + moduleInfo, + documentation, + configuration, + pricing, + listings + ); + } +} diff --git a/src/main/java/com/twilio/rest/marketplace/v1/ModuleDataCreator.java b/src/main/java/com/twilio/rest/marketplace/v1/ModuleDataCreator.java new file mode 100644 index 000000000..08bd2419a --- /dev/null +++ b/src/main/java/com/twilio/rest/marketplace/v1/ModuleDataCreator.java @@ -0,0 +1,89 @@ +/* + * This code was generated by + * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + * + * Twilio - Marketplace + * This is the public Twilio REST API. + * + * NOTE: This class is auto generated by OpenAPI Generator. + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.twilio.rest.marketplace.v1; + +import com.twilio.base.Creator; +import com.twilio.constant.EnumConstants; +import com.twilio.exception.ApiConnectionException; +import com.twilio.exception.ApiException; +import com.twilio.exception.RestException; +import com.twilio.http.HttpMethod; +import com.twilio.http.Request; +import com.twilio.http.Response; +import com.twilio.http.TwilioRestClient; +import com.twilio.rest.Domains; + +public class ModuleDataCreator extends Creator { + + private String moduleInfo; + private String configuration; + + public ModuleDataCreator() {} + + public ModuleDataCreator setModuleInfo(final String moduleInfo) { + this.moduleInfo = moduleInfo; + return this; + } + + public ModuleDataCreator setConfiguration(final String configuration) { + this.configuration = configuration; + return this; + } + + @Override + public ModuleData create(final TwilioRestClient client) { + String path = "/v1/Listings"; + + Request request = new Request( + HttpMethod.POST, + Domains.MARKETPLACE.toString(), + path + ); + request.setContentType(EnumConstants.ContentType.FORM_URLENCODED); + addPostParams(request); + Response response = client.request(request); + if (response == null) { + throw new ApiConnectionException( + "ModuleData creation failed: Unable to connect to server" + ); + } else if (!TwilioRestClient.SUCCESS.test(response.getStatusCode())) { + RestException restException = RestException.fromJson( + response.getStream(), + client.getObjectMapper() + ); + if (restException == null) { + throw new ApiException( + "Server Error, no content", + response.getStatusCode() + ); + } + throw new ApiException(restException); + } + + return ModuleData.fromJson( + response.getStream(), + client.getObjectMapper() + ); + } + + private void addPostParams(final Request request) { + if (moduleInfo != null) { + request.addPostParam("ModuleInfo", moduleInfo); + } + if (configuration != null) { + request.addPostParam("Configuration", configuration); + } + } +} diff --git a/src/main/java/com/twilio/rest/marketplace/v1/ModuleDataFetcher.java b/src/main/java/com/twilio/rest/marketplace/v1/ModuleDataFetcher.java new file mode 100644 index 000000000..e5772cd65 --- /dev/null +++ b/src/main/java/com/twilio/rest/marketplace/v1/ModuleDataFetcher.java @@ -0,0 +1,67 @@ +/* + * This code was generated by + * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + * + * Twilio - Marketplace + * This is the public Twilio REST API. + * + * NOTE: This class is auto generated by OpenAPI Generator. + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.twilio.rest.marketplace.v1; + +import com.twilio.base.Fetcher; +import com.twilio.constant.EnumConstants; +import com.twilio.exception.ApiConnectionException; +import com.twilio.exception.ApiException; +import com.twilio.exception.RestException; +import com.twilio.http.HttpMethod; +import com.twilio.http.Request; +import com.twilio.http.Response; +import com.twilio.http.TwilioRestClient; +import com.twilio.rest.Domains; + +public class ModuleDataFetcher extends Fetcher { + + public ModuleDataFetcher() {} + + @Override + public ModuleData fetch(final TwilioRestClient client) { + String path = "/v1/Listings"; + + Request request = new Request( + HttpMethod.GET, + Domains.MARKETPLACE.toString(), + path + ); + request.setContentType(EnumConstants.ContentType.FORM_URLENCODED); + Response response = client.request(request); + + if (response == null) { + throw new ApiConnectionException( + "ModuleData fetch failed: Unable to connect to server" + ); + } else if (!TwilioRestClient.SUCCESS.test(response.getStatusCode())) { + RestException restException = RestException.fromJson( + response.getStream(), + client.getObjectMapper() + ); + if (restException == null) { + throw new ApiException( + "Server Error, no content", + response.getStatusCode() + ); + } + throw new ApiException(restException); + } + + return ModuleData.fromJson( + response.getStream(), + client.getObjectMapper() + ); + } +} diff --git a/src/main/java/com/twilio/rest/numbers/v1/PortingWebhookConfigurationFetch.java b/src/main/java/com/twilio/rest/numbers/v1/Webhook.java similarity index 82% rename from src/main/java/com/twilio/rest/numbers/v1/PortingWebhookConfigurationFetch.java rename to src/main/java/com/twilio/rest/numbers/v1/Webhook.java index 53c0f02a2..6e9c6921d 100644 --- a/src/main/java/com/twilio/rest/numbers/v1/PortingWebhookConfigurationFetch.java +++ b/src/main/java/com/twilio/rest/numbers/v1/Webhook.java @@ -35,31 +35,28 @@ @JsonIgnoreProperties(ignoreUnknown = true) @ToString -public class PortingWebhookConfigurationFetch extends Resource { +public class Webhook extends Resource { private static final long serialVersionUID = 270526030240961L; - public static PortingWebhookConfigurationFetchFetcher fetcher() { - return new PortingWebhookConfigurationFetchFetcher(); + public static WebhookFetcher fetcher() { + return new WebhookFetcher(); } /** - * Converts a JSON String into a PortingWebhookConfigurationFetch object using the provided ObjectMapper. + * Converts a JSON String into a Webhook object using the provided ObjectMapper. * * @param json Raw JSON String * @param objectMapper Jackson ObjectMapper - * @return PortingWebhookConfigurationFetch object represented by the provided JSON + * @return Webhook object represented by the provided JSON */ - public static PortingWebhookConfigurationFetch fromJson( + public static Webhook fromJson( final String json, final ObjectMapper objectMapper ) { // Convert all checked exceptions to Runtime try { - return objectMapper.readValue( - json, - PortingWebhookConfigurationFetch.class - ); + return objectMapper.readValue(json, Webhook.class); } catch (final JsonMappingException | JsonParseException e) { throw new ApiException(e.getMessage(), e); } catch (final IOException e) { @@ -68,23 +65,20 @@ public static PortingWebhookConfigurationFetch fromJson( } /** - * Converts a JSON InputStream into a PortingWebhookConfigurationFetch object using the provided + * Converts a JSON InputStream into a Webhook object using the provided * ObjectMapper. * * @param json Raw JSON InputStream * @param objectMapper Jackson ObjectMapper - * @return PortingWebhookConfigurationFetch object represented by the provided JSON + * @return Webhook object represented by the provided JSON */ - public static PortingWebhookConfigurationFetch fromJson( + public static Webhook fromJson( final InputStream json, final ObjectMapper objectMapper ) { // Convert all checked exceptions to Runtime try { - return objectMapper.readValue( - json, - PortingWebhookConfigurationFetch.class - ); + return objectMapper.readValue(json, Webhook.class); } catch (final JsonMappingException | JsonParseException e) { throw new ApiException(e.getMessage(), e); } catch (final IOException e) { @@ -100,7 +94,7 @@ public static PortingWebhookConfigurationFetch fromJson( private final ZonedDateTime portOutTargetDateCreated; @JsonCreator - private PortingWebhookConfigurationFetch( + private Webhook( @JsonProperty("url") final URI url, @JsonProperty("port_in_target_url") final URI portInTargetUrl, @JsonProperty("port_out_target_url") final URI portOutTargetUrl, @@ -156,8 +150,7 @@ public boolean equals(final Object o) { return false; } - PortingWebhookConfigurationFetch other = - (PortingWebhookConfigurationFetch) o; + Webhook other = (Webhook) o; return ( Objects.equals(url, other.url) && diff --git a/src/main/java/com/twilio/rest/numbers/v1/PortingWebhookConfigurationFetchFetcher.java b/src/main/java/com/twilio/rest/numbers/v1/WebhookFetcher.java similarity index 79% rename from src/main/java/com/twilio/rest/numbers/v1/PortingWebhookConfigurationFetchFetcher.java rename to src/main/java/com/twilio/rest/numbers/v1/WebhookFetcher.java index 59d0dc599..ccffc0062 100644 --- a/src/main/java/com/twilio/rest/numbers/v1/PortingWebhookConfigurationFetchFetcher.java +++ b/src/main/java/com/twilio/rest/numbers/v1/WebhookFetcher.java @@ -25,15 +25,12 @@ import com.twilio.http.TwilioRestClient; import com.twilio.rest.Domains; -public class PortingWebhookConfigurationFetchFetcher - extends Fetcher { +public class WebhookFetcher extends Fetcher { - public PortingWebhookConfigurationFetchFetcher() {} + public WebhookFetcher() {} @Override - public PortingWebhookConfigurationFetch fetch( - final TwilioRestClient client - ) { + public Webhook fetch(final TwilioRestClient client) { String path = "/v1/Porting/Configuration/Webhook"; Request request = new Request( @@ -46,7 +43,7 @@ public PortingWebhookConfigurationFetch fetch( if (response == null) { throw new ApiConnectionException( - "PortingWebhookConfigurationFetch fetch failed: Unable to connect to server" + "Webhook fetch failed: Unable to connect to server" ); } else if (!TwilioRestClient.SUCCESS.test(response.getStatusCode())) { RestException restException = RestException.fromJson( @@ -62,9 +59,6 @@ public PortingWebhookConfigurationFetch fetch( throw new ApiException(restException); } - return PortingWebhookConfigurationFetch.fromJson( - response.getStream(), - client.getObjectMapper() - ); + return Webhook.fromJson(response.getStream(), client.getObjectMapper()); } }