@ Override @ SuppressWarnings ( "checkstyle:linelength" ) public Message update ( final TwilioRestClient client ) { Request request = new Request ( HttpMethod . POST , Domains . IPMESSAGING . toString ( ) , "/v1/Services/" + this . pathServiceSid + "/Channels/" + this . pathChannelSid + "/Messages/" + this . pathSid + "" , client . getRegion ( ) ) ; addPostParams ( request ) ; Response response = client . request ( request ) ; if ( response == null ) { throw new ApiConnectionException ( "Message update failed: Unable to connect to server" ) ; } else if ( ! TwilioRestClient . SUCCESS . apply ( response . getStatusCode ( ) ) ) { RestException restException = RestException . fromJson ( response . getStream ( ) , client . getObjectMapper ( ) ) ; if ( restException == null ) { throw new ApiException ( "Server Error, no content" ) ; } throw new ApiException ( restException . getMessage ( ) , restException . getCode ( ) , restException . getMoreInfo ( ) , restException . getStatus ( ) , null ) ; } return Message . fromJson ( response . getStream ( ) , client . getObjectMapper ( ) ) ; }
Make the request to the Twilio API to perform the update .