Skip to content

Commit

Permalink
[Librarian] Regenerated @ d97b0740a0c7cf86beebd56c6973927b07719cde 1f…
Browse files Browse the repository at this point in the history
…c3bb6195ebcbd02451fb8fc9080c695b075d4f
  • Loading branch information
twilio-dx committed Oct 17, 2024
1 parent 9a72488 commit 5bda956
Show file tree
Hide file tree
Showing 3 changed files with 284 additions and 0 deletions.
9 changes: 9 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,15 @@
twilio-java changelog
=====================

[2024-10-17] Version 10.6.1
---------------------------
**Api**
- Add response key `country` to fetch AvailablePhoneNumber resource by specific country.

**Messaging**
- Make library and doc public for requestManagedCert Endpoint


[2024-10-03] Version 10.6.0
---------------------------
**Library - Chore**
Expand Down
198 changes: 198 additions & 0 deletions src/main/java/com/twilio/rest/messaging/v1/RequestManagedCert.java
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
);
}
}
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()
);
}
}

0 comments on commit 5bda956

Please sign in to comment.