From b9c019ae96ebb12acbe8267123163033b552605d Mon Sep 17 00:00:00 2001 From: Twilio Date: Thu, 18 Apr 2024 14:17:45 +0000 Subject: [PATCH] [Librarian] Regenerated @ bd01257c5bef8696988f5e9f18d803d8ccdb5a0f 0d301f7b8858e2f9dc391bd6803943499955b8f0 --- CHANGES.md | 16 ++ .../com/twilio/rest/flexapi/v2/FlexUser.java | 262 ++++++++++++++++++ .../rest/flexapi/v2/FlexUserFetcher.java | 85 ++++++ .../rest/flexapi/v2/WebChannelsCreator.java | 13 + .../twilio/rest/numbers/v1/PortingPortIn.java | 6 + .../rest/numbers/v1/PortingPortInDeleter.java | 71 +++++ .../numbers/v1/PortingPortInPhoneNumber.java | 85 +++++- .../v1/PortingPortInPhoneNumberDeleter.java | 83 ++++++ 8 files changed, 620 insertions(+), 1 deletion(-) create mode 100644 src/main/java/com/twilio/rest/flexapi/v2/FlexUser.java create mode 100644 src/main/java/com/twilio/rest/flexapi/v2/FlexUserFetcher.java create mode 100644 src/main/java/com/twilio/rest/numbers/v1/PortingPortInDeleter.java create mode 100644 src/main/java/com/twilio/rest/numbers/v1/PortingPortInPhoneNumberDeleter.java diff --git a/CHANGES.md b/CHANGES.md index 569007f325..b9c9820c7d 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -1,6 +1,22 @@ twilio-java changelog ===================== +[2024-04-18] Version 10.1.5 +--------------------------- +**Library - Chore** +- [PR #791](https://github.com/twilio/twilio-java/pull/791): add variant class to compliance tests. Thanks to [@sbansla](https://github.com/sbansla)! +- [PR #789](https://github.com/twilio/twilio-java/pull/789): bumping nexus staging maven plugin version. Thanks to [@tiwarishubham635](https://github.com/tiwarishubham635)! + +**Flex** +- Add header `ui_version` to `web_channels` API + +**Messaging** +- Redeploy after failed pipeline + +**Numbers** +- Add Delete Port In request phone number api and Add Delete Port In request api + + [2024-04-04] Version 10.1.4 --------------------------- **Api** diff --git a/src/main/java/com/twilio/rest/flexapi/v2/FlexUser.java b/src/main/java/com/twilio/rest/flexapi/v2/FlexUser.java new file mode 100644 index 0000000000..060db33dad --- /dev/null +++ b/src/main/java/com/twilio/rest/flexapi/v2/FlexUser.java @@ -0,0 +1,262 @@ +/* + * This code was generated by + * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + * + * Twilio - Flex + * 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.flexapi.v2; + +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.converter.DateConverter; +import com.twilio.exception.ApiConnectionException; +import com.twilio.exception.ApiException; +import java.io.IOException; +import java.io.InputStream; +import java.net.URI; +import java.time.ZonedDateTime; +import java.util.Objects; +import lombok.ToString; +import lombok.ToString; + +@JsonIgnoreProperties(ignoreUnknown = true) +@ToString +public class FlexUser extends Resource { + + private static final long serialVersionUID = 256615130966532L; + + public static FlexUserFetcher fetcher( + final String pathInstanceSid, + final String pathFlexUserSid + ) { + return new FlexUserFetcher(pathInstanceSid, pathFlexUserSid); + } + + /** + * Converts a JSON String into a FlexUser object using the provided ObjectMapper. + * + * @param json Raw JSON String + * @param objectMapper Jackson ObjectMapper + * @return FlexUser object represented by the provided JSON + */ + public static FlexUser fromJson( + final String json, + final ObjectMapper objectMapper + ) { + // Convert all checked exceptions to Runtime + try { + return objectMapper.readValue(json, FlexUser.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 FlexUser object using the provided + * ObjectMapper. + * + * @param json Raw JSON InputStream + * @param objectMapper Jackson ObjectMapper + * @return FlexUser object represented by the provided JSON + */ + public static FlexUser fromJson( + final InputStream json, + final ObjectMapper objectMapper + ) { + // Convert all checked exceptions to Runtime + try { + return objectMapper.readValue(json, FlexUser.class); + } catch (final JsonMappingException | JsonParseException e) { + throw new ApiException(e.getMessage(), e); + } catch (final IOException e) { + throw new ApiConnectionException(e.getMessage(), e); + } + } + + private final String accountSid; + private final String instanceSid; + private final String userSid; + private final String flexUserSid; + private final String workerSid; + private final String workspaceSid; + private final String flexTeamSid; + private final String firstName; + private final String lastName; + private final String username; + private final String email; + private final String friendlyName; + private final ZonedDateTime createdDate; + private final ZonedDateTime updatedDate; + private final Integer version; + private final URI url; + + @JsonCreator + private FlexUser( + @JsonProperty("account_sid") final String accountSid, + @JsonProperty("instance_sid") final String instanceSid, + @JsonProperty("user_sid") final String userSid, + @JsonProperty("flex_user_sid") final String flexUserSid, + @JsonProperty("worker_sid") final String workerSid, + @JsonProperty("workspace_sid") final String workspaceSid, + @JsonProperty("flex_team_sid") final String flexTeamSid, + @JsonProperty("first_name") final String firstName, + @JsonProperty("last_name") final String lastName, + @JsonProperty("username") final String username, + @JsonProperty("email") final String email, + @JsonProperty("friendly_name") final String friendlyName, + @JsonProperty("created_date") final String createdDate, + @JsonProperty("updated_date") final String updatedDate, + @JsonProperty("version") final Integer version, + @JsonProperty("url") final URI url + ) { + this.accountSid = accountSid; + this.instanceSid = instanceSid; + this.userSid = userSid; + this.flexUserSid = flexUserSid; + this.workerSid = workerSid; + this.workspaceSid = workspaceSid; + this.flexTeamSid = flexTeamSid; + this.firstName = firstName; + this.lastName = lastName; + this.username = username; + this.email = email; + this.friendlyName = friendlyName; + this.createdDate = DateConverter.iso8601DateTimeFromString(createdDate); + this.updatedDate = DateConverter.iso8601DateTimeFromString(updatedDate); + this.version = version; + this.url = url; + } + + public final String getAccountSid() { + return this.accountSid; + } + + public final String getInstanceSid() { + return this.instanceSid; + } + + public final String getUserSid() { + return this.userSid; + } + + public final String getFlexUserSid() { + return this.flexUserSid; + } + + public final String getWorkerSid() { + return this.workerSid; + } + + public final String getWorkspaceSid() { + return this.workspaceSid; + } + + public final String getFlexTeamSid() { + return this.flexTeamSid; + } + + public final String getFirstName() { + return this.firstName; + } + + public final String getLastName() { + return this.lastName; + } + + public final String getUsername() { + return this.username; + } + + public final String getEmail() { + return this.email; + } + + public final String getFriendlyName() { + return this.friendlyName; + } + + public final ZonedDateTime getCreatedDate() { + return this.createdDate; + } + + public final ZonedDateTime getUpdatedDate() { + return this.updatedDate; + } + + public final Integer getVersion() { + return this.version; + } + + public final URI getUrl() { + return this.url; + } + + @Override + public boolean equals(final Object o) { + if (this == o) { + return true; + } + + if (o == null || getClass() != o.getClass()) { + return false; + } + + FlexUser other = (FlexUser) o; + + return ( + Objects.equals(accountSid, other.accountSid) && + Objects.equals(instanceSid, other.instanceSid) && + Objects.equals(userSid, other.userSid) && + Objects.equals(flexUserSid, other.flexUserSid) && + Objects.equals(workerSid, other.workerSid) && + Objects.equals(workspaceSid, other.workspaceSid) && + Objects.equals(flexTeamSid, other.flexTeamSid) && + Objects.equals(firstName, other.firstName) && + Objects.equals(lastName, other.lastName) && + Objects.equals(username, other.username) && + Objects.equals(email, other.email) && + Objects.equals(friendlyName, other.friendlyName) && + Objects.equals(createdDate, other.createdDate) && + Objects.equals(updatedDate, other.updatedDate) && + Objects.equals(version, other.version) && + Objects.equals(url, other.url) + ); + } + + @Override + public int hashCode() { + return Objects.hash( + accountSid, + instanceSid, + userSid, + flexUserSid, + workerSid, + workspaceSid, + flexTeamSid, + firstName, + lastName, + username, + email, + friendlyName, + createdDate, + updatedDate, + version, + url + ); + } +} diff --git a/src/main/java/com/twilio/rest/flexapi/v2/FlexUserFetcher.java b/src/main/java/com/twilio/rest/flexapi/v2/FlexUserFetcher.java new file mode 100644 index 0000000000..6927f7d2a8 --- /dev/null +++ b/src/main/java/com/twilio/rest/flexapi/v2/FlexUserFetcher.java @@ -0,0 +1,85 @@ +/* + * This code was generated by + * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + * + * Twilio - Flex + * 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.flexapi.v2; + +import com.twilio.base.Fetcher; +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 FlexUserFetcher extends Fetcher { + + private String pathInstanceSid; + private String pathFlexUserSid; + + public FlexUserFetcher( + final String pathInstanceSid, + final String pathFlexUserSid + ) { + this.pathInstanceSid = pathInstanceSid; + this.pathFlexUserSid = pathFlexUserSid; + } + + @Override + public FlexUser fetch(final TwilioRestClient client) { + String path = "/v2/Instances/{InstanceSid}/Users/{FlexUserSid}"; + + path = + path.replace( + "{" + "InstanceSid" + "}", + this.pathInstanceSid.toString() + ); + path = + path.replace( + "{" + "FlexUserSid" + "}", + this.pathFlexUserSid.toString() + ); + + Request request = new Request( + HttpMethod.GET, + Domains.FLEXAPI.toString(), + path + ); + Response response = client.request(request); + + if (response == null) { + throw new ApiConnectionException( + "FlexUser 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 FlexUser.fromJson( + response.getStream(), + client.getObjectMapper() + ); + } +} diff --git a/src/main/java/com/twilio/rest/flexapi/v2/WebChannelsCreator.java b/src/main/java/com/twilio/rest/flexapi/v2/WebChannelsCreator.java index 30dd105352..e01a533e65 100644 --- a/src/main/java/com/twilio/rest/flexapi/v2/WebChannelsCreator.java +++ b/src/main/java/com/twilio/rest/flexapi/v2/WebChannelsCreator.java @@ -28,6 +28,7 @@ public class WebChannelsCreator extends Creator { private String addressSid; + private String uiVersion; private String chatFriendlyName; private String customerFriendlyName; private String preEngagementData; @@ -41,6 +42,11 @@ public WebChannelsCreator setAddressSid(final String addressSid) { return this; } + public WebChannelsCreator setUiVersion(final String uiVersion) { + this.uiVersion = uiVersion; + return this; + } + public WebChannelsCreator setChatFriendlyName( final String chatFriendlyName ) { @@ -76,6 +82,7 @@ public WebChannels create(final TwilioRestClient client) { ); request.setContentType(EnumConstants.ContentType.FORM_URLENCODED); addPostParams(request); + addHeaderParams(request); Response response = client.request(request); if (response == null) { throw new ApiConnectionException( @@ -115,4 +122,10 @@ private void addPostParams(final Request request) { request.addPostParam("PreEngagementData", preEngagementData); } } + + private void addHeaderParams(final Request request) { + if (uiVersion != null) { + request.addHeaderParam("Ui-Version", uiVersion); + } + } } diff --git a/src/main/java/com/twilio/rest/numbers/v1/PortingPortIn.java b/src/main/java/com/twilio/rest/numbers/v1/PortingPortIn.java index ef0412753c..e7e880f0ea 100644 --- a/src/main/java/com/twilio/rest/numbers/v1/PortingPortIn.java +++ b/src/main/java/com/twilio/rest/numbers/v1/PortingPortIn.java @@ -41,6 +41,12 @@ public static PortingPortInCreator creator() { return new PortingPortInCreator(); } + public static PortingPortInDeleter deleter( + final String pathPortInRequestSid + ) { + return new PortingPortInDeleter(pathPortInRequestSid); + } + /** * Converts a JSON String into a PortingPortIn object using the provided ObjectMapper. * diff --git a/src/main/java/com/twilio/rest/numbers/v1/PortingPortInDeleter.java b/src/main/java/com/twilio/rest/numbers/v1/PortingPortInDeleter.java new file mode 100644 index 0000000000..1e737da233 --- /dev/null +++ b/src/main/java/com/twilio/rest/numbers/v1/PortingPortInDeleter.java @@ -0,0 +1,71 @@ +/* + * This code was generated by + * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + * + * Twilio - Numbers + * 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.numbers.v1; + +import com.twilio.base.Deleter; +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 PortingPortInDeleter extends Deleter { + + private String pathPortInRequestSid; + + public PortingPortInDeleter(final String pathPortInRequestSid) { + this.pathPortInRequestSid = pathPortInRequestSid; + } + + @Override + public boolean delete(final TwilioRestClient client) { + String path = "/v1/Porting/PortIn/{PortInRequestSid}"; + + path = + path.replace( + "{" + "PortInRequestSid" + "}", + this.pathPortInRequestSid.toString() + ); + + Request request = new Request( + HttpMethod.DELETE, + Domains.NUMBERS.toString(), + path + ); + Response response = client.request(request); + + if (response == null) { + throw new ApiConnectionException( + "PortingPortIn 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/numbers/v1/PortingPortInPhoneNumber.java b/src/main/java/com/twilio/rest/numbers/v1/PortingPortInPhoneNumber.java index 9b864c9e2c..4abd6b4777 100644 --- a/src/main/java/com/twilio/rest/numbers/v1/PortingPortInPhoneNumber.java +++ b/src/main/java/com/twilio/rest/numbers/v1/PortingPortInPhoneNumber.java @@ -1,4 +1,87 @@ +/* + * This code was generated by + * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + * + * Twilio - Numbers + * 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.numbers.v1; -public class PortingPortInPhoneNumber { +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +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 lombok.ToString; +import lombok.ToString; + +@JsonIgnoreProperties(ignoreUnknown = true) +@ToString +public class PortingPortInPhoneNumber extends Resource { + + private static final long serialVersionUID = 0L; + + public static PortingPortInPhoneNumberDeleter deleter( + final String pathPortInRequestSid, + final String pathPhoneNumberSid + ) { + return new PortingPortInPhoneNumberDeleter( + pathPortInRequestSid, + pathPhoneNumberSid + ); + } + + /** + * Converts a JSON String into a PortingPortInPhoneNumber object using the provided ObjectMapper. + * + * @param json Raw JSON String + * @param objectMapper Jackson ObjectMapper + * @return PortingPortInPhoneNumber object represented by the provided JSON + */ + public static PortingPortInPhoneNumber fromJson( + final String json, + final ObjectMapper objectMapper + ) { + // Convert all checked exceptions to Runtime + try { + return objectMapper.readValue(json, PortingPortInPhoneNumber.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 PortingPortInPhoneNumber object using the provided + * ObjectMapper. + * + * @param json Raw JSON InputStream + * @param objectMapper Jackson ObjectMapper + * @return PortingPortInPhoneNumber object represented by the provided JSON + */ + public static PortingPortInPhoneNumber fromJson( + final InputStream json, + final ObjectMapper objectMapper + ) { + // Convert all checked exceptions to Runtime + try { + return objectMapper.readValue(json, PortingPortInPhoneNumber.class); + } catch (final JsonMappingException | JsonParseException 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/numbers/v1/PortingPortInPhoneNumberDeleter.java b/src/main/java/com/twilio/rest/numbers/v1/PortingPortInPhoneNumberDeleter.java new file mode 100644 index 0000000000..db3aca7676 --- /dev/null +++ b/src/main/java/com/twilio/rest/numbers/v1/PortingPortInPhoneNumberDeleter.java @@ -0,0 +1,83 @@ +/* + * This code was generated by + * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + * + * Twilio - Numbers + * 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.numbers.v1; + +import com.twilio.base.Deleter; +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 PortingPortInPhoneNumberDeleter + extends Deleter { + + private String pathPortInRequestSid; + private String pathPhoneNumberSid; + + public PortingPortInPhoneNumberDeleter( + final String pathPortInRequestSid, + final String pathPhoneNumberSid + ) { + this.pathPortInRequestSid = pathPortInRequestSid; + this.pathPhoneNumberSid = pathPhoneNumberSid; + } + + @Override + public boolean delete(final TwilioRestClient client) { + String path = + "/v1/Porting/PortIn/{PortInRequestSid}/PhoneNumber/{PhoneNumberSid}"; + + path = + path.replace( + "{" + "PortInRequestSid" + "}", + this.pathPortInRequestSid.toString() + ); + path = + path.replace( + "{" + "PhoneNumberSid" + "}", + this.pathPhoneNumberSid.toString() + ); + + Request request = new Request( + HttpMethod.DELETE, + Domains.NUMBERS.toString(), + path + ); + Response response = client.request(request); + + if (response == null) { + throw new ApiConnectionException( + "PortingPortInPhoneNumber 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; + } +}