-
Notifications
You must be signed in to change notification settings - Fork 428
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Librarian] Regenerated @ d97b0740a0c7cf86beebd56c6973927b07719cde 1f…
…c3bb6195ebcbd02451fb8fc9080c695b075d4f
- Loading branch information
Showing
3 changed files
with
284 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
198 changes: 198 additions & 0 deletions
198
src/main/java/com/twilio/rest/messaging/v1/RequestManagedCert.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,198 @@ | ||
/* | ||
* This code was generated by | ||
* ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ | ||
* | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ | ||
* | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ | ||
* | ||
* Twilio - Messaging | ||
* 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.messaging.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.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 RequestManagedCert extends Resource { | ||
|
||
private static final long serialVersionUID = 86009690306630L; | ||
|
||
public static RequestManagedCertUpdater updater( | ||
final String pathDomainSid | ||
) { | ||
return new RequestManagedCertUpdater(pathDomainSid); | ||
} | ||
|
||
/** | ||
* Converts a JSON String into a RequestManagedCert object using the provided ObjectMapper. | ||
* | ||
* @param json Raw JSON String | ||
* @param objectMapper Jackson ObjectMapper | ||
* @return RequestManagedCert object represented by the provided JSON | ||
*/ | ||
public static RequestManagedCert fromJson( | ||
final String json, | ||
final ObjectMapper objectMapper | ||
) { | ||
// Convert all checked exceptions to Runtime | ||
try { | ||
return objectMapper.readValue(json, RequestManagedCert.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 RequestManagedCert object using the provided | ||
* ObjectMapper. | ||
* | ||
* @param json Raw JSON InputStream | ||
* @param objectMapper Jackson ObjectMapper | ||
* @return RequestManagedCert object represented by the provided JSON | ||
*/ | ||
public static RequestManagedCert fromJson( | ||
final InputStream json, | ||
final ObjectMapper objectMapper | ||
) { | ||
// Convert all checked exceptions to Runtime | ||
try { | ||
return objectMapper.readValue(json, RequestManagedCert.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 domainSid; | ||
private final ZonedDateTime dateUpdated; | ||
private final ZonedDateTime dateCreated; | ||
private final ZonedDateTime dateExpires; | ||
private final URI domainName; | ||
private final String certificateSid; | ||
private final URI url; | ||
private final Boolean managed; | ||
private final Boolean requesting; | ||
|
||
@JsonCreator | ||
private RequestManagedCert( | ||
@JsonProperty("domain_sid") final String domainSid, | ||
@JsonProperty("date_updated") final String dateUpdated, | ||
@JsonProperty("date_created") final String dateCreated, | ||
@JsonProperty("date_expires") final String dateExpires, | ||
@JsonProperty("domain_name") final URI domainName, | ||
@JsonProperty("certificate_sid") final String certificateSid, | ||
@JsonProperty("url") final URI url, | ||
@JsonProperty("managed") final Boolean managed, | ||
@JsonProperty("requesting") final Boolean requesting | ||
) { | ||
this.domainSid = domainSid; | ||
this.dateUpdated = DateConverter.iso8601DateTimeFromString(dateUpdated); | ||
this.dateCreated = DateConverter.iso8601DateTimeFromString(dateCreated); | ||
this.dateExpires = DateConverter.iso8601DateTimeFromString(dateExpires); | ||
this.domainName = domainName; | ||
this.certificateSid = certificateSid; | ||
this.url = url; | ||
this.managed = managed; | ||
this.requesting = requesting; | ||
} | ||
|
||
public final String getDomainSid() { | ||
return this.domainSid; | ||
} | ||
|
||
public final ZonedDateTime getDateUpdated() { | ||
return this.dateUpdated; | ||
} | ||
|
||
public final ZonedDateTime getDateCreated() { | ||
return this.dateCreated; | ||
} | ||
|
||
public final ZonedDateTime getDateExpires() { | ||
return this.dateExpires; | ||
} | ||
|
||
public final URI getDomainName() { | ||
return this.domainName; | ||
} | ||
|
||
public final String getCertificateSid() { | ||
return this.certificateSid; | ||
} | ||
|
||
public final URI getUrl() { | ||
return this.url; | ||
} | ||
|
||
public final Boolean getManaged() { | ||
return this.managed; | ||
} | ||
|
||
public final Boolean getRequesting() { | ||
return this.requesting; | ||
} | ||
|
||
@Override | ||
public boolean equals(final Object o) { | ||
if (this == o) { | ||
return true; | ||
} | ||
|
||
if (o == null || getClass() != o.getClass()) { | ||
return false; | ||
} | ||
|
||
RequestManagedCert other = (RequestManagedCert) o; | ||
|
||
return ( | ||
Objects.equals(domainSid, other.domainSid) && | ||
Objects.equals(dateUpdated, other.dateUpdated) && | ||
Objects.equals(dateCreated, other.dateCreated) && | ||
Objects.equals(dateExpires, other.dateExpires) && | ||
Objects.equals(domainName, other.domainName) && | ||
Objects.equals(certificateSid, other.certificateSid) && | ||
Objects.equals(url, other.url) && | ||
Objects.equals(managed, other.managed) && | ||
Objects.equals(requesting, other.requesting) | ||
); | ||
} | ||
|
||
@Override | ||
public int hashCode() { | ||
return Objects.hash( | ||
domainSid, | ||
dateUpdated, | ||
dateCreated, | ||
dateExpires, | ||
domainName, | ||
certificateSid, | ||
url, | ||
managed, | ||
requesting | ||
); | ||
} | ||
} |
77 changes: 77 additions & 0 deletions
77
src/main/java/com/twilio/rest/messaging/v1/RequestManagedCertUpdater.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
/* | ||
* This code was generated by | ||
* ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ | ||
* | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ | ||
* | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ | ||
* | ||
* Twilio - Messaging | ||
* 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.messaging.v1; | ||
|
||
import com.twilio.base.Updater; | ||
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 RequestManagedCertUpdater extends Updater<RequestManagedCert> { | ||
|
||
private String pathDomainSid; | ||
|
||
public RequestManagedCertUpdater(final String pathDomainSid) { | ||
this.pathDomainSid = pathDomainSid; | ||
} | ||
|
||
@Override | ||
public RequestManagedCert update(final TwilioRestClient client) { | ||
String path = | ||
"/v1/LinkShortening/Domains/{DomainSid}/RequestManagedCert"; | ||
|
||
path = | ||
path.replace( | ||
"{" + "DomainSid" + "}", | ||
this.pathDomainSid.toString() | ||
); | ||
|
||
Request request = new Request( | ||
HttpMethod.POST, | ||
Domains.MESSAGING.toString(), | ||
path | ||
); | ||
request.setContentType(EnumConstants.ContentType.FORM_URLENCODED); | ||
Response response = client.request(request); | ||
if (response == null) { | ||
throw new ApiConnectionException( | ||
"RequestManagedCert update 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 RequestManagedCert.fromJson( | ||
response.getStream(), | ||
client.getObjectMapper() | ||
); | ||
} | ||
} |