-
Notifications
You must be signed in to change notification settings - Fork 434
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Librarian] Regenerated @ 5eb406c4977c9f6976e6053cb5b581056f541a59
- Loading branch information
Showing
10 changed files
with
679 additions
and
2 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
151 changes: 151 additions & 0 deletions
151
src/main/java/com/twilio/rest/flexapi/v1/ProvisioningStatus.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,151 @@ | ||
/* | ||
* 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.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.Promoter; | ||
import com.twilio.exception.ApiConnectionException; | ||
import com.twilio.exception.ApiException; | ||
import java.io.IOException; | ||
import java.io.InputStream; | ||
import java.net.URI; | ||
import java.util.Objects; | ||
import lombok.ToString; | ||
import lombok.ToString; | ||
|
||
@JsonIgnoreProperties(ignoreUnknown = true) | ||
@ToString | ||
public class ProvisioningStatus extends Resource { | ||
|
||
private static final long serialVersionUID = 116877818354472L; | ||
|
||
public static ProvisioningStatusFetcher fetcher() { | ||
return new ProvisioningStatusFetcher(); | ||
} | ||
|
||
/** | ||
* Converts a JSON String into a ProvisioningStatus object using the provided ObjectMapper. | ||
* | ||
* @param json Raw JSON String | ||
* @param objectMapper Jackson ObjectMapper | ||
* @return ProvisioningStatus object represented by the provided JSON | ||
*/ | ||
public static ProvisioningStatus fromJson( | ||
final String json, | ||
final ObjectMapper objectMapper | ||
) { | ||
// Convert all checked exceptions to Runtime | ||
try { | ||
return objectMapper.readValue(json, ProvisioningStatus.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 ProvisioningStatus object using the provided | ||
* ObjectMapper. | ||
* | ||
* @param json Raw JSON InputStream | ||
* @param objectMapper Jackson ObjectMapper | ||
* @return ProvisioningStatus object represented by the provided JSON | ||
*/ | ||
public static ProvisioningStatus fromJson( | ||
final InputStream json, | ||
final ObjectMapper objectMapper | ||
) { | ||
// Convert all checked exceptions to Runtime | ||
try { | ||
return objectMapper.readValue(json, ProvisioningStatus.class); | ||
} catch (final JsonMappingException | JsonParseException e) { | ||
throw new ApiException(e.getMessage(), e); | ||
} catch (final IOException e) { | ||
throw new ApiConnectionException(e.getMessage(), e); | ||
} | ||
} | ||
|
||
public enum Status { | ||
ACTIVE("active"), | ||
IN_PROGRESS("in-progress"), | ||
NOT_CONFIGURED("not-configured"), | ||
FAILED("failed"); | ||
|
||
private final String value; | ||
|
||
private Status(final String value) { | ||
this.value = value; | ||
} | ||
|
||
public String toString() { | ||
return value; | ||
} | ||
|
||
@JsonCreator | ||
public static Status forValue(final String value) { | ||
return Promoter.enumFromString(value, Status.values()); | ||
} | ||
} | ||
|
||
private final ProvisioningStatus.Status status; | ||
private final URI url; | ||
|
||
@JsonCreator | ||
private ProvisioningStatus( | ||
@JsonProperty("status") final ProvisioningStatus.Status status, | ||
@JsonProperty("url") final URI url | ||
) { | ||
this.status = status; | ||
this.url = url; | ||
} | ||
|
||
public final ProvisioningStatus.Status getStatus() { | ||
return this.status; | ||
} | ||
|
||
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; | ||
} | ||
|
||
ProvisioningStatus other = (ProvisioningStatus) o; | ||
|
||
return ( | ||
Objects.equals(status, other.status) && | ||
Objects.equals(url, other.url) | ||
); | ||
} | ||
|
||
@Override | ||
public int hashCode() { | ||
return Objects.hash(status, url); | ||
} | ||
} |
65 changes: 65 additions & 0 deletions
65
src/main/java/com/twilio/rest/flexapi/v1/ProvisioningStatusFetcher.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,65 @@ | ||
/* | ||
* 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.v1; | ||
|
||
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 ProvisioningStatusFetcher extends Fetcher<ProvisioningStatus> { | ||
|
||
public ProvisioningStatusFetcher() {} | ||
|
||
@Override | ||
public ProvisioningStatus fetch(final TwilioRestClient client) { | ||
String path = "/v1/account/provision/status"; | ||
|
||
Request request = new Request( | ||
HttpMethod.GET, | ||
Domains.FLEXAPI.toString(), | ||
path | ||
); | ||
Response response = client.request(request); | ||
|
||
if (response == null) { | ||
throw new ApiConnectionException( | ||
"ProvisioningStatus 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 ProvisioningStatus.fromJson( | ||
response.getStream(), | ||
client.getObjectMapper() | ||
); | ||
} | ||
} |
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
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
67 changes: 67 additions & 0 deletions
67
src/main/java/com/twilio/rest/messaging/v1/TollfreeVerificationDeleter.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,67 @@ | ||
/* | ||
* 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.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 TollfreeVerificationDeleter extends Deleter<TollfreeVerification> { | ||
|
||
private String pathSid; | ||
|
||
public TollfreeVerificationDeleter(final String pathSid) { | ||
this.pathSid = pathSid; | ||
} | ||
|
||
@Override | ||
public boolean delete(final TwilioRestClient client) { | ||
String path = "/v1/Tollfree/Verifications/{Sid}"; | ||
|
||
path = path.replace("{" + "Sid" + "}", this.pathSid.toString()); | ||
|
||
Request request = new Request( | ||
HttpMethod.DELETE, | ||
Domains.MESSAGING.toString(), | ||
path | ||
); | ||
Response response = client.request(request); | ||
|
||
if (response == null) { | ||
throw new ApiConnectionException( | ||
"TollfreeVerification 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; | ||
} | ||
} |
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
Oops, something went wrong.