diff --git a/src/main/java/com/twilio/rest/voice/v2/Client.java b/src/main/java/com/twilio/rest/voice/v2/Client.java deleted file mode 100644 index 3b7c77777..000000000 --- a/src/main/java/com/twilio/rest/voice/v2/Client.java +++ /dev/null @@ -1,261 +0,0 @@ -/* - * This code was generated by - * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ - * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ - * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ - * - * Twilio API definition for public-api voice - * Powers Twilio public-api voice - * - * NOTE: This class is auto generated by OpenAPI Generator. - * https://openapi-generator.tech - * Do not edit the class manually. - */ - -package com.twilio.rest.voice.v2; - -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.core.JsonParseException; -import com.fasterxml.jackson.core.JsonProcessingException; -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 com.twilio.http.HttpMethod; -import java.io.IOException; -import java.io.InputStream; -import java.net.URI; -import java.util.Objects; -import lombok.Getter; -import lombok.Setter; -import lombok.ToString; -import lombok.ToString; - -@JsonIgnoreProperties(ignoreUnknown = true) -@ToString -public class Client extends Resource { - - private static final long serialVersionUID = 20407420146524L; - - @ToString - public static class VoiceV2ClientConfigurationResponseConfigurationCallnotification { - - @JsonInclude(JsonInclude.Include.NON_EMPTY) - @JsonProperty("url") - @Getter - @Setter - private URI url; - - @JsonInclude(JsonInclude.Include.NON_EMPTY) - @JsonProperty("method") - @Getter - @Setter - private HttpMethod method; - - public static VoiceV2ClientConfigurationResponseConfigurationCallnotification fromJson( - String jsonString, - ObjectMapper mapper - ) throws IOException { - return mapper.readValue( - jsonString, - VoiceV2ClientConfigurationResponseConfigurationCallnotification.class - ); - } - } - - @ToString - public static class VoiceV2ClientConfigurationResponseConfiguration { - - @JsonInclude(JsonInclude.Include.NON_EMPTY) - @JsonProperty("callnotification") - @Getter - @Setter - private VoiceV2ClientConfigurationResponseConfigurationCallnotification callnotification; - - public static VoiceV2ClientConfigurationResponseConfiguration fromJson( - String jsonString, - ObjectMapper mapper - ) throws IOException { - return mapper.readValue( - jsonString, - VoiceV2ClientConfigurationResponseConfiguration.class - ); - } - } - - @ToString - public static class VoiceV2ClientConfigurationRequest { - - @JsonInclude(JsonInclude.Include.NON_EMPTY) - @JsonProperty("friendly_name") - @Getter - @Setter - private String friendlyName; - - @JsonInclude(JsonInclude.Include.NON_EMPTY) - @JsonProperty("description") - @Getter - @Setter - private String description; - - @JsonInclude(JsonInclude.Include.NON_EMPTY) - @JsonProperty("configuration") - @Getter - @Setter - private VoiceV2ClientConfigurationResponseConfiguration configuration; - - public VoiceV2ClientConfigurationRequest() {} - - public static VoiceV2ClientConfigurationRequest fromJson( - String jsonString, - ObjectMapper mapper - ) throws IOException { - return mapper.readValue( - jsonString, - VoiceV2ClientConfigurationRequest.class - ); - } - } - - public static ClientCreator creator() { - return new ClientCreator(); - } - - public static ClientDeleter deleter(final String pathIdOrFriendlyName) { - return new ClientDeleter(pathIdOrFriendlyName); - } - - /** - * Converts a JSON String into a Client object using the provided ObjectMapper. - * - * @param json Raw JSON String - * @param objectMapper Jackson ObjectMapper - * @return Client object represented by the provided JSON - */ - public static Client fromJson( - final String json, - final ObjectMapper objectMapper - ) { - // Convert all checked exceptions to Runtime - try { - return objectMapper.readValue(json, Client.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 Client object using the provided - * ObjectMapper. - * - * @param json Raw JSON InputStream - * @param objectMapper Jackson ObjectMapper - * @return Client object represented by the provided JSON - */ - public static Client fromJson( - final InputStream json, - final ObjectMapper objectMapper - ) { - // Convert all checked exceptions to Runtime - try { - return objectMapper.readValue(json, Client.class); - } catch (final JsonMappingException | JsonParseException e) { - throw new ApiException(e.getMessage(), e); - } catch (final IOException e) { - throw new ApiConnectionException(e.getMessage(), e); - } - } - - public static String toJson(Object object, ObjectMapper mapper) { - try { - return mapper.writeValueAsString(object); - } catch (final JsonMappingException e) { - throw new ApiException(e.getMessage(), e); - } catch (JsonProcessingException e) { - throw new ApiException(e.getMessage(), e); - } catch (final IOException e) { - throw new ApiConnectionException(e.getMessage(), e); - } - } - - private final String id; - private final String accountSid; - private final String friendlyName; - private final String description; - private final VoiceV2ClientConfigurationResponseConfiguration configuration; - - @JsonCreator - private Client( - @JsonProperty("id") final String id, - @JsonProperty("account_sid") final String accountSid, - @JsonProperty("friendly_name") final String friendlyName, - @JsonProperty("description") final String description, - @JsonProperty( - "configuration" - ) final VoiceV2ClientConfigurationResponseConfiguration configuration - ) { - this.id = id; - this.accountSid = accountSid; - this.friendlyName = friendlyName; - this.description = description; - this.configuration = configuration; - } - - public final String getId() { - return this.id; - } - - public final String getAccountSid() { - return this.accountSid; - } - - public final String getFriendlyName() { - return this.friendlyName; - } - - public final String getDescription() { - return this.description; - } - - public final VoiceV2ClientConfigurationResponseConfiguration getConfiguration() { - return this.configuration; - } - - @Override - public boolean equals(final Object o) { - if (this == o) { - return true; - } - - if (o == null || getClass() != o.getClass()) { - return false; - } - - Client other = (Client) o; - - return ( - Objects.equals(id, other.id) && - Objects.equals(accountSid, other.accountSid) && - Objects.equals(friendlyName, other.friendlyName) && - Objects.equals(description, other.description) && - Objects.equals(configuration, other.configuration) - ); - } - - @Override - public int hashCode() { - return Objects.hash( - id, - accountSid, - friendlyName, - description, - configuration - ); - } -} diff --git a/src/main/java/com/twilio/rest/voice/v2/ClientCreator.java b/src/main/java/com/twilio/rest/voice/v2/ClientCreator.java deleted file mode 100644 index 3fb5778e2..000000000 --- a/src/main/java/com/twilio/rest/voice/v2/ClientCreator.java +++ /dev/null @@ -1,84 +0,0 @@ -/* - * This code was generated by - * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ - * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ - * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ - * - * Twilio API definition for public-api voice - * Powers Twilio public-api voice - * - * NOTE: This class is auto generated by OpenAPI Generator. - * https://openapi-generator.tech - * Do not edit the class manually. - */ - -package com.twilio.rest.voice.v2; - -import com.fasterxml.jackson.databind.ObjectMapper; -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 ClientCreator extends Creator { - - private Client.VoiceV2ClientConfigurationRequest voiceV2ClientConfigurationRequest; - - public ClientCreator() {} - - public ClientCreator setVoiceV2ClientConfigurationRequest( - final Client.VoiceV2ClientConfigurationRequest voiceV2ClientConfigurationRequest - ) { - this.voiceV2ClientConfigurationRequest = - voiceV2ClientConfigurationRequest; - return this; - } - - @Override - public Client create(final TwilioRestClient client) { - String path = "/v2/Configurations/Client"; - - Request request = new Request( - HttpMethod.POST, - Domains.VOICE.toString(), - path - ); - request.setContentType(EnumConstants.ContentType.FORM_URLENCODED); - addPostParams(request, client); - Response response = client.request(request); - if (response == null) { - throw new ApiConnectionException( - "Client 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 Client.fromJson(response.getStream(), client.getObjectMapper()); - } - - private void addPostParams(final Request request, TwilioRestClient client) { - ObjectMapper objectMapper = client.getObjectMapper(); - if (voiceV2ClientConfigurationRequest != null) { - request.setBody( - Client.toJson(voiceV2ClientConfigurationRequest, objectMapper) - ); - } - } -} diff --git a/src/main/java/com/twilio/rest/voice/v2/ClientDeleter.java b/src/main/java/com/twilio/rest/voice/v2/ClientDeleter.java deleted file mode 100644 index 732d5a0c7..000000000 --- a/src/main/java/com/twilio/rest/voice/v2/ClientDeleter.java +++ /dev/null @@ -1,73 +0,0 @@ -/* - * This code was generated by - * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ - * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ - * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ - * - * Twilio API definition for public-api voice - * Powers Twilio public-api voice - * - * NOTE: This class is auto generated by OpenAPI Generator. - * https://openapi-generator.tech - * Do not edit the class manually. - */ - -package com.twilio.rest.voice.v2; - -import com.twilio.base.Deleter; -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 ClientDeleter extends Deleter { - - private String pathIdOrFriendlyName; - - public ClientDeleter(final String pathIdOrFriendlyName) { - this.pathIdOrFriendlyName = pathIdOrFriendlyName; - } - - @Override - public boolean delete(final TwilioRestClient client) { - String path = "/v2/Configurations/Client/{IdOrFriendlyName}"; - - path = - path.replace( - "{" + "IdOrFriendlyName" + "}", - this.pathIdOrFriendlyName.toString() - ); - - Request request = new Request( - HttpMethod.DELETE, - Domains.VOICE.toString(), - path - ); - request.setContentType(EnumConstants.ContentType.FORM_URLENCODED); - Response response = client.request(request); - - if (response == null) { - throw new ApiConnectionException( - "Client delete 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 response.getStatusCode() == 204; - } -} diff --git a/src/main/java/com/twilio/rest/voice/v2/Default.java b/src/main/java/com/twilio/rest/voice/v2/Default.java deleted file mode 100644 index 0248966f6..000000000 --- a/src/main/java/com/twilio/rest/voice/v2/Default.java +++ /dev/null @@ -1,120 +0,0 @@ -/* - * This code was generated by - * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ - * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ - * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ - * - * Twilio API definition for public-api voice - * Powers Twilio public-api voice - * - * NOTE: This class is auto generated by OpenAPI Generator. - * https://openapi-generator.tech - * Do not edit the class manually. - */ - -package com.twilio.rest.voice.v2; - -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.core.JsonParseException; -import com.fasterxml.jackson.core.JsonProcessingException; -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 lombok.Getter; -import lombok.Setter; -import lombok.ToString; -import lombok.ToString; - -@JsonIgnoreProperties(ignoreUnknown = true) -@ToString -public class Default extends Resource { - - private static final long serialVersionUID = 0L; - - @ToString - public static class DefaultClientConfigurationRequest { - - @JsonInclude(JsonInclude.Include.NON_EMPTY) - @JsonProperty("config_id") - @Getter - @Setter - private String configId; - - public DefaultClientConfigurationRequest() {} - - public static DefaultClientConfigurationRequest fromJson( - String jsonString, - ObjectMapper mapper - ) throws IOException { - return mapper.readValue( - jsonString, - DefaultClientConfigurationRequest.class - ); - } - } - - public static DefaultCreator creator() { - return new DefaultCreator(); - } - - /** - * Converts a JSON String into a Default object using the provided ObjectMapper. - * - * @param json Raw JSON String - * @param objectMapper Jackson ObjectMapper - * @return Default object represented by the provided JSON - */ - public static Default fromJson( - final String json, - final ObjectMapper objectMapper - ) { - // Convert all checked exceptions to Runtime - try { - return objectMapper.readValue(json, Default.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 Default object using the provided - * ObjectMapper. - * - * @param json Raw JSON InputStream - * @param objectMapper Jackson ObjectMapper - * @return Default object represented by the provided JSON - */ - public static Default fromJson( - final InputStream json, - final ObjectMapper objectMapper - ) { - // Convert all checked exceptions to Runtime - try { - return objectMapper.readValue(json, Default.class); - } catch (final JsonMappingException | JsonParseException e) { - throw new ApiException(e.getMessage(), e); - } catch (final IOException e) { - throw new ApiConnectionException(e.getMessage(), e); - } - } - - public static String toJson(Object object, ObjectMapper mapper) { - try { - return mapper.writeValueAsString(object); - } catch (final JsonMappingException e) { - throw new ApiException(e.getMessage(), e); - } catch (JsonProcessingException e) { - throw new ApiException(e.getMessage(), e); - } catch (final IOException e) { - throw new ApiConnectionException(e.getMessage(), e); - } - } -} diff --git a/src/main/java/com/twilio/rest/voice/v2/DefaultCreator.java b/src/main/java/com/twilio/rest/voice/v2/DefaultCreator.java deleted file mode 100644 index 53ca3b86b..000000000 --- a/src/main/java/com/twilio/rest/voice/v2/DefaultCreator.java +++ /dev/null @@ -1,84 +0,0 @@ -/* - * This code was generated by - * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ - * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ - * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ - * - * Twilio API definition for public-api voice - * Powers Twilio public-api voice - * - * NOTE: This class is auto generated by OpenAPI Generator. - * https://openapi-generator.tech - * Do not edit the class manually. - */ - -package com.twilio.rest.voice.v2; - -import com.fasterxml.jackson.databind.ObjectMapper; -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 DefaultCreator extends Creator { - - private Default.DefaultClientConfigurationRequest defaultClientConfigurationRequest; - - public DefaultCreator() {} - - public DefaultCreator setDefaultClientConfigurationRequest( - final Default.DefaultClientConfigurationRequest defaultClientConfigurationRequest - ) { - this.defaultClientConfigurationRequest = - defaultClientConfigurationRequest; - return this; - } - - @Override - public Default create(final TwilioRestClient client) { - String path = "/v2/Configurations/Client/Default"; - - Request request = new Request( - HttpMethod.POST, - Domains.VOICE.toString(), - path - ); - request.setContentType(EnumConstants.ContentType.FORM_URLENCODED); - addPostParams(request, client); - Response response = client.request(request); - if (response == null) { - throw new ApiConnectionException( - "Default 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 Default.fromJson(response.getStream(), client.getObjectMapper()); - } - - private void addPostParams(final Request request, TwilioRestClient client) { - ObjectMapper objectMapper = client.getObjectMapper(); - if (defaultClientConfigurationRequest != null) { - request.setBody( - Default.toJson(defaultClientConfigurationRequest, objectMapper) - ); - } - } -} diff --git a/src/test/java/com/twilio/compliance/ComplianceTest.java b/src/test/java/com/twilio/compliance/ComplianceTest.java index ec9b5d284..492821ba3 100644 --- a/src/test/java/com/twilio/compliance/ComplianceTest.java +++ b/src/test/java/com/twilio/compliance/ComplianceTest.java @@ -50,7 +50,7 @@ public void setUp() { variantClasses.add(com.twilio.rest.voice.v1.ArchivedCall.class); variantClasses.add(com.twilio.rest.numbers.v1.PortingPortInPhoneNumber.class); variantClasses.add(com.twilio.rest.numbers.v1.PortingWebhookConfigurationDelete.class); - variantClasses.add(com.twilio.rest.voice.v2.Default.class); +// variantClasses.add(com.twilio.rest.voice.v2.Default.class); } @Test