diff --git a/.github/workflows/test-and-deploy.yml b/.github/workflows/test-and-deploy.yml index 07178db5f3..d9aace8a70 100644 --- a/.github/workflows/test-and-deploy.yml +++ b/.github/workflows/test-and-deploy.yml @@ -62,7 +62,7 @@ jobs: with: distribution: 'zulu' java-version: '17' - + - name: SonarCloud Scan if: ${{ (github.event_name == 'pull_request' || github.ref_type == 'branch') && matrix.java == 11 && !github.event.pull_request.head.repo.fork }} env: @@ -94,7 +94,7 @@ jobs: - name: Create GitHub Release uses: sendgrid/dx-automator/actions/release@main with: - footer: '**[Maven](https://mvnrepository.com/artifact/com.twilio.sdk/twilio/${version})**' + footer: '**[Maven](https://central.sonatype.com/artifact/com.twilio.sdk/twilio/${version})**' env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/CHANGES.md b/CHANGES.md index 2a4a510039..b410ee82df 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -1,6 +1,56 @@ twilio-java changelog ===================== +[2025-07-24] Version 11.0.0-rc.3 +-------------------------------- +**Events** +- Remove `SinkSid` parameter when updating subscriptions. **(breaking change)** + +**Twiml** +- Remove Duplicates. +- Add Polly Generative voices. +- Add Latest Google (Chirp3-HD) voices. + + +[2025-07-10] Version 11.0.0-rc.2 +-------------------------------- +**Flex** +- update team name for web_channel, webchat_init_token, webchat_refresh_token + + +[2025-07-03] Version 11.0.0-rc.1 +-------------------------------- +**Library - Chore** +- [PR #875](https://github.com/twilio/twilio-java/pull/875): prepare for RC release. Thanks to [@tiwarishubham635](https://github.com/tiwarishubham635)! +- [PR #874](https://github.com/twilio/twilio-java/pull/874): Handle List serialization. Thanks to [@tiwarishubham635](https://github.com/tiwarishubham635)! +- [PR #873](https://github.com/twilio/twilio-java/pull/873): use Object for anyType. Thanks to [@tiwarishubham635](https://github.com/tiwarishubham635)! + +**Bulkexports** +- Changed the type of 'details' field to be a list of objects instead of a single object + +**Conversations** +- Updates to `method` casing for ConfgurationAddress, ConversationScopedWebhook, and ServiceConversationScopedWebhook for RestProxy compatibility + +**Proxy** +- remove shortcodes resource as its no longer used + +**Serverless** +- Change log field level from type `ienum` to `string` in Logs api + +**Taskrouter** +- Remove `URL-encoded` from attributes param definition in tasks + +**Trunking** +- Added `symmetric_rtp_enabled` property on Trunks. + +**Twiml** +- Add support for `` noun under `` verb + + +[2025-07-03] Version 11.0.0-rc.0 +-------------------------------- +- Release Candidate prep + [2025-06-12] Version 10.9.2 --------------------------- **Library - Chore** diff --git a/README.md b/README.md index dbd9f1c804..e498ca964c 100644 --- a/README.md +++ b/README.md @@ -62,7 +62,7 @@ Use the following dependency in your project to grab via Maven: com.twilio.sdk twilio - 10.X.X + 11.X.X-rc.x compile ``` @@ -70,7 +70,7 @@ Use the following dependency in your project to grab via Maven: or Gradle: ```groovy -implementation "com.twilio.sdk:twilio:10.X.X" +implementation "com.twilio.sdk:twilio:11.X.X-rc.x" ``` If you want to compile it yourself, here's how: diff --git a/examples/Content.md b/examples/Content.md index b9c7298a4f..4d1e77a224 100644 --- a/examples/Content.md +++ b/examples/Content.md @@ -1,18 +1,18 @@ public class ContentExamples { - public static void main { + public static void main(String[] args) { Twilio.init(ACCOUNT_SID, AUTH_TOKEN); createTwilioText(); } public static void createTwilioText() { - Content.ContentCreateRequest createRequest = new Content.ContentCreateRequest("es", types); - Content.TwilioText twilioText = new Content.TwilioText(); twilioText.setBody("text body"); Content.Types types = new Content.Types(); types.setTwilioText(twilioText); + Content.ContentCreateRequest createRequest = new Content.ContentCreateRequest("es", types); + Map variables = new HashMap<>(); variables.put("var1", "val1"); diff --git a/pom.xml b/pom.xml index 69033e805e..317961afc9 100644 --- a/pom.xml +++ b/pom.xml @@ -5,7 +5,7 @@ twilio jar twilio - 10.9.2 + 11.0.0-rc.3 Twilio Java Helper Library https://www.twilio.com @@ -19,7 +19,7 @@ git@github.com:twilio/twilio-java.git scm:git:git@github.com:twilio/twilio-java.git scm:git:git@github.com:twilio/twilio-java.git - 10.9.2 + 11.0.0-rc.3 diff --git a/src/main/java/com/twilio/Domains.java b/src/main/java/com/twilio/Domains.java index 956b8080b9..2baa605f57 100644 --- a/src/main/java/com/twilio/Domains.java +++ b/src/main/java/com/twilio/Domains.java @@ -26,11 +26,9 @@ public enum Domains { INSIGHTS("insights"), INTELLIGENCE("intelligence"), IPMESSAGING("ip-messaging"), - KNOWLEDGE("knowledge"), LOOKUPS("lookups"), MARKETPLACE("marketplace"), MESSAGING("messaging"), - MICROVISOR("microvisor"), MONITOR("monitor"), NOTIFY("notify"), NUMBERS("numbers"), diff --git a/src/main/java/com/twilio/Twilio.java b/src/main/java/com/twilio/Twilio.java index 7ed3da168a..3e33c76558 100644 --- a/src/main/java/com/twilio/Twilio.java +++ b/src/main/java/com/twilio/Twilio.java @@ -24,7 +24,7 @@ */ public class Twilio { - public static final String VERSION = "10.9.2"; + public static final String VERSION = "11.0.0-rc.3"; public static final String JAVA_VERSION = System.getProperty("java.version"); public static final String OS_NAME = System.getProperty("os.name"); public static final String OS_ARCH = System.getProperty("os.arch"); @@ -37,7 +37,7 @@ public class Twilio { private static String edge = System.getenv("TWILIO_EDGE"); private static volatile TwilioRestClient restClient; private static volatile ExecutorService executorService; - + private static CredentialProvider credentialProvider; private Twilio() { @@ -85,7 +85,7 @@ private static void setCredentialProvider(final CredentialProvider credentialPro if (credentialProvider == null) { throw new AuthenticationException("Credential Provider can not be null"); } - + if (!credentialProvider.equals(Twilio.credentialProvider)) { Twilio.invalidate(); } @@ -315,7 +315,7 @@ private static void invalidate() { private static void invalidateOAuthCreds() { Twilio.credentialProvider = null; } - + private static void invalidateBasicCreds() { Twilio.username = null; Twilio.password = null; diff --git a/src/main/java/com/twilio/base/ResourceSet.java b/src/main/java/com/twilio/base/ResourceSet.java index 37fec6c969..6e5608adce 100644 --- a/src/main/java/com/twilio/base/ResourceSet.java +++ b/src/main/java/com/twilio/base/ResourceSet.java @@ -14,6 +14,7 @@ public class ResourceSet implements Iterable { private final Reader reader; private final TwilioRestClient client; + private final Page firstPage; // Store reference to first page to enable multiple iterations private boolean autoPaging; private long pages = 1; @@ -32,6 +33,7 @@ public class ResourceSet implements Iterable { public ResourceSet(final Reader reader, final TwilioRestClient client, final Page page) { this.reader = reader; this.client = client; + this.firstPage = page; // Save first page to allow resetting iterator state this.page = page; this.iterator = page.getRecords().iterator(); this.autoPaging = true; @@ -74,6 +76,12 @@ public long getPageLimit() { @Override public Iterator iterator() { + // Reset state to allow multiple iterations + this.processed = 0; + this.pages = 1; + this.page = this.firstPage; // Reset to first page for new iteration + this.iterator = this.firstPage.getRecords().iterator(); // Reset iterator to start of first page + return new ResourceSetIterator<>(this); } diff --git a/src/main/java/com/twilio/base/bearertoken/ResourceSet.java b/src/main/java/com/twilio/base/bearertoken/ResourceSet.java index 16bc369084..4cc09d8c2d 100644 --- a/src/main/java/com/twilio/base/bearertoken/ResourceSet.java +++ b/src/main/java/com/twilio/base/bearertoken/ResourceSet.java @@ -14,6 +14,7 @@ public class ResourceSet implements Iterable { private final Reader reader; private final BearerTokenTwilioRestClient client; + private final Page firstPage; // Store reference to first page to enable multiple iterations private boolean autoPaging; private long pages = 1; @@ -32,6 +33,7 @@ public class ResourceSet implements Iterable { public ResourceSet(final Reader reader, final BearerTokenTwilioRestClient client, final Page page) { this.reader = reader; this.client = client; + this.firstPage = page; // Save first page to allow resetting iterator state this.page = page; this.iterator = page.getRecords().iterator(); this.autoPaging = true; @@ -74,6 +76,12 @@ public long getPageLimit() { @Override public Iterator iterator() { + // Reset state to allow multiple iterations + this.processed = 0; + this.pages = 1; + this.page = this.firstPage; // Reset to first page for new iteration + this.iterator = this.firstPage.getRecords().iterator(); // Reset iterator to start of first page + return new ResourceSetIterator<>(this); } diff --git a/src/main/java/com/twilio/rest/accounts/v1/BulkConsents.java b/src/main/java/com/twilio/rest/accounts/v1/BulkConsents.java index 2ef3ff3e24..8c8eee79da 100644 --- a/src/main/java/com/twilio/rest/accounts/v1/BulkConsents.java +++ b/src/main/java/com/twilio/rest/accounts/v1/BulkConsents.java @@ -38,9 +38,7 @@ public class BulkConsents extends Resource { private static final long serialVersionUID = 126137950684284L; - public static BulkConsentsCreator creator( - final List> items - ) { + public static BulkConsentsCreator creator(final List items) { return new BulkConsentsCreator(items); } diff --git a/src/main/java/com/twilio/rest/accounts/v1/BulkConsentsCreator.java b/src/main/java/com/twilio/rest/accounts/v1/BulkConsentsCreator.java index 93a1b73bbf..1155c9fd32 100644 --- a/src/main/java/com/twilio/rest/accounts/v1/BulkConsentsCreator.java +++ b/src/main/java/com/twilio/rest/accounts/v1/BulkConsentsCreator.java @@ -29,23 +29,21 @@ import com.twilio.rest.Domains; import java.util.List; import java.util.List; -import java.util.Map; -import java.util.Map; public class BulkConsentsCreator extends Creator { - private List> items; + private List items; - public BulkConsentsCreator(final List> items) { + public BulkConsentsCreator(final List items) { this.items = items; } - public BulkConsentsCreator setItems(final List> items) { + public BulkConsentsCreator setItems(final List items) { this.items = items; return this; } - public BulkConsentsCreator setItems(final Map items) { + public BulkConsentsCreator setItems(final Object items) { return setItems(Promoter.listOfOne(items)); } @@ -89,8 +87,8 @@ public BulkConsents create(final TwilioRestClient client) { private void addPostParams(final Request request) { if (items != null) { - for (Map prop : items) { - request.addPostParam("Items", Converter.mapToJson(prop)); + for (Object prop : items) { + request.addPostParam("Items", Converter.objectToJson(prop)); } } } diff --git a/src/main/java/com/twilio/rest/accounts/v1/BulkContacts.java b/src/main/java/com/twilio/rest/accounts/v1/BulkContacts.java index fbb28d1b7f..b4ff307a19 100644 --- a/src/main/java/com/twilio/rest/accounts/v1/BulkContacts.java +++ b/src/main/java/com/twilio/rest/accounts/v1/BulkContacts.java @@ -38,9 +38,7 @@ public class BulkContacts extends Resource { private static final long serialVersionUID = 126137950684284L; - public static BulkContactsCreator creator( - final List> items - ) { + public static BulkContactsCreator creator(final List items) { return new BulkContactsCreator(items); } diff --git a/src/main/java/com/twilio/rest/accounts/v1/BulkContactsCreator.java b/src/main/java/com/twilio/rest/accounts/v1/BulkContactsCreator.java index 0f3653b994..7dc970c184 100644 --- a/src/main/java/com/twilio/rest/accounts/v1/BulkContactsCreator.java +++ b/src/main/java/com/twilio/rest/accounts/v1/BulkContactsCreator.java @@ -29,23 +29,21 @@ import com.twilio.rest.Domains; import java.util.List; import java.util.List; -import java.util.Map; -import java.util.Map; public class BulkContactsCreator extends Creator { - private List> items; + private List items; - public BulkContactsCreator(final List> items) { + public BulkContactsCreator(final List items) { this.items = items; } - public BulkContactsCreator setItems(final List> items) { + public BulkContactsCreator setItems(final List items) { this.items = items; return this; } - public BulkContactsCreator setItems(final Map items) { + public BulkContactsCreator setItems(final Object items) { return setItems(Promoter.listOfOne(items)); } @@ -89,8 +87,8 @@ public BulkContacts create(final TwilioRestClient client) { private void addPostParams(final Request request) { if (items != null) { - for (Map prop : items) { - request.addPostParam("Items", Converter.mapToJson(prop)); + for (Object prop : items) { + request.addPostParam("Items", Converter.objectToJson(prop)); } } } diff --git a/src/main/java/com/twilio/rest/api/v2010/account/MessageCreator.java b/src/main/java/com/twilio/rest/api/v2010/account/MessageCreator.java index 4ee0387373..c938512a64 100644 --- a/src/main/java/com/twilio/rest/api/v2010/account/MessageCreator.java +++ b/src/main/java/com/twilio/rest/api/v2010/account/MessageCreator.java @@ -318,7 +318,7 @@ public Message create(final TwilioRestClient client) { "{" + "AccountSid" + "}", this.pathAccountSid.toString() ); - path = path.replace("{" + "To" + "}", this.to.encode("utf-8")); + path = path.replace("{" + "To" + "}", this.to.toString()); Request request = new Request( HttpMethod.POST, diff --git a/src/main/java/com/twilio/rest/api/v2010/account/ValidationRequestCreator.java b/src/main/java/com/twilio/rest/api/v2010/account/ValidationRequestCreator.java index b98f8f62b9..15486f1597 100644 --- a/src/main/java/com/twilio/rest/api/v2010/account/ValidationRequestCreator.java +++ b/src/main/java/com/twilio/rest/api/v2010/account/ValidationRequestCreator.java @@ -115,7 +115,7 @@ public ValidationRequest create(final TwilioRestClient client) { path = path.replace( "{" + "PhoneNumber" + "}", - this.phoneNumber.encode("utf-8") + this.phoneNumber.toString() ); Request request = new Request( diff --git a/src/main/java/com/twilio/rest/api/v2010/account/call/PaymentCreator.java b/src/main/java/com/twilio/rest/api/v2010/account/call/PaymentCreator.java index b92f9468f1..c34dfa3202 100644 --- a/src/main/java/com/twilio/rest/api/v2010/account/call/PaymentCreator.java +++ b/src/main/java/com/twilio/rest/api/v2010/account/call/PaymentCreator.java @@ -31,8 +31,6 @@ import java.math.BigDecimal; import java.net.URI; import java.net.URI; -import java.util.Map; -import java.util.Map; public class PaymentCreator extends Creator { @@ -46,7 +44,7 @@ public class PaymentCreator extends Creator { private String description; private String input; private Integer minPostalCodeLength; - private Map parameter; + private Object parameter; private String paymentConnector; private Payment.PaymentMethod paymentMethod; private Boolean postalCode; @@ -125,7 +123,7 @@ public PaymentCreator setMinPostalCodeLength( return this; } - public PaymentCreator setParameter(final Map parameter) { + public PaymentCreator setParameter(final Object parameter) { this.parameter = parameter; return this; } @@ -251,7 +249,10 @@ private void addPostParams(final Request request) { ); } if (parameter != null) { - request.addPostParam("Parameter", Converter.mapToJson(parameter)); + request.addPostParam( + "Parameter", + Converter.objectToJson(parameter) + ); } if (paymentConnector != null) { request.addPostParam("PaymentConnector", paymentConnector); diff --git a/src/main/java/com/twilio/rest/api/v2010/account/incomingphonenumber/LocalCreator.java b/src/main/java/com/twilio/rest/api/v2010/account/incomingphonenumber/LocalCreator.java index 27ecf933c4..25a74eb499 100644 --- a/src/main/java/com/twilio/rest/api/v2010/account/incomingphonenumber/LocalCreator.java +++ b/src/main/java/com/twilio/rest/api/v2010/account/incomingphonenumber/LocalCreator.java @@ -241,7 +241,7 @@ public Local create(final TwilioRestClient client) { path = path.replace( "{" + "PhoneNumber" + "}", - this.phoneNumber.encode("utf-8") + this.phoneNumber.toString() ); Request request = new Request( diff --git a/src/main/java/com/twilio/rest/api/v2010/account/incomingphonenumber/MobileCreator.java b/src/main/java/com/twilio/rest/api/v2010/account/incomingphonenumber/MobileCreator.java index 5a40e409a0..6fe7fa36c0 100644 --- a/src/main/java/com/twilio/rest/api/v2010/account/incomingphonenumber/MobileCreator.java +++ b/src/main/java/com/twilio/rest/api/v2010/account/incomingphonenumber/MobileCreator.java @@ -241,7 +241,7 @@ public Mobile create(final TwilioRestClient client) { path = path.replace( "{" + "PhoneNumber" + "}", - this.phoneNumber.encode("utf-8") + this.phoneNumber.toString() ); Request request = new Request( diff --git a/src/main/java/com/twilio/rest/api/v2010/account/incomingphonenumber/TollFreeCreator.java b/src/main/java/com/twilio/rest/api/v2010/account/incomingphonenumber/TollFreeCreator.java index c6426ab2ce..61034d20c3 100644 --- a/src/main/java/com/twilio/rest/api/v2010/account/incomingphonenumber/TollFreeCreator.java +++ b/src/main/java/com/twilio/rest/api/v2010/account/incomingphonenumber/TollFreeCreator.java @@ -243,7 +243,7 @@ public TollFree create(final TwilioRestClient client) { path = path.replace( "{" + "PhoneNumber" + "}", - this.phoneNumber.encode("utf-8") + this.phoneNumber.toString() ); Request request = new Request( diff --git a/src/main/java/com/twilio/rest/assistants/v1/Assistant.java b/src/main/java/com/twilio/rest/assistants/v1/Assistant.java index 94f290b45d..0c4ed48947 100644 --- a/src/main/java/com/twilio/rest/assistants/v1/Assistant.java +++ b/src/main/java/com/twilio/rest/assistants/v1/Assistant.java @@ -23,7 +23,6 @@ import com.fasterxml.jackson.databind.JsonMappingException; import com.fasterxml.jackson.databind.ObjectMapper; import com.twilio.base.Resource; -import com.twilio.converter.Converter; import com.twilio.converter.DateConverter; import com.twilio.exception.ApiConnectionException; import com.twilio.exception.ApiException; @@ -136,7 +135,9 @@ public static class AssistantsV1ServiceCreateAssistantRequest { @Setter private AssistantsV1ServiceSegmentCredential segmentCredential; - public AssistantsV1ServiceCreateAssistantRequest() {} + public AssistantsV1ServiceCreateAssistantRequest(final String name) { + this.name = name; + } public static AssistantsV1ServiceCreateAssistantRequest fromJson( String jsonString, @@ -222,10 +223,6 @@ public static class AssistantsV1ServiceKnowledge { @Setter private Map knowledgeSourceDetails; - public String getKnowledgeSourceDetails() { - return Converter.mapToJson(knowledgeSourceDetails); - } - @JsonInclude(JsonInclude.Include.NON_EMPTY) @JsonProperty("name") @Getter @@ -320,10 +317,6 @@ public static class AssistantsV1ServiceTool { @Setter private Map meta; - public String getMeta() { - return Converter.mapToJson(meta); - } - @JsonInclude(JsonInclude.Include.NON_EMPTY) @JsonProperty("name") @Getter diff --git a/src/main/java/com/twilio/rest/assistants/v1/Knowledge.java b/src/main/java/com/twilio/rest/assistants/v1/Knowledge.java index 0f5b469bb2..a899609713 100644 --- a/src/main/java/com/twilio/rest/assistants/v1/Knowledge.java +++ b/src/main/java/com/twilio/rest/assistants/v1/Knowledge.java @@ -23,7 +23,6 @@ import com.fasterxml.jackson.databind.JsonMappingException; import com.fasterxml.jackson.databind.ObjectMapper; import com.twilio.base.Resource; -import com.twilio.converter.Converter; import com.twilio.converter.DateConverter; import com.twilio.exception.ApiConnectionException; import com.twilio.exception.ApiException; @@ -71,10 +70,6 @@ public static class AssistantsV1ServiceCreatePolicyRequest { @Setter private Object policyDetails; - public String getPolicyDetails() { - return Converter.objectToJson(policyDetails); - } - @JsonInclude(JsonInclude.Include.NON_EMPTY) @JsonProperty("type") @Getter @@ -113,10 +108,6 @@ public static class AssistantsV1ServiceCreateKnowledgeRequest { @Setter private Map knowledgeSourceDetails; - public String getKnowledgeSourceDetails() { - return Converter.mapToJson(knowledgeSourceDetails); - } - @JsonInclude(JsonInclude.Include.NON_EMPTY) @JsonProperty("name") @Getter @@ -141,7 +132,13 @@ public String getKnowledgeSourceDetails() { @Setter private String embeddingModel; - public AssistantsV1ServiceCreateKnowledgeRequest() {} + public AssistantsV1ServiceCreateKnowledgeRequest( + final String name, + final String type + ) { + this.name = name; + this.type = type; + } public static AssistantsV1ServiceCreateKnowledgeRequest fromJson( String jsonString, @@ -169,10 +166,6 @@ public static class AssistantsV1ServiceUpdateKnowledgeRequest { @Setter private Map knowledgeSourceDetails; - public String getKnowledgeSourceDetails() { - return Converter.mapToJson(knowledgeSourceDetails); - } - @JsonInclude(JsonInclude.Include.NON_EMPTY) @JsonProperty("name") @Getter diff --git a/src/main/java/com/twilio/rest/assistants/v1/Tool.java b/src/main/java/com/twilio/rest/assistants/v1/Tool.java index c4dbbf3be2..48770ad6a1 100644 --- a/src/main/java/com/twilio/rest/assistants/v1/Tool.java +++ b/src/main/java/com/twilio/rest/assistants/v1/Tool.java @@ -23,7 +23,6 @@ import com.fasterxml.jackson.databind.JsonMappingException; import com.fasterxml.jackson.databind.ObjectMapper; import com.twilio.base.Resource; -import com.twilio.converter.Converter; import com.twilio.converter.DateConverter; import com.twilio.exception.ApiConnectionException; import com.twilio.exception.ApiException; @@ -72,10 +71,6 @@ public static class AssistantsV1ServiceCreatePolicyRequest { @Setter private Object policyDetails; - public String getPolicyDetails() { - return Converter.objectToJson(policyDetails); - } - @JsonInclude(JsonInclude.Include.NON_EMPTY) @JsonProperty("type") @Getter @@ -120,10 +115,6 @@ public static class AssistantsV1ServiceCreateToolRequest { @Setter private Map meta; - public String getMeta() { - return Converter.mapToJson(meta); - } - @JsonInclude(JsonInclude.Include.NON_EMPTY) @JsonProperty("name") @Getter @@ -142,7 +133,15 @@ public String getMeta() { @Setter private String type; - public AssistantsV1ServiceCreateToolRequest() {} + public AssistantsV1ServiceCreateToolRequest( + final Boolean enabled, + final String name, + final String type + ) { + this.enabled = enabled; + this.name = name; + this.type = type; + } public static AssistantsV1ServiceCreateToolRequest fromJson( String jsonString, @@ -182,10 +181,6 @@ public static class AssistantsV1ServiceUpdateToolRequest { @Setter private Map meta; - public String getMeta() { - return Converter.mapToJson(meta); - } - @JsonInclude(JsonInclude.Include.NON_EMPTY) @JsonProperty("name") @Getter @@ -262,10 +257,6 @@ public static class AssistantsV1ServicePolicy { @Setter private Map policyDetails; - public String getPolicyDetails() { - return Converter.mapToJson(policyDetails); - } - @JsonInclude(JsonInclude.Include.NON_EMPTY) @JsonProperty("dateCreated") @Getter diff --git a/src/main/java/com/twilio/rest/bulkexports/v1/export/ExportCustomJob.java b/src/main/java/com/twilio/rest/bulkexports/v1/export/ExportCustomJob.java index 058ef9a15c..ee3bc089bb 100644 --- a/src/main/java/com/twilio/rest/bulkexports/v1/export/ExportCustomJob.java +++ b/src/main/java/com/twilio/rest/bulkexports/v1/export/ExportCustomJob.java @@ -25,6 +25,7 @@ import com.twilio.exception.ApiException; import java.io.IOException; import java.io.InputStream; +import java.util.List; import java.util.Map; import java.util.Map; import java.util.Objects; @@ -35,7 +36,7 @@ @ToString public class ExportCustomJob extends Resource { - private static final long serialVersionUID = 125242558228L; + private static final long serialVersionUID = 87737406045908L; public static ExportCustomJobCreator creator( final String pathResourceType, @@ -106,7 +107,7 @@ public static ExportCustomJob fromJson( private final String webhookMethod; private final String email; private final String jobSid; - private final Map details; + private final List> details; private final String jobQueuePosition; private final String estimatedCompletionTime; @@ -120,7 +121,7 @@ private ExportCustomJob( @JsonProperty("webhook_method") final String webhookMethod, @JsonProperty("email") final String email, @JsonProperty("job_sid") final String jobSid, - @JsonProperty("details") final Map details, + @JsonProperty("details") final List> details, @JsonProperty("job_queue_position") final String jobQueuePosition, @JsonProperty( "estimated_completion_time" @@ -171,7 +172,7 @@ public final String getJobSid() { return this.jobSid; } - public final Map getDetails() { + public final List> getDetails() { return this.details; } diff --git a/src/main/java/com/twilio/rest/bulkexports/v1/export/Job.java b/src/main/java/com/twilio/rest/bulkexports/v1/export/Job.java index 52fce1b2eb..685913964b 100644 --- a/src/main/java/com/twilio/rest/bulkexports/v1/export/Job.java +++ b/src/main/java/com/twilio/rest/bulkexports/v1/export/Job.java @@ -26,6 +26,7 @@ import java.io.IOException; import java.io.InputStream; import java.net.URI; +import java.util.List; import java.util.Map; import java.util.Map; import java.util.Objects; @@ -36,7 +37,7 @@ @ToString public class Job extends Resource { - private static final long serialVersionUID = 103628862500013L; + private static final long serialVersionUID = 152000944333983L; public static JobDeleter deleter(final String pathJobSid) { return new JobDeleter(pathJobSid); @@ -91,7 +92,7 @@ public static Job fromJson( private final String resourceType; private final String friendlyName; - private final Map details; + private final List> details; private final String startDay; private final String endDay; private final String jobSid; @@ -106,7 +107,7 @@ public static Job fromJson( private Job( @JsonProperty("resource_type") final String resourceType, @JsonProperty("friendly_name") final String friendlyName, - @JsonProperty("details") final Map details, + @JsonProperty("details") final List> details, @JsonProperty("start_day") final String startDay, @JsonProperty("end_day") final String endDay, @JsonProperty("job_sid") final String jobSid, @@ -141,7 +142,7 @@ public final String getFriendlyName() { return this.friendlyName; } - public final Map getDetails() { + public final List> getDetails() { return this.details; } diff --git a/src/main/java/com/twilio/rest/conversations/v1/AddressConfiguration.java b/src/main/java/com/twilio/rest/conversations/v1/AddressConfiguration.java index e621325249..b0b200cf5f 100644 --- a/src/main/java/com/twilio/rest/conversations/v1/AddressConfiguration.java +++ b/src/main/java/com/twilio/rest/conversations/v1/AddressConfiguration.java @@ -246,19 +246,13 @@ public static AutoCreationType forValue(final String value) { } } - public enum Type { - SMS("sms"), - WHATSAPP("whatsapp"), - MESSENGER("messenger"), - GBM("gbm"), - EMAIL("email"), - RCS("rcs"), - APPLE("apple"), - CHAT("chat"); + public enum Method { + GET("get"), + POST("post"); private final String value; - private Type(final String value) { + private Method(final String value) { this.value = value; } @@ -267,18 +261,24 @@ public String toString() { } @JsonCreator - public static Type forValue(final String value) { - return Promoter.enumFromString(value, Type.values()); + public static Method forValue(final String value) { + return Promoter.enumFromString(value, Method.values()); } } - public enum Method { - GET("GET"), - POST("POST"); + public enum Type { + SMS("sms"), + WHATSAPP("whatsapp"), + MESSENGER("messenger"), + GBM("gbm"), + EMAIL("email"), + RCS("rcs"), + APPLE("apple"), + CHAT("chat"); private final String value; - private Method(final String value) { + private Type(final String value) { this.value = value; } @@ -287,8 +287,8 @@ public String toString() { } @JsonCreator - public static Method forValue(final String value) { - return Promoter.enumFromString(value, Method.values()); + public static Type forValue(final String value) { + return Promoter.enumFromString(value, Type.values()); } } } diff --git a/src/main/java/com/twilio/rest/conversations/v1/conversation/Webhook.java b/src/main/java/com/twilio/rest/conversations/v1/conversation/Webhook.java index f6da62268d..8bfea294d0 100644 --- a/src/main/java/com/twilio/rest/conversations/v1/conversation/Webhook.java +++ b/src/main/java/com/twilio/rest/conversations/v1/conversation/Webhook.java @@ -238,8 +238,8 @@ public static Target forValue(final String value) { } public enum Method { - GET("GET"), - POST("POST"); + GET("get"), + POST("post"); private final String value; diff --git a/src/main/java/com/twilio/rest/conversations/v1/service/conversation/Webhook.java b/src/main/java/com/twilio/rest/conversations/v1/service/conversation/Webhook.java index dfaee4587f..3df7568adc 100644 --- a/src/main/java/com/twilio/rest/conversations/v1/service/conversation/Webhook.java +++ b/src/main/java/com/twilio/rest/conversations/v1/service/conversation/Webhook.java @@ -270,8 +270,8 @@ public static Target forValue(final String value) { } public enum Method { - GET("GET"), - POST("POST"); + GET("get"), + POST("post"); private final String value; diff --git a/src/main/java/com/twilio/rest/events/v1/Sink.java b/src/main/java/com/twilio/rest/events/v1/Sink.java index 1a0f0eb112..8a5ea31e9c 100644 --- a/src/main/java/com/twilio/rest/events/v1/Sink.java +++ b/src/main/java/com/twilio/rest/events/v1/Sink.java @@ -43,7 +43,7 @@ public class Sink extends Resource { public static SinkCreator creator( final String description, - final Map sinkConfiguration, + final Object sinkConfiguration, final Sink.SinkType sinkType ) { return new SinkCreator(description, sinkConfiguration, sinkType); diff --git a/src/main/java/com/twilio/rest/events/v1/SinkCreator.java b/src/main/java/com/twilio/rest/events/v1/SinkCreator.java index 781066e4cd..632c1d9aec 100644 --- a/src/main/java/com/twilio/rest/events/v1/SinkCreator.java +++ b/src/main/java/com/twilio/rest/events/v1/SinkCreator.java @@ -26,18 +26,16 @@ import com.twilio.http.Response; import com.twilio.http.TwilioRestClient; import com.twilio.rest.Domains; -import java.util.Map; -import java.util.Map; public class SinkCreator extends Creator { private String description; - private Map sinkConfiguration; + private Object sinkConfiguration; private Sink.SinkType sinkType; public SinkCreator( final String description, - final Map sinkConfiguration, + final Object sinkConfiguration, final Sink.SinkType sinkType ) { this.description = description; @@ -50,9 +48,7 @@ public SinkCreator setDescription(final String description) { return this; } - public SinkCreator setSinkConfiguration( - final Map sinkConfiguration - ) { + public SinkCreator setSinkConfiguration(final Object sinkConfiguration) { this.sinkConfiguration = sinkConfiguration; return this; } @@ -114,7 +110,7 @@ private void addPostParams(final Request request) { if (sinkConfiguration != null) { request.addPostParam( "SinkConfiguration", - Converter.mapToJson(sinkConfiguration) + Converter.objectToJson(sinkConfiguration) ); } if (sinkType != null) { diff --git a/src/main/java/com/twilio/rest/events/v1/Subscription.java b/src/main/java/com/twilio/rest/events/v1/Subscription.java index 0a37de2b4a..123ccdbbfc 100644 --- a/src/main/java/com/twilio/rest/events/v1/Subscription.java +++ b/src/main/java/com/twilio/rest/events/v1/Subscription.java @@ -44,7 +44,7 @@ public class Subscription extends Resource { public static SubscriptionCreator creator( final String description, final String sinkSid, - final List> types + final List types ) { return new SubscriptionCreator(description, sinkSid, types); } diff --git a/src/main/java/com/twilio/rest/events/v1/SubscriptionCreator.java b/src/main/java/com/twilio/rest/events/v1/SubscriptionCreator.java index 449e4aa7cd..32e9a37342 100644 --- a/src/main/java/com/twilio/rest/events/v1/SubscriptionCreator.java +++ b/src/main/java/com/twilio/rest/events/v1/SubscriptionCreator.java @@ -29,19 +29,17 @@ import com.twilio.rest.Domains; import java.util.List; import java.util.List; -import java.util.Map; -import java.util.Map; public class SubscriptionCreator extends Creator { private String description; private String sinkSid; - private List> types; + private List types; public SubscriptionCreator( final String description, final String sinkSid, - final List> types + final List types ) { this.description = description; this.sinkSid = sinkSid; @@ -58,12 +56,12 @@ public SubscriptionCreator setSinkSid(final String sinkSid) { return this; } - public SubscriptionCreator setTypes(final List> types) { + public SubscriptionCreator setTypes(final List types) { this.types = types; return this; } - public SubscriptionCreator setTypes(final Map types) { + public SubscriptionCreator setTypes(final Object types) { return setTypes(Promoter.listOfOne(types)); } @@ -119,8 +117,8 @@ private void addPostParams(final Request request) { request.addPostParam("SinkSid", sinkSid); } if (types != null) { - for (Map prop : types) { - request.addPostParam("Types", Converter.mapToJson(prop)); + for (Object prop : types) { + request.addPostParam("Types", Converter.objectToJson(prop)); } } } diff --git a/src/main/java/com/twilio/rest/events/v1/SubscriptionUpdater.java b/src/main/java/com/twilio/rest/events/v1/SubscriptionUpdater.java index adefd8eab6..a6907cb6e5 100644 --- a/src/main/java/com/twilio/rest/events/v1/SubscriptionUpdater.java +++ b/src/main/java/com/twilio/rest/events/v1/SubscriptionUpdater.java @@ -29,7 +29,6 @@ public class SubscriptionUpdater extends Updater { private String pathSid; private String description; - private String sinkSid; public SubscriptionUpdater(final String pathSid) { this.pathSid = pathSid; @@ -40,11 +39,6 @@ public SubscriptionUpdater setDescription(final String description) { return this; } - public SubscriptionUpdater setSinkSid(final String sinkSid) { - this.sinkSid = sinkSid; - return this; - } - @Override public Subscription update(final TwilioRestClient client) { String path = "/v1/Subscriptions/{Sid}"; @@ -87,8 +81,5 @@ private void addPostParams(final Request request) { if (description != null) { request.addPostParam("Description", description); } - if (sinkSid != null) { - request.addPostParam("SinkSid", sinkSid); - } } } diff --git a/src/main/java/com/twilio/rest/flexapi/v1/Interaction.java b/src/main/java/com/twilio/rest/flexapi/v1/Interaction.java index 9bce2d74ec..99af3da8ff 100644 --- a/src/main/java/com/twilio/rest/flexapi/v1/Interaction.java +++ b/src/main/java/com/twilio/rest/flexapi/v1/Interaction.java @@ -38,9 +38,7 @@ public class Interaction extends Resource { private static final long serialVersionUID = 256485735361091L; - public static InteractionCreator creator( - final Map channel - ) { + public static InteractionCreator creator(final Object channel) { return new InteractionCreator(channel); } diff --git a/src/main/java/com/twilio/rest/flexapi/v1/InteractionCreator.java b/src/main/java/com/twilio/rest/flexapi/v1/InteractionCreator.java index fa70c4a23e..4ac64c4b4a 100644 --- a/src/main/java/com/twilio/rest/flexapi/v1/InteractionCreator.java +++ b/src/main/java/com/twilio/rest/flexapi/v1/InteractionCreator.java @@ -26,26 +26,24 @@ import com.twilio.http.Response; import com.twilio.http.TwilioRestClient; import com.twilio.rest.Domains; -import java.util.Map; -import java.util.Map; public class InteractionCreator extends Creator { - private Map channel; - private Map routing; + private Object channel; + private Object routing; private String interactionContextSid; private String webhookTtid; - public InteractionCreator(final Map channel) { + public InteractionCreator(final Object channel) { this.channel = channel; } - public InteractionCreator setChannel(final Map channel) { + public InteractionCreator setChannel(final Object channel) { this.channel = channel; return this; } - public InteractionCreator setRouting(final Map routing) { + public InteractionCreator setRouting(final Object routing) { this.routing = routing; return this; } @@ -102,10 +100,10 @@ public Interaction create(final TwilioRestClient client) { private void addPostParams(final Request request) { if (channel != null) { - request.addPostParam("Channel", Converter.mapToJson(channel)); + request.addPostParam("Channel", Converter.objectToJson(channel)); } if (routing != null) { - request.addPostParam("Routing", Converter.mapToJson(routing)); + request.addPostParam("Routing", Converter.objectToJson(routing)); } if (interactionContextSid != null) { request.addPostParam( diff --git a/src/main/java/com/twilio/rest/flexapi/v1/PluginConfigurationCreator.java b/src/main/java/com/twilio/rest/flexapi/v1/PluginConfigurationCreator.java index 0450fd0ae1..3fc0e2b9d8 100644 --- a/src/main/java/com/twilio/rest/flexapi/v1/PluginConfigurationCreator.java +++ b/src/main/java/com/twilio/rest/flexapi/v1/PluginConfigurationCreator.java @@ -29,14 +29,12 @@ import com.twilio.rest.Domains; import java.util.List; import java.util.List; -import java.util.Map; -import java.util.Map; public class PluginConfigurationCreator extends Creator { private String name; private String flexMetadata; - private List> plugins; + private List plugins; private String description; public PluginConfigurationCreator(final String name) { @@ -55,16 +53,12 @@ public PluginConfigurationCreator setFlexMetadata( return this; } - public PluginConfigurationCreator setPlugins( - final List> plugins - ) { + public PluginConfigurationCreator setPlugins(final List plugins) { this.plugins = plugins; return this; } - public PluginConfigurationCreator setPlugins( - final Map plugins - ) { + public PluginConfigurationCreator setPlugins(final Object plugins) { return setPlugins(Promoter.listOfOne(plugins)); } @@ -117,8 +111,8 @@ private void addPostParams(final Request request) { request.addPostParam("Name", name); } if (plugins != null) { - for (Map prop : plugins) { - request.addPostParam("Plugins", Converter.mapToJson(prop)); + for (Object prop : plugins) { + request.addPostParam("Plugins", Converter.objectToJson(prop)); } } if (description != null) { diff --git a/src/main/java/com/twilio/rest/flexapi/v1/interaction/InteractionChannelUpdater.java b/src/main/java/com/twilio/rest/flexapi/v1/interaction/InteractionChannelUpdater.java index 22a50f6d76..3c61717b83 100644 --- a/src/main/java/com/twilio/rest/flexapi/v1/interaction/InteractionChannelUpdater.java +++ b/src/main/java/com/twilio/rest/flexapi/v1/interaction/InteractionChannelUpdater.java @@ -25,14 +25,13 @@ import com.twilio.http.Response; import com.twilio.http.TwilioRestClient; import com.twilio.rest.Domains; -import java.util.Map; public class InteractionChannelUpdater extends Updater { private String pathInteractionSid; private String pathSid; private InteractionChannel.UpdateChannelStatus status; - private Map routing; + private Object routing; public InteractionChannelUpdater( final String pathInteractionSid, @@ -51,9 +50,7 @@ public InteractionChannelUpdater setStatus( return this; } - public InteractionChannelUpdater setRouting( - final Map routing - ) { + public InteractionChannelUpdater setRouting(final Object routing) { this.routing = routing; return this; } @@ -107,7 +104,7 @@ private void addPostParams(final Request request) { request.addPostParam("Status", status.toString()); } if (routing != null) { - request.addPostParam("Routing", Converter.mapToJson(routing)); + request.addPostParam("Routing", Converter.objectToJson(routing)); } } } diff --git a/src/main/java/com/twilio/rest/flexapi/v1/interaction/interactionchannel/InteractionChannelInvite.java b/src/main/java/com/twilio/rest/flexapi/v1/interaction/interactionchannel/InteractionChannelInvite.java index 6a9e79717b..da656b886a 100644 --- a/src/main/java/com/twilio/rest/flexapi/v1/interaction/interactionchannel/InteractionChannelInvite.java +++ b/src/main/java/com/twilio/rest/flexapi/v1/interaction/interactionchannel/InteractionChannelInvite.java @@ -41,7 +41,7 @@ public class InteractionChannelInvite extends Resource { public static InteractionChannelInviteCreator creator( final String pathInteractionSid, final String pathChannelSid, - final Map routing + final Object routing ) { return new InteractionChannelInviteCreator( pathInteractionSid, diff --git a/src/main/java/com/twilio/rest/flexapi/v1/interaction/interactionchannel/InteractionChannelInviteCreator.java b/src/main/java/com/twilio/rest/flexapi/v1/interaction/interactionchannel/InteractionChannelInviteCreator.java index 94643ed2dd..89dd3e12be 100644 --- a/src/main/java/com/twilio/rest/flexapi/v1/interaction/interactionchannel/InteractionChannelInviteCreator.java +++ b/src/main/java/com/twilio/rest/flexapi/v1/interaction/interactionchannel/InteractionChannelInviteCreator.java @@ -26,29 +26,25 @@ import com.twilio.http.Response; import com.twilio.http.TwilioRestClient; import com.twilio.rest.Domains; -import java.util.Map; -import java.util.Map; public class InteractionChannelInviteCreator extends Creator { private String pathInteractionSid; private String pathChannelSid; - private Map routing; + private Object routing; public InteractionChannelInviteCreator( final String pathInteractionSid, final String pathChannelSid, - final Map routing + final Object routing ) { this.pathInteractionSid = pathInteractionSid; this.pathChannelSid = pathChannelSid; this.routing = routing; } - public InteractionChannelInviteCreator setRouting( - final Map routing - ) { + public InteractionChannelInviteCreator setRouting(final Object routing) { this.routing = routing; return this; } @@ -104,7 +100,7 @@ public InteractionChannelInvite create(final TwilioRestClient client) { private void addPostParams(final Request request) { if (routing != null) { - request.addPostParam("Routing", Converter.mapToJson(routing)); + request.addPostParam("Routing", Converter.objectToJson(routing)); } } } diff --git a/src/main/java/com/twilio/rest/flexapi/v1/interaction/interactionchannel/InteractionChannelParticipant.java b/src/main/java/com/twilio/rest/flexapi/v1/interaction/interactionchannel/InteractionChannelParticipant.java index 390638a66e..16c65ee470 100644 --- a/src/main/java/com/twilio/rest/flexapi/v1/interaction/interactionchannel/InteractionChannelParticipant.java +++ b/src/main/java/com/twilio/rest/flexapi/v1/interaction/interactionchannel/InteractionChannelParticipant.java @@ -43,7 +43,7 @@ public static InteractionChannelParticipantCreator creator( final String pathInteractionSid, final String pathChannelSid, final InteractionChannelParticipant.Type type, - final Map mediaProperties + final Object mediaProperties ) { return new InteractionChannelParticipantCreator( pathInteractionSid, diff --git a/src/main/java/com/twilio/rest/flexapi/v1/interaction/interactionchannel/InteractionChannelParticipantCreator.java b/src/main/java/com/twilio/rest/flexapi/v1/interaction/interactionchannel/InteractionChannelParticipantCreator.java index 587a591060..0de36280bf 100644 --- a/src/main/java/com/twilio/rest/flexapi/v1/interaction/interactionchannel/InteractionChannelParticipantCreator.java +++ b/src/main/java/com/twilio/rest/flexapi/v1/interaction/interactionchannel/InteractionChannelParticipantCreator.java @@ -26,8 +26,6 @@ import com.twilio.http.Response; import com.twilio.http.TwilioRestClient; import com.twilio.rest.Domains; -import java.util.Map; -import java.util.Map; public class InteractionChannelParticipantCreator extends Creator { @@ -35,14 +33,14 @@ public class InteractionChannelParticipantCreator private String pathInteractionSid; private String pathChannelSid; private InteractionChannelParticipant.Type type; - private Map mediaProperties; - private Map routingProperties; + private Object mediaProperties; + private Object routingProperties; public InteractionChannelParticipantCreator( final String pathInteractionSid, final String pathChannelSid, final InteractionChannelParticipant.Type type, - final Map mediaProperties + final Object mediaProperties ) { this.pathInteractionSid = pathInteractionSid; this.pathChannelSid = pathChannelSid; @@ -58,14 +56,14 @@ public InteractionChannelParticipantCreator setType( } public InteractionChannelParticipantCreator setMediaProperties( - final Map mediaProperties + final Object mediaProperties ) { this.mediaProperties = mediaProperties; return this; } public InteractionChannelParticipantCreator setRoutingProperties( - final Map routingProperties + final Object routingProperties ) { this.routingProperties = routingProperties; return this; @@ -132,13 +130,13 @@ private void addPostParams(final Request request) { if (mediaProperties != null) { request.addPostParam( "MediaProperties", - Converter.mapToJson(mediaProperties) + Converter.objectToJson(mediaProperties) ); } if (routingProperties != null) { request.addPostParam( "RoutingProperties", - Converter.mapToJson(routingProperties) + Converter.objectToJson(routingProperties) ); } } diff --git a/src/main/java/com/twilio/rest/insights/v1/CallSummariesReader.java b/src/main/java/com/twilio/rest/insights/v1/CallSummariesReader.java index 5c1f1334a7..b298cde879 100644 --- a/src/main/java/com/twilio/rest/insights/v1/CallSummariesReader.java +++ b/src/main/java/com/twilio/rest/insights/v1/CallSummariesReader.java @@ -55,6 +55,10 @@ public class CallSummariesReader extends Reader { private Boolean brandedEnabled; private Boolean voiceIntegrityEnabled; private String brandedBundleSid; + private Boolean brandedLogo; + private String brandedType; + private String brandedUseCase; + private String brandedCallReason; private String voiceIntegrityBundleSid; private String voiceIntegrityUseCase; private String businessProfileIdentity; @@ -215,6 +219,28 @@ public CallSummariesReader setBrandedBundleSid( return this; } + public CallSummariesReader setBrandedLogo(final Boolean brandedLogo) { + this.brandedLogo = brandedLogo; + return this; + } + + public CallSummariesReader setBrandedType(final String brandedType) { + this.brandedType = brandedType; + return this; + } + + public CallSummariesReader setBrandedUseCase(final String brandedUseCase) { + this.brandedUseCase = brandedUseCase; + return this; + } + + public CallSummariesReader setBrandedCallReason( + final String brandedCallReason + ) { + this.brandedCallReason = brandedCallReason; + return this; + } + public CallSummariesReader setVoiceIntegrityBundleSid( final String voiceIntegrityBundleSid ) { @@ -441,6 +467,18 @@ private void addQueryParams(final Request request) { if (brandedBundleSid != null) { request.addQueryParam("BrandedBundleSid", brandedBundleSid); } + if (brandedLogo != null) { + request.addQueryParam("BrandedLogo", brandedLogo.toString()); + } + if (brandedType != null) { + request.addQueryParam("BrandedType", brandedType); + } + if (brandedUseCase != null) { + request.addQueryParam("BrandedUseCase", brandedUseCase); + } + if (brandedCallReason != null) { + request.addQueryParam("BrandedCallReason", brandedCallReason); + } if (voiceIntegrityBundleSid != null) { request.addQueryParam( "VoiceIntegrityBundleSid", diff --git a/src/main/java/com/twilio/rest/intelligence/v2/CustomOperator.java b/src/main/java/com/twilio/rest/intelligence/v2/CustomOperator.java index fa1df6c2b0..577770f332 100644 --- a/src/main/java/com/twilio/rest/intelligence/v2/CustomOperator.java +++ b/src/main/java/com/twilio/rest/intelligence/v2/CustomOperator.java @@ -44,7 +44,7 @@ public class CustomOperator extends Resource { public static CustomOperatorCreator creator( final String friendlyName, final String operatorType, - final Map config + final Object config ) { return new CustomOperatorCreator(friendlyName, operatorType, config); } @@ -64,7 +64,7 @@ public static CustomOperatorReader reader() { public static CustomOperatorUpdater updater( final String pathSid, final String friendlyName, - final Map config + final Object config ) { return new CustomOperatorUpdater(pathSid, friendlyName, config); } diff --git a/src/main/java/com/twilio/rest/intelligence/v2/CustomOperatorCreator.java b/src/main/java/com/twilio/rest/intelligence/v2/CustomOperatorCreator.java index 1f8707d982..85535d3191 100644 --- a/src/main/java/com/twilio/rest/intelligence/v2/CustomOperatorCreator.java +++ b/src/main/java/com/twilio/rest/intelligence/v2/CustomOperatorCreator.java @@ -26,19 +26,17 @@ import com.twilio.http.Response; import com.twilio.http.TwilioRestClient; import com.twilio.rest.Domains; -import java.util.Map; -import java.util.Map; public class CustomOperatorCreator extends Creator { private String friendlyName; private String operatorType; - private Map config; + private Object config; public CustomOperatorCreator( final String friendlyName, final String operatorType, - final Map config + final Object config ) { this.friendlyName = friendlyName; this.operatorType = operatorType; @@ -55,7 +53,7 @@ public CustomOperatorCreator setOperatorType(final String operatorType) { return this; } - public CustomOperatorCreator setConfig(final Map config) { + public CustomOperatorCreator setConfig(final Object config) { this.config = config; return this; } @@ -116,7 +114,7 @@ private void addPostParams(final Request request) { request.addPostParam("OperatorType", operatorType); } if (config != null) { - request.addPostParam("Config", Converter.mapToJson(config)); + request.addPostParam("Config", Converter.objectToJson(config)); } } } diff --git a/src/main/java/com/twilio/rest/intelligence/v2/CustomOperatorUpdater.java b/src/main/java/com/twilio/rest/intelligence/v2/CustomOperatorUpdater.java index 45dbf98813..73c396b60d 100644 --- a/src/main/java/com/twilio/rest/intelligence/v2/CustomOperatorUpdater.java +++ b/src/main/java/com/twilio/rest/intelligence/v2/CustomOperatorUpdater.java @@ -25,19 +25,18 @@ import com.twilio.http.Response; import com.twilio.http.TwilioRestClient; import com.twilio.rest.Domains; -import java.util.Map; public class CustomOperatorUpdater extends Updater { private String pathSid; private String friendlyName; - private Map config; + private Object config; private String ifMatch; public CustomOperatorUpdater( final String pathSid, final String friendlyName, - final Map config + final Object config ) { this.pathSid = pathSid; this.friendlyName = friendlyName; @@ -49,7 +48,7 @@ public CustomOperatorUpdater setFriendlyName(final String friendlyName) { return this; } - public CustomOperatorUpdater setConfig(final Map config) { + public CustomOperatorUpdater setConfig(final Object config) { this.config = config; return this; } @@ -109,7 +108,7 @@ private void addPostParams(final Request request) { request.addPostParam("FriendlyName", friendlyName); } if (config != null) { - request.addPostParam("Config", Converter.mapToJson(config)); + request.addPostParam("Config", Converter.objectToJson(config)); } } diff --git a/src/main/java/com/twilio/rest/intelligence/v2/Transcript.java b/src/main/java/com/twilio/rest/intelligence/v2/Transcript.java index fa0fddb1df..0e19d311a1 100644 --- a/src/main/java/com/twilio/rest/intelligence/v2/Transcript.java +++ b/src/main/java/com/twilio/rest/intelligence/v2/Transcript.java @@ -43,7 +43,7 @@ public class Transcript extends Resource { public static TranscriptCreator creator( final String serviceSid, - final Map channel + final Object channel ) { return new TranscriptCreator(serviceSid, channel); } diff --git a/src/main/java/com/twilio/rest/intelligence/v2/TranscriptCreator.java b/src/main/java/com/twilio/rest/intelligence/v2/TranscriptCreator.java index 8ab04ae15c..7a9249f442 100644 --- a/src/main/java/com/twilio/rest/intelligence/v2/TranscriptCreator.java +++ b/src/main/java/com/twilio/rest/intelligence/v2/TranscriptCreator.java @@ -27,20 +27,15 @@ import com.twilio.http.TwilioRestClient; import com.twilio.rest.Domains; import java.time.ZonedDateTime; -import java.util.Map; -import java.util.Map; public class TranscriptCreator extends Creator { private String serviceSid; - private Map channel; + private Object channel; private String customerKey; private ZonedDateTime mediaStartTime; - public TranscriptCreator( - final String serviceSid, - final Map channel - ) { + public TranscriptCreator(final String serviceSid, final Object channel) { this.serviceSid = serviceSid; this.channel = channel; } @@ -50,7 +45,7 @@ public TranscriptCreator setServiceSid(final String serviceSid) { return this; } - public TranscriptCreator setChannel(final Map channel) { + public TranscriptCreator setChannel(final Object channel) { this.channel = channel; return this; } @@ -112,7 +107,7 @@ private void addPostParams(final Request request) { request.addPostParam("ServiceSid", serviceSid); } if (channel != null) { - request.addPostParam("Channel", Converter.mapToJson(channel)); + request.addPostParam("Channel", Converter.objectToJson(channel)); } if (customerKey != null) { request.addPostParam("CustomerKey", customerKey); diff --git a/src/main/java/com/twilio/rest/knowledge/v1/Knowledge.java b/src/main/java/com/twilio/rest/knowledge/v1/Knowledge.java deleted file mode 100644 index a2a7a572e3..0000000000 --- a/src/main/java/com/twilio/rest/knowledge/v1/Knowledge.java +++ /dev/null @@ -1,416 +0,0 @@ -/* - * This code was generated by - * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ - * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ - * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ - * - * Twilio - Knowledge - * 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.knowledge.v1; - -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.core.JsonParseException; -import com.fasterxml.jackson.core.JsonProcessingException; -import com.fasterxml.jackson.databind.JsonMappingException; -import com.fasterxml.jackson.databind.ObjectMapper; -import com.twilio.base.Resource; -import com.twilio.converter.Converter; -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.time.ZonedDateTime; -import java.util.Map; -import java.util.Map; -import java.util.Objects; -import lombok.Getter; -import lombok.Setter; -import lombok.ToString; -import lombok.ToString; - -@JsonIgnoreProperties(ignoreUnknown = true) -@ToString -public class Knowledge extends Resource { - - private static final long serialVersionUID = 142704301669097L; - - @ToString - public static class KnowledgeV1ServiceCreatePolicyRequest { - - @JsonInclude(JsonInclude.Include.NON_EMPTY) - @JsonProperty("description") - @Getter - @Setter - private String description; - - @JsonInclude(JsonInclude.Include.NON_EMPTY) - @JsonProperty("id") - @Getter - @Setter - private String id; - - @JsonInclude(JsonInclude.Include.NON_EMPTY) - @JsonProperty("name") - @Getter - @Setter - private String name; - - @JsonInclude(JsonInclude.Include.NON_EMPTY) - @JsonProperty("policy_details") - @Getter - @Setter - private Object policyDetails; - - public String getPolicyDetails() { - return Converter.objectToJson(policyDetails); - } - - @JsonInclude(JsonInclude.Include.NON_EMPTY) - @JsonProperty("type") - @Getter - @Setter - private String type; - - public static KnowledgeV1ServiceCreatePolicyRequest fromJson( - String jsonString, - ObjectMapper mapper - ) throws IOException { - return mapper.readValue( - jsonString, - KnowledgeV1ServiceCreatePolicyRequest.class - ); - } - } - - @ToString - public static class KnowledgeV1ServiceCreateKnowledgeRequest { - - @JsonInclude(JsonInclude.Include.NON_EMPTY) - @JsonProperty("description") - @Getter - @Setter - private String description; - - @JsonInclude(JsonInclude.Include.NON_EMPTY) - @JsonProperty("knowledge_source_details") - @Getter - @Setter - private Map knowledgeSourceDetails; - - public String getKnowledgeSourceDetails() { - return Converter.mapToJson(knowledgeSourceDetails); - } - - @JsonInclude(JsonInclude.Include.NON_EMPTY) - @JsonProperty("name") - @Getter - @Setter - private String name; - - @JsonInclude(JsonInclude.Include.NON_EMPTY) - @JsonProperty("policy") - @Getter - @Setter - private KnowledgeV1ServiceCreatePolicyRequest policy; - - @JsonInclude(JsonInclude.Include.NON_EMPTY) - @JsonProperty("type") - @Getter - @Setter - private String type; - - @JsonInclude(JsonInclude.Include.NON_EMPTY) - @JsonProperty("embedding_model") - @Getter - @Setter - private String embeddingModel; - - public KnowledgeV1ServiceCreateKnowledgeRequest() {} - - public static KnowledgeV1ServiceCreateKnowledgeRequest fromJson( - String jsonString, - ObjectMapper mapper - ) throws IOException { - return mapper.readValue( - jsonString, - KnowledgeV1ServiceCreateKnowledgeRequest.class - ); - } - } - - @ToString - public static class KnowledgeV1ServiceUpdateKnowledgeRequest { - - @JsonInclude(JsonInclude.Include.NON_EMPTY) - @JsonProperty("description") - @Getter - @Setter - private String description; - - @JsonInclude(JsonInclude.Include.NON_EMPTY) - @JsonProperty("knowledge_source_details") - @Getter - @Setter - private Map knowledgeSourceDetails; - - public String getKnowledgeSourceDetails() { - return Converter.mapToJson(knowledgeSourceDetails); - } - - @JsonInclude(JsonInclude.Include.NON_EMPTY) - @JsonProperty("name") - @Getter - @Setter - private String name; - - @JsonInclude(JsonInclude.Include.NON_EMPTY) - @JsonProperty("policy") - @Getter - @Setter - private KnowledgeV1ServiceCreatePolicyRequest policy; - - @JsonInclude(JsonInclude.Include.NON_EMPTY) - @JsonProperty("type") - @Getter - @Setter - private String type; - - @JsonInclude(JsonInclude.Include.NON_EMPTY) - @JsonProperty("embedding_model") - @Getter - @Setter - private String embeddingModel; - - public KnowledgeV1ServiceUpdateKnowledgeRequest() {} - - public static KnowledgeV1ServiceUpdateKnowledgeRequest fromJson( - String jsonString, - ObjectMapper mapper - ) throws IOException { - return mapper.readValue( - jsonString, - KnowledgeV1ServiceUpdateKnowledgeRequest.class - ); - } - } - - public static KnowledgeCreator creator( - final Knowledge.KnowledgeV1ServiceCreateKnowledgeRequest knowledgeV1ServiceCreateKnowledgeRequest - ) { - return new KnowledgeCreator(knowledgeV1ServiceCreateKnowledgeRequest); - } - - public static KnowledgeDeleter deleter(final String pathId) { - return new KnowledgeDeleter(pathId); - } - - public static KnowledgeFetcher fetcher(final String pathId) { - return new KnowledgeFetcher(pathId); - } - - public static KnowledgeReader reader() { - return new KnowledgeReader(); - } - - public static KnowledgeUpdater updater(final String pathId) { - return new KnowledgeUpdater(pathId); - } - - /** - * Converts a JSON String into a Knowledge object using the provided ObjectMapper. - * - * @param json Raw JSON String - * @param objectMapper Jackson ObjectMapper - * @return Knowledge object represented by the provided JSON - */ - public static Knowledge fromJson( - final String json, - final ObjectMapper objectMapper - ) { - // Convert all checked exceptions to Runtime - try { - return objectMapper.readValue(json, Knowledge.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 Knowledge object using the provided - * ObjectMapper. - * - * @param json Raw JSON InputStream - * @param objectMapper Jackson ObjectMapper - * @return Knowledge object represented by the provided JSON - */ - public static Knowledge fromJson( - final InputStream json, - final ObjectMapper objectMapper - ) { - // Convert all checked exceptions to Runtime - try { - return objectMapper.readValue(json, Knowledge.class); - } catch (final JsonMappingException | JsonParseException e) { - throw new ApiException(e.getMessage(), e); - } catch (final IOException e) { - throw new ApiConnectionException(e.getMessage(), e); - } - } - - public static String toJson(Object object, ObjectMapper mapper) { - try { - return mapper.writeValueAsString(object); - } catch (final JsonMappingException e) { - throw new ApiException(e.getMessage(), e); - } catch (JsonProcessingException e) { - throw new ApiException(e.getMessage(), e); - } catch (final IOException e) { - throw new ApiConnectionException(e.getMessage(), e); - } - } - - private final String description; - private final String id; - private final String accountSid; - private final Map knowledgeSourceDetails; - private final String name; - private final String status; - private final String type; - private final String url; - private final String embeddingModel; - private final ZonedDateTime dateCreated; - private final ZonedDateTime dateUpdated; - - @JsonCreator - private Knowledge( - @JsonProperty("description") final String description, - @JsonProperty("id") final String id, - @JsonProperty("account_sid") final String accountSid, - @JsonProperty("knowledge_source_details") final Map< - String, - Object - > knowledgeSourceDetails, - @JsonProperty("name") final String name, - @JsonProperty("status") final String status, - @JsonProperty("type") final String type, - @JsonProperty("url") final String url, - @JsonProperty("embedding_model") final String embeddingModel, - @JsonProperty("date_created") final String dateCreated, - @JsonProperty("date_updated") final String dateUpdated - ) { - this.description = description; - this.id = id; - this.accountSid = accountSid; - this.knowledgeSourceDetails = knowledgeSourceDetails; - this.name = name; - this.status = status; - this.type = type; - this.url = url; - this.embeddingModel = embeddingModel; - this.dateCreated = DateConverter.iso8601DateTimeFromString(dateCreated); - this.dateUpdated = DateConverter.iso8601DateTimeFromString(dateUpdated); - } - - public final String getDescription() { - return this.description; - } - - public final String getId() { - return this.id; - } - - public final String getAccountSid() { - return this.accountSid; - } - - public final Map getKnowledgeSourceDetails() { - return this.knowledgeSourceDetails; - } - - public final String getName() { - return this.name; - } - - public final String getStatus() { - return this.status; - } - - public final String getType() { - return this.type; - } - - public final String getUrl() { - return this.url; - } - - public final String getEmbeddingModel() { - return this.embeddingModel; - } - - public final ZonedDateTime getDateCreated() { - return this.dateCreated; - } - - public final ZonedDateTime getDateUpdated() { - return this.dateUpdated; - } - - @Override - public boolean equals(final Object o) { - if (this == o) { - return true; - } - - if (o == null || getClass() != o.getClass()) { - return false; - } - - Knowledge other = (Knowledge) o; - - return ( - Objects.equals(description, other.description) && - Objects.equals(id, other.id) && - Objects.equals(accountSid, other.accountSid) && - Objects.equals( - knowledgeSourceDetails, - other.knowledgeSourceDetails - ) && - Objects.equals(name, other.name) && - Objects.equals(status, other.status) && - Objects.equals(type, other.type) && - Objects.equals(url, other.url) && - Objects.equals(embeddingModel, other.embeddingModel) && - Objects.equals(dateCreated, other.dateCreated) && - Objects.equals(dateUpdated, other.dateUpdated) - ); - } - - @Override - public int hashCode() { - return Objects.hash( - description, - id, - accountSid, - knowledgeSourceDetails, - name, - status, - type, - url, - embeddingModel, - dateCreated, - dateUpdated - ); - } -} diff --git a/src/main/java/com/twilio/rest/knowledge/v1/KnowledgeDeleter.java b/src/main/java/com/twilio/rest/knowledge/v1/KnowledgeDeleter.java deleted file mode 100644 index 59804cdc4e..0000000000 --- a/src/main/java/com/twilio/rest/knowledge/v1/KnowledgeDeleter.java +++ /dev/null @@ -1,69 +0,0 @@ -/* - * This code was generated by - * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ - * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ - * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ - * - * Twilio - Knowledge - * 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.knowledge.v1; - -import com.twilio.base.Deleter; -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 KnowledgeDeleter extends Deleter { - - private String pathId; - - public KnowledgeDeleter(final String pathId) { - this.pathId = pathId; - } - - @Override - public boolean delete(final TwilioRestClient client) { - String path = "/v1/Knowledge/{id}"; - - path = path.replace("{" + "id" + "}", this.pathId.toString()); - - Request request = new Request( - HttpMethod.DELETE, - Domains.KNOWLEDGE.toString(), - path - ); - request.setContentType(EnumConstants.ContentType.FORM_URLENCODED); - Response response = client.request(request); - - if (response == null) { - throw new ApiConnectionException( - "Knowledge 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/knowledge/v1/KnowledgeFetcher.java b/src/main/java/com/twilio/rest/knowledge/v1/KnowledgeFetcher.java deleted file mode 100644 index 5e7aea48b0..0000000000 --- a/src/main/java/com/twilio/rest/knowledge/v1/KnowledgeFetcher.java +++ /dev/null @@ -1,73 +0,0 @@ -/* - * This code was generated by - * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ - * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ - * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ - * - * Twilio - Knowledge - * 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.knowledge.v1; - -import com.twilio.base.Fetcher; -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 KnowledgeFetcher extends Fetcher { - - private String pathId; - - public KnowledgeFetcher(final String pathId) { - this.pathId = pathId; - } - - @Override - public Knowledge fetch(final TwilioRestClient client) { - String path = "/v1/Knowledge/{id}"; - - path = path.replace("{" + "id" + "}", this.pathId.toString()); - - Request request = new Request( - HttpMethod.GET, - Domains.KNOWLEDGE.toString(), - path - ); - request.setContentType(EnumConstants.ContentType.FORM_URLENCODED); - Response response = client.request(request); - - if (response == null) { - throw new ApiConnectionException( - "Knowledge 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 Knowledge.fromJson( - response.getStream(), - client.getObjectMapper() - ); - } -} diff --git a/src/main/java/com/twilio/rest/knowledge/v1/KnowledgeReader.java b/src/main/java/com/twilio/rest/knowledge/v1/KnowledgeReader.java deleted file mode 100644 index f0d8abd0f5..0000000000 --- a/src/main/java/com/twilio/rest/knowledge/v1/KnowledgeReader.java +++ /dev/null @@ -1,144 +0,0 @@ -/* - * This code was generated by - * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ - * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ - * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ - * - * Twilio - Knowledge - * 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.knowledge.v1; - -import com.twilio.base.Page; -import com.twilio.base.Reader; -import com.twilio.base.ResourceSet; -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 KnowledgeReader extends Reader { - - private Integer pageSize; - private String tags; - - public KnowledgeReader() {} - - public KnowledgeReader setPageSize(final Integer pageSize) { - this.pageSize = pageSize; - return this; - } - - public KnowledgeReader setTags(final String tags) { - this.tags = tags; - return this; - } - - @Override - public ResourceSet read(final TwilioRestClient client) { - return new ResourceSet<>(this, client, firstPage(client)); - } - - public Page firstPage(final TwilioRestClient client) { - String path = "/v1/Knowledge"; - - Request request = new Request( - HttpMethod.GET, - Domains.KNOWLEDGE.toString(), - path - ); - - addQueryParams(request); - request.setContentType(EnumConstants.ContentType.FORM_URLENCODED); - return pageForRequest(client, request); - } - - private Page pageForRequest( - final TwilioRestClient client, - final Request request - ) { - Response response = client.request(request); - - if (response == null) { - throw new ApiConnectionException( - "Knowledge read 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 Page.fromJson( - "knowledge", - response.getContent(), - Knowledge.class, - client.getObjectMapper() - ); - } - - @Override - public Page previousPage( - final Page page, - final TwilioRestClient client - ) { - Request request = new Request( - HttpMethod.GET, - page.getPreviousPageUrl(Domains.KNOWLEDGE.toString()) - ); - return pageForRequest(client, request); - } - - @Override - public Page nextPage( - final Page page, - final TwilioRestClient client - ) { - Request request = new Request( - HttpMethod.GET, - page.getNextPageUrl(Domains.KNOWLEDGE.toString()) - ); - return pageForRequest(client, request); - } - - @Override - public Page getPage( - final String targetUrl, - final TwilioRestClient client - ) { - Request request = new Request(HttpMethod.GET, targetUrl); - - return pageForRequest(client, request); - } - - private void addQueryParams(final Request request) { - if (pageSize != null) { - request.addQueryParam("PageSize", pageSize.toString()); - } - if (tags != null) { - request.addQueryParam("Tags", tags); - } - - if (getPageSize() != null) { - request.addQueryParam("PageSize", Integer.toString(getPageSize())); - } - } -} diff --git a/src/main/java/com/twilio/rest/knowledge/v1/knowledge/Chunk.java b/src/main/java/com/twilio/rest/knowledge/v1/knowledge/Chunk.java deleted file mode 100644 index b0336d7aa9..0000000000 --- a/src/main/java/com/twilio/rest/knowledge/v1/knowledge/Chunk.java +++ /dev/null @@ -1,161 +0,0 @@ -/* - * This code was generated by - * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ - * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ - * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ - * - * Twilio - Knowledge - * 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.knowledge.v1.knowledge; - -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.time.ZonedDateTime; -import java.util.Map; -import java.util.Map; -import java.util.Objects; -import lombok.ToString; -import lombok.ToString; - -@JsonIgnoreProperties(ignoreUnknown = true) -@ToString -public class Chunk extends Resource { - - private static final long serialVersionUID = 152804488582909L; - - public static ChunkReader reader(final String pathId) { - return new ChunkReader(pathId); - } - - /** - * Converts a JSON String into a Chunk object using the provided ObjectMapper. - * - * @param json Raw JSON String - * @param objectMapper Jackson ObjectMapper - * @return Chunk object represented by the provided JSON - */ - public static Chunk fromJson( - final String json, - final ObjectMapper objectMapper - ) { - // Convert all checked exceptions to Runtime - try { - return objectMapper.readValue(json, Chunk.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 Chunk object using the provided - * ObjectMapper. - * - * @param json Raw JSON InputStream - * @param objectMapper Jackson ObjectMapper - * @return Chunk object represented by the provided JSON - */ - public static Chunk fromJson( - final InputStream json, - final ObjectMapper objectMapper - ) { - // Convert all checked exceptions to Runtime - try { - return objectMapper.readValue(json, Chunk.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 content; - private final Map metadata; - private final ZonedDateTime dateCreated; - private final ZonedDateTime dateUpdated; - - @JsonCreator - private Chunk( - @JsonProperty("account_sid") final String accountSid, - @JsonProperty("content") final String content, - @JsonProperty("metadata") final Map metadata, - @JsonProperty("date_created") final String dateCreated, - @JsonProperty("date_updated") final String dateUpdated - ) { - this.accountSid = accountSid; - this.content = content; - this.metadata = metadata; - this.dateCreated = DateConverter.iso8601DateTimeFromString(dateCreated); - this.dateUpdated = DateConverter.iso8601DateTimeFromString(dateUpdated); - } - - public final String getAccountSid() { - return this.accountSid; - } - - public final String getContent() { - return this.content; - } - - public final Map getMetadata() { - return this.metadata; - } - - public final ZonedDateTime getDateCreated() { - return this.dateCreated; - } - - public final ZonedDateTime getDateUpdated() { - return this.dateUpdated; - } - - @Override - public boolean equals(final Object o) { - if (this == o) { - return true; - } - - if (o == null || getClass() != o.getClass()) { - return false; - } - - Chunk other = (Chunk) o; - - return ( - Objects.equals(accountSid, other.accountSid) && - Objects.equals(content, other.content) && - Objects.equals(metadata, other.metadata) && - Objects.equals(dateCreated, other.dateCreated) && - Objects.equals(dateUpdated, other.dateUpdated) - ); - } - - @Override - public int hashCode() { - return Objects.hash( - accountSid, - content, - metadata, - dateCreated, - dateUpdated - ); - } -} diff --git a/src/main/java/com/twilio/rest/knowledge/v1/knowledge/ChunkReader.java b/src/main/java/com/twilio/rest/knowledge/v1/knowledge/ChunkReader.java deleted file mode 100644 index bceed7b7f8..0000000000 --- a/src/main/java/com/twilio/rest/knowledge/v1/knowledge/ChunkReader.java +++ /dev/null @@ -1,139 +0,0 @@ -/* - * This code was generated by - * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ - * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ - * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ - * - * Twilio - Knowledge - * 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.knowledge.v1.knowledge; - -import com.twilio.base.Page; -import com.twilio.base.Reader; -import com.twilio.base.ResourceSet; -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 ChunkReader extends Reader { - - private String pathId; - private Integer pageSize; - - public ChunkReader(final String pathId) { - this.pathId = pathId; - } - - public ChunkReader setPageSize(final Integer pageSize) { - this.pageSize = pageSize; - return this; - } - - @Override - public ResourceSet read(final TwilioRestClient client) { - return new ResourceSet<>(this, client, firstPage(client)); - } - - public Page firstPage(final TwilioRestClient client) { - String path = "/v1/Knowledge/{id}/Chunks"; - path = path.replace("{" + "id" + "}", this.pathId.toString()); - - Request request = new Request( - HttpMethod.GET, - Domains.KNOWLEDGE.toString(), - path - ); - - addQueryParams(request); - request.setContentType(EnumConstants.ContentType.FORM_URLENCODED); - return pageForRequest(client, request); - } - - private Page pageForRequest( - final TwilioRestClient client, - final Request request - ) { - Response response = client.request(request); - - if (response == null) { - throw new ApiConnectionException( - "Chunk read 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 Page.fromJson( - "chunks", - response.getContent(), - Chunk.class, - client.getObjectMapper() - ); - } - - @Override - public Page previousPage( - final Page page, - final TwilioRestClient client - ) { - Request request = new Request( - HttpMethod.GET, - page.getPreviousPageUrl(Domains.KNOWLEDGE.toString()) - ); - return pageForRequest(client, request); - } - - @Override - public Page nextPage( - final Page page, - final TwilioRestClient client - ) { - Request request = new Request( - HttpMethod.GET, - page.getNextPageUrl(Domains.KNOWLEDGE.toString()) - ); - return pageForRequest(client, request); - } - - @Override - public Page getPage( - final String targetUrl, - final TwilioRestClient client - ) { - Request request = new Request(HttpMethod.GET, targetUrl); - - return pageForRequest(client, request); - } - - private void addQueryParams(final Request request) { - if (pageSize != null) { - request.addQueryParam("PageSize", pageSize.toString()); - } - - if (getPageSize() != null) { - request.addQueryParam("PageSize", Integer.toString(getPageSize())); - } - } -} diff --git a/src/main/java/com/twilio/rest/knowledge/v1/knowledge/KnowledgeStatus.java b/src/main/java/com/twilio/rest/knowledge/v1/knowledge/KnowledgeStatus.java deleted file mode 100644 index ded378b2d8..0000000000 --- a/src/main/java/com/twilio/rest/knowledge/v1/knowledge/KnowledgeStatus.java +++ /dev/null @@ -1,145 +0,0 @@ -/* - * This code was generated by - * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ - * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ - * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ - * - * Twilio - Knowledge - * 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.knowledge.v1.knowledge; - -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.time.ZonedDateTime; -import java.util.Objects; -import lombok.ToString; -import lombok.ToString; - -@JsonIgnoreProperties(ignoreUnknown = true) -@ToString -public class KnowledgeStatus extends Resource { - - private static final long serialVersionUID = 178959927465400L; - - public static KnowledgeStatusFetcher fetcher(final String pathId) { - return new KnowledgeStatusFetcher(pathId); - } - - /** - * Converts a JSON String into a KnowledgeStatus object using the provided ObjectMapper. - * - * @param json Raw JSON String - * @param objectMapper Jackson ObjectMapper - * @return KnowledgeStatus object represented by the provided JSON - */ - public static KnowledgeStatus fromJson( - final String json, - final ObjectMapper objectMapper - ) { - // Convert all checked exceptions to Runtime - try { - return objectMapper.readValue(json, KnowledgeStatus.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 KnowledgeStatus object using the provided - * ObjectMapper. - * - * @param json Raw JSON InputStream - * @param objectMapper Jackson ObjectMapper - * @return KnowledgeStatus object represented by the provided JSON - */ - public static KnowledgeStatus fromJson( - final InputStream json, - final ObjectMapper objectMapper - ) { - // Convert all checked exceptions to Runtime - try { - return objectMapper.readValue(json, KnowledgeStatus.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 status; - private final String lastStatus; - private final ZonedDateTime dateUpdated; - - @JsonCreator - private KnowledgeStatus( - @JsonProperty("account_sid") final String accountSid, - @JsonProperty("status") final String status, - @JsonProperty("last_status") final String lastStatus, - @JsonProperty("date_updated") final String dateUpdated - ) { - this.accountSid = accountSid; - this.status = status; - this.lastStatus = lastStatus; - this.dateUpdated = DateConverter.iso8601DateTimeFromString(dateUpdated); - } - - public final String getAccountSid() { - return this.accountSid; - } - - public final String getStatus() { - return this.status; - } - - public final String getLastStatus() { - return this.lastStatus; - } - - public final ZonedDateTime getDateUpdated() { - return this.dateUpdated; - } - - @Override - public boolean equals(final Object o) { - if (this == o) { - return true; - } - - if (o == null || getClass() != o.getClass()) { - return false; - } - - KnowledgeStatus other = (KnowledgeStatus) o; - - return ( - Objects.equals(accountSid, other.accountSid) && - Objects.equals(status, other.status) && - Objects.equals(lastStatus, other.lastStatus) && - Objects.equals(dateUpdated, other.dateUpdated) - ); - } - - @Override - public int hashCode() { - return Objects.hash(accountSid, status, lastStatus, dateUpdated); - } -} diff --git a/src/main/java/com/twilio/rest/knowledge/v1/knowledge/KnowledgeStatusFetcher.java b/src/main/java/com/twilio/rest/knowledge/v1/knowledge/KnowledgeStatusFetcher.java deleted file mode 100644 index 93c2e7bfb6..0000000000 --- a/src/main/java/com/twilio/rest/knowledge/v1/knowledge/KnowledgeStatusFetcher.java +++ /dev/null @@ -1,73 +0,0 @@ -/* - * This code was generated by - * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ - * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ - * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ - * - * Twilio - Knowledge - * 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.knowledge.v1.knowledge; - -import com.twilio.base.Fetcher; -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 KnowledgeStatusFetcher extends Fetcher { - - private String pathId; - - public KnowledgeStatusFetcher(final String pathId) { - this.pathId = pathId; - } - - @Override - public KnowledgeStatus fetch(final TwilioRestClient client) { - String path = "/v1/Knowledge/{id}/Status"; - - path = path.replace("{" + "id" + "}", this.pathId.toString()); - - Request request = new Request( - HttpMethod.GET, - Domains.KNOWLEDGE.toString(), - path - ); - request.setContentType(EnumConstants.ContentType.FORM_URLENCODED); - Response response = client.request(request); - - if (response == null) { - throw new ApiConnectionException( - "KnowledgeStatus 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 KnowledgeStatus.fromJson( - response.getStream(), - client.getObjectMapper() - ); - } -} diff --git a/src/main/java/com/twilio/rest/lookups/v2/Bucket.java b/src/main/java/com/twilio/rest/lookups/v2/Bucket.java new file mode 100644 index 0000000000..221da7456a --- /dev/null +++ b/src/main/java/com/twilio/rest/lookups/v2/Bucket.java @@ -0,0 +1,209 @@ +/* + * This code was generated by + * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + * + * Twilio - Lookups + * 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.lookups.v2; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.core.JsonParseException; +import com.fasterxml.jackson.core.JsonProcessingException; +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 java.util.Objects; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; +import lombok.ToString; + +@JsonIgnoreProperties(ignoreUnknown = true) +@ToString +public class Bucket extends Resource { + + private static final long serialVersionUID = 277677635778369L; + + @ToString + public static class RateLimitRequest { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("limit") + @Getter + @Setter + private Integer limit; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("ttl") + @Getter + @Setter + private Integer ttl; + + public RateLimitRequest() {} + + public static RateLimitRequest fromJson( + String jsonString, + ObjectMapper mapper + ) throws IOException { + return mapper.readValue(jsonString, RateLimitRequest.class); + } + } + + public static BucketDeleter deleter( + final String pathField, + final String pathBucket + ) { + return new BucketDeleter(pathField, pathBucket); + } + + public static BucketFetcher fetcher( + final String pathField, + final String pathBucket + ) { + return new BucketFetcher(pathField, pathBucket); + } + + public static BucketUpdater updater( + final String pathField, + final String pathBucket + ) { + return new BucketUpdater(pathField, pathBucket); + } + + /** + * Converts a JSON String into a Bucket object using the provided ObjectMapper. + * + * @param json Raw JSON String + * @param objectMapper Jackson ObjectMapper + * @return Bucket object represented by the provided JSON + */ + public static Bucket fromJson( + final String json, + final ObjectMapper objectMapper + ) { + // Convert all checked exceptions to Runtime + try { + return objectMapper.readValue(json, Bucket.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 Bucket object using the provided + * ObjectMapper. + * + * @param json Raw JSON InputStream + * @param objectMapper Jackson ObjectMapper + * @return Bucket object represented by the provided JSON + */ + public static Bucket fromJson( + final InputStream json, + final ObjectMapper objectMapper + ) { + // Convert all checked exceptions to Runtime + try { + return objectMapper.readValue(json, Bucket.class); + } catch (final JsonMappingException | JsonParseException e) { + throw new ApiException(e.getMessage(), e); + } catch (final IOException e) { + throw new ApiConnectionException(e.getMessage(), e); + } + } + + public static String toJson(Object object, ObjectMapper mapper) { + try { + return mapper.writeValueAsString(object); + } catch (final JsonMappingException e) { + throw new ApiException(e.getMessage(), e); + } catch (JsonProcessingException e) { + throw new ApiException(e.getMessage(), e); + } catch (final IOException e) { + throw new ApiConnectionException(e.getMessage(), e); + } + } + + private final String field; + private final Integer limit; + private final String bucket; + private final String owner; + private final Integer ttl; + + @JsonCreator + private Bucket( + @JsonProperty("field") final String field, + @JsonProperty("limit") final Integer limit, + @JsonProperty("bucket") final String bucket, + @JsonProperty("owner") final String owner, + @JsonProperty("ttl") final Integer ttl + ) { + this.field = field; + this.limit = limit; + this.bucket = bucket; + this.owner = owner; + this.ttl = ttl; + } + + public final String getField() { + return this.field; + } + + public final Integer getLimit() { + return this.limit; + } + + public final String getBucket() { + return this.bucket; + } + + public final String getOwner() { + return this.owner; + } + + public final Integer getTtl() { + return this.ttl; + } + + @Override + public boolean equals(final Object o) { + if (this == o) { + return true; + } + + if (o == null || getClass() != o.getClass()) { + return false; + } + + Bucket other = (Bucket) o; + + return ( + Objects.equals(field, other.field) && + Objects.equals(limit, other.limit) && + Objects.equals(bucket, other.bucket) && + Objects.equals(owner, other.owner) && + Objects.equals(ttl, other.ttl) + ); + } + + @Override + public int hashCode() { + return Objects.hash(field, limit, bucket, owner, ttl); + } +} diff --git a/src/main/java/com/twilio/rest/microvisor/v1/AccountConfigDeleter.java b/src/main/java/com/twilio/rest/lookups/v2/BucketDeleter.java similarity index 73% rename from src/main/java/com/twilio/rest/microvisor/v1/AccountConfigDeleter.java rename to src/main/java/com/twilio/rest/lookups/v2/BucketDeleter.java index 9529bba7b5..511751bad2 100644 --- a/src/main/java/com/twilio/rest/microvisor/v1/AccountConfigDeleter.java +++ b/src/main/java/com/twilio/rest/lookups/v2/BucketDeleter.java @@ -4,7 +4,7 @@ * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ * - * Twilio - Microvisor + * Twilio - Lookups * This is the public Twilio REST API. * * NOTE: This class is auto generated by OpenAPI Generator. @@ -12,7 +12,7 @@ * Do not edit the class manually. */ -package com.twilio.rest.microvisor.v1; +package com.twilio.rest.lookups.v2; import com.twilio.base.Deleter; import com.twilio.constant.EnumConstants; @@ -25,23 +25,26 @@ import com.twilio.http.TwilioRestClient; import com.twilio.rest.Domains; -public class AccountConfigDeleter extends Deleter { +public class BucketDeleter extends Deleter { - private String pathKey; + private String pathField; + private String pathBucket; - public AccountConfigDeleter(final String pathKey) { - this.pathKey = pathKey; + public BucketDeleter(final String pathField, final String pathBucket) { + this.pathField = pathField; + this.pathBucket = pathBucket; } @Override public boolean delete(final TwilioRestClient client) { - String path = "/v1/Configs/{Key}"; + String path = "/v2/RateLimits/Fields/{Field}/Bucket/{Bucket}"; - path = path.replace("{" + "Key" + "}", this.pathKey.toString()); + path = path.replace("{" + "Field" + "}", this.pathField.toString()); + path = path.replace("{" + "Bucket" + "}", this.pathBucket.toString()); Request request = new Request( HttpMethod.DELETE, - Domains.MICROVISOR.toString(), + Domains.LOOKUPS.toString(), path ); request.setContentType(EnumConstants.ContentType.FORM_URLENCODED); @@ -49,7 +52,7 @@ public boolean delete(final TwilioRestClient client) { if (response == null) { throw new ApiConnectionException( - "AccountConfig delete failed: Unable to connect to server" + "Bucket delete failed: Unable to connect to server" ); } else if (!TwilioRestClient.SUCCESS.test(response.getStatusCode())) { RestException restException = RestException.fromJson( diff --git a/src/main/java/com/twilio/rest/microvisor/v1/DeviceFetcher.java b/src/main/java/com/twilio/rest/lookups/v2/BucketFetcher.java similarity index 69% rename from src/main/java/com/twilio/rest/microvisor/v1/DeviceFetcher.java rename to src/main/java/com/twilio/rest/lookups/v2/BucketFetcher.java index 6192902ea2..c73c369da4 100644 --- a/src/main/java/com/twilio/rest/microvisor/v1/DeviceFetcher.java +++ b/src/main/java/com/twilio/rest/lookups/v2/BucketFetcher.java @@ -4,7 +4,7 @@ * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ * - * Twilio - Microvisor + * Twilio - Lookups * This is the public Twilio REST API. * * NOTE: This class is auto generated by OpenAPI Generator. @@ -12,7 +12,7 @@ * Do not edit the class manually. */ -package com.twilio.rest.microvisor.v1; +package com.twilio.rest.lookups.v2; import com.twilio.base.Fetcher; import com.twilio.constant.EnumConstants; @@ -25,23 +25,26 @@ import com.twilio.http.TwilioRestClient; import com.twilio.rest.Domains; -public class DeviceFetcher extends Fetcher { +public class BucketFetcher extends Fetcher { - private String pathSid; + private String pathField; + private String pathBucket; - public DeviceFetcher(final String pathSid) { - this.pathSid = pathSid; + public BucketFetcher(final String pathField, final String pathBucket) { + this.pathField = pathField; + this.pathBucket = pathBucket; } @Override - public Device fetch(final TwilioRestClient client) { - String path = "/v1/Devices/{Sid}"; + public Bucket fetch(final TwilioRestClient client) { + String path = "/v2/RateLimits/Fields/{Field}/Bucket/{Bucket}"; - path = path.replace("{" + "Sid" + "}", this.pathSid.toString()); + path = path.replace("{" + "Field" + "}", this.pathField.toString()); + path = path.replace("{" + "Bucket" + "}", this.pathBucket.toString()); Request request = new Request( HttpMethod.GET, - Domains.MICROVISOR.toString(), + Domains.LOOKUPS.toString(), path ); request.setContentType(EnumConstants.ContentType.FORM_URLENCODED); @@ -49,7 +52,7 @@ public Device fetch(final TwilioRestClient client) { if (response == null) { throw new ApiConnectionException( - "Device fetch failed: Unable to connect to server" + "Bucket fetch failed: Unable to connect to server" ); } else if (!TwilioRestClient.SUCCESS.test(response.getStatusCode())) { RestException restException = RestException.fromJson( @@ -65,6 +68,6 @@ public Device fetch(final TwilioRestClient client) { throw new ApiException(restException); } - return Device.fromJson(response.getStream(), client.getObjectMapper()); + return Bucket.fromJson(response.getStream(), client.getObjectMapper()); } } diff --git a/src/main/java/com/twilio/rest/microvisor/v1/AccountConfigUpdater.java b/src/main/java/com/twilio/rest/lookups/v2/BucketUpdater.java similarity index 53% rename from src/main/java/com/twilio/rest/microvisor/v1/AccountConfigUpdater.java rename to src/main/java/com/twilio/rest/lookups/v2/BucketUpdater.java index 0c2c55a496..ebb98856f1 100644 --- a/src/main/java/com/twilio/rest/microvisor/v1/AccountConfigUpdater.java +++ b/src/main/java/com/twilio/rest/lookups/v2/BucketUpdater.java @@ -4,7 +4,7 @@ * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ * - * Twilio - Microvisor + * Twilio - Lookups * This is the public Twilio REST API. * * NOTE: This class is auto generated by OpenAPI Generator. @@ -12,8 +12,9 @@ * Do not edit the class manually. */ -package com.twilio.rest.microvisor.v1; +package com.twilio.rest.lookups.v2; +import com.fasterxml.jackson.databind.ObjectMapper; import com.twilio.base.Updater; import com.twilio.constant.EnumConstants; import com.twilio.exception.ApiConnectionException; @@ -25,39 +26,42 @@ import com.twilio.http.TwilioRestClient; import com.twilio.rest.Domains; -public class AccountConfigUpdater extends Updater { +public class BucketUpdater extends Updater { - private String pathKey; - private String value; + private String pathField; + private String pathBucket; + private Bucket.RateLimitRequest rateLimitRequest; - public AccountConfigUpdater(final String pathKey, final String value) { - this.pathKey = pathKey; - this.value = value; + public BucketUpdater(final String pathField, final String pathBucket) { + this.pathField = pathField; + this.pathBucket = pathBucket; } - public AccountConfigUpdater setValue(final String value) { - this.value = value; + public BucketUpdater setRateLimitRequest( + final Bucket.RateLimitRequest rateLimitRequest + ) { + this.rateLimitRequest = rateLimitRequest; return this; } @Override - public AccountConfig update(final TwilioRestClient client) { - String path = "/v1/Configs/{Key}"; + public Bucket update(final TwilioRestClient client) { + String path = "/v2/RateLimits/Fields/{Field}/Bucket/{Bucket}"; - path = path.replace("{" + "Key" + "}", this.pathKey.toString()); - path = path.replace("{" + "Value" + "}", this.value.toString()); + path = path.replace("{" + "Field" + "}", this.pathField.toString()); + path = path.replace("{" + "Bucket" + "}", this.pathBucket.toString()); Request request = new Request( - HttpMethod.POST, - Domains.MICROVISOR.toString(), + HttpMethod.PUT, + Domains.LOOKUPS.toString(), path ); - request.setContentType(EnumConstants.ContentType.FORM_URLENCODED); - addPostParams(request); + request.setContentType(EnumConstants.ContentType.JSON); + addPostParams(request, client); Response response = client.request(request); if (response == null) { throw new ApiConnectionException( - "AccountConfig update failed: Unable to connect to server" + "Bucket update failed: Unable to connect to server" ); } else if (!TwilioRestClient.SUCCESS.test(response.getStatusCode())) { RestException restException = RestException.fromJson( @@ -73,15 +77,13 @@ public AccountConfig update(final TwilioRestClient client) { throw new ApiException(restException); } - return AccountConfig.fromJson( - response.getStream(), - client.getObjectMapper() - ); + return Bucket.fromJson(response.getStream(), client.getObjectMapper()); } - private void addPostParams(final Request request) { - if (value != null) { - request.addPostParam("Value", value); + private void addPostParams(final Request request, TwilioRestClient client) { + ObjectMapper objectMapper = client.getObjectMapper(); + if (rateLimitRequest != null) { + request.setBody(Bucket.toJson(rateLimitRequest, objectMapper)); } } } diff --git a/src/main/java/com/twilio/rest/lookups/v2/LookupOverride.java b/src/main/java/com/twilio/rest/lookups/v2/LookupOverride.java new file mode 100644 index 0000000000..69b4c42558 --- /dev/null +++ b/src/main/java/com/twilio/rest/lookups/v2/LookupOverride.java @@ -0,0 +1,337 @@ +/* + * This code was generated by + * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + * + * Twilio - Lookups + * 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.lookups.v2; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.core.JsonParseException; +import com.fasterxml.jackson.core.JsonProcessingException; +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.converter.Promoter; +import com.twilio.exception.ApiConnectionException; +import com.twilio.exception.ApiException; +import java.io.IOException; +import java.io.InputStream; +import java.time.ZonedDateTime; +import java.util.Objects; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; +import lombok.ToString; + +@JsonIgnoreProperties(ignoreUnknown = true) +@ToString +public class LookupOverride extends Resource { + + private static final long serialVersionUID = 147188354779019L; + + @ToString + public static class OverridesRequest { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("line_type") + @Getter + @Setter + private LineTypeEnum lineType; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("reason") + @Getter + @Setter + private String reason; + + public OverridesRequest() {} + + public static OverridesRequest fromJson( + String jsonString, + ObjectMapper mapper + ) throws IOException { + return mapper.readValue(jsonString, OverridesRequest.class); + } + } + + public static LookupOverrideCreator creator( + final String pathField, + final String pathPhoneNumber + ) { + return new LookupOverrideCreator(pathField, pathPhoneNumber); + } + + public static LookupOverrideDeleter deleter( + final String pathField, + final String pathPhoneNumber + ) { + return new LookupOverrideDeleter(pathField, pathPhoneNumber); + } + + public static LookupOverrideFetcher fetcher( + final String pathField, + final String pathPhoneNumber + ) { + return new LookupOverrideFetcher(pathField, pathPhoneNumber); + } + + public static LookupOverrideUpdater updater( + final String pathField, + final String pathPhoneNumber + ) { + return new LookupOverrideUpdater(pathField, pathPhoneNumber); + } + + /** + * Converts a JSON String into a LookupOverride object using the provided ObjectMapper. + * + * @param json Raw JSON String + * @param objectMapper Jackson ObjectMapper + * @return LookupOverride object represented by the provided JSON + */ + public static LookupOverride fromJson( + final String json, + final ObjectMapper objectMapper + ) { + // Convert all checked exceptions to Runtime + try { + return objectMapper.readValue(json, LookupOverride.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 LookupOverride object using the provided + * ObjectMapper. + * + * @param json Raw JSON InputStream + * @param objectMapper Jackson ObjectMapper + * @return LookupOverride object represented by the provided JSON + */ + public static LookupOverride fromJson( + final InputStream json, + final ObjectMapper objectMapper + ) { + // Convert all checked exceptions to Runtime + try { + return objectMapper.readValue(json, LookupOverride.class); + } catch (final JsonMappingException | JsonParseException e) { + throw new ApiException(e.getMessage(), e); + } catch (final IOException e) { + throw new ApiConnectionException(e.getMessage(), e); + } + } + + public static String toJson(Object object, ObjectMapper mapper) { + try { + return mapper.writeValueAsString(object); + } catch (final JsonMappingException e) { + throw new ApiException(e.getMessage(), e); + } catch (JsonProcessingException e) { + throw new ApiException(e.getMessage(), e); + } catch (final IOException e) { + throw new ApiConnectionException(e.getMessage(), e); + } + } + + private final String phoneNumber; + private final LookupOverride.OriginalLineTypeEnum originalLineType; + private final LookupOverride.OverriddenLineTypeEnum overriddenLineType; + private final String overrideReason; + private final ZonedDateTime overrideTimestamp; + private final String overriddenByAccountSid; + + @JsonCreator + private LookupOverride( + @JsonProperty("phone_number") final String phoneNumber, + @JsonProperty( + "original_line_type" + ) final LookupOverride.OriginalLineTypeEnum originalLineType, + @JsonProperty( + "overridden_line_type" + ) final LookupOverride.OverriddenLineTypeEnum overriddenLineType, + @JsonProperty("override_reason") final String overrideReason, + @JsonProperty("override_timestamp") final String overrideTimestamp, + @JsonProperty( + "overridden_by_account_sid" + ) final String overriddenByAccountSid + ) { + this.phoneNumber = phoneNumber; + this.originalLineType = originalLineType; + this.overriddenLineType = overriddenLineType; + this.overrideReason = overrideReason; + this.overrideTimestamp = + DateConverter.iso8601DateTimeFromString(overrideTimestamp); + this.overriddenByAccountSid = overriddenByAccountSid; + } + + public final String getPhoneNumber() { + return this.phoneNumber; + } + + public final LookupOverride.OriginalLineTypeEnum getOriginalLineType() { + return this.originalLineType; + } + + public final LookupOverride.OverriddenLineTypeEnum getOverriddenLineType() { + return this.overriddenLineType; + } + + public final String getOverrideReason() { + return this.overrideReason; + } + + public final ZonedDateTime getOverrideTimestamp() { + return this.overrideTimestamp; + } + + public final String getOverriddenByAccountSid() { + return this.overriddenByAccountSid; + } + + @Override + public boolean equals(final Object o) { + if (this == o) { + return true; + } + + if (o == null || getClass() != o.getClass()) { + return false; + } + + LookupOverride other = (LookupOverride) o; + + return ( + Objects.equals(phoneNumber, other.phoneNumber) && + Objects.equals(originalLineType, other.originalLineType) && + Objects.equals(overriddenLineType, other.overriddenLineType) && + Objects.equals(overrideReason, other.overrideReason) && + Objects.equals(overrideTimestamp, other.overrideTimestamp) && + Objects.equals(overriddenByAccountSid, other.overriddenByAccountSid) + ); + } + + @Override + public int hashCode() { + return Objects.hash( + phoneNumber, + originalLineType, + overriddenLineType, + overrideReason, + overrideTimestamp, + overriddenByAccountSid + ); + } + + public enum OverriddenLineTypeEnum { + MOBILE("mobile"), + LANDLINE("landline"), + TOLLFREE("tollFree"), + FIXEDVOIP("fixedVoip"), + NONFIXEDVOIP("nonFixedVoip"), + PERSONAL("personal"), + PREMIUM("premium"), + VOICEMAIL("voicemail"), + SHAREDCOST("sharedCost"), + UAN("uan"), + PAGER("pager"), + UNKNOWN("unknown"); + + private final String value; + + private OverriddenLineTypeEnum(final String value) { + this.value = value; + } + + public String toString() { + return value; + } + + @JsonCreator + public static OverriddenLineTypeEnum forValue(final String value) { + return Promoter.enumFromString( + value, + OverriddenLineTypeEnum.values() + ); + } + } + + public enum LineTypeEnum { + MOBILE("mobile"), + LANDLINE("landline"), + TOLLFREE("tollFree"), + FIXEDVOIP("fixedVoip"), + NONFIXEDVOIP("nonFixedVoip"), + PERSONAL("personal"), + PREMIUM("premium"), + VOICEMAIL("voicemail"), + SHAREDCOST("sharedCost"), + UAN("uan"), + PAGER("pager"), + UNKNOWN("unknown"); + + private final String value; + + private LineTypeEnum(final String value) { + this.value = value; + } + + public String toString() { + return value; + } + + @JsonCreator + public static LineTypeEnum forValue(final String value) { + return Promoter.enumFromString(value, LineTypeEnum.values()); + } + } + + public enum OriginalLineTypeEnum { + MOBILE("mobile"), + LANDLINE("landline"), + TOLLFREE("tollFree"), + FIXEDVOIP("fixedVoip"), + NONFIXEDVOIP("nonFixedVoip"), + PERSONAL("personal"), + PREMIUM("premium"), + VOICEMAIL("voicemail"), + SHAREDCOST("sharedCost"), + UAN("uan"), + PAGER("pager"), + UNKNOWN("unknown"); + + private final String value; + + private OriginalLineTypeEnum(final String value) { + this.value = value; + } + + public String toString() { + return value; + } + + @JsonCreator + public static OriginalLineTypeEnum forValue(final String value) { + return Promoter.enumFromString( + value, + OriginalLineTypeEnum.values() + ); + } + } +} diff --git a/src/main/java/com/twilio/rest/knowledge/v1/KnowledgeCreator.java b/src/main/java/com/twilio/rest/lookups/v2/LookupOverrideCreator.java similarity index 61% rename from src/main/java/com/twilio/rest/knowledge/v1/KnowledgeCreator.java rename to src/main/java/com/twilio/rest/lookups/v2/LookupOverrideCreator.java index 943ed52437..bdc0dc5304 100644 --- a/src/main/java/com/twilio/rest/knowledge/v1/KnowledgeCreator.java +++ b/src/main/java/com/twilio/rest/lookups/v2/LookupOverrideCreator.java @@ -4,7 +4,7 @@ * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ * - * Twilio - Knowledge + * Twilio - Lookups * This is the public Twilio REST API. * * NOTE: This class is auto generated by OpenAPI Generator. @@ -12,7 +12,7 @@ * Do not edit the class manually. */ -package com.twilio.rest.knowledge.v1; +package com.twilio.rest.lookups.v2; import com.fasterxml.jackson.databind.ObjectMapper; import com.twilio.base.Creator; @@ -26,38 +26,41 @@ import com.twilio.http.TwilioRestClient; import com.twilio.rest.Domains; -public class KnowledgeCreator extends Creator { +public class LookupOverrideCreator extends Creator { - private Knowledge.KnowledgeV1ServiceCreateKnowledgeRequest knowledgeV1ServiceCreateKnowledgeRequest; + private String pathField; + private String pathPhoneNumber; + private LookupOverride.OverridesRequest overridesRequest; - public KnowledgeCreator( - final Knowledge.KnowledgeV1ServiceCreateKnowledgeRequest knowledgeV1ServiceCreateKnowledgeRequest + public LookupOverrideCreator( + final String pathField, + final String pathPhoneNumber ) { - this.knowledgeV1ServiceCreateKnowledgeRequest = - knowledgeV1ServiceCreateKnowledgeRequest; + this.pathField = pathField; + this.pathPhoneNumber = pathPhoneNumber; } - public KnowledgeCreator setKnowledgeV1ServiceCreateKnowledgeRequest( - final Knowledge.KnowledgeV1ServiceCreateKnowledgeRequest knowledgeV1ServiceCreateKnowledgeRequest + public LookupOverrideCreator setOverridesRequest( + final LookupOverride.OverridesRequest overridesRequest ) { - this.knowledgeV1ServiceCreateKnowledgeRequest = - knowledgeV1ServiceCreateKnowledgeRequest; + this.overridesRequest = overridesRequest; return this; } @Override - public Knowledge create(final TwilioRestClient client) { - String path = "/v1/Knowledge"; + public LookupOverride create(final TwilioRestClient client) { + String path = "/v2/PhoneNumbers/{PhoneNumber}/Overrides/{Field}"; + path = path.replace("{" + "Field" + "}", this.pathField.toString()); path = path.replace( - "{" + "KnowledgeV1ServiceCreateKnowledgeRequest" + "}", - this.knowledgeV1ServiceCreateKnowledgeRequest.toString() + "{" + "PhoneNumber" + "}", + this.pathPhoneNumber.toString() ); Request request = new Request( HttpMethod.POST, - Domains.KNOWLEDGE.toString(), + Domains.LOOKUPS.toString(), path ); request.setContentType(EnumConstants.ContentType.JSON); @@ -65,7 +68,7 @@ public Knowledge create(final TwilioRestClient client) { Response response = client.request(request); if (response == null) { throw new ApiConnectionException( - "Knowledge creation failed: Unable to connect to server" + "LookupOverride creation failed: Unable to connect to server" ); } else if (!TwilioRestClient.SUCCESS.test(response.getStatusCode())) { RestException restException = RestException.fromJson( @@ -81,7 +84,7 @@ public Knowledge create(final TwilioRestClient client) { throw new ApiException(restException); } - return Knowledge.fromJson( + return LookupOverride.fromJson( response.getStream(), client.getObjectMapper() ); @@ -89,12 +92,9 @@ public Knowledge create(final TwilioRestClient client) { private void addPostParams(final Request request, TwilioRestClient client) { ObjectMapper objectMapper = client.getObjectMapper(); - if (knowledgeV1ServiceCreateKnowledgeRequest != null) { + if (overridesRequest != null) { request.setBody( - Knowledge.toJson( - knowledgeV1ServiceCreateKnowledgeRequest, - objectMapper - ) + LookupOverride.toJson(overridesRequest, objectMapper) ); } } diff --git a/src/main/java/com/twilio/rest/microvisor/v1/device/DeviceConfigDeleter.java b/src/main/java/com/twilio/rest/lookups/v2/LookupOverrideDeleter.java similarity index 71% rename from src/main/java/com/twilio/rest/microvisor/v1/device/DeviceConfigDeleter.java rename to src/main/java/com/twilio/rest/lookups/v2/LookupOverrideDeleter.java index e471b64a72..7a13b9fcf0 100644 --- a/src/main/java/com/twilio/rest/microvisor/v1/device/DeviceConfigDeleter.java +++ b/src/main/java/com/twilio/rest/lookups/v2/LookupOverrideDeleter.java @@ -4,7 +4,7 @@ * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ * - * Twilio - Microvisor + * Twilio - Lookups * This is the public Twilio REST API. * * NOTE: This class is auto generated by OpenAPI Generator. @@ -12,7 +12,7 @@ * Do not edit the class manually. */ -package com.twilio.rest.microvisor.v1.device; +package com.twilio.rest.lookups.v2; import com.twilio.base.Deleter; import com.twilio.constant.EnumConstants; @@ -25,33 +25,33 @@ import com.twilio.http.TwilioRestClient; import com.twilio.rest.Domains; -public class DeviceConfigDeleter extends Deleter { +public class LookupOverrideDeleter extends Deleter { - private String pathDeviceSid; - private String pathKey; + private String pathField; + private String pathPhoneNumber; - public DeviceConfigDeleter( - final String pathDeviceSid, - final String pathKey + public LookupOverrideDeleter( + final String pathField, + final String pathPhoneNumber ) { - this.pathDeviceSid = pathDeviceSid; - this.pathKey = pathKey; + this.pathField = pathField; + this.pathPhoneNumber = pathPhoneNumber; } @Override public boolean delete(final TwilioRestClient client) { - String path = "/v1/Devices/{DeviceSid}/Configs/{Key}"; + String path = "/v2/PhoneNumbers/{PhoneNumber}/Overrides/{Field}"; + path = path.replace("{" + "Field" + "}", this.pathField.toString()); path = path.replace( - "{" + "DeviceSid" + "}", - this.pathDeviceSid.toString() + "{" + "PhoneNumber" + "}", + this.pathPhoneNumber.toString() ); - path = path.replace("{" + "Key" + "}", this.pathKey.toString()); Request request = new Request( HttpMethod.DELETE, - Domains.MICROVISOR.toString(), + Domains.LOOKUPS.toString(), path ); request.setContentType(EnumConstants.ContentType.FORM_URLENCODED); @@ -59,7 +59,7 @@ public boolean delete(final TwilioRestClient client) { if (response == null) { throw new ApiConnectionException( - "DeviceConfig delete failed: Unable to connect to server" + "LookupOverride delete failed: Unable to connect to server" ); } else if (!TwilioRestClient.SUCCESS.test(response.getStatusCode())) { RestException restException = RestException.fromJson( diff --git a/src/main/java/com/twilio/rest/microvisor/v1/device/DeviceConfigFetcher.java b/src/main/java/com/twilio/rest/lookups/v2/LookupOverrideFetcher.java similarity index 68% rename from src/main/java/com/twilio/rest/microvisor/v1/device/DeviceConfigFetcher.java rename to src/main/java/com/twilio/rest/lookups/v2/LookupOverrideFetcher.java index 3b0d148d4a..f345b4a4e4 100644 --- a/src/main/java/com/twilio/rest/microvisor/v1/device/DeviceConfigFetcher.java +++ b/src/main/java/com/twilio/rest/lookups/v2/LookupOverrideFetcher.java @@ -4,7 +4,7 @@ * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ * - * Twilio - Microvisor + * Twilio - Lookups * This is the public Twilio REST API. * * NOTE: This class is auto generated by OpenAPI Generator. @@ -12,7 +12,7 @@ * Do not edit the class manually. */ -package com.twilio.rest.microvisor.v1.device; +package com.twilio.rest.lookups.v2; import com.twilio.base.Fetcher; import com.twilio.constant.EnumConstants; @@ -25,33 +25,33 @@ import com.twilio.http.TwilioRestClient; import com.twilio.rest.Domains; -public class DeviceConfigFetcher extends Fetcher { +public class LookupOverrideFetcher extends Fetcher { - private String pathDeviceSid; - private String pathKey; + private String pathField; + private String pathPhoneNumber; - public DeviceConfigFetcher( - final String pathDeviceSid, - final String pathKey + public LookupOverrideFetcher( + final String pathField, + final String pathPhoneNumber ) { - this.pathDeviceSid = pathDeviceSid; - this.pathKey = pathKey; + this.pathField = pathField; + this.pathPhoneNumber = pathPhoneNumber; } @Override - public DeviceConfig fetch(final TwilioRestClient client) { - String path = "/v1/Devices/{DeviceSid}/Configs/{Key}"; + public LookupOverride fetch(final TwilioRestClient client) { + String path = "/v2/PhoneNumbers/{PhoneNumber}/Overrides/{Field}"; + path = path.replace("{" + "Field" + "}", this.pathField.toString()); path = path.replace( - "{" + "DeviceSid" + "}", - this.pathDeviceSid.toString() + "{" + "PhoneNumber" + "}", + this.pathPhoneNumber.toString() ); - path = path.replace("{" + "Key" + "}", this.pathKey.toString()); Request request = new Request( HttpMethod.GET, - Domains.MICROVISOR.toString(), + Domains.LOOKUPS.toString(), path ); request.setContentType(EnumConstants.ContentType.FORM_URLENCODED); @@ -59,7 +59,7 @@ public DeviceConfig fetch(final TwilioRestClient client) { if (response == null) { throw new ApiConnectionException( - "DeviceConfig fetch failed: Unable to connect to server" + "LookupOverride fetch failed: Unable to connect to server" ); } else if (!TwilioRestClient.SUCCESS.test(response.getStatusCode())) { RestException restException = RestException.fromJson( @@ -75,7 +75,7 @@ public DeviceConfig fetch(final TwilioRestClient client) { throw new ApiException(restException); } - return DeviceConfig.fromJson( + return LookupOverride.fromJson( response.getStream(), client.getObjectMapper() ); diff --git a/src/main/java/com/twilio/rest/knowledge/v1/KnowledgeUpdater.java b/src/main/java/com/twilio/rest/lookups/v2/LookupOverrideUpdater.java similarity index 63% rename from src/main/java/com/twilio/rest/knowledge/v1/KnowledgeUpdater.java rename to src/main/java/com/twilio/rest/lookups/v2/LookupOverrideUpdater.java index bfa6ca6ee5..5674e6110a 100644 --- a/src/main/java/com/twilio/rest/knowledge/v1/KnowledgeUpdater.java +++ b/src/main/java/com/twilio/rest/lookups/v2/LookupOverrideUpdater.java @@ -4,7 +4,7 @@ * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ * - * Twilio - Knowledge + * Twilio - Lookups * This is the public Twilio REST API. * * NOTE: This class is auto generated by OpenAPI Generator. @@ -12,7 +12,7 @@ * Do not edit the class manually. */ -package com.twilio.rest.knowledge.v1; +package com.twilio.rest.lookups.v2; import com.fasterxml.jackson.databind.ObjectMapper; import com.twilio.base.Updater; @@ -26,32 +26,41 @@ import com.twilio.http.TwilioRestClient; import com.twilio.rest.Domains; -public class KnowledgeUpdater extends Updater { +public class LookupOverrideUpdater extends Updater { - private String pathId; - private Knowledge.KnowledgeV1ServiceUpdateKnowledgeRequest knowledgeV1ServiceUpdateKnowledgeRequest; + private String pathField; + private String pathPhoneNumber; + private LookupOverride.OverridesRequest overridesRequest; - public KnowledgeUpdater(final String pathId) { - this.pathId = pathId; + public LookupOverrideUpdater( + final String pathField, + final String pathPhoneNumber + ) { + this.pathField = pathField; + this.pathPhoneNumber = pathPhoneNumber; } - public KnowledgeUpdater setKnowledgeV1ServiceUpdateKnowledgeRequest( - final Knowledge.KnowledgeV1ServiceUpdateKnowledgeRequest knowledgeV1ServiceUpdateKnowledgeRequest + public LookupOverrideUpdater setOverridesRequest( + final LookupOverride.OverridesRequest overridesRequest ) { - this.knowledgeV1ServiceUpdateKnowledgeRequest = - knowledgeV1ServiceUpdateKnowledgeRequest; + this.overridesRequest = overridesRequest; return this; } @Override - public Knowledge update(final TwilioRestClient client) { - String path = "/v1/Knowledge/{id}"; + public LookupOverride update(final TwilioRestClient client) { + String path = "/v2/PhoneNumbers/{PhoneNumber}/Overrides/{Field}"; - path = path.replace("{" + "id" + "}", this.pathId.toString()); + path = path.replace("{" + "Field" + "}", this.pathField.toString()); + path = + path.replace( + "{" + "PhoneNumber" + "}", + this.pathPhoneNumber.toString() + ); Request request = new Request( HttpMethod.PUT, - Domains.KNOWLEDGE.toString(), + Domains.LOOKUPS.toString(), path ); request.setContentType(EnumConstants.ContentType.JSON); @@ -59,7 +68,7 @@ public Knowledge update(final TwilioRestClient client) { Response response = client.request(request); if (response == null) { throw new ApiConnectionException( - "Knowledge update failed: Unable to connect to server" + "LookupOverride update failed: Unable to connect to server" ); } else if (!TwilioRestClient.SUCCESS.test(response.getStatusCode())) { RestException restException = RestException.fromJson( @@ -75,7 +84,7 @@ public Knowledge update(final TwilioRestClient client) { throw new ApiException(restException); } - return Knowledge.fromJson( + return LookupOverride.fromJson( response.getStream(), client.getObjectMapper() ); @@ -83,12 +92,9 @@ public Knowledge update(final TwilioRestClient client) { private void addPostParams(final Request request, TwilioRestClient client) { ObjectMapper objectMapper = client.getObjectMapper(); - if (knowledgeV1ServiceUpdateKnowledgeRequest != null) { + if (overridesRequest != null) { request.setBody( - Knowledge.toJson( - knowledgeV1ServiceUpdateKnowledgeRequest, - objectMapper - ) + LookupOverride.toJson(overridesRequest, objectMapper) ); } } diff --git a/src/main/java/com/twilio/rest/lookups/v2/Query.java b/src/main/java/com/twilio/rest/lookups/v2/Query.java new file mode 100644 index 0000000000..14e8748259 --- /dev/null +++ b/src/main/java/com/twilio/rest/lookups/v2/Query.java @@ -0,0 +1,799 @@ +/* + * This code was generated by + * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + * + * Twilio - Lookups + * 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.lookups.v2; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.core.JsonParseException; +import com.fasterxml.jackson.core.JsonProcessingException; +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.time.ZonedDateTime; +import java.util.List; +import java.util.Objects; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; +import lombok.ToString; + +@JsonIgnoreProperties(ignoreUnknown = true) +@ToString +public class Query extends Resource { + + private static final long serialVersionUID = 115616150775512L; + + @ToString + public static class IdentityMatchParameters { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("first_name") + @Getter + @Setter + private String firstName; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("last_name") + @Getter + @Setter + private String lastName; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("address_line1") + @Getter + @Setter + private String addressLine1; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("address_line2") + @Getter + @Setter + private String addressLine2; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("city") + @Getter + @Setter + private String city; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("state") + @Getter + @Setter + private String state; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("postal_code") + @Getter + @Setter + private String postalCode; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("address_country_code") + @Getter + @Setter + private String addressCountryCode; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("national_id") + @Getter + @Setter + private String nationalId; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("date_of_birth") + @Getter + @Setter + private String dateOfBirth; + + public static IdentityMatchParameters fromJson( + String jsonString, + ObjectMapper mapper + ) throws IOException { + return mapper.readValue(jsonString, IdentityMatchParameters.class); + } + } + + @ToString + public static class ReassignedNumberRequest { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("last_verified_date") + @Getter + @Setter + private String lastVerifiedDate; + + public static ReassignedNumberRequest fromJson( + String jsonString, + ObjectMapper mapper + ) throws IOException { + return mapper.readValue(jsonString, ReassignedNumberRequest.class); + } + } + + @ToString + public static class SmsPumpingRiskParameters { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("partner_sub_id") + @Getter + @Setter + private String partnerSubId; + + public static SmsPumpingRiskParameters fromJson( + String jsonString, + ObjectMapper mapper + ) throws IOException { + return mapper.readValue(jsonString, SmsPumpingRiskParameters.class); + } + } + + @ToString + public static class LookupRequestWithCorId { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("correlation_id") + @Getter + @Setter + private String correlationId; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("phone_number") + @Getter + @Setter + private String phoneNumber; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("fields") + @Getter + @Setter + private List fields; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("country_code") + @Getter + @Setter + private String countryCode; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("identity_match") + @Getter + @Setter + private IdentityMatchParameters identityMatch; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("reassigned_number") + @Getter + @Setter + private ReassignedNumberRequest reassignedNumber; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("sms_pumping_risk") + @Getter + @Setter + private SmsPumpingRiskParameters smsPumpingRisk; + + public static LookupRequestWithCorId fromJson( + String jsonString, + ObjectMapper mapper + ) throws IOException { + return mapper.readValue(jsonString, LookupRequestWithCorId.class); + } + } + + @ToString + public static class LookupRequest1 { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("phone_numbers") + @Getter + @Setter + private List phoneNumbers; + + public LookupRequest1() {} + + public static LookupRequest1 fromJson( + String jsonString, + ObjectMapper mapper + ) throws IOException { + return mapper.readValue(jsonString, LookupRequest1.class); + } + } + + @ToString + public static class CallerName { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("caller_name") + @Getter + @Setter + private String callerName; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("caller_type") + @Getter + @Setter + private String callerType; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("error_code") + @Getter + @Setter + private Integer errorCode; + + public static CallerName fromJson( + String jsonString, + ObjectMapper mapper + ) throws IOException { + return mapper.readValue(jsonString, CallerName.class); + } + } + + @ToString + public static class LastSimSwap { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("last_sim_swap_date") + @Getter + @Setter + private ZonedDateTime lastSimSwapDate; + + public String getLastSimSwapDate() { + return lastSimSwapDate.toInstant().toString(); + } + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("swapped_period") + @Getter + @Setter + private String swappedPeriod; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("swapped_in_period") + @Getter + @Setter + private Boolean swappedInPeriod; + + public static LastSimSwap fromJson( + String jsonString, + ObjectMapper mapper + ) throws IOException { + return mapper.readValue(jsonString, LastSimSwap.class); + } + } + + @ToString + public static class SimSwap { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("last_sim_swap") + @Getter + @Setter + private LastSimSwap lastSimSwap; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("carrier_name") + @Getter + @Setter + private String carrierName; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("mobile_country_code") + @Getter + @Setter + private String mobileCountryCode; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("mobile_network_code") + @Getter + @Setter + private String mobileNetworkCode; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("error_code") + @Getter + @Setter + private Integer errorCode; + + public static SimSwap fromJson(String jsonString, ObjectMapper mapper) + throws IOException { + return mapper.readValue(jsonString, SimSwap.class); + } + } + + @ToString + public static class CallForwarding { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("call_forwarding_enabled") + @Getter + @Setter + private Boolean callForwardingEnabled; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("error_code") + @Getter + @Setter + private Integer errorCode; + + public static CallForwarding fromJson( + String jsonString, + ObjectMapper mapper + ) throws IOException { + return mapper.readValue(jsonString, CallForwarding.class); + } + } + + @ToString + public static class LineTypeIntelligence { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("type") + @Getter + @Setter + private String type; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("carrier_name") + @Getter + @Setter + private String carrierName; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("mobile_country_code") + @Getter + @Setter + private String mobileCountryCode; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("mobile_network_code") + @Getter + @Setter + private String mobileNetworkCode; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("error_code") + @Getter + @Setter + private Integer errorCode; + + public static LineTypeIntelligence fromJson( + String jsonString, + ObjectMapper mapper + ) throws IOException { + return mapper.readValue(jsonString, LineTypeIntelligence.class); + } + } + + @ToString + public static class LineStatus { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("status") + @Getter + @Setter + private String status; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("error_code") + @Getter + @Setter + private Integer errorCode; + + public static LineStatus fromJson( + String jsonString, + ObjectMapper mapper + ) throws IOException { + return mapper.readValue(jsonString, LineStatus.class); + } + } + + @ToString + public static class IdentityMatch { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("first_name_match") + @Getter + @Setter + private String firstNameMatch; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("last_name_match") + @Getter + @Setter + private String lastNameMatch; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("address_line_match") + @Getter + @Setter + private String addressLineMatch; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("city_match") + @Getter + @Setter + private String cityMatch; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("state_match") + @Getter + @Setter + private String stateMatch; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("postal_code_match") + @Getter + @Setter + private String postalCodeMatch; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("country_code_match") + @Getter + @Setter + private String countryCodeMatch; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("national_id_match") + @Getter + @Setter + private String nationalIdMatch; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("date_of_birth_match") + @Getter + @Setter + private String dateOfBirthMatch; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("summary_score") + @Getter + @Setter + private Integer summaryScore; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("error_code") + @Getter + @Setter + private Integer errorCode; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("error_message") + @Getter + @Setter + private String errorMessage; + + public static IdentityMatch fromJson( + String jsonString, + ObjectMapper mapper + ) throws IOException { + return mapper.readValue(jsonString, IdentityMatch.class); + } + } + + @ToString + public static class ReassignedNumberResponse { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("last_verified_date") + @Getter + @Setter + private String lastVerifiedDate; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("is_number_reassigned") + @Getter + @Setter + private String isNumberReassigned; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("error_code") + @Getter + @Setter + private String errorCode; + + public static ReassignedNumberResponse fromJson( + String jsonString, + ObjectMapper mapper + ) throws IOException { + return mapper.readValue(jsonString, ReassignedNumberResponse.class); + } + } + + @ToString + public static class SmsPumpingRisk { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("carrier_risk_category") + @Getter + @Setter + private String carrierRiskCategory; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("number_blocked") + @Getter + @Setter + private Boolean numberBlocked; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("number_blocked_date") + @Getter + @Setter + private ZonedDateTime numberBlockedDate; + + public String getNumberBlockedDate() { + return numberBlockedDate.toInstant().toString(); + } + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("number_blocked_last_3_months") + @Getter + @Setter + private Boolean numberBlockedLast3Months; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("sms_pumping_risk_score") + @Getter + @Setter + private Integer smsPumpingRiskScore; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("error_code") + @Getter + @Setter + private Integer errorCode; + + public static SmsPumpingRisk fromJson( + String jsonString, + ObjectMapper mapper + ) throws IOException { + return mapper.readValue(jsonString, SmsPumpingRisk.class); + } + } + + @ToString + public static class LookupResponseWithCorId { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("correlation_id") + @Getter + @Setter + private String correlationId; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("twilio_error_code") + @Getter + @Setter + private Integer twilioErrorCode; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("calling_country_code") + @Getter + @Setter + private String callingCountryCode; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("country_code") + @Getter + @Setter + private String countryCode; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("phone_number") + @Getter + @Setter + private String phoneNumber; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("national_format") + @Getter + @Setter + private String nationalFormat; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("valid") + @Getter + @Setter + private Boolean valid; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("validation_errors") + @Getter + @Setter + private List validationErrors; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("caller_name") + @Getter + @Setter + private CallerName callerName; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("sim_swap") + @Getter + @Setter + private SimSwap simSwap; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("call_forwarding") + @Getter + @Setter + private CallForwarding callForwarding; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("line_type_intelligence") + @Getter + @Setter + private LineTypeIntelligence lineTypeIntelligence; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("line_status") + @Getter + @Setter + private LineStatus lineStatus; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("identity_match") + @Getter + @Setter + private IdentityMatch identityMatch; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("reassigned_number") + @Getter + @Setter + private ReassignedNumberResponse reassignedNumber; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("sms_pumping_risk") + @Getter + @Setter + private SmsPumpingRisk smsPumpingRisk; + + public static LookupResponseWithCorId fromJson( + String jsonString, + ObjectMapper mapper + ) throws IOException { + return mapper.readValue(jsonString, LookupResponseWithCorId.class); + } + } + + public static QueryCreator creator() { + return new QueryCreator(); + } + + /** + * Converts a JSON String into a Query object using the provided ObjectMapper. + * + * @param json Raw JSON String + * @param objectMapper Jackson ObjectMapper + * @return Query object represented by the provided JSON + */ + public static Query fromJson( + final String json, + final ObjectMapper objectMapper + ) { + // Convert all checked exceptions to Runtime + try { + return objectMapper.readValue(json, Query.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 Query object using the provided + * ObjectMapper. + * + * @param json Raw JSON InputStream + * @param objectMapper Jackson ObjectMapper + * @return Query object represented by the provided JSON + */ + public static Query fromJson( + final InputStream json, + final ObjectMapper objectMapper + ) { + // Convert all checked exceptions to Runtime + try { + return objectMapper.readValue(json, Query.class); + } catch (final JsonMappingException | JsonParseException e) { + throw new ApiException(e.getMessage(), e); + } catch (final IOException e) { + throw new ApiConnectionException(e.getMessage(), e); + } + } + + public static String toJson(Object object, ObjectMapper mapper) { + try { + return mapper.writeValueAsString(object); + } catch (final JsonMappingException e) { + throw new ApiException(e.getMessage(), e); + } catch (JsonProcessingException e) { + throw new ApiException(e.getMessage(), e); + } catch (final IOException e) { + throw new ApiConnectionException(e.getMessage(), e); + } + } + + private final List phoneNumbers; + + @JsonCreator + private Query( + @JsonProperty("phone_numbers") final List< + LookupResponseWithCorId + > phoneNumbers + ) { + this.phoneNumbers = phoneNumbers; + } + + public final List getPhoneNumbers() { + return this.phoneNumbers; + } + + @Override + public boolean equals(final Object o) { + if (this == o) { + return true; + } + + if (o == null || getClass() != o.getClass()) { + return false; + } + + Query other = (Query) o; + + return Objects.equals(phoneNumbers, other.phoneNumbers); + } + + @Override + public int hashCode() { + return Objects.hash(phoneNumbers); + } + + public enum FieldsEnum { + CALLER_NAME("caller_name"), + SIM_SWAP("sim_swap"), + CALL_FORWARDING("call_forwarding"), + LINE_TYPE_INTELLIGENCE("line_type_intelligence"), + LINE_STATUS("line_status"), + IDENTITY_MATCH("identity_match"), + REASSIGNED_NUMBER("reassigned_number"), + SMS_PUMPING_RISK("sms_pumping_risk"); + + private final String value; + + private FieldsEnum(final String value) { + this.value = value; + } + + public String toString() { + return value; + } + + @JsonCreator + public static FieldsEnum forValue(final String value) { + return Promoter.enumFromString(value, FieldsEnum.values()); + } + } +} diff --git a/src/main/java/com/twilio/rest/microvisor/v1/device/DeviceSecretDeleter.java b/src/main/java/com/twilio/rest/lookups/v2/QueryCreator.java similarity index 58% rename from src/main/java/com/twilio/rest/microvisor/v1/device/DeviceSecretDeleter.java rename to src/main/java/com/twilio/rest/lookups/v2/QueryCreator.java index 992f623f57..e7481c28d8 100644 --- a/src/main/java/com/twilio/rest/microvisor/v1/device/DeviceSecretDeleter.java +++ b/src/main/java/com/twilio/rest/lookups/v2/QueryCreator.java @@ -4,7 +4,7 @@ * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ * - * Twilio - Microvisor + * Twilio - Lookups * This is the public Twilio REST API. * * NOTE: This class is auto generated by OpenAPI Generator. @@ -12,9 +12,10 @@ * Do not edit the class manually. */ -package com.twilio.rest.microvisor.v1.device; +package com.twilio.rest.lookups.v2; -import com.twilio.base.Deleter; +import com.fasterxml.jackson.databind.ObjectMapper; +import com.twilio.base.Creator; import com.twilio.constant.EnumConstants; import com.twilio.exception.ApiConnectionException; import com.twilio.exception.ApiException; @@ -25,41 +26,34 @@ import com.twilio.http.TwilioRestClient; import com.twilio.rest.Domains; -public class DeviceSecretDeleter extends Deleter { +public class QueryCreator extends Creator { - private String pathDeviceSid; - private String pathKey; + private Query.LookupRequest1 lookupRequest1; - public DeviceSecretDeleter( - final String pathDeviceSid, - final String pathKey + public QueryCreator() {} + + public QueryCreator setLookupRequest1( + final Query.LookupRequest1 lookupRequest1 ) { - this.pathDeviceSid = pathDeviceSid; - this.pathKey = pathKey; + this.lookupRequest1 = lookupRequest1; + return this; } @Override - public boolean delete(final TwilioRestClient client) { - String path = "/v1/Devices/{DeviceSid}/Secrets/{Key}"; - - path = - path.replace( - "{" + "DeviceSid" + "}", - this.pathDeviceSid.toString() - ); - path = path.replace("{" + "Key" + "}", this.pathKey.toString()); + public Query create(final TwilioRestClient client) { + String path = "/v2/batch/query"; Request request = new Request( - HttpMethod.DELETE, - Domains.MICROVISOR.toString(), + HttpMethod.POST, + Domains.LOOKUPS.toString(), path ); - request.setContentType(EnumConstants.ContentType.FORM_URLENCODED); + request.setContentType(EnumConstants.ContentType.JSON); + addPostParams(request, client); Response response = client.request(request); - if (response == null) { throw new ApiConnectionException( - "DeviceSecret delete failed: Unable to connect to server" + "Query creation failed: Unable to connect to server" ); } else if (!TwilioRestClient.SUCCESS.test(response.getStatusCode())) { RestException restException = RestException.fromJson( @@ -74,6 +68,14 @@ public boolean delete(final TwilioRestClient client) { } throw new ApiException(restException); } - return response.getStatusCode() == 204; + + return Query.fromJson(response.getStream(), client.getObjectMapper()); + } + + private void addPostParams(final Request request, TwilioRestClient client) { + ObjectMapper objectMapper = client.getObjectMapper(); + if (lookupRequest1 != null) { + request.setBody(Query.toJson(lookupRequest1, objectMapper)); + } } } diff --git a/src/main/java/com/twilio/rest/microvisor/v1/app/AppManifest.java b/src/main/java/com/twilio/rest/lookups/v2/RateLimit.java similarity index 52% rename from src/main/java/com/twilio/rest/microvisor/v1/app/AppManifest.java rename to src/main/java/com/twilio/rest/lookups/v2/RateLimit.java index 9beb04ce48..0551523fd0 100644 --- a/src/main/java/com/twilio/rest/microvisor/v1/app/AppManifest.java +++ b/src/main/java/com/twilio/rest/lookups/v2/RateLimit.java @@ -4,7 +4,7 @@ * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ * - * Twilio - Microvisor + * Twilio - Lookups * This is the public Twilio REST API. * * NOTE: This class is auto generated by OpenAPI Generator. @@ -12,10 +12,11 @@ * Do not edit the class manually. */ -package com.twilio.rest.microvisor.v1.app; +package com.twilio.rest.lookups.v2; import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.core.JsonParseException; import com.fasterxml.jackson.databind.JsonMappingException; @@ -25,35 +26,78 @@ import com.twilio.exception.ApiException; import java.io.IOException; import java.io.InputStream; -import java.net.URI; +import java.util.List; import java.util.Objects; +import lombok.Getter; +import lombok.Setter; import lombok.ToString; import lombok.ToString; @JsonIgnoreProperties(ignoreUnknown = true) @ToString -public class AppManifest extends Resource { - - private static final long serialVersionUID = 249809073531699L; +public class RateLimit extends Resource { + + private static final long serialVersionUID = 36869169584327L; + + @ToString + public static class RateLimitResponse { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("field") + @Getter + @Setter + private String field; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("limit") + @Getter + @Setter + private Integer limit; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("bucket") + @Getter + @Setter + private String bucket; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("owner") + @Getter + @Setter + private String owner; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("ttl") + @Getter + @Setter + private Integer ttl; + + public static RateLimitResponse fromJson( + String jsonString, + ObjectMapper mapper + ) throws IOException { + return mapper.readValue(jsonString, RateLimitResponse.class); + } + } - public static AppManifestFetcher fetcher(final String pathAppSid) { - return new AppManifestFetcher(pathAppSid); + public static RateLimitFetcher fetcher() { + return new RateLimitFetcher(); } /** - * Converts a JSON String into a AppManifest object using the provided ObjectMapper. + * Converts a JSON String into a RateLimit object using the provided ObjectMapper. * * @param json Raw JSON String * @param objectMapper Jackson ObjectMapper - * @return AppManifest object represented by the provided JSON + * @return RateLimit object represented by the provided JSON */ - public static AppManifest fromJson( + public static RateLimit fromJson( final String json, final ObjectMapper objectMapper ) { // Convert all checked exceptions to Runtime try { - return objectMapper.readValue(json, AppManifest.class); + return objectMapper.readValue(json, RateLimit.class); } catch (final JsonMappingException | JsonParseException e) { throw new ApiException(e.getMessage(), e); } catch (final IOException e) { @@ -62,20 +106,20 @@ public static AppManifest fromJson( } /** - * Converts a JSON InputStream into a AppManifest object using the provided + * Converts a JSON InputStream into a RateLimit object using the provided * ObjectMapper. * * @param json Raw JSON InputStream * @param objectMapper Jackson ObjectMapper - * @return AppManifest object represented by the provided JSON + * @return RateLimit object represented by the provided JSON */ - public static AppManifest fromJson( + public static RateLimit fromJson( final InputStream json, final ObjectMapper objectMapper ) { // Convert all checked exceptions to Runtime try { - return objectMapper.readValue(json, AppManifest.class); + return objectMapper.readValue(json, RateLimit.class); } catch (final JsonMappingException | JsonParseException e) { throw new ApiException(e.getMessage(), e); } catch (final IOException e) { @@ -83,38 +127,17 @@ public static AppManifest fromJson( } } - private final String appSid; - private final String hash; - private final String encodedBytes; - private final URI url; + private final List rateLimits; @JsonCreator - private AppManifest( - @JsonProperty("app_sid") final String appSid, - @JsonProperty("hash") final String hash, - @JsonProperty("encoded_bytes") final String encodedBytes, - @JsonProperty("url") final URI url + private RateLimit( + @JsonProperty("rate_limits") final List rateLimits ) { - this.appSid = appSid; - this.hash = hash; - this.encodedBytes = encodedBytes; - this.url = url; - } - - public final String getAppSid() { - return this.appSid; - } - - public final String getHash() { - return this.hash; - } - - public final String getEncodedBytes() { - return this.encodedBytes; + this.rateLimits = rateLimits; } - public final URI getUrl() { - return this.url; + public final List getRateLimits() { + return this.rateLimits; } @Override @@ -127,18 +150,13 @@ public boolean equals(final Object o) { return false; } - AppManifest other = (AppManifest) o; + RateLimit other = (RateLimit) o; - return ( - Objects.equals(appSid, other.appSid) && - Objects.equals(hash, other.hash) && - Objects.equals(encodedBytes, other.encodedBytes) && - Objects.equals(url, other.url) - ); + return Objects.equals(rateLimits, other.rateLimits); } @Override public int hashCode() { - return Objects.hash(appSid, hash, encodedBytes, url); + return Objects.hash(rateLimits); } } diff --git a/src/main/java/com/twilio/rest/proxy/v1/service/ShortCodeFetcher.java b/src/main/java/com/twilio/rest/lookups/v2/RateLimitFetcher.java similarity index 65% rename from src/main/java/com/twilio/rest/proxy/v1/service/ShortCodeFetcher.java rename to src/main/java/com/twilio/rest/lookups/v2/RateLimitFetcher.java index deeb66ca54..8d3e241b82 100644 --- a/src/main/java/com/twilio/rest/proxy/v1/service/ShortCodeFetcher.java +++ b/src/main/java/com/twilio/rest/lookups/v2/RateLimitFetcher.java @@ -4,7 +4,7 @@ * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ * - * Twilio - Proxy + * Twilio - Lookups * This is the public Twilio REST API. * * NOTE: This class is auto generated by OpenAPI Generator. @@ -12,10 +12,11 @@ * Do not edit the class manually. */ -package com.twilio.rest.proxy.v1.service; +package com.twilio.rest.lookups.v2; import com.twilio.base.Fetcher; import com.twilio.constant.EnumConstants; +import com.twilio.converter.Promoter; import com.twilio.exception.ApiConnectionException; import com.twilio.exception.ApiException; import com.twilio.exception.RestException; @@ -24,39 +25,39 @@ import com.twilio.http.Response; import com.twilio.http.TwilioRestClient; import com.twilio.rest.Domains; +import java.util.List; -public class ShortCodeFetcher extends Fetcher { +public class RateLimitFetcher extends Fetcher { - private String pathServiceSid; - private String pathSid; + private List fields; - public ShortCodeFetcher(final String pathServiceSid, final String pathSid) { - this.pathServiceSid = pathServiceSid; - this.pathSid = pathSid; + public RateLimitFetcher() {} + + public RateLimitFetcher setFields(final List fields) { + this.fields = fields; + return this; } - @Override - public ShortCode fetch(final TwilioRestClient client) { - String path = "/v1/Services/{ServiceSid}/ShortCodes/{Sid}"; + public RateLimitFetcher setFields(final String fields) { + return setFields(Promoter.listOfOne(fields)); + } - path = - path.replace( - "{" + "ServiceSid" + "}", - this.pathServiceSid.toString() - ); - path = path.replace("{" + "Sid" + "}", this.pathSid.toString()); + @Override + public RateLimit fetch(final TwilioRestClient client) { + String path = "/v2/RateLimits"; Request request = new Request( HttpMethod.GET, - Domains.PROXY.toString(), + Domains.LOOKUPS.toString(), path ); + addQueryParams(request); request.setContentType(EnumConstants.ContentType.FORM_URLENCODED); Response response = client.request(request); if (response == null) { throw new ApiConnectionException( - "ShortCode fetch failed: Unable to connect to server" + "RateLimit fetch failed: Unable to connect to server" ); } else if (!TwilioRestClient.SUCCESS.test(response.getStatusCode())) { RestException restException = RestException.fromJson( @@ -72,9 +73,17 @@ public ShortCode fetch(final TwilioRestClient client) { throw new ApiException(restException); } - return ShortCode.fromJson( + return RateLimit.fromJson( response.getStream(), client.getObjectMapper() ); } + + private void addQueryParams(final Request request) { + if (fields != null) { + for (String prop : fields) { + request.addQueryParam("Fields", prop); + } + } + } } diff --git a/src/main/java/com/twilio/rest/messaging/v2/ChannelsSender.java b/src/main/java/com/twilio/rest/messaging/v2/ChannelsSender.java index 0560e1d4ce..668b7a85cb 100644 --- a/src/main/java/com/twilio/rest/messaging/v2/ChannelsSender.java +++ b/src/main/java/com/twilio/rest/messaging/v2/ChannelsSender.java @@ -23,7 +23,6 @@ import com.fasterxml.jackson.databind.JsonMappingException; import com.fasterxml.jackson.databind.ObjectMapper; import com.twilio.base.Resource; -import com.twilio.converter.Converter; import com.twilio.converter.Promoter; import com.twilio.exception.ApiConnectionException; import com.twilio.exception.ApiException; @@ -41,7 +40,7 @@ @ToString public class ChannelsSender extends Resource { - private static final long serialVersionUID = 42075077215889L; + private static final long serialVersionUID = 103954331986266L; @ToString public static class MessagingV2ChannelsSenderConfiguration { @@ -164,10 +163,6 @@ public static class MessagingV2ChannelsSenderProfile { @Setter private Object emails; - public String getEmails() { - return Converter.objectToJson(emails); - } - @JsonInclude(JsonInclude.Include.NON_EMPTY) @JsonProperty("logo_url") @Getter @@ -186,10 +181,6 @@ public String getEmails() { @Setter private Object websites; - public String getWebsites() { - return Converter.objectToJson(websites); - } - public static MessagingV2ChannelsSenderProfile fromJson( String jsonString, ObjectMapper mapper @@ -228,7 +219,9 @@ public static class MessagingV2ChannelsSenderRequestsCreate { @Setter private MessagingV2ChannelsSenderProfile profile; - public MessagingV2ChannelsSenderRequestsCreate() {} + public MessagingV2ChannelsSenderRequestsCreate(final String senderId) { + this.senderId = senderId; + } public static MessagingV2ChannelsSenderRequestsCreate fromJson( String jsonString, @@ -275,6 +268,120 @@ public static MessagingV2ChannelsSenderRequestsUpdate fromJson( } } + @ToString + public static class MessagingV2ChannelsSenderProfileResponseEmails { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("email") + @Getter + @Setter + private String email; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("label") + @Getter + @Setter + private String label; + + public static MessagingV2ChannelsSenderProfileResponseEmails fromJson( + String jsonString, + ObjectMapper mapper + ) throws IOException { + return mapper.readValue( + jsonString, + MessagingV2ChannelsSenderProfileResponseEmails.class + ); + } + } + + @ToString + public static class MessagingV2ChannelsSenderProfileResponseWebsites { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("website") + @Getter + @Setter + private String website; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("label") + @Getter + @Setter + private String label; + + public static MessagingV2ChannelsSenderProfileResponseWebsites fromJson( + String jsonString, + ObjectMapper mapper + ) throws IOException { + return mapper.readValue( + jsonString, + MessagingV2ChannelsSenderProfileResponseWebsites.class + ); + } + } + + @ToString + public static class MessagingV2ChannelsSenderProfileResponse { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("name") + @Getter + @Setter + private String name; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("about") + @Getter + @Setter + private String about; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("address") + @Getter + @Setter + private String address; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("description") + @Getter + @Setter + private String description; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("emails") + @Getter + @Setter + private List emails; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("logo_url") + @Getter + @Setter + private String logoUrl; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("vertical") + @Getter + @Setter + private String vertical; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("websites") + @Getter + @Setter + private List websites; + + public static MessagingV2ChannelsSenderProfileResponse fromJson( + String jsonString, + ObjectMapper mapper + ) throws IOException { + return mapper.readValue( + jsonString, + MessagingV2ChannelsSenderProfileResponse.class + ); + } + } + @ToString public static class MessagingV2ChannelsSenderProperties { @@ -417,7 +524,7 @@ public static String toJson(Object object, ObjectMapper mapper) { private final String senderId; private final MessagingV2ChannelsSenderConfiguration configuration; private final MessagingV2ChannelsSenderWebhook webhook; - private final MessagingV2ChannelsSenderProfile profile; + private final MessagingV2ChannelsSenderProfileResponse profile; private final MessagingV2ChannelsSenderProperties properties; private final List< MessagingV2ChannelsSenderOfflineReasonsItems @@ -433,7 +540,9 @@ private ChannelsSender( "configuration" ) final MessagingV2ChannelsSenderConfiguration configuration, @JsonProperty("webhook") final MessagingV2ChannelsSenderWebhook webhook, - @JsonProperty("profile") final MessagingV2ChannelsSenderProfile profile, + @JsonProperty( + "profile" + ) final MessagingV2ChannelsSenderProfileResponse profile, @JsonProperty( "properties" ) final MessagingV2ChannelsSenderProperties properties, @@ -473,7 +582,7 @@ public final MessagingV2ChannelsSenderWebhook getWebhook() { return this.webhook; } - public final MessagingV2ChannelsSenderProfile getProfile() { + public final MessagingV2ChannelsSenderProfileResponse getProfile() { return this.profile; } diff --git a/src/main/java/com/twilio/rest/microvisor/v1/AccountConfig.java b/src/main/java/com/twilio/rest/microvisor/v1/AccountConfig.java deleted file mode 100644 index f51341b9ef..0000000000 --- a/src/main/java/com/twilio/rest/microvisor/v1/AccountConfig.java +++ /dev/null @@ -1,168 +0,0 @@ -/* - * This code was generated by - * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ - * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ - * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ - * - * Twilio - Microvisor - * 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.microvisor.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 AccountConfig extends Resource { - - private static final long serialVersionUID = 212393375904180L; - - public static AccountConfigCreator creator( - final String key, - final String value - ) { - return new AccountConfigCreator(key, value); - } - - public static AccountConfigDeleter deleter(final String pathKey) { - return new AccountConfigDeleter(pathKey); - } - - public static AccountConfigFetcher fetcher(final String pathKey) { - return new AccountConfigFetcher(pathKey); - } - - public static AccountConfigReader reader() { - return new AccountConfigReader(); - } - - public static AccountConfigUpdater updater( - final String pathKey, - final String value - ) { - return new AccountConfigUpdater(pathKey, value); - } - - /** - * Converts a JSON String into a AccountConfig object using the provided ObjectMapper. - * - * @param json Raw JSON String - * @param objectMapper Jackson ObjectMapper - * @return AccountConfig object represented by the provided JSON - */ - public static AccountConfig fromJson( - final String json, - final ObjectMapper objectMapper - ) { - // Convert all checked exceptions to Runtime - try { - return objectMapper.readValue(json, AccountConfig.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 AccountConfig object using the provided - * ObjectMapper. - * - * @param json Raw JSON InputStream - * @param objectMapper Jackson ObjectMapper - * @return AccountConfig object represented by the provided JSON - */ - public static AccountConfig fromJson( - final InputStream json, - final ObjectMapper objectMapper - ) { - // Convert all checked exceptions to Runtime - try { - return objectMapper.readValue(json, AccountConfig.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 key; - private final ZonedDateTime dateUpdated; - private final String value; - private final URI url; - - @JsonCreator - private AccountConfig( - @JsonProperty("key") final String key, - @JsonProperty("date_updated") final String dateUpdated, - @JsonProperty("value") final String value, - @JsonProperty("url") final URI url - ) { - this.key = key; - this.dateUpdated = DateConverter.iso8601DateTimeFromString(dateUpdated); - this.value = value; - this.url = url; - } - - public final String getKey() { - return this.key; - } - - public final ZonedDateTime getDateUpdated() { - return this.dateUpdated; - } - - public final String getValue() { - return this.value; - } - - 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; - } - - AccountConfig other = (AccountConfig) o; - - return ( - Objects.equals(key, other.key) && - Objects.equals(dateUpdated, other.dateUpdated) && - Objects.equals(value, other.value) && - Objects.equals(url, other.url) - ); - } - - @Override - public int hashCode() { - return Objects.hash(key, dateUpdated, value, url); - } -} diff --git a/src/main/java/com/twilio/rest/microvisor/v1/AccountConfigCreator.java b/src/main/java/com/twilio/rest/microvisor/v1/AccountConfigCreator.java deleted file mode 100644 index 7070bac8d9..0000000000 --- a/src/main/java/com/twilio/rest/microvisor/v1/AccountConfigCreator.java +++ /dev/null @@ -1,95 +0,0 @@ -/* - * This code was generated by - * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ - * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ - * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ - * - * Twilio - Microvisor - * 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.microvisor.v1; - -import com.twilio.base.Creator; -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 AccountConfigCreator extends Creator { - - private String key; - private String value; - - public AccountConfigCreator(final String key, final String value) { - this.key = key; - this.value = value; - } - - public AccountConfigCreator setKey(final String key) { - this.key = key; - return this; - } - - public AccountConfigCreator setValue(final String value) { - this.value = value; - return this; - } - - @Override - public AccountConfig create(final TwilioRestClient client) { - String path = "/v1/Configs"; - - path = path.replace("{" + "Key" + "}", this.key.toString()); - path = path.replace("{" + "Value" + "}", this.value.toString()); - - Request request = new Request( - HttpMethod.POST, - Domains.MICROVISOR.toString(), - path - ); - request.setContentType(EnumConstants.ContentType.FORM_URLENCODED); - addPostParams(request); - Response response = client.request(request); - if (response == null) { - throw new ApiConnectionException( - "AccountConfig creation 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 AccountConfig.fromJson( - response.getStream(), - client.getObjectMapper() - ); - } - - private void addPostParams(final Request request) { - if (key != null) { - request.addPostParam("Key", key); - } - if (value != null) { - request.addPostParam("Value", value); - } - } -} diff --git a/src/main/java/com/twilio/rest/microvisor/v1/AccountConfigFetcher.java b/src/main/java/com/twilio/rest/microvisor/v1/AccountConfigFetcher.java deleted file mode 100644 index 54949a068e..0000000000 --- a/src/main/java/com/twilio/rest/microvisor/v1/AccountConfigFetcher.java +++ /dev/null @@ -1,73 +0,0 @@ -/* - * This code was generated by - * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ - * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ - * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ - * - * Twilio - Microvisor - * 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.microvisor.v1; - -import com.twilio.base.Fetcher; -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 AccountConfigFetcher extends Fetcher { - - private String pathKey; - - public AccountConfigFetcher(final String pathKey) { - this.pathKey = pathKey; - } - - @Override - public AccountConfig fetch(final TwilioRestClient client) { - String path = "/v1/Configs/{Key}"; - - path = path.replace("{" + "Key" + "}", this.pathKey.toString()); - - Request request = new Request( - HttpMethod.GET, - Domains.MICROVISOR.toString(), - path - ); - request.setContentType(EnumConstants.ContentType.FORM_URLENCODED); - Response response = client.request(request); - - if (response == null) { - throw new ApiConnectionException( - "AccountConfig 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 AccountConfig.fromJson( - response.getStream(), - client.getObjectMapper() - ); - } -} diff --git a/src/main/java/com/twilio/rest/microvisor/v1/AccountConfigReader.java b/src/main/java/com/twilio/rest/microvisor/v1/AccountConfigReader.java deleted file mode 100644 index 5e68b1b2bd..0000000000 --- a/src/main/java/com/twilio/rest/microvisor/v1/AccountConfigReader.java +++ /dev/null @@ -1,135 +0,0 @@ -/* - * This code was generated by - * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ - * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ - * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ - * - * Twilio - Microvisor - * 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.microvisor.v1; - -import com.twilio.base.Page; -import com.twilio.base.Reader; -import com.twilio.base.ResourceSet; -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 AccountConfigReader extends Reader { - - private Long pageSize; - - public AccountConfigReader() {} - - public AccountConfigReader setPageSize(final Long pageSize) { - this.pageSize = pageSize; - return this; - } - - @Override - public ResourceSet read(final TwilioRestClient client) { - return new ResourceSet<>(this, client, firstPage(client)); - } - - public Page firstPage(final TwilioRestClient client) { - String path = "/v1/Configs"; - - Request request = new Request( - HttpMethod.GET, - Domains.MICROVISOR.toString(), - path - ); - - addQueryParams(request); - request.setContentType(EnumConstants.ContentType.FORM_URLENCODED); - return pageForRequest(client, request); - } - - private Page pageForRequest( - final TwilioRestClient client, - final Request request - ) { - Response response = client.request(request); - - if (response == null) { - throw new ApiConnectionException( - "AccountConfig read 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 Page.fromJson( - "configs", - response.getContent(), - AccountConfig.class, - client.getObjectMapper() - ); - } - - @Override - public Page previousPage( - final Page page, - final TwilioRestClient client - ) { - Request request = new Request( - HttpMethod.GET, - page.getPreviousPageUrl(Domains.MICROVISOR.toString()) - ); - return pageForRequest(client, request); - } - - @Override - public Page nextPage( - final Page page, - final TwilioRestClient client - ) { - Request request = new Request( - HttpMethod.GET, - page.getNextPageUrl(Domains.MICROVISOR.toString()) - ); - return pageForRequest(client, request); - } - - @Override - public Page getPage( - final String targetUrl, - final TwilioRestClient client - ) { - Request request = new Request(HttpMethod.GET, targetUrl); - - return pageForRequest(client, request); - } - - private void addQueryParams(final Request request) { - if (pageSize != null) { - request.addQueryParam("PageSize", pageSize.toString()); - } - - if (getPageSize() != null) { - request.addQueryParam("PageSize", Integer.toString(getPageSize())); - } - } -} diff --git a/src/main/java/com/twilio/rest/microvisor/v1/AccountSecret.java b/src/main/java/com/twilio/rest/microvisor/v1/AccountSecret.java deleted file mode 100644 index 65fab57e56..0000000000 --- a/src/main/java/com/twilio/rest/microvisor/v1/AccountSecret.java +++ /dev/null @@ -1,160 +0,0 @@ -/* - * This code was generated by - * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ - * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ - * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ - * - * Twilio - Microvisor - * 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.microvisor.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 AccountSecret extends Resource { - - private static final long serialVersionUID = 245444757442788L; - - public static AccountSecretCreator creator( - final String key, - final String value - ) { - return new AccountSecretCreator(key, value); - } - - public static AccountSecretDeleter deleter(final String pathKey) { - return new AccountSecretDeleter(pathKey); - } - - public static AccountSecretFetcher fetcher(final String pathKey) { - return new AccountSecretFetcher(pathKey); - } - - public static AccountSecretReader reader() { - return new AccountSecretReader(); - } - - public static AccountSecretUpdater updater( - final String pathKey, - final String value - ) { - return new AccountSecretUpdater(pathKey, value); - } - - /** - * Converts a JSON String into a AccountSecret object using the provided ObjectMapper. - * - * @param json Raw JSON String - * @param objectMapper Jackson ObjectMapper - * @return AccountSecret object represented by the provided JSON - */ - public static AccountSecret fromJson( - final String json, - final ObjectMapper objectMapper - ) { - // Convert all checked exceptions to Runtime - try { - return objectMapper.readValue(json, AccountSecret.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 AccountSecret object using the provided - * ObjectMapper. - * - * @param json Raw JSON InputStream - * @param objectMapper Jackson ObjectMapper - * @return AccountSecret object represented by the provided JSON - */ - public static AccountSecret fromJson( - final InputStream json, - final ObjectMapper objectMapper - ) { - // Convert all checked exceptions to Runtime - try { - return objectMapper.readValue(json, AccountSecret.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 key; - private final ZonedDateTime dateRotated; - private final URI url; - - @JsonCreator - private AccountSecret( - @JsonProperty("key") final String key, - @JsonProperty("date_rotated") final String dateRotated, - @JsonProperty("url") final URI url - ) { - this.key = key; - this.dateRotated = DateConverter.iso8601DateTimeFromString(dateRotated); - this.url = url; - } - - public final String getKey() { - return this.key; - } - - public final ZonedDateTime getDateRotated() { - return this.dateRotated; - } - - 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; - } - - AccountSecret other = (AccountSecret) o; - - return ( - Objects.equals(key, other.key) && - Objects.equals(dateRotated, other.dateRotated) && - Objects.equals(url, other.url) - ); - } - - @Override - public int hashCode() { - return Objects.hash(key, dateRotated, url); - } -} diff --git a/src/main/java/com/twilio/rest/microvisor/v1/AccountSecretCreator.java b/src/main/java/com/twilio/rest/microvisor/v1/AccountSecretCreator.java deleted file mode 100644 index 2652846681..0000000000 --- a/src/main/java/com/twilio/rest/microvisor/v1/AccountSecretCreator.java +++ /dev/null @@ -1,95 +0,0 @@ -/* - * This code was generated by - * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ - * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ - * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ - * - * Twilio - Microvisor - * 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.microvisor.v1; - -import com.twilio.base.Creator; -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 AccountSecretCreator extends Creator { - - private String key; - private String value; - - public AccountSecretCreator(final String key, final String value) { - this.key = key; - this.value = value; - } - - public AccountSecretCreator setKey(final String key) { - this.key = key; - return this; - } - - public AccountSecretCreator setValue(final String value) { - this.value = value; - return this; - } - - @Override - public AccountSecret create(final TwilioRestClient client) { - String path = "/v1/Secrets"; - - path = path.replace("{" + "Key" + "}", this.key.toString()); - path = path.replace("{" + "Value" + "}", this.value.toString()); - - Request request = new Request( - HttpMethod.POST, - Domains.MICROVISOR.toString(), - path - ); - request.setContentType(EnumConstants.ContentType.FORM_URLENCODED); - addPostParams(request); - Response response = client.request(request); - if (response == null) { - throw new ApiConnectionException( - "AccountSecret creation 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 AccountSecret.fromJson( - response.getStream(), - client.getObjectMapper() - ); - } - - private void addPostParams(final Request request) { - if (key != null) { - request.addPostParam("Key", key); - } - if (value != null) { - request.addPostParam("Value", value); - } - } -} diff --git a/src/main/java/com/twilio/rest/microvisor/v1/AccountSecretDeleter.java b/src/main/java/com/twilio/rest/microvisor/v1/AccountSecretDeleter.java deleted file mode 100644 index c427b71904..0000000000 --- a/src/main/java/com/twilio/rest/microvisor/v1/AccountSecretDeleter.java +++ /dev/null @@ -1,69 +0,0 @@ -/* - * This code was generated by - * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ - * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ - * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ - * - * Twilio - Microvisor - * 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.microvisor.v1; - -import com.twilio.base.Deleter; -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 AccountSecretDeleter extends Deleter { - - private String pathKey; - - public AccountSecretDeleter(final String pathKey) { - this.pathKey = pathKey; - } - - @Override - public boolean delete(final TwilioRestClient client) { - String path = "/v1/Secrets/{Key}"; - - path = path.replace("{" + "Key" + "}", this.pathKey.toString()); - - Request request = new Request( - HttpMethod.DELETE, - Domains.MICROVISOR.toString(), - path - ); - request.setContentType(EnumConstants.ContentType.FORM_URLENCODED); - Response response = client.request(request); - - if (response == null) { - throw new ApiConnectionException( - "AccountSecret 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/microvisor/v1/AccountSecretReader.java b/src/main/java/com/twilio/rest/microvisor/v1/AccountSecretReader.java deleted file mode 100644 index eeeccfb5f1..0000000000 --- a/src/main/java/com/twilio/rest/microvisor/v1/AccountSecretReader.java +++ /dev/null @@ -1,135 +0,0 @@ -/* - * This code was generated by - * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ - * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ - * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ - * - * Twilio - Microvisor - * 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.microvisor.v1; - -import com.twilio.base.Page; -import com.twilio.base.Reader; -import com.twilio.base.ResourceSet; -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 AccountSecretReader extends Reader { - - private Long pageSize; - - public AccountSecretReader() {} - - public AccountSecretReader setPageSize(final Long pageSize) { - this.pageSize = pageSize; - return this; - } - - @Override - public ResourceSet read(final TwilioRestClient client) { - return new ResourceSet<>(this, client, firstPage(client)); - } - - public Page firstPage(final TwilioRestClient client) { - String path = "/v1/Secrets"; - - Request request = new Request( - HttpMethod.GET, - Domains.MICROVISOR.toString(), - path - ); - - addQueryParams(request); - request.setContentType(EnumConstants.ContentType.FORM_URLENCODED); - return pageForRequest(client, request); - } - - private Page pageForRequest( - final TwilioRestClient client, - final Request request - ) { - Response response = client.request(request); - - if (response == null) { - throw new ApiConnectionException( - "AccountSecret read 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 Page.fromJson( - "secrets", - response.getContent(), - AccountSecret.class, - client.getObjectMapper() - ); - } - - @Override - public Page previousPage( - final Page page, - final TwilioRestClient client - ) { - Request request = new Request( - HttpMethod.GET, - page.getPreviousPageUrl(Domains.MICROVISOR.toString()) - ); - return pageForRequest(client, request); - } - - @Override - public Page nextPage( - final Page page, - final TwilioRestClient client - ) { - Request request = new Request( - HttpMethod.GET, - page.getNextPageUrl(Domains.MICROVISOR.toString()) - ); - return pageForRequest(client, request); - } - - @Override - public Page getPage( - final String targetUrl, - final TwilioRestClient client - ) { - Request request = new Request(HttpMethod.GET, targetUrl); - - return pageForRequest(client, request); - } - - private void addQueryParams(final Request request) { - if (pageSize != null) { - request.addQueryParam("PageSize", pageSize.toString()); - } - - if (getPageSize() != null) { - request.addQueryParam("PageSize", Integer.toString(getPageSize())); - } - } -} diff --git a/src/main/java/com/twilio/rest/microvisor/v1/App.java b/src/main/java/com/twilio/rest/microvisor/v1/App.java deleted file mode 100644 index 23827af572..0000000000 --- a/src/main/java/com/twilio/rest/microvisor/v1/App.java +++ /dev/null @@ -1,197 +0,0 @@ -/* - * This code was generated by - * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ - * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ - * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ - * - * Twilio - Microvisor - * 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.microvisor.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.Map; -import java.util.Map; -import java.util.Objects; -import lombok.ToString; -import lombok.ToString; - -@JsonIgnoreProperties(ignoreUnknown = true) -@ToString -public class App extends Resource { - - private static final long serialVersionUID = 223120562272974L; - - public static AppDeleter deleter(final String pathSid) { - return new AppDeleter(pathSid); - } - - public static AppFetcher fetcher(final String pathSid) { - return new AppFetcher(pathSid); - } - - public static AppReader reader() { - return new AppReader(); - } - - /** - * Converts a JSON String into a App object using the provided ObjectMapper. - * - * @param json Raw JSON String - * @param objectMapper Jackson ObjectMapper - * @return App object represented by the provided JSON - */ - public static App fromJson( - final String json, - final ObjectMapper objectMapper - ) { - // Convert all checked exceptions to Runtime - try { - return objectMapper.readValue(json, App.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 App object using the provided - * ObjectMapper. - * - * @param json Raw JSON InputStream - * @param objectMapper Jackson ObjectMapper - * @return App object represented by the provided JSON - */ - public static App fromJson( - final InputStream json, - final ObjectMapper objectMapper - ) { - // Convert all checked exceptions to Runtime - try { - return objectMapper.readValue(json, App.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 sid; - private final String accountSid; - private final String hash; - private final String uniqueName; - private final ZonedDateTime dateCreated; - private final ZonedDateTime dateUpdated; - private final URI url; - private final Map links; - - @JsonCreator - private App( - @JsonProperty("sid") final String sid, - @JsonProperty("account_sid") final String accountSid, - @JsonProperty("hash") final String hash, - @JsonProperty("unique_name") final String uniqueName, - @JsonProperty("date_created") final String dateCreated, - @JsonProperty("date_updated") final String dateUpdated, - @JsonProperty("url") final URI url, - @JsonProperty("links") final Map links - ) { - this.sid = sid; - this.accountSid = accountSid; - this.hash = hash; - this.uniqueName = uniqueName; - this.dateCreated = DateConverter.iso8601DateTimeFromString(dateCreated); - this.dateUpdated = DateConverter.iso8601DateTimeFromString(dateUpdated); - this.url = url; - this.links = links; - } - - public final String getSid() { - return this.sid; - } - - public final String getAccountSid() { - return this.accountSid; - } - - public final String getHash() { - return this.hash; - } - - public final String getUniqueName() { - return this.uniqueName; - } - - public final ZonedDateTime getDateCreated() { - return this.dateCreated; - } - - public final ZonedDateTime getDateUpdated() { - return this.dateUpdated; - } - - public final URI getUrl() { - return this.url; - } - - public final Map getLinks() { - return this.links; - } - - @Override - public boolean equals(final Object o) { - if (this == o) { - return true; - } - - if (o == null || getClass() != o.getClass()) { - return false; - } - - App other = (App) o; - - return ( - Objects.equals(sid, other.sid) && - Objects.equals(accountSid, other.accountSid) && - Objects.equals(hash, other.hash) && - Objects.equals(uniqueName, other.uniqueName) && - Objects.equals(dateCreated, other.dateCreated) && - Objects.equals(dateUpdated, other.dateUpdated) && - Objects.equals(url, other.url) && - Objects.equals(links, other.links) - ); - } - - @Override - public int hashCode() { - return Objects.hash( - sid, - accountSid, - hash, - uniqueName, - dateCreated, - dateUpdated, - url, - links - ); - } -} diff --git a/src/main/java/com/twilio/rest/microvisor/v1/AppDeleter.java b/src/main/java/com/twilio/rest/microvisor/v1/AppDeleter.java deleted file mode 100644 index ee834cbce9..0000000000 --- a/src/main/java/com/twilio/rest/microvisor/v1/AppDeleter.java +++ /dev/null @@ -1,69 +0,0 @@ -/* - * This code was generated by - * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ - * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ - * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ - * - * Twilio - Microvisor - * 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.microvisor.v1; - -import com.twilio.base.Deleter; -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 AppDeleter extends Deleter { - - private String pathSid; - - public AppDeleter(final String pathSid) { - this.pathSid = pathSid; - } - - @Override - public boolean delete(final TwilioRestClient client) { - String path = "/v1/Apps/{Sid}"; - - path = path.replace("{" + "Sid" + "}", this.pathSid.toString()); - - Request request = new Request( - HttpMethod.DELETE, - Domains.MICROVISOR.toString(), - path - ); - request.setContentType(EnumConstants.ContentType.FORM_URLENCODED); - Response response = client.request(request); - - if (response == null) { - throw new ApiConnectionException( - "App 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/microvisor/v1/AppFetcher.java b/src/main/java/com/twilio/rest/microvisor/v1/AppFetcher.java deleted file mode 100644 index e5f7fb789a..0000000000 --- a/src/main/java/com/twilio/rest/microvisor/v1/AppFetcher.java +++ /dev/null @@ -1,70 +0,0 @@ -/* - * This code was generated by - * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ - * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ - * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ - * - * Twilio - Microvisor - * 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.microvisor.v1; - -import com.twilio.base.Fetcher; -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 AppFetcher extends Fetcher { - - private String pathSid; - - public AppFetcher(final String pathSid) { - this.pathSid = pathSid; - } - - @Override - public App fetch(final TwilioRestClient client) { - String path = "/v1/Apps/{Sid}"; - - path = path.replace("{" + "Sid" + "}", this.pathSid.toString()); - - Request request = new Request( - HttpMethod.GET, - Domains.MICROVISOR.toString(), - path - ); - request.setContentType(EnumConstants.ContentType.FORM_URLENCODED); - Response response = client.request(request); - - if (response == null) { - throw new ApiConnectionException( - "App 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 App.fromJson(response.getStream(), client.getObjectMapper()); - } -} diff --git a/src/main/java/com/twilio/rest/microvisor/v1/AppReader.java b/src/main/java/com/twilio/rest/microvisor/v1/AppReader.java deleted file mode 100644 index 2c0d0efdf5..0000000000 --- a/src/main/java/com/twilio/rest/microvisor/v1/AppReader.java +++ /dev/null @@ -1,135 +0,0 @@ -/* - * This code was generated by - * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ - * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ - * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ - * - * Twilio - Microvisor - * 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.microvisor.v1; - -import com.twilio.base.Page; -import com.twilio.base.Reader; -import com.twilio.base.ResourceSet; -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 AppReader extends Reader { - - private Long pageSize; - - public AppReader() {} - - public AppReader setPageSize(final Long pageSize) { - this.pageSize = pageSize; - return this; - } - - @Override - public ResourceSet read(final TwilioRestClient client) { - return new ResourceSet<>(this, client, firstPage(client)); - } - - public Page firstPage(final TwilioRestClient client) { - String path = "/v1/Apps"; - - Request request = new Request( - HttpMethod.GET, - Domains.MICROVISOR.toString(), - path - ); - - addQueryParams(request); - request.setContentType(EnumConstants.ContentType.FORM_URLENCODED); - return pageForRequest(client, request); - } - - private Page pageForRequest( - final TwilioRestClient client, - final Request request - ) { - Response response = client.request(request); - - if (response == null) { - throw new ApiConnectionException( - "App read 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 Page.fromJson( - "apps", - response.getContent(), - App.class, - client.getObjectMapper() - ); - } - - @Override - public Page previousPage( - final Page page, - final TwilioRestClient client - ) { - Request request = new Request( - HttpMethod.GET, - page.getPreviousPageUrl(Domains.MICROVISOR.toString()) - ); - return pageForRequest(client, request); - } - - @Override - public Page nextPage( - final Page page, - final TwilioRestClient client - ) { - Request request = new Request( - HttpMethod.GET, - page.getNextPageUrl(Domains.MICROVISOR.toString()) - ); - return pageForRequest(client, request); - } - - @Override - public Page getPage( - final String targetUrl, - final TwilioRestClient client - ) { - Request request = new Request(HttpMethod.GET, targetUrl); - - return pageForRequest(client, request); - } - - private void addQueryParams(final Request request) { - if (pageSize != null) { - request.addQueryParam("PageSize", pageSize.toString()); - } - - if (getPageSize() != null) { - request.addQueryParam("PageSize", Integer.toString(getPageSize())); - } - } -} diff --git a/src/main/java/com/twilio/rest/microvisor/v1/Device.java b/src/main/java/com/twilio/rest/microvisor/v1/Device.java deleted file mode 100644 index 6775341645..0000000000 --- a/src/main/java/com/twilio/rest/microvisor/v1/Device.java +++ /dev/null @@ -1,206 +0,0 @@ -/* - * This code was generated by - * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ - * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ - * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ - * - * Twilio - Microvisor - * 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.microvisor.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.Map; -import java.util.Map; -import java.util.Objects; -import lombok.ToString; -import lombok.ToString; - -@JsonIgnoreProperties(ignoreUnknown = true) -@ToString -public class Device extends Resource { - - private static final long serialVersionUID = 266652017538801L; - - public static DeviceFetcher fetcher(final String pathSid) { - return new DeviceFetcher(pathSid); - } - - public static DeviceReader reader() { - return new DeviceReader(); - } - - public static DeviceUpdater updater(final String pathSid) { - return new DeviceUpdater(pathSid); - } - - /** - * Converts a JSON String into a Device object using the provided ObjectMapper. - * - * @param json Raw JSON String - * @param objectMapper Jackson ObjectMapper - * @return Device object represented by the provided JSON - */ - public static Device fromJson( - final String json, - final ObjectMapper objectMapper - ) { - // Convert all checked exceptions to Runtime - try { - return objectMapper.readValue(json, Device.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 Device object using the provided - * ObjectMapper. - * - * @param json Raw JSON InputStream - * @param objectMapper Jackson ObjectMapper - * @return Device object represented by the provided JSON - */ - public static Device fromJson( - final InputStream json, - final ObjectMapper objectMapper - ) { - // Convert all checked exceptions to Runtime - try { - return objectMapper.readValue(json, Device.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 sid; - private final String uniqueName; - private final String accountSid; - private final Map app; - private final Map logging; - private final ZonedDateTime dateCreated; - private final ZonedDateTime dateUpdated; - private final URI url; - private final Map links; - - @JsonCreator - private Device( - @JsonProperty("sid") final String sid, - @JsonProperty("unique_name") final String uniqueName, - @JsonProperty("account_sid") final String accountSid, - @JsonProperty("app") final Map app, - @JsonProperty("logging") final Map logging, - @JsonProperty("date_created") final String dateCreated, - @JsonProperty("date_updated") final String dateUpdated, - @JsonProperty("url") final URI url, - @JsonProperty("links") final Map links - ) { - this.sid = sid; - this.uniqueName = uniqueName; - this.accountSid = accountSid; - this.app = app; - this.logging = logging; - this.dateCreated = DateConverter.iso8601DateTimeFromString(dateCreated); - this.dateUpdated = DateConverter.iso8601DateTimeFromString(dateUpdated); - this.url = url; - this.links = links; - } - - public final String getSid() { - return this.sid; - } - - public final String getUniqueName() { - return this.uniqueName; - } - - public final String getAccountSid() { - return this.accountSid; - } - - public final Map getApp() { - return this.app; - } - - public final Map getLogging() { - return this.logging; - } - - public final ZonedDateTime getDateCreated() { - return this.dateCreated; - } - - public final ZonedDateTime getDateUpdated() { - return this.dateUpdated; - } - - public final URI getUrl() { - return this.url; - } - - public final Map getLinks() { - return this.links; - } - - @Override - public boolean equals(final Object o) { - if (this == o) { - return true; - } - - if (o == null || getClass() != o.getClass()) { - return false; - } - - Device other = (Device) o; - - return ( - Objects.equals(sid, other.sid) && - Objects.equals(uniqueName, other.uniqueName) && - Objects.equals(accountSid, other.accountSid) && - Objects.equals(app, other.app) && - Objects.equals(logging, other.logging) && - Objects.equals(dateCreated, other.dateCreated) && - Objects.equals(dateUpdated, other.dateUpdated) && - Objects.equals(url, other.url) && - Objects.equals(links, other.links) - ); - } - - @Override - public int hashCode() { - return Objects.hash( - sid, - uniqueName, - accountSid, - app, - logging, - dateCreated, - dateUpdated, - url, - links - ); - } -} diff --git a/src/main/java/com/twilio/rest/microvisor/v1/DeviceUpdater.java b/src/main/java/com/twilio/rest/microvisor/v1/DeviceUpdater.java deleted file mode 100644 index 4c451aa3c0..0000000000 --- a/src/main/java/com/twilio/rest/microvisor/v1/DeviceUpdater.java +++ /dev/null @@ -1,109 +0,0 @@ -/* - * This code was generated by - * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ - * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ - * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ - * - * Twilio - Microvisor - * 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.microvisor.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 DeviceUpdater extends Updater { - - private String pathSid; - private String uniqueName; - private String targetApp; - private Boolean loggingEnabled; - private Boolean restartApp; - - public DeviceUpdater(final String pathSid) { - this.pathSid = pathSid; - } - - public DeviceUpdater setUniqueName(final String uniqueName) { - this.uniqueName = uniqueName; - return this; - } - - public DeviceUpdater setTargetApp(final String targetApp) { - this.targetApp = targetApp; - return this; - } - - public DeviceUpdater setLoggingEnabled(final Boolean loggingEnabled) { - this.loggingEnabled = loggingEnabled; - return this; - } - - public DeviceUpdater setRestartApp(final Boolean restartApp) { - this.restartApp = restartApp; - return this; - } - - @Override - public Device update(final TwilioRestClient client) { - String path = "/v1/Devices/{Sid}"; - - path = path.replace("{" + "Sid" + "}", this.pathSid.toString()); - - Request request = new Request( - HttpMethod.POST, - Domains.MICROVISOR.toString(), - path - ); - request.setContentType(EnumConstants.ContentType.FORM_URLENCODED); - addPostParams(request); - Response response = client.request(request); - if (response == null) { - throw new ApiConnectionException( - "Device 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 Device.fromJson(response.getStream(), client.getObjectMapper()); - } - - private void addPostParams(final Request request) { - if (uniqueName != null) { - request.addPostParam("UniqueName", uniqueName); - } - if (targetApp != null) { - request.addPostParam("TargetApp", targetApp); - } - if (loggingEnabled != null) { - request.addPostParam("LoggingEnabled", loggingEnabled.toString()); - } - if (restartApp != null) { - request.addPostParam("RestartApp", restartApp.toString()); - } - } -} diff --git a/src/main/java/com/twilio/rest/microvisor/v1/app/AppManifestFetcher.java b/src/main/java/com/twilio/rest/microvisor/v1/app/AppManifestFetcher.java deleted file mode 100644 index 296b8d3a0a..0000000000 --- a/src/main/java/com/twilio/rest/microvisor/v1/app/AppManifestFetcher.java +++ /dev/null @@ -1,73 +0,0 @@ -/* - * This code was generated by - * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ - * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ - * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ - * - * Twilio - Microvisor - * 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.microvisor.v1.app; - -import com.twilio.base.Fetcher; -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 AppManifestFetcher extends Fetcher { - - private String pathAppSid; - - public AppManifestFetcher(final String pathAppSid) { - this.pathAppSid = pathAppSid; - } - - @Override - public AppManifest fetch(final TwilioRestClient client) { - String path = "/v1/Apps/{AppSid}/Manifest"; - - path = path.replace("{" + "AppSid" + "}", this.pathAppSid.toString()); - - Request request = new Request( - HttpMethod.GET, - Domains.MICROVISOR.toString(), - path - ); - request.setContentType(EnumConstants.ContentType.FORM_URLENCODED); - Response response = client.request(request); - - if (response == null) { - throw new ApiConnectionException( - "AppManifest 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 AppManifest.fromJson( - response.getStream(), - client.getObjectMapper() - ); - } -} diff --git a/src/main/java/com/twilio/rest/microvisor/v1/device/DeviceConfig.java b/src/main/java/com/twilio/rest/microvisor/v1/device/DeviceConfig.java deleted file mode 100644 index 3574a6e773..0000000000 --- a/src/main/java/com/twilio/rest/microvisor/v1/device/DeviceConfig.java +++ /dev/null @@ -1,184 +0,0 @@ -/* - * This code was generated by - * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ - * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ - * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ - * - * Twilio - Microvisor - * 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.microvisor.v1.device; - -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 DeviceConfig extends Resource { - - private static final long serialVersionUID = 4121523224128L; - - public static DeviceConfigCreator creator( - final String pathDeviceSid, - final String key, - final String value - ) { - return new DeviceConfigCreator(pathDeviceSid, key, value); - } - - public static DeviceConfigDeleter deleter( - final String pathDeviceSid, - final String pathKey - ) { - return new DeviceConfigDeleter(pathDeviceSid, pathKey); - } - - public static DeviceConfigFetcher fetcher( - final String pathDeviceSid, - final String pathKey - ) { - return new DeviceConfigFetcher(pathDeviceSid, pathKey); - } - - public static DeviceConfigReader reader(final String pathDeviceSid) { - return new DeviceConfigReader(pathDeviceSid); - } - - public static DeviceConfigUpdater updater( - final String pathDeviceSid, - final String pathKey, - final String value - ) { - return new DeviceConfigUpdater(pathDeviceSid, pathKey, value); - } - - /** - * Converts a JSON String into a DeviceConfig object using the provided ObjectMapper. - * - * @param json Raw JSON String - * @param objectMapper Jackson ObjectMapper - * @return DeviceConfig object represented by the provided JSON - */ - public static DeviceConfig fromJson( - final String json, - final ObjectMapper objectMapper - ) { - // Convert all checked exceptions to Runtime - try { - return objectMapper.readValue(json, DeviceConfig.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 DeviceConfig object using the provided - * ObjectMapper. - * - * @param json Raw JSON InputStream - * @param objectMapper Jackson ObjectMapper - * @return DeviceConfig object represented by the provided JSON - */ - public static DeviceConfig fromJson( - final InputStream json, - final ObjectMapper objectMapper - ) { - // Convert all checked exceptions to Runtime - try { - return objectMapper.readValue(json, DeviceConfig.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 deviceSid; - private final String key; - private final String value; - private final ZonedDateTime dateUpdated; - private final URI url; - - @JsonCreator - private DeviceConfig( - @JsonProperty("device_sid") final String deviceSid, - @JsonProperty("key") final String key, - @JsonProperty("value") final String value, - @JsonProperty("date_updated") final String dateUpdated, - @JsonProperty("url") final URI url - ) { - this.deviceSid = deviceSid; - this.key = key; - this.value = value; - this.dateUpdated = DateConverter.iso8601DateTimeFromString(dateUpdated); - this.url = url; - } - - public final String getDeviceSid() { - return this.deviceSid; - } - - public final String getKey() { - return this.key; - } - - public final String getValue() { - return this.value; - } - - public final ZonedDateTime getDateUpdated() { - return this.dateUpdated; - } - - 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; - } - - DeviceConfig other = (DeviceConfig) o; - - return ( - Objects.equals(deviceSid, other.deviceSid) && - Objects.equals(key, other.key) && - Objects.equals(value, other.value) && - Objects.equals(dateUpdated, other.dateUpdated) && - Objects.equals(url, other.url) - ); - } - - @Override - public int hashCode() { - return Objects.hash(deviceSid, key, value, dateUpdated, url); - } -} diff --git a/src/main/java/com/twilio/rest/microvisor/v1/device/DeviceConfigCreator.java b/src/main/java/com/twilio/rest/microvisor/v1/device/DeviceConfigCreator.java deleted file mode 100644 index badaac3ead..0000000000 --- a/src/main/java/com/twilio/rest/microvisor/v1/device/DeviceConfigCreator.java +++ /dev/null @@ -1,106 +0,0 @@ -/* - * This code was generated by - * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ - * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ - * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ - * - * Twilio - Microvisor - * 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.microvisor.v1.device; - -import com.twilio.base.Creator; -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 DeviceConfigCreator extends Creator { - - private String pathDeviceSid; - private String key; - private String value; - - public DeviceConfigCreator( - final String pathDeviceSid, - final String key, - final String value - ) { - this.pathDeviceSid = pathDeviceSid; - this.key = key; - this.value = value; - } - - public DeviceConfigCreator setKey(final String key) { - this.key = key; - return this; - } - - public DeviceConfigCreator setValue(final String value) { - this.value = value; - return this; - } - - @Override - public DeviceConfig create(final TwilioRestClient client) { - String path = "/v1/Devices/{DeviceSid}/Configs"; - - path = - path.replace( - "{" + "DeviceSid" + "}", - this.pathDeviceSid.toString() - ); - path = path.replace("{" + "Key" + "}", this.key.toString()); - path = path.replace("{" + "Value" + "}", this.value.toString()); - - Request request = new Request( - HttpMethod.POST, - Domains.MICROVISOR.toString(), - path - ); - request.setContentType(EnumConstants.ContentType.FORM_URLENCODED); - addPostParams(request); - Response response = client.request(request); - if (response == null) { - throw new ApiConnectionException( - "DeviceConfig creation 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 DeviceConfig.fromJson( - response.getStream(), - client.getObjectMapper() - ); - } - - private void addPostParams(final Request request) { - if (key != null) { - request.addPostParam("Key", key); - } - if (value != null) { - request.addPostParam("Value", value); - } - } -} diff --git a/src/main/java/com/twilio/rest/microvisor/v1/device/DeviceConfigReader.java b/src/main/java/com/twilio/rest/microvisor/v1/device/DeviceConfigReader.java deleted file mode 100644 index aa855c227d..0000000000 --- a/src/main/java/com/twilio/rest/microvisor/v1/device/DeviceConfigReader.java +++ /dev/null @@ -1,143 +0,0 @@ -/* - * This code was generated by - * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ - * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ - * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ - * - * Twilio - Microvisor - * 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.microvisor.v1.device; - -import com.twilio.base.Page; -import com.twilio.base.Reader; -import com.twilio.base.ResourceSet; -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 DeviceConfigReader extends Reader { - - private String pathDeviceSid; - private Long pageSize; - - public DeviceConfigReader(final String pathDeviceSid) { - this.pathDeviceSid = pathDeviceSid; - } - - public DeviceConfigReader setPageSize(final Long pageSize) { - this.pageSize = pageSize; - return this; - } - - @Override - public ResourceSet read(final TwilioRestClient client) { - return new ResourceSet<>(this, client, firstPage(client)); - } - - public Page firstPage(final TwilioRestClient client) { - String path = "/v1/Devices/{DeviceSid}/Configs"; - path = - path.replace( - "{" + "DeviceSid" + "}", - this.pathDeviceSid.toString() - ); - - Request request = new Request( - HttpMethod.GET, - Domains.MICROVISOR.toString(), - path - ); - - addQueryParams(request); - request.setContentType(EnumConstants.ContentType.FORM_URLENCODED); - return pageForRequest(client, request); - } - - private Page pageForRequest( - final TwilioRestClient client, - final Request request - ) { - Response response = client.request(request); - - if (response == null) { - throw new ApiConnectionException( - "DeviceConfig read 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 Page.fromJson( - "configs", - response.getContent(), - DeviceConfig.class, - client.getObjectMapper() - ); - } - - @Override - public Page previousPage( - final Page page, - final TwilioRestClient client - ) { - Request request = new Request( - HttpMethod.GET, - page.getPreviousPageUrl(Domains.MICROVISOR.toString()) - ); - return pageForRequest(client, request); - } - - @Override - public Page nextPage( - final Page page, - final TwilioRestClient client - ) { - Request request = new Request( - HttpMethod.GET, - page.getNextPageUrl(Domains.MICROVISOR.toString()) - ); - return pageForRequest(client, request); - } - - @Override - public Page getPage( - final String targetUrl, - final TwilioRestClient client - ) { - Request request = new Request(HttpMethod.GET, targetUrl); - - return pageForRequest(client, request); - } - - private void addQueryParams(final Request request) { - if (pageSize != null) { - request.addQueryParam("PageSize", pageSize.toString()); - } - - if (getPageSize() != null) { - request.addQueryParam("PageSize", Integer.toString(getPageSize())); - } - } -} diff --git a/src/main/java/com/twilio/rest/microvisor/v1/device/DeviceConfigUpdater.java b/src/main/java/com/twilio/rest/microvisor/v1/device/DeviceConfigUpdater.java deleted file mode 100644 index d2f55627e1..0000000000 --- a/src/main/java/com/twilio/rest/microvisor/v1/device/DeviceConfigUpdater.java +++ /dev/null @@ -1,98 +0,0 @@ -/* - * This code was generated by - * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ - * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ - * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ - * - * Twilio - Microvisor - * 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.microvisor.v1.device; - -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 DeviceConfigUpdater extends Updater { - - private String pathDeviceSid; - private String pathKey; - private String value; - - public DeviceConfigUpdater( - final String pathDeviceSid, - final String pathKey, - final String value - ) { - this.pathDeviceSid = pathDeviceSid; - this.pathKey = pathKey; - this.value = value; - } - - public DeviceConfigUpdater setValue(final String value) { - this.value = value; - return this; - } - - @Override - public DeviceConfig update(final TwilioRestClient client) { - String path = "/v1/Devices/{DeviceSid}/Configs/{Key}"; - - path = - path.replace( - "{" + "DeviceSid" + "}", - this.pathDeviceSid.toString() - ); - path = path.replace("{" + "Key" + "}", this.pathKey.toString()); - path = path.replace("{" + "Value" + "}", this.value.toString()); - - Request request = new Request( - HttpMethod.POST, - Domains.MICROVISOR.toString(), - path - ); - request.setContentType(EnumConstants.ContentType.FORM_URLENCODED); - addPostParams(request); - Response response = client.request(request); - if (response == null) { - throw new ApiConnectionException( - "DeviceConfig 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 DeviceConfig.fromJson( - response.getStream(), - client.getObjectMapper() - ); - } - - private void addPostParams(final Request request) { - if (value != null) { - request.addPostParam("Value", value); - } - } -} diff --git a/src/main/java/com/twilio/rest/microvisor/v1/device/DeviceSecret.java b/src/main/java/com/twilio/rest/microvisor/v1/device/DeviceSecret.java deleted file mode 100644 index 36e7e8916a..0000000000 --- a/src/main/java/com/twilio/rest/microvisor/v1/device/DeviceSecret.java +++ /dev/null @@ -1,176 +0,0 @@ -/* - * This code was generated by - * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ - * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ - * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ - * - * Twilio - Microvisor - * 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.microvisor.v1.device; - -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 DeviceSecret extends Resource { - - private static final long serialVersionUID = 4318157927104L; - - public static DeviceSecretCreator creator( - final String pathDeviceSid, - final String key, - final String value - ) { - return new DeviceSecretCreator(pathDeviceSid, key, value); - } - - public static DeviceSecretDeleter deleter( - final String pathDeviceSid, - final String pathKey - ) { - return new DeviceSecretDeleter(pathDeviceSid, pathKey); - } - - public static DeviceSecretFetcher fetcher( - final String pathDeviceSid, - final String pathKey - ) { - return new DeviceSecretFetcher(pathDeviceSid, pathKey); - } - - public static DeviceSecretReader reader(final String pathDeviceSid) { - return new DeviceSecretReader(pathDeviceSid); - } - - public static DeviceSecretUpdater updater( - final String pathDeviceSid, - final String pathKey, - final String value - ) { - return new DeviceSecretUpdater(pathDeviceSid, pathKey, value); - } - - /** - * Converts a JSON String into a DeviceSecret object using the provided ObjectMapper. - * - * @param json Raw JSON String - * @param objectMapper Jackson ObjectMapper - * @return DeviceSecret object represented by the provided JSON - */ - public static DeviceSecret fromJson( - final String json, - final ObjectMapper objectMapper - ) { - // Convert all checked exceptions to Runtime - try { - return objectMapper.readValue(json, DeviceSecret.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 DeviceSecret object using the provided - * ObjectMapper. - * - * @param json Raw JSON InputStream - * @param objectMapper Jackson ObjectMapper - * @return DeviceSecret object represented by the provided JSON - */ - public static DeviceSecret fromJson( - final InputStream json, - final ObjectMapper objectMapper - ) { - // Convert all checked exceptions to Runtime - try { - return objectMapper.readValue(json, DeviceSecret.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 deviceSid; - private final String key; - private final ZonedDateTime dateRotated; - private final URI url; - - @JsonCreator - private DeviceSecret( - @JsonProperty("device_sid") final String deviceSid, - @JsonProperty("key") final String key, - @JsonProperty("date_rotated") final String dateRotated, - @JsonProperty("url") final URI url - ) { - this.deviceSid = deviceSid; - this.key = key; - this.dateRotated = DateConverter.iso8601DateTimeFromString(dateRotated); - this.url = url; - } - - public final String getDeviceSid() { - return this.deviceSid; - } - - public final String getKey() { - return this.key; - } - - public final ZonedDateTime getDateRotated() { - return this.dateRotated; - } - - 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; - } - - DeviceSecret other = (DeviceSecret) o; - - return ( - Objects.equals(deviceSid, other.deviceSid) && - Objects.equals(key, other.key) && - Objects.equals(dateRotated, other.dateRotated) && - Objects.equals(url, other.url) - ); - } - - @Override - public int hashCode() { - return Objects.hash(deviceSid, key, dateRotated, url); - } -} diff --git a/src/main/java/com/twilio/rest/microvisor/v1/device/DeviceSecretCreator.java b/src/main/java/com/twilio/rest/microvisor/v1/device/DeviceSecretCreator.java deleted file mode 100644 index 33e07b238c..0000000000 --- a/src/main/java/com/twilio/rest/microvisor/v1/device/DeviceSecretCreator.java +++ /dev/null @@ -1,106 +0,0 @@ -/* - * This code was generated by - * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ - * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ - * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ - * - * Twilio - Microvisor - * 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.microvisor.v1.device; - -import com.twilio.base.Creator; -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 DeviceSecretCreator extends Creator { - - private String pathDeviceSid; - private String key; - private String value; - - public DeviceSecretCreator( - final String pathDeviceSid, - final String key, - final String value - ) { - this.pathDeviceSid = pathDeviceSid; - this.key = key; - this.value = value; - } - - public DeviceSecretCreator setKey(final String key) { - this.key = key; - return this; - } - - public DeviceSecretCreator setValue(final String value) { - this.value = value; - return this; - } - - @Override - public DeviceSecret create(final TwilioRestClient client) { - String path = "/v1/Devices/{DeviceSid}/Secrets"; - - path = - path.replace( - "{" + "DeviceSid" + "}", - this.pathDeviceSid.toString() - ); - path = path.replace("{" + "Key" + "}", this.key.toString()); - path = path.replace("{" + "Value" + "}", this.value.toString()); - - Request request = new Request( - HttpMethod.POST, - Domains.MICROVISOR.toString(), - path - ); - request.setContentType(EnumConstants.ContentType.FORM_URLENCODED); - addPostParams(request); - Response response = client.request(request); - if (response == null) { - throw new ApiConnectionException( - "DeviceSecret creation 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 DeviceSecret.fromJson( - response.getStream(), - client.getObjectMapper() - ); - } - - private void addPostParams(final Request request) { - if (key != null) { - request.addPostParam("Key", key); - } - if (value != null) { - request.addPostParam("Value", value); - } - } -} diff --git a/src/main/java/com/twilio/rest/microvisor/v1/device/DeviceSecretFetcher.java b/src/main/java/com/twilio/rest/microvisor/v1/device/DeviceSecretFetcher.java deleted file mode 100644 index 363d966e83..0000000000 --- a/src/main/java/com/twilio/rest/microvisor/v1/device/DeviceSecretFetcher.java +++ /dev/null @@ -1,83 +0,0 @@ -/* - * This code was generated by - * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ - * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ - * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ - * - * Twilio - Microvisor - * 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.microvisor.v1.device; - -import com.twilio.base.Fetcher; -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 DeviceSecretFetcher extends Fetcher { - - private String pathDeviceSid; - private String pathKey; - - public DeviceSecretFetcher( - final String pathDeviceSid, - final String pathKey - ) { - this.pathDeviceSid = pathDeviceSid; - this.pathKey = pathKey; - } - - @Override - public DeviceSecret fetch(final TwilioRestClient client) { - String path = "/v1/Devices/{DeviceSid}/Secrets/{Key}"; - - path = - path.replace( - "{" + "DeviceSid" + "}", - this.pathDeviceSid.toString() - ); - path = path.replace("{" + "Key" + "}", this.pathKey.toString()); - - Request request = new Request( - HttpMethod.GET, - Domains.MICROVISOR.toString(), - path - ); - request.setContentType(EnumConstants.ContentType.FORM_URLENCODED); - Response response = client.request(request); - - if (response == null) { - throw new ApiConnectionException( - "DeviceSecret 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 DeviceSecret.fromJson( - response.getStream(), - client.getObjectMapper() - ); - } -} diff --git a/src/main/java/com/twilio/rest/microvisor/v1/device/DeviceSecretReader.java b/src/main/java/com/twilio/rest/microvisor/v1/device/DeviceSecretReader.java deleted file mode 100644 index 4eb5e21ae8..0000000000 --- a/src/main/java/com/twilio/rest/microvisor/v1/device/DeviceSecretReader.java +++ /dev/null @@ -1,143 +0,0 @@ -/* - * This code was generated by - * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ - * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ - * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ - * - * Twilio - Microvisor - * 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.microvisor.v1.device; - -import com.twilio.base.Page; -import com.twilio.base.Reader; -import com.twilio.base.ResourceSet; -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 DeviceSecretReader extends Reader { - - private String pathDeviceSid; - private Long pageSize; - - public DeviceSecretReader(final String pathDeviceSid) { - this.pathDeviceSid = pathDeviceSid; - } - - public DeviceSecretReader setPageSize(final Long pageSize) { - this.pageSize = pageSize; - return this; - } - - @Override - public ResourceSet read(final TwilioRestClient client) { - return new ResourceSet<>(this, client, firstPage(client)); - } - - public Page firstPage(final TwilioRestClient client) { - String path = "/v1/Devices/{DeviceSid}/Secrets"; - path = - path.replace( - "{" + "DeviceSid" + "}", - this.pathDeviceSid.toString() - ); - - Request request = new Request( - HttpMethod.GET, - Domains.MICROVISOR.toString(), - path - ); - - addQueryParams(request); - request.setContentType(EnumConstants.ContentType.FORM_URLENCODED); - return pageForRequest(client, request); - } - - private Page pageForRequest( - final TwilioRestClient client, - final Request request - ) { - Response response = client.request(request); - - if (response == null) { - throw new ApiConnectionException( - "DeviceSecret read 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 Page.fromJson( - "secrets", - response.getContent(), - DeviceSecret.class, - client.getObjectMapper() - ); - } - - @Override - public Page previousPage( - final Page page, - final TwilioRestClient client - ) { - Request request = new Request( - HttpMethod.GET, - page.getPreviousPageUrl(Domains.MICROVISOR.toString()) - ); - return pageForRequest(client, request); - } - - @Override - public Page nextPage( - final Page page, - final TwilioRestClient client - ) { - Request request = new Request( - HttpMethod.GET, - page.getNextPageUrl(Domains.MICROVISOR.toString()) - ); - return pageForRequest(client, request); - } - - @Override - public Page getPage( - final String targetUrl, - final TwilioRestClient client - ) { - Request request = new Request(HttpMethod.GET, targetUrl); - - return pageForRequest(client, request); - } - - private void addQueryParams(final Request request) { - if (pageSize != null) { - request.addQueryParam("PageSize", pageSize.toString()); - } - - if (getPageSize() != null) { - request.addQueryParam("PageSize", Integer.toString(getPageSize())); - } - } -} diff --git a/src/main/java/com/twilio/rest/microvisor/v1/device/DeviceSecretUpdater.java b/src/main/java/com/twilio/rest/microvisor/v1/device/DeviceSecretUpdater.java deleted file mode 100644 index ec9105b461..0000000000 --- a/src/main/java/com/twilio/rest/microvisor/v1/device/DeviceSecretUpdater.java +++ /dev/null @@ -1,98 +0,0 @@ -/* - * This code was generated by - * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ - * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ - * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ - * - * Twilio - Microvisor - * 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.microvisor.v1.device; - -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 DeviceSecretUpdater extends Updater { - - private String pathDeviceSid; - private String pathKey; - private String value; - - public DeviceSecretUpdater( - final String pathDeviceSid, - final String pathKey, - final String value - ) { - this.pathDeviceSid = pathDeviceSid; - this.pathKey = pathKey; - this.value = value; - } - - public DeviceSecretUpdater setValue(final String value) { - this.value = value; - return this; - } - - @Override - public DeviceSecret update(final TwilioRestClient client) { - String path = "/v1/Devices/{DeviceSid}/Secrets/{Key}"; - - path = - path.replace( - "{" + "DeviceSid" + "}", - this.pathDeviceSid.toString() - ); - path = path.replace("{" + "Key" + "}", this.pathKey.toString()); - path = path.replace("{" + "Value" + "}", this.value.toString()); - - Request request = new Request( - HttpMethod.POST, - Domains.MICROVISOR.toString(), - path - ); - request.setContentType(EnumConstants.ContentType.FORM_URLENCODED); - addPostParams(request); - Response response = client.request(request); - if (response == null) { - throw new ApiConnectionException( - "DeviceSecret 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 DeviceSecret.fromJson( - response.getStream(), - client.getObjectMapper() - ); - } - - private void addPostParams(final Request request) { - if (value != null) { - request.addPostParam("Value", value); - } - } -} diff --git a/src/main/java/com/twilio/rest/notify/v1/service/NotificationCreator.java b/src/main/java/com/twilio/rest/notify/v1/service/NotificationCreator.java index c1debefd56..249e0f9685 100644 --- a/src/main/java/com/twilio/rest/notify/v1/service/NotificationCreator.java +++ b/src/main/java/com/twilio/rest/notify/v1/service/NotificationCreator.java @@ -29,8 +29,6 @@ import com.twilio.rest.Domains; import java.util.List; import java.util.List; -import java.util.Map; -import java.util.Map; public class NotificationCreator extends Creator { @@ -41,14 +39,14 @@ public class NotificationCreator extends Creator { private String title; private String sound; private String action; - private Map data; - private Map apn; - private Map gcm; - private Map sms; - private Map facebookMessenger; - private Map fcm; + private Object data; + private Object apn; + private Object gcm; + private Object sms; + private Object facebookMessenger; + private Object fcm; private List segment; - private Map alexa; + private Object alexa; private List toBinding; private String deliveryCallbackUrl; private List identity; @@ -90,34 +88,34 @@ public NotificationCreator setAction(final String action) { return this; } - public NotificationCreator setData(final Map data) { + public NotificationCreator setData(final Object data) { this.data = data; return this; } - public NotificationCreator setApn(final Map apn) { + public NotificationCreator setApn(final Object apn) { this.apn = apn; return this; } - public NotificationCreator setGcm(final Map gcm) { + public NotificationCreator setGcm(final Object gcm) { this.gcm = gcm; return this; } - public NotificationCreator setSms(final Map sms) { + public NotificationCreator setSms(final Object sms) { this.sms = sms; return this; } public NotificationCreator setFacebookMessenger( - final Map facebookMessenger + final Object facebookMessenger ) { this.facebookMessenger = facebookMessenger; return this; } - public NotificationCreator setFcm(final Map fcm) { + public NotificationCreator setFcm(final Object fcm) { this.fcm = fcm; return this; } @@ -131,7 +129,7 @@ public NotificationCreator setSegment(final String segment) { return setSegment(Promoter.listOfOne(segment)); } - public NotificationCreator setAlexa(final Map alexa) { + public NotificationCreator setAlexa(final Object alexa) { this.alexa = alexa; return this; } @@ -232,25 +230,25 @@ private void addPostParams(final Request request) { request.addPostParam("Action", action); } if (data != null) { - request.addPostParam("Data", Converter.mapToJson(data)); + request.addPostParam("Data", Converter.objectToJson(data)); } if (apn != null) { - request.addPostParam("Apn", Converter.mapToJson(apn)); + request.addPostParam("Apn", Converter.objectToJson(apn)); } if (gcm != null) { - request.addPostParam("Gcm", Converter.mapToJson(gcm)); + request.addPostParam("Gcm", Converter.objectToJson(gcm)); } if (sms != null) { - request.addPostParam("Sms", Converter.mapToJson(sms)); + request.addPostParam("Sms", Converter.objectToJson(sms)); } if (facebookMessenger != null) { request.addPostParam( "FacebookMessenger", - Converter.mapToJson(facebookMessenger) + Converter.objectToJson(facebookMessenger) ); } if (fcm != null) { - request.addPostParam("Fcm", Converter.mapToJson(fcm)); + request.addPostParam("Fcm", Converter.objectToJson(fcm)); } if (segment != null) { for (String prop : segment) { @@ -258,7 +256,7 @@ private void addPostParams(final Request request) { } } if (alexa != null) { - request.addPostParam("Alexa", Converter.mapToJson(alexa)); + request.addPostParam("Alexa", Converter.objectToJson(alexa)); } if (toBinding != null) { for (String prop : toBinding) { diff --git a/src/main/java/com/twilio/rest/numbers/v1/PortingPortabilityFetcher.java b/src/main/java/com/twilio/rest/numbers/v1/PortingPortabilityFetcher.java index eedc6e5dc1..3eec9d2bbe 100644 --- a/src/main/java/com/twilio/rest/numbers/v1/PortingPortabilityFetcher.java +++ b/src/main/java/com/twilio/rest/numbers/v1/PortingPortabilityFetcher.java @@ -56,7 +56,7 @@ public PortingPortability fetch(final TwilioRestClient client) { path = path.replace( "{" + "PhoneNumber" + "}", - this.pathPhoneNumber.encode("utf-8") + this.pathPhoneNumber.toString() ); Request request = new Request( diff --git a/src/main/java/com/twilio/rest/numbers/v1/PortingWebhookConfigurationFetch.java b/src/main/java/com/twilio/rest/numbers/v1/Webhook.java similarity index 82% rename from src/main/java/com/twilio/rest/numbers/v1/PortingWebhookConfigurationFetch.java rename to src/main/java/com/twilio/rest/numbers/v1/Webhook.java index 53c0f02a23..6e9c6921dd 100644 --- a/src/main/java/com/twilio/rest/numbers/v1/PortingWebhookConfigurationFetch.java +++ b/src/main/java/com/twilio/rest/numbers/v1/Webhook.java @@ -35,31 +35,28 @@ @JsonIgnoreProperties(ignoreUnknown = true) @ToString -public class PortingWebhookConfigurationFetch extends Resource { +public class Webhook extends Resource { private static final long serialVersionUID = 270526030240961L; - public static PortingWebhookConfigurationFetchFetcher fetcher() { - return new PortingWebhookConfigurationFetchFetcher(); + public static WebhookFetcher fetcher() { + return new WebhookFetcher(); } /** - * Converts a JSON String into a PortingWebhookConfigurationFetch object using the provided ObjectMapper. + * Converts a JSON String into a Webhook object using the provided ObjectMapper. * * @param json Raw JSON String * @param objectMapper Jackson ObjectMapper - * @return PortingWebhookConfigurationFetch object represented by the provided JSON + * @return Webhook object represented by the provided JSON */ - public static PortingWebhookConfigurationFetch fromJson( + public static Webhook fromJson( final String json, final ObjectMapper objectMapper ) { // Convert all checked exceptions to Runtime try { - return objectMapper.readValue( - json, - PortingWebhookConfigurationFetch.class - ); + return objectMapper.readValue(json, Webhook.class); } catch (final JsonMappingException | JsonParseException e) { throw new ApiException(e.getMessage(), e); } catch (final IOException e) { @@ -68,23 +65,20 @@ public static PortingWebhookConfigurationFetch fromJson( } /** - * Converts a JSON InputStream into a PortingWebhookConfigurationFetch object using the provided + * Converts a JSON InputStream into a Webhook object using the provided * ObjectMapper. * * @param json Raw JSON InputStream * @param objectMapper Jackson ObjectMapper - * @return PortingWebhookConfigurationFetch object represented by the provided JSON + * @return Webhook object represented by the provided JSON */ - public static PortingWebhookConfigurationFetch fromJson( + public static Webhook fromJson( final InputStream json, final ObjectMapper objectMapper ) { // Convert all checked exceptions to Runtime try { - return objectMapper.readValue( - json, - PortingWebhookConfigurationFetch.class - ); + return objectMapper.readValue(json, Webhook.class); } catch (final JsonMappingException | JsonParseException e) { throw new ApiException(e.getMessage(), e); } catch (final IOException e) { @@ -100,7 +94,7 @@ public static PortingWebhookConfigurationFetch fromJson( private final ZonedDateTime portOutTargetDateCreated; @JsonCreator - private PortingWebhookConfigurationFetch( + private Webhook( @JsonProperty("url") final URI url, @JsonProperty("port_in_target_url") final URI portInTargetUrl, @JsonProperty("port_out_target_url") final URI portOutTargetUrl, @@ -156,8 +150,7 @@ public boolean equals(final Object o) { return false; } - PortingWebhookConfigurationFetch other = - (PortingWebhookConfigurationFetch) o; + Webhook other = (Webhook) o; return ( Objects.equals(url, other.url) && diff --git a/src/main/java/com/twilio/rest/numbers/v1/PortingWebhookConfigurationFetchFetcher.java b/src/main/java/com/twilio/rest/numbers/v1/WebhookFetcher.java similarity index 79% rename from src/main/java/com/twilio/rest/numbers/v1/PortingWebhookConfigurationFetchFetcher.java rename to src/main/java/com/twilio/rest/numbers/v1/WebhookFetcher.java index 59d0dc599f..ccffc00624 100644 --- a/src/main/java/com/twilio/rest/numbers/v1/PortingWebhookConfigurationFetchFetcher.java +++ b/src/main/java/com/twilio/rest/numbers/v1/WebhookFetcher.java @@ -25,15 +25,12 @@ import com.twilio.http.TwilioRestClient; import com.twilio.rest.Domains; -public class PortingWebhookConfigurationFetchFetcher - extends Fetcher { +public class WebhookFetcher extends Fetcher { - public PortingWebhookConfigurationFetchFetcher() {} + public WebhookFetcher() {} @Override - public PortingWebhookConfigurationFetch fetch( - final TwilioRestClient client - ) { + public Webhook fetch(final TwilioRestClient client) { String path = "/v1/Porting/Configuration/Webhook"; Request request = new Request( @@ -46,7 +43,7 @@ public PortingWebhookConfigurationFetch fetch( if (response == null) { throw new ApiConnectionException( - "PortingWebhookConfigurationFetch fetch failed: Unable to connect to server" + "Webhook fetch failed: Unable to connect to server" ); } else if (!TwilioRestClient.SUCCESS.test(response.getStatusCode())) { RestException restException = RestException.fromJson( @@ -62,9 +59,6 @@ public PortingWebhookConfigurationFetch fetch( throw new ApiException(restException); } - return PortingWebhookConfigurationFetch.fromJson( - response.getStream(), - client.getObjectMapper() - ); + return Webhook.fromJson(response.getStream(), client.getObjectMapper()); } } diff --git a/src/main/java/com/twilio/rest/numbers/v2/AuthorizationDocumentCreator.java b/src/main/java/com/twilio/rest/numbers/v2/AuthorizationDocumentCreator.java index fded505c8a..3e9f6c5dd8 100644 --- a/src/main/java/com/twilio/rest/numbers/v2/AuthorizationDocumentCreator.java +++ b/src/main/java/com/twilio/rest/numbers/v2/AuthorizationDocumentCreator.java @@ -118,7 +118,7 @@ public AuthorizationDocument create(final TwilioRestClient client) { path = path.replace( "{" + "ContactPhoneNumber" + "}", - this.contactPhoneNumber.encode("utf-8") + this.contactPhoneNumber.toString() ); path = path.replace( diff --git a/src/main/java/com/twilio/rest/numbers/v2/HostedNumberOrderCreator.java b/src/main/java/com/twilio/rest/numbers/v2/HostedNumberOrderCreator.java index 7de5551daf..1345e5ce8a 100644 --- a/src/main/java/com/twilio/rest/numbers/v2/HostedNumberOrderCreator.java +++ b/src/main/java/com/twilio/rest/numbers/v2/HostedNumberOrderCreator.java @@ -196,12 +196,12 @@ public HostedNumberOrder create(final TwilioRestClient client) { path = path.replace( "{" + "PhoneNumber" + "}", - this.phoneNumber.encode("utf-8") + this.phoneNumber.toString() ); path = path.replace( "{" + "ContactPhoneNumber" + "}", - this.contactPhoneNumber.encode("utf-8") + this.contactPhoneNumber.toString() ); path = path.replace("{" + "AddressSid" + "}", this.addressSid.toString()); diff --git a/src/main/java/com/twilio/rest/numbers/v2/regulatorycompliance/EndUserCreator.java b/src/main/java/com/twilio/rest/numbers/v2/regulatorycompliance/EndUserCreator.java index 52ac79162d..9f301c0623 100644 --- a/src/main/java/com/twilio/rest/numbers/v2/regulatorycompliance/EndUserCreator.java +++ b/src/main/java/com/twilio/rest/numbers/v2/regulatorycompliance/EndUserCreator.java @@ -26,14 +26,12 @@ import com.twilio.http.Response; import com.twilio.http.TwilioRestClient; import com.twilio.rest.Domains; -import java.util.Map; -import java.util.Map; public class EndUserCreator extends Creator { private String friendlyName; private EndUser.Type type; - private Map attributes; + private Object attributes; public EndUserCreator(final String friendlyName, final EndUser.Type type) { this.friendlyName = friendlyName; @@ -50,7 +48,7 @@ public EndUserCreator setType(final EndUser.Type type) { return this; } - public EndUserCreator setAttributes(final Map attributes) { + public EndUserCreator setAttributes(final Object attributes) { this.attributes = attributes; return this; } @@ -103,7 +101,10 @@ private void addPostParams(final Request request) { request.addPostParam("Type", type.toString()); } if (attributes != null) { - request.addPostParam("Attributes", Converter.mapToJson(attributes)); + request.addPostParam( + "Attributes", + Converter.objectToJson(attributes) + ); } } } diff --git a/src/main/java/com/twilio/rest/numbers/v2/regulatorycompliance/EndUserUpdater.java b/src/main/java/com/twilio/rest/numbers/v2/regulatorycompliance/EndUserUpdater.java index 0abd35a726..189bd34787 100644 --- a/src/main/java/com/twilio/rest/numbers/v2/regulatorycompliance/EndUserUpdater.java +++ b/src/main/java/com/twilio/rest/numbers/v2/regulatorycompliance/EndUserUpdater.java @@ -25,13 +25,12 @@ import com.twilio.http.Response; import com.twilio.http.TwilioRestClient; import com.twilio.rest.Domains; -import java.util.Map; public class EndUserUpdater extends Updater { private String pathSid; private String friendlyName; - private Map attributes; + private Object attributes; public EndUserUpdater(final String pathSid) { this.pathSid = pathSid; @@ -42,7 +41,7 @@ public EndUserUpdater setFriendlyName(final String friendlyName) { return this; } - public EndUserUpdater setAttributes(final Map attributes) { + public EndUserUpdater setAttributes(final Object attributes) { this.attributes = attributes; return this; } @@ -87,7 +86,10 @@ private void addPostParams(final Request request) { request.addPostParam("FriendlyName", friendlyName); } if (attributes != null) { - request.addPostParam("Attributes", Converter.mapToJson(attributes)); + request.addPostParam( + "Attributes", + Converter.objectToJson(attributes) + ); } } } diff --git a/src/main/java/com/twilio/rest/numbers/v2/regulatorycompliance/SupportingDocumentCreator.java b/src/main/java/com/twilio/rest/numbers/v2/regulatorycompliance/SupportingDocumentCreator.java index 61701ee5a0..9c53a94eb5 100644 --- a/src/main/java/com/twilio/rest/numbers/v2/regulatorycompliance/SupportingDocumentCreator.java +++ b/src/main/java/com/twilio/rest/numbers/v2/regulatorycompliance/SupportingDocumentCreator.java @@ -26,14 +26,12 @@ import com.twilio.http.Response; import com.twilio.http.TwilioRestClient; import com.twilio.rest.Domains; -import java.util.Map; -import java.util.Map; public class SupportingDocumentCreator extends Creator { private String friendlyName; private String type; - private Map attributes; + private Object attributes; public SupportingDocumentCreator( final String friendlyName, @@ -55,9 +53,7 @@ public SupportingDocumentCreator setType(final String type) { return this; } - public SupportingDocumentCreator setAttributes( - final Map attributes - ) { + public SupportingDocumentCreator setAttributes(final Object attributes) { this.attributes = attributes; return this; } @@ -113,7 +109,10 @@ private void addPostParams(final Request request) { request.addPostParam("Type", type); } if (attributes != null) { - request.addPostParam("Attributes", Converter.mapToJson(attributes)); + request.addPostParam( + "Attributes", + Converter.objectToJson(attributes) + ); } } } diff --git a/src/main/java/com/twilio/rest/numbers/v2/regulatorycompliance/SupportingDocumentUpdater.java b/src/main/java/com/twilio/rest/numbers/v2/regulatorycompliance/SupportingDocumentUpdater.java index 9e8edb947e..4a243f5fc5 100644 --- a/src/main/java/com/twilio/rest/numbers/v2/regulatorycompliance/SupportingDocumentUpdater.java +++ b/src/main/java/com/twilio/rest/numbers/v2/regulatorycompliance/SupportingDocumentUpdater.java @@ -25,13 +25,12 @@ import com.twilio.http.Response; import com.twilio.http.TwilioRestClient; import com.twilio.rest.Domains; -import java.util.Map; public class SupportingDocumentUpdater extends Updater { private String pathSid; private String friendlyName; - private Map attributes; + private Object attributes; public SupportingDocumentUpdater(final String pathSid) { this.pathSid = pathSid; @@ -44,9 +43,7 @@ public SupportingDocumentUpdater setFriendlyName( return this; } - public SupportingDocumentUpdater setAttributes( - final Map attributes - ) { + public SupportingDocumentUpdater setAttributes(final Object attributes) { this.attributes = attributes; return this; } @@ -94,7 +91,10 @@ private void addPostParams(final Request request) { request.addPostParam("FriendlyName", friendlyName); } if (attributes != null) { - request.addPostParam("Attributes", Converter.mapToJson(attributes)); + request.addPostParam( + "Attributes", + Converter.objectToJson(attributes) + ); } } } diff --git a/src/main/java/com/twilio/rest/preview/hostedNumbers/HostedNumberOrderCreator.java b/src/main/java/com/twilio/rest/preview/hostedNumbers/HostedNumberOrderCreator.java index 4f48c3128b..927eba9f60 100644 --- a/src/main/java/com/twilio/rest/preview/hostedNumbers/HostedNumberOrderCreator.java +++ b/src/main/java/com/twilio/rest/preview/hostedNumbers/HostedNumberOrderCreator.java @@ -192,7 +192,7 @@ public HostedNumberOrder create(final TwilioRestClient client) { path = path.replace( "{" + "PhoneNumber" + "}", - this.phoneNumber.encode("utf-8") + this.phoneNumber.toString() ); path = path.replace( diff --git a/src/main/java/com/twilio/rest/preview/marketplace/InstalledAddOnCreator.java b/src/main/java/com/twilio/rest/preview/marketplace/InstalledAddOnCreator.java index 881b0d804c..21254453bc 100644 --- a/src/main/java/com/twilio/rest/preview/marketplace/InstalledAddOnCreator.java +++ b/src/main/java/com/twilio/rest/preview/marketplace/InstalledAddOnCreator.java @@ -26,14 +26,12 @@ import com.twilio.http.Response; import com.twilio.http.TwilioRestClient; import com.twilio.rest.Domains; -import java.util.Map; -import java.util.Map; public class InstalledAddOnCreator extends Creator { private String availableAddOnSid; private Boolean acceptTermsOfService; - private Map configuration; + private Object configuration; private String uniqueName; public InstalledAddOnCreator( @@ -58,9 +56,7 @@ public InstalledAddOnCreator setAcceptTermsOfService( return this; } - public InstalledAddOnCreator setConfiguration( - final Map configuration - ) { + public InstalledAddOnCreator setConfiguration(final Object configuration) { this.configuration = configuration; return this; } @@ -130,7 +126,7 @@ private void addPostParams(final Request request) { if (configuration != null) { request.addPostParam( "Configuration", - Converter.mapToJson(configuration) + Converter.objectToJson(configuration) ); } if (uniqueName != null) { diff --git a/src/main/java/com/twilio/rest/preview/marketplace/InstalledAddOnUpdater.java b/src/main/java/com/twilio/rest/preview/marketplace/InstalledAddOnUpdater.java index 72748e7594..bb4dc1e55b 100644 --- a/src/main/java/com/twilio/rest/preview/marketplace/InstalledAddOnUpdater.java +++ b/src/main/java/com/twilio/rest/preview/marketplace/InstalledAddOnUpdater.java @@ -25,21 +25,18 @@ import com.twilio.http.Response; import com.twilio.http.TwilioRestClient; import com.twilio.rest.Domains; -import java.util.Map; public class InstalledAddOnUpdater extends Updater { private String pathSid; - private Map configuration; + private Object configuration; private String uniqueName; public InstalledAddOnUpdater(final String pathSid) { this.pathSid = pathSid; } - public InstalledAddOnUpdater setConfiguration( - final Map configuration - ) { + public InstalledAddOnUpdater setConfiguration(final Object configuration) { this.configuration = configuration; return this; } @@ -91,7 +88,7 @@ private void addPostParams(final Request request) { if (configuration != null) { request.addPostParam( "Configuration", - Converter.mapToJson(configuration) + Converter.objectToJson(configuration) ); } if (uniqueName != null) { diff --git a/src/main/java/com/twilio/rest/pricing/v1/voice/NumberFetcher.java b/src/main/java/com/twilio/rest/pricing/v1/voice/NumberFetcher.java index 4b3b9a50fd..ff3d62d4e3 100644 --- a/src/main/java/com/twilio/rest/pricing/v1/voice/NumberFetcher.java +++ b/src/main/java/com/twilio/rest/pricing/v1/voice/NumberFetcher.java @@ -37,8 +37,7 @@ public NumberFetcher(final com.twilio.type.PhoneNumber pathNumber) { public Number fetch(final TwilioRestClient client) { String path = "/v1/Voice/Numbers/{Number}"; - path = - path.replace("{" + "Number" + "}", this.pathNumber.encode("utf-8")); + path = path.replace("{" + "Number" + "}", this.pathNumber.toString()); Request request = new Request( HttpMethod.GET, diff --git a/src/main/java/com/twilio/rest/pricing/v2/NumberFetcher.java b/src/main/java/com/twilio/rest/pricing/v2/NumberFetcher.java index b433b097a0..e41c589818 100644 --- a/src/main/java/com/twilio/rest/pricing/v2/NumberFetcher.java +++ b/src/main/java/com/twilio/rest/pricing/v2/NumberFetcher.java @@ -57,7 +57,7 @@ public Number fetch(final TwilioRestClient client) { path = path.replace( "{" + "DestinationNumber" + "}", - this.pathDestinationNumber.encode("utf-8") + this.pathDestinationNumber.toString() ); Request request = new Request( diff --git a/src/main/java/com/twilio/rest/pricing/v2/voice/NumberFetcher.java b/src/main/java/com/twilio/rest/pricing/v2/voice/NumberFetcher.java index a0285c5f44..806d653a7b 100644 --- a/src/main/java/com/twilio/rest/pricing/v2/voice/NumberFetcher.java +++ b/src/main/java/com/twilio/rest/pricing/v2/voice/NumberFetcher.java @@ -57,7 +57,7 @@ public Number fetch(final TwilioRestClient client) { path = path.replace( "{" + "DestinationNumber" + "}", - this.pathDestinationNumber.encode("utf-8") + this.pathDestinationNumber.toString() ); Request request = new Request( diff --git a/src/main/java/com/twilio/rest/proxy/v1/service/SessionCreator.java b/src/main/java/com/twilio/rest/proxy/v1/service/SessionCreator.java index 988ff069e6..db40a233aa 100644 --- a/src/main/java/com/twilio/rest/proxy/v1/service/SessionCreator.java +++ b/src/main/java/com/twilio/rest/proxy/v1/service/SessionCreator.java @@ -30,8 +30,6 @@ import java.time.ZonedDateTime; import java.util.List; import java.util.List; -import java.util.Map; -import java.util.Map; public class SessionCreator extends Creator { @@ -41,7 +39,7 @@ public class SessionCreator extends Creator { private Integer ttl; private Session.Mode mode; private Session.Status status; - private List> participants; + private List participants; public SessionCreator(final String pathServiceSid) { this.pathServiceSid = pathServiceSid; @@ -72,16 +70,12 @@ public SessionCreator setStatus(final Session.Status status) { return this; } - public SessionCreator setParticipants( - final List> participants - ) { + public SessionCreator setParticipants(final List participants) { this.participants = participants; return this; } - public SessionCreator setParticipants( - final Map participants - ) { + public SessionCreator setParticipants(final Object participants) { return setParticipants(Promoter.listOfOne(participants)); } @@ -144,8 +138,11 @@ private void addPostParams(final Request request) { request.addPostParam("Status", status.toString()); } if (participants != null) { - for (Map prop : participants) { - request.addPostParam("Participants", Converter.mapToJson(prop)); + for (Object prop : participants) { + request.addPostParam( + "Participants", + Converter.objectToJson(prop) + ); } } } diff --git a/src/main/java/com/twilio/rest/proxy/v1/service/ShortCode.java b/src/main/java/com/twilio/rest/proxy/v1/service/ShortCode.java deleted file mode 100644 index f329ccddf9..0000000000 --- a/src/main/java/com/twilio/rest/proxy/v1/service/ShortCode.java +++ /dev/null @@ -1,236 +0,0 @@ -/* - * This code was generated by - * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ - * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ - * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ - * - * Twilio - Proxy - * 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.proxy.v1.service; - -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 com.twilio.type.PhoneNumberCapabilities; -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 ShortCode extends Resource { - - private static final long serialVersionUID = 222849980654127L; - - public static ShortCodeCreator creator( - final String pathServiceSid, - final String sid - ) { - return new ShortCodeCreator(pathServiceSid, sid); - } - - public static ShortCodeDeleter deleter( - final String pathServiceSid, - final String pathSid - ) { - return new ShortCodeDeleter(pathServiceSid, pathSid); - } - - public static ShortCodeFetcher fetcher( - final String pathServiceSid, - final String pathSid - ) { - return new ShortCodeFetcher(pathServiceSid, pathSid); - } - - public static ShortCodeReader reader(final String pathServiceSid) { - return new ShortCodeReader(pathServiceSid); - } - - public static ShortCodeUpdater updater( - final String pathServiceSid, - final String pathSid - ) { - return new ShortCodeUpdater(pathServiceSid, pathSid); - } - - /** - * Converts a JSON String into a ShortCode object using the provided ObjectMapper. - * - * @param json Raw JSON String - * @param objectMapper Jackson ObjectMapper - * @return ShortCode object represented by the provided JSON - */ - public static ShortCode fromJson( - final String json, - final ObjectMapper objectMapper - ) { - // Convert all checked exceptions to Runtime - try { - return objectMapper.readValue(json, ShortCode.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 ShortCode object using the provided - * ObjectMapper. - * - * @param json Raw JSON InputStream - * @param objectMapper Jackson ObjectMapper - * @return ShortCode object represented by the provided JSON - */ - public static ShortCode fromJson( - final InputStream json, - final ObjectMapper objectMapper - ) { - // Convert all checked exceptions to Runtime - try { - return objectMapper.readValue(json, ShortCode.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 sid; - private final String accountSid; - private final String serviceSid; - private final ZonedDateTime dateCreated; - private final ZonedDateTime dateUpdated; - private final String shortCode; - private final String isoCountry; - private final PhoneNumberCapabilities capabilities; - private final URI url; - private final Boolean isReserved; - - @JsonCreator - private ShortCode( - @JsonProperty("sid") final String sid, - @JsonProperty("account_sid") final String accountSid, - @JsonProperty("service_sid") final String serviceSid, - @JsonProperty("date_created") final String dateCreated, - @JsonProperty("date_updated") final String dateUpdated, - @JsonProperty("short_code") final String shortCode, - @JsonProperty("iso_country") final String isoCountry, - @JsonProperty( - "capabilities" - ) final PhoneNumberCapabilities capabilities, - @JsonProperty("url") final URI url, - @JsonProperty("is_reserved") final Boolean isReserved - ) { - this.sid = sid; - this.accountSid = accountSid; - this.serviceSid = serviceSid; - this.dateCreated = DateConverter.iso8601DateTimeFromString(dateCreated); - this.dateUpdated = DateConverter.iso8601DateTimeFromString(dateUpdated); - this.shortCode = shortCode; - this.isoCountry = isoCountry; - this.capabilities = capabilities; - this.url = url; - this.isReserved = isReserved; - } - - public final String getSid() { - return this.sid; - } - - public final String getAccountSid() { - return this.accountSid; - } - - public final String getServiceSid() { - return this.serviceSid; - } - - public final ZonedDateTime getDateCreated() { - return this.dateCreated; - } - - public final ZonedDateTime getDateUpdated() { - return this.dateUpdated; - } - - public final String getShortCode() { - return this.shortCode; - } - - public final String getIsoCountry() { - return this.isoCountry; - } - - public final PhoneNumberCapabilities getCapabilities() { - return this.capabilities; - } - - public final URI getUrl() { - return this.url; - } - - public final Boolean getIsReserved() { - return this.isReserved; - } - - @Override - public boolean equals(final Object o) { - if (this == o) { - return true; - } - - if (o == null || getClass() != o.getClass()) { - return false; - } - - ShortCode other = (ShortCode) o; - - return ( - Objects.equals(sid, other.sid) && - Objects.equals(accountSid, other.accountSid) && - Objects.equals(serviceSid, other.serviceSid) && - Objects.equals(dateCreated, other.dateCreated) && - Objects.equals(dateUpdated, other.dateUpdated) && - Objects.equals(shortCode, other.shortCode) && - Objects.equals(isoCountry, other.isoCountry) && - Objects.equals(capabilities, other.capabilities) && - Objects.equals(url, other.url) && - Objects.equals(isReserved, other.isReserved) - ); - } - - @Override - public int hashCode() { - return Objects.hash( - sid, - accountSid, - serviceSid, - dateCreated, - dateUpdated, - shortCode, - isoCountry, - capabilities, - url, - isReserved - ); - } -} diff --git a/src/main/java/com/twilio/rest/proxy/v1/service/ShortCodeDeleter.java b/src/main/java/com/twilio/rest/proxy/v1/service/ShortCodeDeleter.java deleted file mode 100644 index 488b8600c0..0000000000 --- a/src/main/java/com/twilio/rest/proxy/v1/service/ShortCodeDeleter.java +++ /dev/null @@ -1,76 +0,0 @@ -/* - * This code was generated by - * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ - * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ - * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ - * - * Twilio - Proxy - * 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.proxy.v1.service; - -import com.twilio.base.Deleter; -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 ShortCodeDeleter extends Deleter { - - private String pathServiceSid; - private String pathSid; - - public ShortCodeDeleter(final String pathServiceSid, final String pathSid) { - this.pathServiceSid = pathServiceSid; - this.pathSid = pathSid; - } - - @Override - public boolean delete(final TwilioRestClient client) { - String path = "/v1/Services/{ServiceSid}/ShortCodes/{Sid}"; - - path = - path.replace( - "{" + "ServiceSid" + "}", - this.pathServiceSid.toString() - ); - path = path.replace("{" + "Sid" + "}", this.pathSid.toString()); - - Request request = new Request( - HttpMethod.DELETE, - Domains.PROXY.toString(), - path - ); - request.setContentType(EnumConstants.ContentType.FORM_URLENCODED); - Response response = client.request(request); - - if (response == null) { - throw new ApiConnectionException( - "ShortCode 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/proxy/v1/service/ShortCodeReader.java b/src/main/java/com/twilio/rest/proxy/v1/service/ShortCodeReader.java deleted file mode 100644 index 1a88f3707d..0000000000 --- a/src/main/java/com/twilio/rest/proxy/v1/service/ShortCodeReader.java +++ /dev/null @@ -1,143 +0,0 @@ -/* - * This code was generated by - * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ - * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ - * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ - * - * Twilio - Proxy - * 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.proxy.v1.service; - -import com.twilio.base.Page; -import com.twilio.base.Reader; -import com.twilio.base.ResourceSet; -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 ShortCodeReader extends Reader { - - private String pathServiceSid; - private Long pageSize; - - public ShortCodeReader(final String pathServiceSid) { - this.pathServiceSid = pathServiceSid; - } - - public ShortCodeReader setPageSize(final Long pageSize) { - this.pageSize = pageSize; - return this; - } - - @Override - public ResourceSet read(final TwilioRestClient client) { - return new ResourceSet<>(this, client, firstPage(client)); - } - - public Page firstPage(final TwilioRestClient client) { - String path = "/v1/Services/{ServiceSid}/ShortCodes"; - path = - path.replace( - "{" + "ServiceSid" + "}", - this.pathServiceSid.toString() - ); - - Request request = new Request( - HttpMethod.GET, - Domains.PROXY.toString(), - path - ); - - addQueryParams(request); - request.setContentType(EnumConstants.ContentType.FORM_URLENCODED); - return pageForRequest(client, request); - } - - private Page pageForRequest( - final TwilioRestClient client, - final Request request - ) { - Response response = client.request(request); - - if (response == null) { - throw new ApiConnectionException( - "ShortCode read 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 Page.fromJson( - "short_codes", - response.getContent(), - ShortCode.class, - client.getObjectMapper() - ); - } - - @Override - public Page previousPage( - final Page page, - final TwilioRestClient client - ) { - Request request = new Request( - HttpMethod.GET, - page.getPreviousPageUrl(Domains.PROXY.toString()) - ); - return pageForRequest(client, request); - } - - @Override - public Page nextPage( - final Page page, - final TwilioRestClient client - ) { - Request request = new Request( - HttpMethod.GET, - page.getNextPageUrl(Domains.PROXY.toString()) - ); - return pageForRequest(client, request); - } - - @Override - public Page getPage( - final String targetUrl, - final TwilioRestClient client - ) { - Request request = new Request(HttpMethod.GET, targetUrl); - - return pageForRequest(client, request); - } - - private void addQueryParams(final Request request) { - if (pageSize != null) { - request.addQueryParam("PageSize", pageSize.toString()); - } - - if (getPageSize() != null) { - request.addQueryParam("PageSize", Integer.toString(getPageSize())); - } - } -} diff --git a/src/main/java/com/twilio/rest/proxy/v1/service/ShortCodeUpdater.java b/src/main/java/com/twilio/rest/proxy/v1/service/ShortCodeUpdater.java deleted file mode 100644 index 6672e14a7e..0000000000 --- a/src/main/java/com/twilio/rest/proxy/v1/service/ShortCodeUpdater.java +++ /dev/null @@ -1,92 +0,0 @@ -/* - * This code was generated by - * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ - * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ - * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ - * - * Twilio - Proxy - * 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.proxy.v1.service; - -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 ShortCodeUpdater extends Updater { - - private String pathServiceSid; - private String pathSid; - private Boolean isReserved; - - public ShortCodeUpdater(final String pathServiceSid, final String pathSid) { - this.pathServiceSid = pathServiceSid; - this.pathSid = pathSid; - } - - public ShortCodeUpdater setIsReserved(final Boolean isReserved) { - this.isReserved = isReserved; - return this; - } - - @Override - public ShortCode update(final TwilioRestClient client) { - String path = "/v1/Services/{ServiceSid}/ShortCodes/{Sid}"; - - path = - path.replace( - "{" + "ServiceSid" + "}", - this.pathServiceSid.toString() - ); - path = path.replace("{" + "Sid" + "}", this.pathSid.toString()); - - Request request = new Request( - HttpMethod.POST, - Domains.PROXY.toString(), - path - ); - request.setContentType(EnumConstants.ContentType.FORM_URLENCODED); - addPostParams(request); - Response response = client.request(request); - if (response == null) { - throw new ApiConnectionException( - "ShortCode 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 ShortCode.fromJson( - response.getStream(), - client.getObjectMapper() - ); - } - - private void addPostParams(final Request request) { - if (isReserved != null) { - request.addPostParam("IsReserved", isReserved.toString()); - } - } -} diff --git a/src/main/java/com/twilio/rest/serverless/v1/service/environment/Log.java b/src/main/java/com/twilio/rest/serverless/v1/service/environment/Log.java index f1a225ac49..72abb9f912 100644 --- a/src/main/java/com/twilio/rest/serverless/v1/service/environment/Log.java +++ b/src/main/java/com/twilio/rest/serverless/v1/service/environment/Log.java @@ -22,7 +22,6 @@ import com.fasterxml.jackson.databind.ObjectMapper; import com.twilio.base.Resource; import com.twilio.converter.DateConverter; -import com.twilio.converter.Promoter; import com.twilio.exception.ApiConnectionException; import com.twilio.exception.ApiException; import java.io.IOException; @@ -37,7 +36,7 @@ @ToString public class Log extends Resource { - private static final long serialVersionUID = 129897058125132L; + private static final long serialVersionUID = 41290346867159L; public static LogFetcher fetcher( final String pathServiceSid, @@ -105,7 +104,7 @@ public static Log fromJson( private final String deploymentSid; private final String functionSid; private final String requestSid; - private final Log.Level level; + private final String level; private final String message; private final ZonedDateTime dateCreated; private final URI url; @@ -120,7 +119,7 @@ private Log( @JsonProperty("deployment_sid") final String deploymentSid, @JsonProperty("function_sid") final String functionSid, @JsonProperty("request_sid") final String requestSid, - @JsonProperty("level") final Log.Level level, + @JsonProperty("level") final String level, @JsonProperty("message") final String message, @JsonProperty("date_created") final String dateCreated, @JsonProperty("url") final URI url @@ -171,7 +170,7 @@ public final String getRequestSid() { return this.requestSid; } - public final Log.Level getLevel() { + public final String getLevel() { return this.level; } @@ -232,25 +231,4 @@ public int hashCode() { url ); } - - public enum Level { - INFO("info"), - WARN("warn"), - ERROR("error"); - - private final String value; - - private Level(final String value) { - this.value = value; - } - - public String toString() { - return value; - } - - @JsonCreator - public static Level forValue(final String value) { - return Promoter.enumFromString(value, Level.values()); - } - } } diff --git a/src/main/java/com/twilio/rest/studio/v1/flow/EngagementCreator.java b/src/main/java/com/twilio/rest/studio/v1/flow/EngagementCreator.java index cbd788a972..65b09c1a3c 100644 --- a/src/main/java/com/twilio/rest/studio/v1/flow/EngagementCreator.java +++ b/src/main/java/com/twilio/rest/studio/v1/flow/EngagementCreator.java @@ -27,15 +27,13 @@ import com.twilio.http.Response; import com.twilio.http.TwilioRestClient; import com.twilio.rest.Domains; -import java.util.Map; -import java.util.Map; public class EngagementCreator extends Creator { private String pathFlowSid; private com.twilio.type.PhoneNumber to; private com.twilio.type.PhoneNumber from; - private Map parameters; + private Object parameters; public EngagementCreator( final String pathFlowSid, @@ -65,9 +63,7 @@ public EngagementCreator setFrom(final String from) { return setFrom(Promoter.phoneNumberFromString(from)); } - public EngagementCreator setParameters( - final Map parameters - ) { + public EngagementCreator setParameters(final Object parameters) { this.parameters = parameters; return this; } @@ -77,8 +73,8 @@ public Engagement create(final TwilioRestClient client) { String path = "/v1/Flows/{FlowSid}/Engagements"; path = path.replace("{" + "FlowSid" + "}", this.pathFlowSid.toString()); - path = path.replace("{" + "To" + "}", this.to.encode("utf-8")); - path = path.replace("{" + "From" + "}", this.from.encode("utf-8")); + path = path.replace("{" + "To" + "}", this.to.toString()); + path = path.replace("{" + "From" + "}", this.from.toString()); Request request = new Request( HttpMethod.POST, @@ -120,7 +116,10 @@ private void addPostParams(final Request request) { request.addPostParam("From", from.toString()); } if (parameters != null) { - request.addPostParam("Parameters", Converter.mapToJson(parameters)); + request.addPostParam( + "Parameters", + Converter.objectToJson(parameters) + ); } } } diff --git a/src/main/java/com/twilio/rest/studio/v1/flow/ExecutionCreator.java b/src/main/java/com/twilio/rest/studio/v1/flow/ExecutionCreator.java index 89c8f288e0..bdc96dd0a3 100644 --- a/src/main/java/com/twilio/rest/studio/v1/flow/ExecutionCreator.java +++ b/src/main/java/com/twilio/rest/studio/v1/flow/ExecutionCreator.java @@ -27,15 +27,13 @@ import com.twilio.http.Response; import com.twilio.http.TwilioRestClient; import com.twilio.rest.Domains; -import java.util.Map; -import java.util.Map; public class ExecutionCreator extends Creator { private String pathFlowSid; private com.twilio.type.PhoneNumber to; private com.twilio.type.PhoneNumber from; - private Map parameters; + private Object parameters; public ExecutionCreator( final String pathFlowSid, @@ -65,9 +63,7 @@ public ExecutionCreator setFrom(final String from) { return setFrom(Promoter.phoneNumberFromString(from)); } - public ExecutionCreator setParameters( - final Map parameters - ) { + public ExecutionCreator setParameters(final Object parameters) { this.parameters = parameters; return this; } @@ -77,8 +73,8 @@ public Execution create(final TwilioRestClient client) { String path = "/v1/Flows/{FlowSid}/Executions"; path = path.replace("{" + "FlowSid" + "}", this.pathFlowSid.toString()); - path = path.replace("{" + "To" + "}", this.to.encode("utf-8")); - path = path.replace("{" + "From" + "}", this.from.encode("utf-8")); + path = path.replace("{" + "To" + "}", this.to.toString()); + path = path.replace("{" + "From" + "}", this.from.toString()); Request request = new Request( HttpMethod.POST, @@ -120,7 +116,10 @@ private void addPostParams(final Request request) { request.addPostParam("From", from.toString()); } if (parameters != null) { - request.addPostParam("Parameters", Converter.mapToJson(parameters)); + request.addPostParam( + "Parameters", + Converter.objectToJson(parameters) + ); } } } diff --git a/src/main/java/com/twilio/rest/studio/v2/Flow.java b/src/main/java/com/twilio/rest/studio/v2/Flow.java index f4f9f13fbf..989e733f30 100644 --- a/src/main/java/com/twilio/rest/studio/v2/Flow.java +++ b/src/main/java/com/twilio/rest/studio/v2/Flow.java @@ -45,7 +45,7 @@ public class Flow extends Resource { public static FlowCreator creator( final String friendlyName, final Flow.Status status, - final Map definition + final Object definition ) { return new FlowCreator(friendlyName, status, definition); } diff --git a/src/main/java/com/twilio/rest/studio/v2/FlowCreator.java b/src/main/java/com/twilio/rest/studio/v2/FlowCreator.java index 3834351da1..9ae445c987 100644 --- a/src/main/java/com/twilio/rest/studio/v2/FlowCreator.java +++ b/src/main/java/com/twilio/rest/studio/v2/FlowCreator.java @@ -26,20 +26,18 @@ import com.twilio.http.Response; import com.twilio.http.TwilioRestClient; import com.twilio.rest.Domains; -import java.util.Map; -import java.util.Map; public class FlowCreator extends Creator { private String friendlyName; private Flow.Status status; - private Map definition; + private Object definition; private String commitMessage; public FlowCreator( final String friendlyName, final Flow.Status status, - final Map definition + final Object definition ) { this.friendlyName = friendlyName; this.status = status; @@ -56,7 +54,7 @@ public FlowCreator setStatus(final Flow.Status status) { return this; } - public FlowCreator setDefinition(final Map definition) { + public FlowCreator setDefinition(final Object definition) { this.definition = definition; return this; } @@ -116,7 +114,10 @@ private void addPostParams(final Request request) { request.addPostParam("Status", status.toString()); } if (definition != null) { - request.addPostParam("Definition", Converter.mapToJson(definition)); + request.addPostParam( + "Definition", + Converter.objectToJson(definition) + ); } if (commitMessage != null) { request.addPostParam("CommitMessage", commitMessage); diff --git a/src/main/java/com/twilio/rest/studio/v2/FlowUpdater.java b/src/main/java/com/twilio/rest/studio/v2/FlowUpdater.java index 981e21f24e..6d625f2a21 100644 --- a/src/main/java/com/twilio/rest/studio/v2/FlowUpdater.java +++ b/src/main/java/com/twilio/rest/studio/v2/FlowUpdater.java @@ -25,14 +25,13 @@ import com.twilio.http.Response; import com.twilio.http.TwilioRestClient; import com.twilio.rest.Domains; -import java.util.Map; public class FlowUpdater extends Updater { private String pathSid; private Flow.Status status; private String friendlyName; - private Map definition; + private Object definition; private String commitMessage; public FlowUpdater(final String pathSid, final Flow.Status status) { @@ -50,7 +49,7 @@ public FlowUpdater setFriendlyName(final String friendlyName) { return this; } - public FlowUpdater setDefinition(final Map definition) { + public FlowUpdater setDefinition(final Object definition) { this.definition = definition; return this; } @@ -104,7 +103,10 @@ private void addPostParams(final Request request) { request.addPostParam("FriendlyName", friendlyName); } if (definition != null) { - request.addPostParam("Definition", Converter.mapToJson(definition)); + request.addPostParam( + "Definition", + Converter.objectToJson(definition) + ); } if (commitMessage != null) { request.addPostParam("CommitMessage", commitMessage); diff --git a/src/main/java/com/twilio/rest/studio/v2/FlowValidate.java b/src/main/java/com/twilio/rest/studio/v2/FlowValidate.java index f3a156394a..6eba3f66e9 100644 --- a/src/main/java/com/twilio/rest/studio/v2/FlowValidate.java +++ b/src/main/java/com/twilio/rest/studio/v2/FlowValidate.java @@ -26,8 +26,6 @@ import com.twilio.exception.ApiException; import java.io.IOException; import java.io.InputStream; -import java.util.Map; -import java.util.Map; import java.util.Objects; import lombok.ToString; import lombok.ToString; @@ -41,7 +39,7 @@ public class FlowValidate extends Resource { public static FlowValidateUpdater updater( final String friendlyName, final FlowValidate.Status status, - final Map definition + final Object definition ) { return new FlowValidateUpdater(friendlyName, status, definition); } diff --git a/src/main/java/com/twilio/rest/studio/v2/FlowValidateUpdater.java b/src/main/java/com/twilio/rest/studio/v2/FlowValidateUpdater.java index 7c97916960..954245fd2a 100644 --- a/src/main/java/com/twilio/rest/studio/v2/FlowValidateUpdater.java +++ b/src/main/java/com/twilio/rest/studio/v2/FlowValidateUpdater.java @@ -25,19 +25,18 @@ import com.twilio.http.Response; import com.twilio.http.TwilioRestClient; import com.twilio.rest.Domains; -import java.util.Map; public class FlowValidateUpdater extends Updater { private String friendlyName; private FlowValidate.Status status; - private Map definition; + private Object definition; private String commitMessage; public FlowValidateUpdater( final String friendlyName, final FlowValidate.Status status, - final Map definition + final Object definition ) { this.friendlyName = friendlyName; this.status = status; @@ -54,9 +53,7 @@ public FlowValidateUpdater setStatus(final FlowValidate.Status status) { return this; } - public FlowValidateUpdater setDefinition( - final Map definition - ) { + public FlowValidateUpdater setDefinition(final Object definition) { this.definition = definition; return this; } @@ -119,7 +116,10 @@ private void addPostParams(final Request request) { request.addPostParam("Status", status.toString()); } if (definition != null) { - request.addPostParam("Definition", Converter.mapToJson(definition)); + request.addPostParam( + "Definition", + Converter.objectToJson(definition) + ); } if (commitMessage != null) { request.addPostParam("CommitMessage", commitMessage); diff --git a/src/main/java/com/twilio/rest/studio/v2/flow/ExecutionCreator.java b/src/main/java/com/twilio/rest/studio/v2/flow/ExecutionCreator.java index df3d5c1245..df95407644 100644 --- a/src/main/java/com/twilio/rest/studio/v2/flow/ExecutionCreator.java +++ b/src/main/java/com/twilio/rest/studio/v2/flow/ExecutionCreator.java @@ -27,15 +27,13 @@ import com.twilio.http.Response; import com.twilio.http.TwilioRestClient; import com.twilio.rest.Domains; -import java.util.Map; -import java.util.Map; public class ExecutionCreator extends Creator { private String pathFlowSid; private com.twilio.type.PhoneNumber to; private com.twilio.type.PhoneNumber from; - private Map parameters; + private Object parameters; public ExecutionCreator( final String pathFlowSid, @@ -65,9 +63,7 @@ public ExecutionCreator setFrom(final String from) { return setFrom(Promoter.phoneNumberFromString(from)); } - public ExecutionCreator setParameters( - final Map parameters - ) { + public ExecutionCreator setParameters(final Object parameters) { this.parameters = parameters; return this; } @@ -77,8 +73,8 @@ public Execution create(final TwilioRestClient client) { String path = "/v2/Flows/{FlowSid}/Executions"; path = path.replace("{" + "FlowSid" + "}", this.pathFlowSid.toString()); - path = path.replace("{" + "To" + "}", this.to.encode("utf-8")); - path = path.replace("{" + "From" + "}", this.from.encode("utf-8")); + path = path.replace("{" + "To" + "}", this.to.toString()); + path = path.replace("{" + "From" + "}", this.from.toString()); Request request = new Request( HttpMethod.POST, @@ -120,7 +116,10 @@ private void addPostParams(final Request request) { request.addPostParam("From", from.toString()); } if (parameters != null) { - request.addPostParam("Parameters", Converter.mapToJson(parameters)); + request.addPostParam( + "Parameters", + Converter.objectToJson(parameters) + ); } } } diff --git a/src/main/java/com/twilio/rest/sync/v1/service/DocumentCreator.java b/src/main/java/com/twilio/rest/sync/v1/service/DocumentCreator.java index 9b5eca36b7..3ad46deab0 100644 --- a/src/main/java/com/twilio/rest/sync/v1/service/DocumentCreator.java +++ b/src/main/java/com/twilio/rest/sync/v1/service/DocumentCreator.java @@ -26,14 +26,12 @@ import com.twilio.http.Response; import com.twilio.http.TwilioRestClient; import com.twilio.rest.Domains; -import java.util.Map; -import java.util.Map; public class DocumentCreator extends Creator { private String pathServiceSid; private String uniqueName; - private Map data; + private Object data; private Integer ttl; public DocumentCreator(final String pathServiceSid) { @@ -45,7 +43,7 @@ public DocumentCreator setUniqueName(final String uniqueName) { return this; } - public DocumentCreator setData(final Map data) { + public DocumentCreator setData(final Object data) { this.data = data; return this; } @@ -102,7 +100,7 @@ private void addPostParams(final Request request) { request.addPostParam("UniqueName", uniqueName); } if (data != null) { - request.addPostParam("Data", Converter.mapToJson(data)); + request.addPostParam("Data", Converter.objectToJson(data)); } if (ttl != null) { request.addPostParam("Ttl", ttl.toString()); diff --git a/src/main/java/com/twilio/rest/sync/v1/service/DocumentUpdater.java b/src/main/java/com/twilio/rest/sync/v1/service/DocumentUpdater.java index 1561d4c8a2..8c4bb058d5 100644 --- a/src/main/java/com/twilio/rest/sync/v1/service/DocumentUpdater.java +++ b/src/main/java/com/twilio/rest/sync/v1/service/DocumentUpdater.java @@ -25,14 +25,13 @@ import com.twilio.http.Response; import com.twilio.http.TwilioRestClient; import com.twilio.rest.Domains; -import java.util.Map; public class DocumentUpdater extends Updater { private String pathServiceSid; private String pathSid; private String ifMatch; - private Map data; + private Object data; private Integer ttl; public DocumentUpdater(final String pathServiceSid, final String pathSid) { @@ -45,7 +44,7 @@ public DocumentUpdater setIfMatch(final String ifMatch) { return this; } - public DocumentUpdater setData(final Map data) { + public DocumentUpdater setData(final Object data) { this.data = data; return this; } @@ -101,7 +100,7 @@ public Document update(final TwilioRestClient client) { private void addPostParams(final Request request) { if (data != null) { - request.addPostParam("Data", Converter.mapToJson(data)); + request.addPostParam("Data", Converter.objectToJson(data)); } if (ttl != null) { request.addPostParam("Ttl", ttl.toString()); diff --git a/src/main/java/com/twilio/rest/sync/v1/service/synclist/SyncListItem.java b/src/main/java/com/twilio/rest/sync/v1/service/synclist/SyncListItem.java index c0d70df086..00bbcafebd 100644 --- a/src/main/java/com/twilio/rest/sync/v1/service/synclist/SyncListItem.java +++ b/src/main/java/com/twilio/rest/sync/v1/service/synclist/SyncListItem.java @@ -44,7 +44,7 @@ public class SyncListItem extends Resource { public static SyncListItemCreator creator( final String pathServiceSid, final String pathListSid, - final Map data + final Object data ) { return new SyncListItemCreator(pathServiceSid, pathListSid, data); } diff --git a/src/main/java/com/twilio/rest/sync/v1/service/synclist/SyncListItemCreator.java b/src/main/java/com/twilio/rest/sync/v1/service/synclist/SyncListItemCreator.java index 2af4101ee6..4d8ac8f192 100644 --- a/src/main/java/com/twilio/rest/sync/v1/service/synclist/SyncListItemCreator.java +++ b/src/main/java/com/twilio/rest/sync/v1/service/synclist/SyncListItemCreator.java @@ -26,14 +26,12 @@ import com.twilio.http.Response; import com.twilio.http.TwilioRestClient; import com.twilio.rest.Domains; -import java.util.Map; -import java.util.Map; public class SyncListItemCreator extends Creator { private String pathServiceSid; private String pathListSid; - private Map data; + private Object data; private Integer ttl; private Integer itemTtl; private Integer collectionTtl; @@ -41,14 +39,14 @@ public class SyncListItemCreator extends Creator { public SyncListItemCreator( final String pathServiceSid, final String pathListSid, - final Map data + final Object data ) { this.pathServiceSid = pathServiceSid; this.pathListSid = pathListSid; this.data = data; } - public SyncListItemCreator setData(final Map data) { + public SyncListItemCreator setData(final Object data) { this.data = data; return this; } @@ -114,7 +112,7 @@ public SyncListItem create(final TwilioRestClient client) { private void addPostParams(final Request request) { if (data != null) { - request.addPostParam("Data", Converter.mapToJson(data)); + request.addPostParam("Data", Converter.objectToJson(data)); } if (ttl != null) { request.addPostParam("Ttl", ttl.toString()); diff --git a/src/main/java/com/twilio/rest/sync/v1/service/synclist/SyncListItemUpdater.java b/src/main/java/com/twilio/rest/sync/v1/service/synclist/SyncListItemUpdater.java index df538d9384..24dde562ca 100644 --- a/src/main/java/com/twilio/rest/sync/v1/service/synclist/SyncListItemUpdater.java +++ b/src/main/java/com/twilio/rest/sync/v1/service/synclist/SyncListItemUpdater.java @@ -25,7 +25,6 @@ import com.twilio.http.Response; import com.twilio.http.TwilioRestClient; import com.twilio.rest.Domains; -import java.util.Map; public class SyncListItemUpdater extends Updater { @@ -33,7 +32,7 @@ public class SyncListItemUpdater extends Updater { private String pathListSid; private Integer pathIndex; private String ifMatch; - private Map data; + private Object data; private Integer ttl; private Integer itemTtl; private Integer collectionTtl; @@ -53,7 +52,7 @@ public SyncListItemUpdater setIfMatch(final String ifMatch) { return this; } - public SyncListItemUpdater setData(final Map data) { + public SyncListItemUpdater setData(final Object data) { this.data = data; return this; } @@ -120,7 +119,7 @@ public SyncListItem update(final TwilioRestClient client) { private void addPostParams(final Request request) { if (data != null) { - request.addPostParam("Data", Converter.mapToJson(data)); + request.addPostParam("Data", Converter.objectToJson(data)); } if (ttl != null) { request.addPostParam("Ttl", ttl.toString()); diff --git a/src/main/java/com/twilio/rest/sync/v1/service/syncmap/SyncMapItem.java b/src/main/java/com/twilio/rest/sync/v1/service/syncmap/SyncMapItem.java index e2c25935cf..f134d6fb0c 100644 --- a/src/main/java/com/twilio/rest/sync/v1/service/syncmap/SyncMapItem.java +++ b/src/main/java/com/twilio/rest/sync/v1/service/syncmap/SyncMapItem.java @@ -45,7 +45,7 @@ public static SyncMapItemCreator creator( final String pathServiceSid, final String pathMapSid, final String key, - final Map data + final Object data ) { return new SyncMapItemCreator(pathServiceSid, pathMapSid, key, data); } diff --git a/src/main/java/com/twilio/rest/sync/v1/service/syncmap/SyncMapItemCreator.java b/src/main/java/com/twilio/rest/sync/v1/service/syncmap/SyncMapItemCreator.java index 095e615ca2..c85bdbfeb9 100644 --- a/src/main/java/com/twilio/rest/sync/v1/service/syncmap/SyncMapItemCreator.java +++ b/src/main/java/com/twilio/rest/sync/v1/service/syncmap/SyncMapItemCreator.java @@ -26,15 +26,13 @@ import com.twilio.http.Response; import com.twilio.http.TwilioRestClient; import com.twilio.rest.Domains; -import java.util.Map; -import java.util.Map; public class SyncMapItemCreator extends Creator { private String pathServiceSid; private String pathMapSid; private String key; - private Map data; + private Object data; private Integer ttl; private Integer itemTtl; private Integer collectionTtl; @@ -43,7 +41,7 @@ public SyncMapItemCreator( final String pathServiceSid, final String pathMapSid, final String key, - final Map data + final Object data ) { this.pathServiceSid = pathServiceSid; this.pathMapSid = pathMapSid; @@ -56,7 +54,7 @@ public SyncMapItemCreator setKey(final String key) { return this; } - public SyncMapItemCreator setData(final Map data) { + public SyncMapItemCreator setData(final Object data) { this.data = data; return this; } @@ -126,7 +124,7 @@ private void addPostParams(final Request request) { request.addPostParam("Key", key); } if (data != null) { - request.addPostParam("Data", Converter.mapToJson(data)); + request.addPostParam("Data", Converter.objectToJson(data)); } if (ttl != null) { request.addPostParam("Ttl", ttl.toString()); diff --git a/src/main/java/com/twilio/rest/sync/v1/service/syncmap/SyncMapItemUpdater.java b/src/main/java/com/twilio/rest/sync/v1/service/syncmap/SyncMapItemUpdater.java index f9cb5af292..b0b1a151c0 100644 --- a/src/main/java/com/twilio/rest/sync/v1/service/syncmap/SyncMapItemUpdater.java +++ b/src/main/java/com/twilio/rest/sync/v1/service/syncmap/SyncMapItemUpdater.java @@ -25,7 +25,6 @@ import com.twilio.http.Response; import com.twilio.http.TwilioRestClient; import com.twilio.rest.Domains; -import java.util.Map; public class SyncMapItemUpdater extends Updater { @@ -33,7 +32,7 @@ public class SyncMapItemUpdater extends Updater { private String pathMapSid; private String pathKey; private String ifMatch; - private Map data; + private Object data; private Integer ttl; private Integer itemTtl; private Integer collectionTtl; @@ -53,7 +52,7 @@ public SyncMapItemUpdater setIfMatch(final String ifMatch) { return this; } - public SyncMapItemUpdater setData(final Map data) { + public SyncMapItemUpdater setData(final Object data) { this.data = data; return this; } @@ -120,7 +119,7 @@ public SyncMapItem update(final TwilioRestClient client) { private void addPostParams(final Request request) { if (data != null) { - request.addPostParam("Data", Converter.mapToJson(data)); + request.addPostParam("Data", Converter.objectToJson(data)); } if (ttl != null) { request.addPostParam("Ttl", ttl.toString()); diff --git a/src/main/java/com/twilio/rest/sync/v1/service/syncstream/StreamMessage.java b/src/main/java/com/twilio/rest/sync/v1/service/syncstream/StreamMessage.java index 7191f3acc2..b787e9d5a1 100644 --- a/src/main/java/com/twilio/rest/sync/v1/service/syncstream/StreamMessage.java +++ b/src/main/java/com/twilio/rest/sync/v1/service/syncstream/StreamMessage.java @@ -40,7 +40,7 @@ public class StreamMessage extends Resource { public static StreamMessageCreator creator( final String pathServiceSid, final String pathStreamSid, - final Map data + final Object data ) { return new StreamMessageCreator(pathServiceSid, pathStreamSid, data); } diff --git a/src/main/java/com/twilio/rest/sync/v1/service/syncstream/StreamMessageCreator.java b/src/main/java/com/twilio/rest/sync/v1/service/syncstream/StreamMessageCreator.java index 5739a6e69d..015002f303 100644 --- a/src/main/java/com/twilio/rest/sync/v1/service/syncstream/StreamMessageCreator.java +++ b/src/main/java/com/twilio/rest/sync/v1/service/syncstream/StreamMessageCreator.java @@ -26,26 +26,24 @@ import com.twilio.http.Response; import com.twilio.http.TwilioRestClient; import com.twilio.rest.Domains; -import java.util.Map; -import java.util.Map; public class StreamMessageCreator extends Creator { private String pathServiceSid; private String pathStreamSid; - private Map data; + private Object data; public StreamMessageCreator( final String pathServiceSid, final String pathStreamSid, - final Map data + final Object data ) { this.pathServiceSid = pathServiceSid; this.pathStreamSid = pathStreamSid; this.data = data; } - public StreamMessageCreator setData(final Map data) { + public StreamMessageCreator setData(final Object data) { this.data = data; return this; } @@ -100,7 +98,7 @@ public StreamMessage create(final TwilioRestClient client) { private void addPostParams(final Request request) { if (data != null) { - request.addPostParam("Data", Converter.mapToJson(data)); + request.addPostParam("Data", Converter.objectToJson(data)); } } } diff --git a/src/main/java/com/twilio/rest/trunking/v1/Trunk.java b/src/main/java/com/twilio/rest/trunking/v1/Trunk.java index 2d77f12579..6ddece0cab 100644 --- a/src/main/java/com/twilio/rest/trunking/v1/Trunk.java +++ b/src/main/java/com/twilio/rest/trunking/v1/Trunk.java @@ -41,7 +41,7 @@ @ToString public class Trunk extends Resource { - private static final long serialVersionUID = 225938897286327L; + private static final long serialVersionUID = 232204827569278L; public static TrunkCreator creator() { return new TrunkCreator(); @@ -117,6 +117,7 @@ public static Trunk fromJson( private final Trunk.TransferCallerId transferCallerId; private final Boolean cnamLookupEnabled; private final String authType; + private final Boolean symmetricRtpEnabled; private final List authTypeSet; private final ZonedDateTime dateCreated; private final ZonedDateTime dateUpdated; @@ -141,6 +142,9 @@ private Trunk( ) final Trunk.TransferCallerId transferCallerId, @JsonProperty("cnam_lookup_enabled") final Boolean cnamLookupEnabled, @JsonProperty("auth_type") final String authType, + @JsonProperty( + "symmetric_rtp_enabled" + ) final Boolean symmetricRtpEnabled, @JsonProperty("auth_type_set") final List authTypeSet, @JsonProperty("date_created") final String dateCreated, @JsonProperty("date_updated") final String dateUpdated, @@ -159,6 +163,7 @@ private Trunk( this.transferCallerId = transferCallerId; this.cnamLookupEnabled = cnamLookupEnabled; this.authType = authType; + this.symmetricRtpEnabled = symmetricRtpEnabled; this.authTypeSet = authTypeSet; this.dateCreated = DateConverter.iso8601DateTimeFromString(dateCreated); this.dateUpdated = DateConverter.iso8601DateTimeFromString(dateUpdated); @@ -211,6 +216,10 @@ public final String getAuthType() { return this.authType; } + public final Boolean getSymmetricRtpEnabled() { + return this.symmetricRtpEnabled; + } + public final List getAuthTypeSet() { return this.authTypeSet; } @@ -262,6 +271,7 @@ public boolean equals(final Object o) { Objects.equals(transferCallerId, other.transferCallerId) && Objects.equals(cnamLookupEnabled, other.cnamLookupEnabled) && Objects.equals(authType, other.authType) && + Objects.equals(symmetricRtpEnabled, other.symmetricRtpEnabled) && Objects.equals(authTypeSet, other.authTypeSet) && Objects.equals(dateCreated, other.dateCreated) && Objects.equals(dateUpdated, other.dateUpdated) && @@ -285,6 +295,7 @@ public int hashCode() { transferCallerId, cnamLookupEnabled, authType, + symmetricRtpEnabled, authTypeSet, dateCreated, dateUpdated, diff --git a/src/main/java/com/twilio/rest/trusthub/v1/ComplianceTollfreeInquiriesCreator.java b/src/main/java/com/twilio/rest/trusthub/v1/ComplianceTollfreeInquiriesCreator.java index 35cf959970..a4413dc4c8 100644 --- a/src/main/java/com/twilio/rest/trusthub/v1/ComplianceTollfreeInquiriesCreator.java +++ b/src/main/java/com/twilio/rest/trusthub/v1/ComplianceTollfreeInquiriesCreator.java @@ -259,7 +259,7 @@ public ComplianceTollfreeInquiries create(final TwilioRestClient client) { path = path.replace( "{" + "TollfreePhoneNumber" + "}", - this.tollfreePhoneNumber.encode("utf-8") + this.tollfreePhoneNumber.toString() ); path = path.replace( diff --git a/src/main/java/com/twilio/rest/trusthub/v1/EndUserCreator.java b/src/main/java/com/twilio/rest/trusthub/v1/EndUserCreator.java index 0be75ae9a4..aaddaa97f9 100644 --- a/src/main/java/com/twilio/rest/trusthub/v1/EndUserCreator.java +++ b/src/main/java/com/twilio/rest/trusthub/v1/EndUserCreator.java @@ -26,14 +26,12 @@ import com.twilio.http.Response; import com.twilio.http.TwilioRestClient; import com.twilio.rest.Domains; -import java.util.Map; -import java.util.Map; public class EndUserCreator extends Creator { private String friendlyName; private String type; - private Map attributes; + private Object attributes; public EndUserCreator(final String friendlyName, final String type) { this.friendlyName = friendlyName; @@ -50,7 +48,7 @@ public EndUserCreator setType(final String type) { return this; } - public EndUserCreator setAttributes(final Map attributes) { + public EndUserCreator setAttributes(final Object attributes) { this.attributes = attributes; return this; } @@ -103,7 +101,10 @@ private void addPostParams(final Request request) { request.addPostParam("Type", type); } if (attributes != null) { - request.addPostParam("Attributes", Converter.mapToJson(attributes)); + request.addPostParam( + "Attributes", + Converter.objectToJson(attributes) + ); } } } diff --git a/src/main/java/com/twilio/rest/trusthub/v1/EndUserUpdater.java b/src/main/java/com/twilio/rest/trusthub/v1/EndUserUpdater.java index 39e4de9753..479a4a4ed9 100644 --- a/src/main/java/com/twilio/rest/trusthub/v1/EndUserUpdater.java +++ b/src/main/java/com/twilio/rest/trusthub/v1/EndUserUpdater.java @@ -25,13 +25,12 @@ import com.twilio.http.Response; import com.twilio.http.TwilioRestClient; import com.twilio.rest.Domains; -import java.util.Map; public class EndUserUpdater extends Updater { private String pathSid; private String friendlyName; - private Map attributes; + private Object attributes; public EndUserUpdater(final String pathSid) { this.pathSid = pathSid; @@ -42,7 +41,7 @@ public EndUserUpdater setFriendlyName(final String friendlyName) { return this; } - public EndUserUpdater setAttributes(final Map attributes) { + public EndUserUpdater setAttributes(final Object attributes) { this.attributes = attributes; return this; } @@ -87,7 +86,10 @@ private void addPostParams(final Request request) { request.addPostParam("FriendlyName", friendlyName); } if (attributes != null) { - request.addPostParam("Attributes", Converter.mapToJson(attributes)); + request.addPostParam( + "Attributes", + Converter.objectToJson(attributes) + ); } } } diff --git a/src/main/java/com/twilio/rest/trusthub/v1/SupportingDocumentCreator.java b/src/main/java/com/twilio/rest/trusthub/v1/SupportingDocumentCreator.java index 6b509fe88f..53f68a08d7 100644 --- a/src/main/java/com/twilio/rest/trusthub/v1/SupportingDocumentCreator.java +++ b/src/main/java/com/twilio/rest/trusthub/v1/SupportingDocumentCreator.java @@ -26,14 +26,12 @@ import com.twilio.http.Response; import com.twilio.http.TwilioRestClient; import com.twilio.rest.Domains; -import java.util.Map; -import java.util.Map; public class SupportingDocumentCreator extends Creator { private String friendlyName; private String type; - private Map attributes; + private Object attributes; public SupportingDocumentCreator( final String friendlyName, @@ -55,9 +53,7 @@ public SupportingDocumentCreator setType(final String type) { return this; } - public SupportingDocumentCreator setAttributes( - final Map attributes - ) { + public SupportingDocumentCreator setAttributes(final Object attributes) { this.attributes = attributes; return this; } @@ -113,7 +109,10 @@ private void addPostParams(final Request request) { request.addPostParam("Type", type); } if (attributes != null) { - request.addPostParam("Attributes", Converter.mapToJson(attributes)); + request.addPostParam( + "Attributes", + Converter.objectToJson(attributes) + ); } } } diff --git a/src/main/java/com/twilio/rest/trusthub/v1/SupportingDocumentUpdater.java b/src/main/java/com/twilio/rest/trusthub/v1/SupportingDocumentUpdater.java index 099d6f7077..ec523a8f85 100644 --- a/src/main/java/com/twilio/rest/trusthub/v1/SupportingDocumentUpdater.java +++ b/src/main/java/com/twilio/rest/trusthub/v1/SupportingDocumentUpdater.java @@ -25,13 +25,12 @@ import com.twilio.http.Response; import com.twilio.http.TwilioRestClient; import com.twilio.rest.Domains; -import java.util.Map; public class SupportingDocumentUpdater extends Updater { private String pathSid; private String friendlyName; - private Map attributes; + private Object attributes; public SupportingDocumentUpdater(final String pathSid) { this.pathSid = pathSid; @@ -44,9 +43,7 @@ public SupportingDocumentUpdater setFriendlyName( return this; } - public SupportingDocumentUpdater setAttributes( - final Map attributes - ) { + public SupportingDocumentUpdater setAttributes(final Object attributes) { this.attributes = attributes; return this; } @@ -94,7 +91,10 @@ private void addPostParams(final Request request) { request.addPostParam("FriendlyName", friendlyName); } if (attributes != null) { - request.addPostParam("Attributes", Converter.mapToJson(attributes)); + request.addPostParam( + "Attributes", + Converter.objectToJson(attributes) + ); } } } diff --git a/src/main/java/com/twilio/rest/verify/v2/VerificationAttempt.java b/src/main/java/com/twilio/rest/verify/v2/VerificationAttempt.java index 9058afe690..5fc710aaf4 100644 --- a/src/main/java/com/twilio/rest/verify/v2/VerificationAttempt.java +++ b/src/main/java/com/twilio/rest/verify/v2/VerificationAttempt.java @@ -246,8 +246,7 @@ public enum Channels { CALL("call"), EMAIL("email"), WHATSAPP("whatsapp"), - RBM("rbm"), - SNA("sna"); + RBM("rbm"); private final String value; diff --git a/src/main/java/com/twilio/rest/verify/v2/VerificationAttemptsSummary.java b/src/main/java/com/twilio/rest/verify/v2/VerificationAttemptsSummary.java index 5566ca5174..925f76b700 100644 --- a/src/main/java/com/twilio/rest/verify/v2/VerificationAttemptsSummary.java +++ b/src/main/java/com/twilio/rest/verify/v2/VerificationAttemptsSummary.java @@ -172,7 +172,8 @@ public enum Channels { SMS("sms"), CALL("call"), EMAIL("email"), - WHATSAPP("whatsapp"); + WHATSAPP("whatsapp"), + RBM("rbm"); private final String value; diff --git a/src/main/java/com/twilio/rest/verify/v2/service/VerificationCreator.java b/src/main/java/com/twilio/rest/verify/v2/service/VerificationCreator.java index d6f592d7db..2e88faa3f9 100644 --- a/src/main/java/com/twilio/rest/verify/v2/service/VerificationCreator.java +++ b/src/main/java/com/twilio/rest/verify/v2/service/VerificationCreator.java @@ -26,8 +26,6 @@ import com.twilio.http.Response; import com.twilio.http.TwilioRestClient; import com.twilio.rest.Domains; -import java.util.Map; -import java.util.Map; public class VerificationCreator extends Creator { @@ -41,8 +39,8 @@ public class VerificationCreator extends Creator { private String customCode; private String amount; private String payee; - private Map rateLimits; - private Map channelConfiguration; + private Object rateLimits; + private Object channelConfiguration; private String appHash; private String templateSid; private String templateCustomSubstitutions; @@ -108,15 +106,13 @@ public VerificationCreator setPayee(final String payee) { return this; } - public VerificationCreator setRateLimits( - final Map rateLimits - ) { + public VerificationCreator setRateLimits(final Object rateLimits) { this.rateLimits = rateLimits; return this; } public VerificationCreator setChannelConfiguration( - final Map channelConfiguration + final Object channelConfiguration ) { this.channelConfiguration = channelConfiguration; return this; @@ -236,12 +232,15 @@ private void addPostParams(final Request request) { request.addPostParam("Payee", payee); } if (rateLimits != null) { - request.addPostParam("RateLimits", Converter.mapToJson(rateLimits)); + request.addPostParam( + "RateLimits", + Converter.objectToJson(rateLimits) + ); } if (channelConfiguration != null) { request.addPostParam( "ChannelConfiguration", - Converter.mapToJson(channelConfiguration) + Converter.objectToJson(channelConfiguration) ); } if (appHash != null) { diff --git a/src/main/java/com/twilio/rest/verify/v2/service/entity/ChallengeCreator.java b/src/main/java/com/twilio/rest/verify/v2/service/entity/ChallengeCreator.java index 5f014a389f..366f518740 100644 --- a/src/main/java/com/twilio/rest/verify/v2/service/entity/ChallengeCreator.java +++ b/src/main/java/com/twilio/rest/verify/v2/service/entity/ChallengeCreator.java @@ -30,8 +30,6 @@ import java.time.ZonedDateTime; import java.util.List; import java.util.List; -import java.util.Map; -import java.util.Map; public class ChallengeCreator extends Creator { @@ -40,8 +38,8 @@ public class ChallengeCreator extends Creator { private String factorSid; private ZonedDateTime expirationDate; private String detailsMessage; - private List> detailsFields; - private Map hiddenDetails; + private List detailsFields; + private Object hiddenDetails; private String authPayload; public ChallengeCreator( @@ -71,22 +69,16 @@ public ChallengeCreator setDetailsMessage(final String detailsMessage) { return this; } - public ChallengeCreator setDetailsFields( - final List> detailsFields - ) { + public ChallengeCreator setDetailsFields(final List detailsFields) { this.detailsFields = detailsFields; return this; } - public ChallengeCreator setDetailsFields( - final Map detailsFields - ) { + public ChallengeCreator setDetailsFields(final Object detailsFields) { return setDetailsFields(Promoter.listOfOne(detailsFields)); } - public ChallengeCreator setHiddenDetails( - final Map hiddenDetails - ) { + public ChallengeCreator setHiddenDetails(final Object hiddenDetails) { this.hiddenDetails = hiddenDetails; return this; } @@ -156,17 +148,17 @@ private void addPostParams(final Request request) { request.addPostParam("Details.Message", detailsMessage); } if (detailsFields != null) { - for (Map prop : detailsFields) { + for (Object prop : detailsFields) { request.addPostParam( "Details.Fields", - Converter.mapToJson(prop) + Converter.objectToJson(prop) ); } } if (hiddenDetails != null) { request.addPostParam( "HiddenDetails", - Converter.mapToJson(hiddenDetails) + Converter.objectToJson(hiddenDetails) ); } if (authPayload != null) { diff --git a/src/main/java/com/twilio/rest/verify/v2/service/entity/ChallengeUpdater.java b/src/main/java/com/twilio/rest/verify/v2/service/entity/ChallengeUpdater.java index 3b7fda6ef9..9870c326cc 100644 --- a/src/main/java/com/twilio/rest/verify/v2/service/entity/ChallengeUpdater.java +++ b/src/main/java/com/twilio/rest/verify/v2/service/entity/ChallengeUpdater.java @@ -25,7 +25,6 @@ import com.twilio.http.Response; import com.twilio.http.TwilioRestClient; import com.twilio.rest.Domains; -import java.util.Map; public class ChallengeUpdater extends Updater { @@ -33,7 +32,7 @@ public class ChallengeUpdater extends Updater { private String pathIdentity; private String pathSid; private String authPayload; - private Map metadata; + private Object metadata; public ChallengeUpdater( final String pathServiceSid, @@ -50,7 +49,7 @@ public ChallengeUpdater setAuthPayload(final String authPayload) { return this; } - public ChallengeUpdater setMetadata(final Map metadata) { + public ChallengeUpdater setMetadata(final Object metadata) { this.metadata = metadata; return this; } @@ -106,7 +105,7 @@ private void addPostParams(final Request request) { request.addPostParam("AuthPayload", authPayload); } if (metadata != null) { - request.addPostParam("Metadata", Converter.mapToJson(metadata)); + request.addPostParam("Metadata", Converter.objectToJson(metadata)); } } } diff --git a/src/main/java/com/twilio/rest/verify/v2/service/entity/NewFactorCreator.java b/src/main/java/com/twilio/rest/verify/v2/service/entity/NewFactorCreator.java index 3221e50770..6f4e2f5409 100644 --- a/src/main/java/com/twilio/rest/verify/v2/service/entity/NewFactorCreator.java +++ b/src/main/java/com/twilio/rest/verify/v2/service/entity/NewFactorCreator.java @@ -26,8 +26,6 @@ import com.twilio.http.Response; import com.twilio.http.TwilioRestClient; import com.twilio.rest.Domains; -import java.util.Map; -import java.util.Map; public class NewFactorCreator extends Creator { @@ -46,7 +44,7 @@ public class NewFactorCreator extends Creator { private Integer configSkew; private Integer configCodeLength; private NewFactor.TotpAlgorithms configAlg; - private Map metadata; + private Object metadata; public NewFactorCreator( final String pathServiceSid, @@ -135,7 +133,7 @@ public NewFactorCreator setConfigAlg( return this; } - public NewFactorCreator setMetadata(final Map metadata) { + public NewFactorCreator setMetadata(final Object metadata) { this.metadata = metadata; return this; } @@ -241,7 +239,7 @@ private void addPostParams(final Request request) { request.addPostParam("Config.Alg", configAlg.toString()); } if (metadata != null) { - request.addPostParam("Metadata", Converter.mapToJson(metadata)); + request.addPostParam("Metadata", Converter.objectToJson(metadata)); } } } diff --git a/src/main/java/com/twilio/rest/video/v1/CompositionCreator.java b/src/main/java/com/twilio/rest/video/v1/CompositionCreator.java index 3c579d6781..f162cd921c 100644 --- a/src/main/java/com/twilio/rest/video/v1/CompositionCreator.java +++ b/src/main/java/com/twilio/rest/video/v1/CompositionCreator.java @@ -31,13 +31,11 @@ import java.net.URI; import java.util.List; import java.util.List; -import java.util.Map; -import java.util.Map; public class CompositionCreator extends Creator { private String roomSid; - private Map videoLayout; + private Object videoLayout; private List audioSources; private List audioSourcesExcluded; private String resolution; @@ -55,9 +53,7 @@ public CompositionCreator setRoomSid(final String roomSid) { return this; } - public CompositionCreator setVideoLayout( - final Map videoLayout - ) { + public CompositionCreator setVideoLayout(final Object videoLayout) { this.videoLayout = videoLayout; return this; } @@ -162,7 +158,7 @@ private void addPostParams(final Request request) { if (videoLayout != null) { request.addPostParam( "VideoLayout", - Converter.mapToJson(videoLayout) + Converter.objectToJson(videoLayout) ); } if (audioSources != null) { diff --git a/src/main/java/com/twilio/rest/video/v1/CompositionHookCreator.java b/src/main/java/com/twilio/rest/video/v1/CompositionHookCreator.java index 356fac4185..627d5ef831 100644 --- a/src/main/java/com/twilio/rest/video/v1/CompositionHookCreator.java +++ b/src/main/java/com/twilio/rest/video/v1/CompositionHookCreator.java @@ -31,14 +31,12 @@ import java.net.URI; import java.util.List; import java.util.List; -import java.util.Map; -import java.util.Map; public class CompositionHookCreator extends Creator { private String friendlyName; private Boolean enabled; - private Map videoLayout; + private Object videoLayout; private List audioSources; private List audioSourcesExcluded; private String resolution; @@ -61,9 +59,7 @@ public CompositionHookCreator setEnabled(final Boolean enabled) { return this; } - public CompositionHookCreator setVideoLayout( - final Map videoLayout - ) { + public CompositionHookCreator setVideoLayout(final Object videoLayout) { this.videoLayout = videoLayout; return this; } @@ -181,7 +177,7 @@ private void addPostParams(final Request request) { if (videoLayout != null) { request.addPostParam( "VideoLayout", - Converter.mapToJson(videoLayout) + Converter.objectToJson(videoLayout) ); } if (audioSources != null) { diff --git a/src/main/java/com/twilio/rest/video/v1/CompositionHookUpdater.java b/src/main/java/com/twilio/rest/video/v1/CompositionHookUpdater.java index 90c84daa88..7fe754444a 100644 --- a/src/main/java/com/twilio/rest/video/v1/CompositionHookUpdater.java +++ b/src/main/java/com/twilio/rest/video/v1/CompositionHookUpdater.java @@ -28,14 +28,13 @@ import com.twilio.rest.Domains; import java.net.URI; import java.util.List; -import java.util.Map; public class CompositionHookUpdater extends Updater { private String pathSid; private String friendlyName; private Boolean enabled; - private Map videoLayout; + private Object videoLayout; private List audioSources; private List audioSourcesExcluded; private Boolean trim; @@ -62,9 +61,7 @@ public CompositionHookUpdater setEnabled(final Boolean enabled) { return this; } - public CompositionHookUpdater setVideoLayout( - final Map videoLayout - ) { + public CompositionHookUpdater setVideoLayout(final Object videoLayout) { this.videoLayout = videoLayout; return this; } @@ -183,7 +180,7 @@ private void addPostParams(final Request request) { if (videoLayout != null) { request.addPostParam( "VideoLayout", - Converter.mapToJson(videoLayout) + Converter.objectToJson(videoLayout) ); } if (audioSources != null) { diff --git a/src/main/java/com/twilio/rest/video/v1/RoomCreator.java b/src/main/java/com/twilio/rest/video/v1/RoomCreator.java index 01acec6599..fae39d57e0 100644 --- a/src/main/java/com/twilio/rest/video/v1/RoomCreator.java +++ b/src/main/java/com/twilio/rest/video/v1/RoomCreator.java @@ -46,7 +46,7 @@ public class RoomCreator extends Creator { private Boolean transcribeParticipantsOnConnect; private List videoCodecs; private String mediaRegion; - private Map recordingRules; + private Object recordingRules; private Map transcriptionsConfiguration; private Boolean audioOnly; private Integer maxParticipantDuration; @@ -120,9 +120,7 @@ public RoomCreator setMediaRegion(final String mediaRegion) { return this; } - public RoomCreator setRecordingRules( - final Map recordingRules - ) { + public RoomCreator setRecordingRules(final Object recordingRules) { this.recordingRules = recordingRules; return this; } @@ -239,7 +237,7 @@ private void addPostParams(final Request request) { if (recordingRules != null) { request.addPostParam( "RecordingRules", - Converter.mapToJson(recordingRules) + Converter.objectToJson(recordingRules) ); } if (transcriptionsConfiguration != null) { diff --git a/src/main/java/com/twilio/rest/video/v1/room/RecordingRulesUpdater.java b/src/main/java/com/twilio/rest/video/v1/room/RecordingRulesUpdater.java index 4a726e6315..e4a8477092 100644 --- a/src/main/java/com/twilio/rest/video/v1/room/RecordingRulesUpdater.java +++ b/src/main/java/com/twilio/rest/video/v1/room/RecordingRulesUpdater.java @@ -25,18 +25,17 @@ import com.twilio.http.Response; import com.twilio.http.TwilioRestClient; import com.twilio.rest.Domains; -import java.util.Map; public class RecordingRulesUpdater extends Updater { private String pathRoomSid; - private Map rules; + private Object rules; public RecordingRulesUpdater(final String pathRoomSid) { this.pathRoomSid = pathRoomSid; } - public RecordingRulesUpdater setRules(final Map rules) { + public RecordingRulesUpdater setRules(final Object rules) { this.rules = rules; return this; } @@ -81,7 +80,7 @@ public RecordingRules update(final TwilioRestClient client) { private void addPostParams(final Request request) { if (rules != null) { - request.addPostParam("Rules", Converter.mapToJson(rules)); + request.addPostParam("Rules", Converter.objectToJson(rules)); } } } diff --git a/src/main/java/com/twilio/rest/video/v1/room/Transcriptions.java b/src/main/java/com/twilio/rest/video/v1/room/Transcriptions.java new file mode 100644 index 0000000000..ed27576b7e --- /dev/null +++ b/src/main/java/com/twilio/rest/video/v1/room/Transcriptions.java @@ -0,0 +1,256 @@ +/* + * This code was generated by + * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + * + * Twilio - Video + * 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.video.v1.room; + +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.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.time.ZonedDateTime; +import java.util.Map; +import java.util.Map; +import java.util.Objects; +import lombok.ToString; +import lombok.ToString; + +@JsonIgnoreProperties(ignoreUnknown = true) +@ToString +public class Transcriptions extends Resource { + + private static final long serialVersionUID = 69820289152110L; + + public static TranscriptionsCreator creator(final String pathRoomSid) { + return new TranscriptionsCreator(pathRoomSid); + } + + public static TranscriptionsFetcher fetcher( + final String pathRoomSid, + final String pathTtid + ) { + return new TranscriptionsFetcher(pathRoomSid, pathTtid); + } + + public static TranscriptionsReader reader(final String pathRoomSid) { + return new TranscriptionsReader(pathRoomSid); + } + + public static TranscriptionsUpdater updater( + final String pathRoomSid, + final String pathTtid + ) { + return new TranscriptionsUpdater(pathRoomSid, pathTtid); + } + + /** + * Converts a JSON String into a Transcriptions object using the provided ObjectMapper. + * + * @param json Raw JSON String + * @param objectMapper Jackson ObjectMapper + * @return Transcriptions object represented by the provided JSON + */ + public static Transcriptions fromJson( + final String json, + final ObjectMapper objectMapper + ) { + // Convert all checked exceptions to Runtime + try { + return objectMapper.readValue(json, Transcriptions.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 Transcriptions object using the provided + * ObjectMapper. + * + * @param json Raw JSON InputStream + * @param objectMapper Jackson ObjectMapper + * @return Transcriptions object represented by the provided JSON + */ + public static Transcriptions fromJson( + final InputStream json, + final ObjectMapper objectMapper + ) { + // Convert all checked exceptions to Runtime + try { + return objectMapper.readValue(json, Transcriptions.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 ttid; + private final String accountSid; + private final String roomSid; + private final Transcriptions.Status status; + private final ZonedDateTime dateCreated; + private final ZonedDateTime dateUpdated; + private final ZonedDateTime startTime; + private final ZonedDateTime endTime; + private final Integer duration; + private final URI url; + private final Map configuration; + + @JsonCreator + private Transcriptions( + @JsonProperty("ttid") final String ttid, + @JsonProperty("account_sid") final String accountSid, + @JsonProperty("room_sid") final String roomSid, + @JsonProperty("status") final Transcriptions.Status status, + @JsonProperty("date_created") final String dateCreated, + @JsonProperty("date_updated") final String dateUpdated, + @JsonProperty("start_time") final String startTime, + @JsonProperty("end_time") final String endTime, + @JsonProperty("duration") final Integer duration, + @JsonProperty("url") final URI url, + @JsonProperty("configuration") final Map configuration + ) { + this.ttid = ttid; + this.accountSid = accountSid; + this.roomSid = roomSid; + this.status = status; + this.dateCreated = DateConverter.iso8601DateTimeFromString(dateCreated); + this.dateUpdated = DateConverter.iso8601DateTimeFromString(dateUpdated); + this.startTime = DateConverter.iso8601DateTimeFromString(startTime); + this.endTime = DateConverter.iso8601DateTimeFromString(endTime); + this.duration = duration; + this.url = url; + this.configuration = configuration; + } + + public final String getTtid() { + return this.ttid; + } + + public final String getAccountSid() { + return this.accountSid; + } + + public final String getRoomSid() { + return this.roomSid; + } + + public final Transcriptions.Status getStatus() { + return this.status; + } + + public final ZonedDateTime getDateCreated() { + return this.dateCreated; + } + + public final ZonedDateTime getDateUpdated() { + return this.dateUpdated; + } + + public final ZonedDateTime getStartTime() { + return this.startTime; + } + + public final ZonedDateTime getEndTime() { + return this.endTime; + } + + public final Integer getDuration() { + return this.duration; + } + + public final URI getUrl() { + return this.url; + } + + public final Map getConfiguration() { + return this.configuration; + } + + @Override + public boolean equals(final Object o) { + if (this == o) { + return true; + } + + if (o == null || getClass() != o.getClass()) { + return false; + } + + Transcriptions other = (Transcriptions) o; + + return ( + Objects.equals(ttid, other.ttid) && + Objects.equals(accountSid, other.accountSid) && + Objects.equals(roomSid, other.roomSid) && + Objects.equals(status, other.status) && + Objects.equals(dateCreated, other.dateCreated) && + Objects.equals(dateUpdated, other.dateUpdated) && + Objects.equals(startTime, other.startTime) && + Objects.equals(endTime, other.endTime) && + Objects.equals(duration, other.duration) && + Objects.equals(url, other.url) && + Objects.equals(configuration, other.configuration) + ); + } + + @Override + public int hashCode() { + return Objects.hash( + ttid, + accountSid, + roomSid, + status, + dateCreated, + dateUpdated, + startTime, + endTime, + duration, + url, + configuration + ); + } + + public enum Status { + STARTED("started"), + STOPPED("stopped"), + 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()); + } + } +} diff --git a/src/main/java/com/twilio/rest/proxy/v1/service/ShortCodeCreator.java b/src/main/java/com/twilio/rest/video/v1/room/TranscriptionsCreator.java similarity index 63% rename from src/main/java/com/twilio/rest/proxy/v1/service/ShortCodeCreator.java rename to src/main/java/com/twilio/rest/video/v1/room/TranscriptionsCreator.java index 534da26b49..92947f94ea 100644 --- a/src/main/java/com/twilio/rest/proxy/v1/service/ShortCodeCreator.java +++ b/src/main/java/com/twilio/rest/video/v1/room/TranscriptionsCreator.java @@ -4,7 +4,7 @@ * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ * - * Twilio - Proxy + * Twilio - Video * This is the public Twilio REST API. * * NOTE: This class is auto generated by OpenAPI Generator. @@ -12,10 +12,12 @@ * Do not edit the class manually. */ -package com.twilio.rest.proxy.v1.service; +package com.twilio.rest.video.v1.room; import com.twilio.base.Creator; import com.twilio.constant.EnumConstants; +import com.twilio.converter.Converter; +import com.twilio.converter.Converter; import com.twilio.exception.ApiConnectionException; import com.twilio.exception.ApiException; import com.twilio.exception.RestException; @@ -24,36 +26,34 @@ import com.twilio.http.Response; import com.twilio.http.TwilioRestClient; import com.twilio.rest.Domains; +import java.util.Map; +import java.util.Map; -public class ShortCodeCreator extends Creator { +public class TranscriptionsCreator extends Creator { - private String pathServiceSid; - private String sid; + private String pathRoomSid; + private Map configuration; - public ShortCodeCreator(final String pathServiceSid, final String sid) { - this.pathServiceSid = pathServiceSid; - this.sid = sid; + public TranscriptionsCreator(final String pathRoomSid) { + this.pathRoomSid = pathRoomSid; } - public ShortCodeCreator setSid(final String sid) { - this.sid = sid; + public TranscriptionsCreator setConfiguration( + final Map configuration + ) { + this.configuration = configuration; return this; } @Override - public ShortCode create(final TwilioRestClient client) { - String path = "/v1/Services/{ServiceSid}/ShortCodes"; + public Transcriptions create(final TwilioRestClient client) { + String path = "/v1/Rooms/{RoomSid}/Transcriptions"; - path = - path.replace( - "{" + "ServiceSid" + "}", - this.pathServiceSid.toString() - ); - path = path.replace("{" + "Sid" + "}", this.sid.toString()); + path = path.replace("{" + "RoomSid" + "}", this.pathRoomSid.toString()); Request request = new Request( HttpMethod.POST, - Domains.PROXY.toString(), + Domains.VIDEO.toString(), path ); request.setContentType(EnumConstants.ContentType.FORM_URLENCODED); @@ -61,7 +61,7 @@ public ShortCode create(final TwilioRestClient client) { Response response = client.request(request); if (response == null) { throw new ApiConnectionException( - "ShortCode creation failed: Unable to connect to server" + "Transcriptions creation failed: Unable to connect to server" ); } else if (!TwilioRestClient.SUCCESS.test(response.getStatusCode())) { RestException restException = RestException.fromJson( @@ -77,15 +77,18 @@ public ShortCode create(final TwilioRestClient client) { throw new ApiException(restException); } - return ShortCode.fromJson( + return Transcriptions.fromJson( response.getStream(), client.getObjectMapper() ); } private void addPostParams(final Request request) { - if (sid != null) { - request.addPostParam("Sid", sid); + if (configuration != null) { + request.addPostParam( + "Configuration", + Converter.mapToJson(configuration) + ); } } } diff --git a/src/main/java/com/twilio/rest/microvisor/v1/AccountSecretFetcher.java b/src/main/java/com/twilio/rest/video/v1/room/TranscriptionsFetcher.java similarity index 69% rename from src/main/java/com/twilio/rest/microvisor/v1/AccountSecretFetcher.java rename to src/main/java/com/twilio/rest/video/v1/room/TranscriptionsFetcher.java index 78b58fca72..b1a311a59e 100644 --- a/src/main/java/com/twilio/rest/microvisor/v1/AccountSecretFetcher.java +++ b/src/main/java/com/twilio/rest/video/v1/room/TranscriptionsFetcher.java @@ -4,7 +4,7 @@ * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ * - * Twilio - Microvisor + * Twilio - Video * This is the public Twilio REST API. * * NOTE: This class is auto generated by OpenAPI Generator. @@ -12,7 +12,7 @@ * Do not edit the class manually. */ -package com.twilio.rest.microvisor.v1; +package com.twilio.rest.video.v1.room; import com.twilio.base.Fetcher; import com.twilio.constant.EnumConstants; @@ -25,23 +25,29 @@ import com.twilio.http.TwilioRestClient; import com.twilio.rest.Domains; -public class AccountSecretFetcher extends Fetcher { +public class TranscriptionsFetcher extends Fetcher { - private String pathKey; + private String pathRoomSid; + private String pathTtid; - public AccountSecretFetcher(final String pathKey) { - this.pathKey = pathKey; + public TranscriptionsFetcher( + final String pathRoomSid, + final String pathTtid + ) { + this.pathRoomSid = pathRoomSid; + this.pathTtid = pathTtid; } @Override - public AccountSecret fetch(final TwilioRestClient client) { - String path = "/v1/Secrets/{Key}"; + public Transcriptions fetch(final TwilioRestClient client) { + String path = "/v1/Rooms/{RoomSid}/Transcriptions/{Ttid}"; - path = path.replace("{" + "Key" + "}", this.pathKey.toString()); + path = path.replace("{" + "RoomSid" + "}", this.pathRoomSid.toString()); + path = path.replace("{" + "Ttid" + "}", this.pathTtid.toString()); Request request = new Request( HttpMethod.GET, - Domains.MICROVISOR.toString(), + Domains.VIDEO.toString(), path ); request.setContentType(EnumConstants.ContentType.FORM_URLENCODED); @@ -49,7 +55,7 @@ public AccountSecret fetch(final TwilioRestClient client) { if (response == null) { throw new ApiConnectionException( - "AccountSecret fetch failed: Unable to connect to server" + "Transcriptions fetch failed: Unable to connect to server" ); } else if (!TwilioRestClient.SUCCESS.test(response.getStatusCode())) { RestException restException = RestException.fromJson( @@ -65,7 +71,7 @@ public AccountSecret fetch(final TwilioRestClient client) { throw new ApiException(restException); } - return AccountSecret.fromJson( + return Transcriptions.fromJson( response.getStream(), client.getObjectMapper() ); diff --git a/src/main/java/com/twilio/rest/microvisor/v1/DeviceReader.java b/src/main/java/com/twilio/rest/video/v1/room/TranscriptionsReader.java similarity index 72% rename from src/main/java/com/twilio/rest/microvisor/v1/DeviceReader.java rename to src/main/java/com/twilio/rest/video/v1/room/TranscriptionsReader.java index 28cec8e051..32ee246d4a 100644 --- a/src/main/java/com/twilio/rest/microvisor/v1/DeviceReader.java +++ b/src/main/java/com/twilio/rest/video/v1/room/TranscriptionsReader.java @@ -4,7 +4,7 @@ * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ * - * Twilio - Microvisor + * Twilio - Video * This is the public Twilio REST API. * * NOTE: This class is auto generated by OpenAPI Generator. @@ -12,7 +12,7 @@ * Do not edit the class manually. */ -package com.twilio.rest.microvisor.v1; +package com.twilio.rest.video.v1.room; import com.twilio.base.Page; import com.twilio.base.Reader; @@ -27,28 +27,32 @@ import com.twilio.http.TwilioRestClient; import com.twilio.rest.Domains; -public class DeviceReader extends Reader { +public class TranscriptionsReader extends Reader { + private String pathRoomSid; private Long pageSize; - public DeviceReader() {} + public TranscriptionsReader(final String pathRoomSid) { + this.pathRoomSid = pathRoomSid; + } - public DeviceReader setPageSize(final Long pageSize) { + public TranscriptionsReader setPageSize(final Long pageSize) { this.pageSize = pageSize; return this; } @Override - public ResourceSet read(final TwilioRestClient client) { + public ResourceSet read(final TwilioRestClient client) { return new ResourceSet<>(this, client, firstPage(client)); } - public Page firstPage(final TwilioRestClient client) { - String path = "/v1/Devices"; + public Page firstPage(final TwilioRestClient client) { + String path = "/v1/Rooms/{RoomSid}/Transcriptions"; + path = path.replace("{" + "RoomSid" + "}", this.pathRoomSid.toString()); Request request = new Request( HttpMethod.GET, - Domains.MICROVISOR.toString(), + Domains.VIDEO.toString(), path ); @@ -57,7 +61,7 @@ public Page firstPage(final TwilioRestClient client) { return pageForRequest(client, request); } - private Page pageForRequest( + private Page pageForRequest( final TwilioRestClient client, final Request request ) { @@ -65,7 +69,7 @@ private Page pageForRequest( if (response == null) { throw new ApiConnectionException( - "Device read failed: Unable to connect to server" + "Transcriptions read failed: Unable to connect to server" ); } else if (!TwilioRestClient.SUCCESS.test(response.getStatusCode())) { RestException restException = RestException.fromJson( @@ -82,39 +86,39 @@ private Page pageForRequest( } return Page.fromJson( - "devices", + "transcriptions", response.getContent(), - Device.class, + Transcriptions.class, client.getObjectMapper() ); } @Override - public Page previousPage( - final Page page, + public Page previousPage( + final Page page, final TwilioRestClient client ) { Request request = new Request( HttpMethod.GET, - page.getPreviousPageUrl(Domains.MICROVISOR.toString()) + page.getPreviousPageUrl(Domains.VIDEO.toString()) ); return pageForRequest(client, request); } @Override - public Page nextPage( - final Page page, + public Page nextPage( + final Page page, final TwilioRestClient client ) { Request request = new Request( HttpMethod.GET, - page.getNextPageUrl(Domains.MICROVISOR.toString()) + page.getNextPageUrl(Domains.VIDEO.toString()) ); return pageForRequest(client, request); } @Override - public Page getPage( + public Page getPage( final String targetUrl, final TwilioRestClient client ) { diff --git a/src/main/java/com/twilio/rest/microvisor/v1/AccountSecretUpdater.java b/src/main/java/com/twilio/rest/video/v1/room/TranscriptionsUpdater.java similarity index 64% rename from src/main/java/com/twilio/rest/microvisor/v1/AccountSecretUpdater.java rename to src/main/java/com/twilio/rest/video/v1/room/TranscriptionsUpdater.java index fc4e3c61eb..ff6487e71d 100644 --- a/src/main/java/com/twilio/rest/microvisor/v1/AccountSecretUpdater.java +++ b/src/main/java/com/twilio/rest/video/v1/room/TranscriptionsUpdater.java @@ -4,7 +4,7 @@ * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ * - * Twilio - Microvisor + * Twilio - Video * This is the public Twilio REST API. * * NOTE: This class is auto generated by OpenAPI Generator. @@ -12,7 +12,7 @@ * Do not edit the class manually. */ -package com.twilio.rest.microvisor.v1; +package com.twilio.rest.video.v1.room; import com.twilio.base.Updater; import com.twilio.constant.EnumConstants; @@ -25,31 +25,35 @@ import com.twilio.http.TwilioRestClient; import com.twilio.rest.Domains; -public class AccountSecretUpdater extends Updater { +public class TranscriptionsUpdater extends Updater { - private String pathKey; - private String value; + private String pathRoomSid; + private String pathTtid; + private Transcriptions.Status status; - public AccountSecretUpdater(final String pathKey, final String value) { - this.pathKey = pathKey; - this.value = value; + public TranscriptionsUpdater( + final String pathRoomSid, + final String pathTtid + ) { + this.pathRoomSid = pathRoomSid; + this.pathTtid = pathTtid; } - public AccountSecretUpdater setValue(final String value) { - this.value = value; + public TranscriptionsUpdater setStatus(final Transcriptions.Status status) { + this.status = status; return this; } @Override - public AccountSecret update(final TwilioRestClient client) { - String path = "/v1/Secrets/{Key}"; + public Transcriptions update(final TwilioRestClient client) { + String path = "/v1/Rooms/{RoomSid}/Transcriptions/{Ttid}"; - path = path.replace("{" + "Key" + "}", this.pathKey.toString()); - path = path.replace("{" + "Value" + "}", this.value.toString()); + path = path.replace("{" + "RoomSid" + "}", this.pathRoomSid.toString()); + path = path.replace("{" + "Ttid" + "}", this.pathTtid.toString()); Request request = new Request( HttpMethod.POST, - Domains.MICROVISOR.toString(), + Domains.VIDEO.toString(), path ); request.setContentType(EnumConstants.ContentType.FORM_URLENCODED); @@ -57,7 +61,7 @@ public AccountSecret update(final TwilioRestClient client) { Response response = client.request(request); if (response == null) { throw new ApiConnectionException( - "AccountSecret update failed: Unable to connect to server" + "Transcriptions update failed: Unable to connect to server" ); } else if (!TwilioRestClient.SUCCESS.test(response.getStatusCode())) { RestException restException = RestException.fromJson( @@ -73,15 +77,15 @@ public AccountSecret update(final TwilioRestClient client) { throw new ApiException(restException); } - return AccountSecret.fromJson( + return Transcriptions.fromJson( response.getStream(), client.getObjectMapper() ); } private void addPostParams(final Request request) { - if (value != null) { - request.addPostParam("Value", value); + if (status != null) { + request.addPostParam("Status", status.toString()); } } } diff --git a/src/main/java/com/twilio/rest/video/v1/room/participant/SubscribeRulesUpdater.java b/src/main/java/com/twilio/rest/video/v1/room/participant/SubscribeRulesUpdater.java index 6878b5373b..f33515b655 100644 --- a/src/main/java/com/twilio/rest/video/v1/room/participant/SubscribeRulesUpdater.java +++ b/src/main/java/com/twilio/rest/video/v1/room/participant/SubscribeRulesUpdater.java @@ -25,13 +25,12 @@ import com.twilio.http.Response; import com.twilio.http.TwilioRestClient; import com.twilio.rest.Domains; -import java.util.Map; public class SubscribeRulesUpdater extends Updater { private String pathRoomSid; private String pathParticipantSid; - private Map rules; + private Object rules; public SubscribeRulesUpdater( final String pathRoomSid, @@ -41,7 +40,7 @@ public SubscribeRulesUpdater( this.pathParticipantSid = pathParticipantSid; } - public SubscribeRulesUpdater setRules(final Map rules) { + public SubscribeRulesUpdater setRules(final Object rules) { this.rules = rules; return this; } @@ -92,7 +91,7 @@ public SubscribeRules update(final TwilioRestClient client) { private void addPostParams(final Request request) { if (rules != null) { - request.addPostParam("Rules", Converter.mapToJson(rules)); + request.addPostParam("Rules", Converter.objectToJson(rules)); } } } diff --git a/src/main/java/com/twilio/twiml/voice/Dial.java b/src/main/java/com/twilio/twiml/voice/Dial.java index 0314d5ec65..27eeda82c8 100644 --- a/src/main/java/com/twilio/twiml/voice/Dial.java +++ b/src/main/java/com/twilio/twiml/voice/Dial.java @@ -801,6 +801,15 @@ public Builder application(Application application) { return this; } + /** + * Add a child {@code } element + */ + @JacksonXmlProperty(isAttribute = false, localName = "WhatsApp") + public Builder whatsApp(WhatsApp whatsApp) { + this.children.add(whatsApp); + return this; + } + /** * Create and return resulting {@code } element */ diff --git a/src/main/java/com/twilio/twiml/voice/Say.java b/src/main/java/com/twilio/twiml/voice/Say.java index 094000e5a7..c317fe078e 100644 --- a/src/main/java/com/twilio/twiml/voice/Say.java +++ b/src/main/java/com/twilio/twiml/voice/Say.java @@ -31,6 +31,14 @@ public enum Voice { GOOGLE_AM_ET_STANDARD_B("Google.am-ET-Standard-B"), GOOGLE_AM_ET_WAVENET_A("Google.am-ET-Wavenet-A"), GOOGLE_AM_ET_WAVENET_B("Google.am-ET-Wavenet-B"), + GOOGLE_AR_XA_CHIRP3_HD_AOEDE("Google.ar-XA-Chirp3-HD-Aoede"), + GOOGLE_AR_XA_CHIRP3_HD_CHARON("Google.ar-XA-Chirp3-HD-Charon"), + GOOGLE_AR_XA_CHIRP3_HD_FENRIR("Google.ar-XA-Chirp3-HD-Fenrir"), + GOOGLE_AR_XA_CHIRP3_HD_KORE("Google.ar-XA-Chirp3-HD-Kore"), + GOOGLE_AR_XA_CHIRP3_HD_LEDA("Google.ar-XA-Chirp3-HD-Leda"), + GOOGLE_AR_XA_CHIRP3_HD_ORUS("Google.ar-XA-Chirp3-HD-Orus"), + GOOGLE_AR_XA_CHIRP3_HD_PUCK("Google.ar-XA-Chirp3-HD-Puck"), + GOOGLE_AR_XA_CHIRP3_HD_ZEPHYR("Google.ar-XA-Chirp3-HD-Zephyr"), GOOGLE_AR_XA_STANDARD_A("Google.ar-XA-Standard-A"), GOOGLE_AR_XA_STANDARD_B("Google.ar-XA-Standard-B"), GOOGLE_AR_XA_STANDARD_C("Google.ar-XA-Standard-C"), @@ -40,11 +48,33 @@ public enum Voice { GOOGLE_AR_XA_WAVENET_C("Google.ar-XA-Wavenet-C"), GOOGLE_AR_XA_WAVENET_D("Google.ar-XA-Wavenet-D"), GOOGLE_BG_BG_STANDARD_A("Google.bg-BG-Standard-A"), + GOOGLE_BG_BG_STANDARD_B("Google.bg-BG-Standard-B"), + GOOGLE_BN_IN_CHIRP3_HD_AOEDE("Google.bn-IN-Chirp3-HD-Aoede"), + GOOGLE_BN_IN_CHIRP3_HD_CHARON("Google.bn-IN-Chirp3-HD-Charon"), + GOOGLE_BN_IN_CHIRP3_HD_FENRIR("Google.bn-IN-Chirp3-HD-Fenrir"), + GOOGLE_BN_IN_CHIRP3_HD_KORE("Google.bn-IN-Chirp3-HD-Kore"), + GOOGLE_BN_IN_CHIRP3_HD_LEDA("Google.bn-IN-Chirp3-HD-Leda"), + GOOGLE_BN_IN_CHIRP3_HD_ORUS("Google.bn-IN-Chirp3-HD-Orus"), + GOOGLE_BN_IN_CHIRP3_HD_PUCK("Google.bn-IN-Chirp3-HD-Puck"), + GOOGLE_BN_IN_CHIRP3_HD_ZEPHYR("Google.bn-IN-Chirp3-HD-Zephyr"), + GOOGLE_BN_IN_STANDARD_A("Google.bn-IN-Standard-A"), + GOOGLE_BN_IN_STANDARD_B("Google.bn-IN-Standard-B"), GOOGLE_BN_IN_STANDARD_C("Google.bn-IN-Standard-C"), GOOGLE_BN_IN_STANDARD_D("Google.bn-IN-Standard-D"), + GOOGLE_BN_IN_WAVENET_A("Google.bn-IN-Wavenet-A"), + GOOGLE_BN_IN_WAVENET_B("Google.bn-IN-Wavenet-B"), GOOGLE_BN_IN_WAVENET_C("Google.bn-IN-Wavenet-C"), GOOGLE_BN_IN_WAVENET_D("Google.bn-IN-Wavenet-D"), GOOGLE_CA_ES_STANDARD_A("Google.ca-ES-Standard-A"), + GOOGLE_CA_ES_STANDARD_B("Google.ca-ES-Standard-B"), + GOOGLE_CMN_CN_CHIRP3_HD_AOEDE("Google.cmn-CN-Chirp3-HD-Aoede"), + GOOGLE_CMN_CN_CHIRP3_HD_CHARON("Google.cmn-CN-Chirp3-HD-Charon"), + GOOGLE_CMN_CN_CHIRP3_HD_FENRIR("Google.cmn-CN-Chirp3-HD-Fenrir"), + GOOGLE_CMN_CN_CHIRP3_HD_KORE("Google.cmn-CN-Chirp3-HD-Kore"), + GOOGLE_CMN_CN_CHIRP3_HD_LEDA("Google.cmn-CN-Chirp3-HD-Leda"), + GOOGLE_CMN_CN_CHIRP3_HD_ORUS("Google.cmn-CN-Chirp3-HD-Orus"), + GOOGLE_CMN_CN_CHIRP3_HD_PUCK("Google.cmn-CN-Chirp3-HD-Puck"), + GOOGLE_CMN_CN_CHIRP3_HD_ZEPHYR("Google.cmn-CN-Chirp3-HD-Zephyr"), GOOGLE_CMN_CN_STANDARD_A("Google.cmn-CN-Standard-A"), GOOGLE_CMN_CN_STANDARD_B("Google.cmn-CN-Standard-B"), GOOGLE_CMN_CN_STANDARD_C("Google.cmn-CN-Standard-C"), @@ -60,36 +90,66 @@ public enum Voice { GOOGLE_CMN_TW_WAVENET_B("Google.cmn-TW-Wavenet-B"), GOOGLE_CMN_TW_WAVENET_C("Google.cmn-TW-Wavenet-C"), GOOGLE_CS_CZ_STANDARD_A("Google.cs-CZ-Standard-A"), + GOOGLE_CS_CZ_STANDARD_B("Google.cs-CZ-Standard-B"), GOOGLE_CS_CZ_WAVENET_A("Google.cs-CZ-Wavenet-A"), + GOOGLE_CS_CZ_WAVENET_B("Google.cs-CZ-Wavenet-B"), GOOGLE_DA_DK_NEURAL2_D("Google.da-DK-Neural2-D"), GOOGLE_DA_DK_NEURAL2_F("Google.da-DK-Neural2-F"), GOOGLE_DA_DK_STANDARD_A("Google.da-DK-Standard-A"), GOOGLE_DA_DK_STANDARD_C("Google.da-DK-Standard-C"), GOOGLE_DA_DK_STANDARD_D("Google.da-DK-Standard-D"), GOOGLE_DA_DK_STANDARD_E("Google.da-DK-Standard-E"), + GOOGLE_DA_DK_STANDARD_F("Google.da-DK-Standard-F"), + GOOGLE_DA_DK_STANDARD_G("Google.da-DK-Standard-G"), GOOGLE_DA_DK_WAVENET_A("Google.da-DK-Wavenet-A"), GOOGLE_DA_DK_WAVENET_C("Google.da-DK-Wavenet-C"), GOOGLE_DA_DK_WAVENET_D("Google.da-DK-Wavenet-D"), GOOGLE_DA_DK_WAVENET_E("Google.da-DK-Wavenet-E"), + GOOGLE_DA_DK_WAVENET_F("Google.da-DK-Wavenet-F"), + GOOGLE_DA_DK_WAVENET_G("Google.da-DK-Wavenet-G"), + GOOGLE_DE_DE_CHIRP3_HD_AOEDE("Google.de-DE-Chirp3-HD-Aoede"), + GOOGLE_DE_DE_CHIRP3_HD_CHARON("Google.de-DE-Chirp3-HD-Charon"), + GOOGLE_DE_DE_CHIRP3_HD_FENRIR("Google.de-DE-Chirp3-HD-Fenrir"), + GOOGLE_DE_DE_CHIRP3_HD_KORE("Google.de-DE-Chirp3-HD-Kore"), + GOOGLE_DE_DE_CHIRP3_HD_LEDA("Google.de-DE-Chirp3-HD-Leda"), + GOOGLE_DE_DE_CHIRP3_HD_ORUS("Google.de-DE-Chirp3-HD-Orus"), + GOOGLE_DE_DE_CHIRP3_HD_PUCK("Google.de-DE-Chirp3-HD-Puck"), + GOOGLE_DE_DE_CHIRP3_HD_ZEPHYR("Google.de-DE-Chirp3-HD-Zephyr"), GOOGLE_DE_DE_NEURAL2_A("Google.de-DE-Neural2-A"), GOOGLE_DE_DE_NEURAL2_B("Google.de-DE-Neural2-B"), GOOGLE_DE_DE_NEURAL2_C("Google.de-DE-Neural2-C"), GOOGLE_DE_DE_NEURAL2_D("Google.de-DE-Neural2-D"), GOOGLE_DE_DE_NEURAL2_F("Google.de-DE-Neural2-F"), + GOOGLE_DE_DE_NEURAL2_G("Google.de-DE-Neural2-G"), + GOOGLE_DE_DE_NEURAL2_H("Google.de-DE-Neural2-H"), GOOGLE_DE_DE_STANDARD_A("Google.de-DE-Standard-A"), GOOGLE_DE_DE_STANDARD_B("Google.de-DE-Standard-B"), GOOGLE_DE_DE_STANDARD_C("Google.de-DE-Standard-C"), GOOGLE_DE_DE_STANDARD_D("Google.de-DE-Standard-D"), GOOGLE_DE_DE_STANDARD_E("Google.de-DE-Standard-E"), GOOGLE_DE_DE_STANDARD_F("Google.de-DE-Standard-F"), + GOOGLE_DE_DE_STANDARD_G("Google.de-DE-Standard-G"), + GOOGLE_DE_DE_STANDARD_H("Google.de-DE-Standard-H"), GOOGLE_DE_DE_WAVENET_A("Google.de-DE-Wavenet-A"), GOOGLE_DE_DE_WAVENET_B("Google.de-DE-Wavenet-B"), GOOGLE_DE_DE_WAVENET_C("Google.de-DE-Wavenet-C"), GOOGLE_DE_DE_WAVENET_D("Google.de-DE-Wavenet-D"), GOOGLE_DE_DE_WAVENET_E("Google.de-DE-Wavenet-E"), GOOGLE_DE_DE_WAVENET_F("Google.de-DE-Wavenet-F"), + GOOGLE_DE_DE_WAVENET_G("Google.de-DE-Wavenet-G"), + GOOGLE_DE_DE_WAVENET_H("Google.de-DE-Wavenet-H"), GOOGLE_EL_GR_STANDARD_A("Google.el-GR-Standard-A"), + GOOGLE_EL_GR_STANDARD_B("Google.el-GR-Standard-B"), GOOGLE_EL_GR_WAVENET_A("Google.el-GR-Wavenet-A"), + GOOGLE_EL_GR_WAVENET_B("Google.el-GR-Wavenet-B"), + GOOGLE_EN_AU_CHIRP3_HD_AOEDE("Google.en-AU-Chirp3-HD-Aoede"), + GOOGLE_EN_AU_CHIRP3_HD_CHARON("Google.en-AU-Chirp3-HD-Charon"), + GOOGLE_EN_AU_CHIRP3_HD_FENRIR("Google.en-AU-Chirp3-HD-Fenrir"), + GOOGLE_EN_AU_CHIRP3_HD_KORE("Google.en-AU-Chirp3-HD-Kore"), + GOOGLE_EN_AU_CHIRP3_HD_LEDA("Google.en-AU-Chirp3-HD-Leda"), + GOOGLE_EN_AU_CHIRP3_HD_ORUS("Google.en-AU-Chirp3-HD-Orus"), + GOOGLE_EN_AU_CHIRP3_HD_PUCK("Google.en-AU-Chirp3-HD-Puck"), + GOOGLE_EN_AU_CHIRP3_HD_ZEPHYR("Google.en-AU-Chirp3-HD-Zephyr"), GOOGLE_EN_AU_NEURAL2_A("Google.en-AU-Neural2-A"), GOOGLE_EN_AU_NEURAL2_B("Google.en-AU-Neural2-B"), GOOGLE_EN_AU_NEURAL2_C("Google.en-AU-Neural2-C"), @@ -102,21 +162,43 @@ public enum Voice { GOOGLE_EN_AU_WAVENET_B("Google.en-AU-Wavenet-B"), GOOGLE_EN_AU_WAVENET_C("Google.en-AU-Wavenet-C"), GOOGLE_EN_AU_WAVENET_D("Google.en-AU-Wavenet-D"), + GOOGLE_EN_GB_CHIRP3_HD_AOEDE("Google.en-GB-Chirp3-HD-Aoede"), + GOOGLE_EN_GB_CHIRP3_HD_CHARON("Google.en-GB-Chirp3-HD-Charon"), + GOOGLE_EN_GB_CHIRP3_HD_FENRIR("Google.en-GB-Chirp3-HD-Fenrir"), + GOOGLE_EN_GB_CHIRP3_HD_KORE("Google.en-GB-Chirp3-HD-Kore"), + GOOGLE_EN_GB_CHIRP3_HD_LEDA("Google.en-GB-Chirp3-HD-Leda"), + GOOGLE_EN_GB_CHIRP3_HD_ORUS("Google.en-GB-Chirp3-HD-Orus"), + GOOGLE_EN_GB_CHIRP3_HD_PUCK("Google.en-GB-Chirp3-HD-Puck"), + GOOGLE_EN_GB_CHIRP3_HD_ZEPHYR("Google.en-GB-Chirp3-HD-Zephyr"), GOOGLE_EN_GB_NEURAL2_A("Google.en-GB-Neural2-A"), GOOGLE_EN_GB_NEURAL2_B("Google.en-GB-Neural2-B"), GOOGLE_EN_GB_NEURAL2_C("Google.en-GB-Neural2-C"), GOOGLE_EN_GB_NEURAL2_D("Google.en-GB-Neural2-D"), GOOGLE_EN_GB_NEURAL2_F("Google.en-GB-Neural2-F"), + GOOGLE_EN_GB_NEURAL2_N("Google.en-GB-Neural2-N"), + GOOGLE_EN_GB_NEURAL2_O("Google.en-GB-Neural2-O"), GOOGLE_EN_GB_STANDARD_A("Google.en-GB-Standard-A"), GOOGLE_EN_GB_STANDARD_B("Google.en-GB-Standard-B"), GOOGLE_EN_GB_STANDARD_C("Google.en-GB-Standard-C"), GOOGLE_EN_GB_STANDARD_D("Google.en-GB-Standard-D"), GOOGLE_EN_GB_STANDARD_F("Google.en-GB-Standard-F"), + GOOGLE_EN_GB_STANDARD_N("Google.en-GB-Standard-N"), + GOOGLE_EN_GB_STANDARD_O("Google.en-GB-Standard-O"), GOOGLE_EN_GB_WAVENET_A("Google.en-GB-Wavenet-A"), GOOGLE_EN_GB_WAVENET_B("Google.en-GB-Wavenet-B"), GOOGLE_EN_GB_WAVENET_C("Google.en-GB-Wavenet-C"), GOOGLE_EN_GB_WAVENET_D("Google.en-GB-Wavenet-D"), GOOGLE_EN_GB_WAVENET_F("Google.en-GB-Wavenet-F"), + GOOGLE_EN_GB_WAVENET_N("Google.en-GB-Wavenet-N"), + GOOGLE_EN_GB_WAVENET_O("Google.en-GB-Wavenet-O"), + GOOGLE_EN_IN_CHIRP3_HD_AOEDE("Google.en-IN-Chirp3-HD-Aoede"), + GOOGLE_EN_IN_CHIRP3_HD_CHARON("Google.en-IN-Chirp3-HD-Charon"), + GOOGLE_EN_IN_CHIRP3_HD_FENRIR("Google.en-IN-Chirp3-HD-Fenrir"), + GOOGLE_EN_IN_CHIRP3_HD_KORE("Google.en-IN-Chirp3-HD-Kore"), + GOOGLE_EN_IN_CHIRP3_HD_LEDA("Google.en-IN-Chirp3-HD-Leda"), + GOOGLE_EN_IN_CHIRP3_HD_ORUS("Google.en-IN-Chirp3-HD-Orus"), + GOOGLE_EN_IN_CHIRP3_HD_PUCK("Google.en-IN-Chirp3-HD-Puck"), + GOOGLE_EN_IN_CHIRP3_HD_ZEPHYR("Google.en-IN-Chirp3-HD-Zephyr"), GOOGLE_EN_IN_NEURAL2_A("Google.en-IN-Neural2-A"), GOOGLE_EN_IN_NEURAL2_B("Google.en-IN-Neural2-B"), GOOGLE_EN_IN_NEURAL2_C("Google.en-IN-Neural2-C"), @@ -125,10 +207,22 @@ public enum Voice { GOOGLE_EN_IN_STANDARD_B("Google.en-IN-Standard-B"), GOOGLE_EN_IN_STANDARD_C("Google.en-IN-Standard-C"), GOOGLE_EN_IN_STANDARD_D("Google.en-IN-Standard-D"), + GOOGLE_EN_IN_STANDARD_E("Google.en-IN-Standard-E"), + GOOGLE_EN_IN_STANDARD_F("Google.en-IN-Standard-F"), GOOGLE_EN_IN_WAVENET_A("Google.en-IN-Wavenet-A"), GOOGLE_EN_IN_WAVENET_B("Google.en-IN-Wavenet-B"), GOOGLE_EN_IN_WAVENET_C("Google.en-IN-Wavenet-C"), GOOGLE_EN_IN_WAVENET_D("Google.en-IN-Wavenet-D"), + GOOGLE_EN_IN_WAVENET_E("Google.en-IN-Wavenet-E"), + GOOGLE_EN_IN_WAVENET_F("Google.en-IN-Wavenet-F"), + GOOGLE_EN_US_CHIRP3_HD_AOEDE("Google.en-US-Chirp3-HD-Aoede"), + GOOGLE_EN_US_CHIRP3_HD_CHARON("Google.en-US-Chirp3-HD-Charon"), + GOOGLE_EN_US_CHIRP3_HD_FENRIR("Google.en-US-Chirp3-HD-Fenrir"), + GOOGLE_EN_US_CHIRP3_HD_KORE("Google.en-US-Chirp3-HD-Kore"), + GOOGLE_EN_US_CHIRP3_HD_LEDA("Google.en-US-Chirp3-HD-Leda"), + GOOGLE_EN_US_CHIRP3_HD_ORUS("Google.en-US-Chirp3-HD-Orus"), + GOOGLE_EN_US_CHIRP3_HD_PUCK("Google.en-US-Chirp3-HD-Puck"), + GOOGLE_EN_US_CHIRP3_HD_ZEPHYR("Google.en-US-Chirp3-HD-Zephyr"), GOOGLE_EN_US_NEURAL2_A("Google.en-US-Neural2-A"), GOOGLE_EN_US_NEURAL2_C("Google.en-US-Neural2-C"), GOOGLE_EN_US_NEURAL2_D("Google.en-US-Neural2-D"), @@ -158,18 +252,45 @@ public enum Voice { GOOGLE_EN_US_WAVENET_H("Google.en-US-Wavenet-H"), GOOGLE_EN_US_WAVENET_I("Google.en-US-Wavenet-I"), GOOGLE_EN_US_WAVENET_J("Google.en-US-Wavenet-J"), + GOOGLE_ES_ES_CHIRP3_HD_AOEDE("Google.es-ES-Chirp3-HD-Aoede"), + GOOGLE_ES_ES_CHIRP3_HD_CHARON("Google.es-ES-Chirp3-HD-Charon"), + GOOGLE_ES_ES_CHIRP3_HD_FENRIR("Google.es-ES-Chirp3-HD-Fenrir"), + GOOGLE_ES_ES_CHIRP3_HD_KORE("Google.es-ES-Chirp3-HD-Kore"), + GOOGLE_ES_ES_CHIRP3_HD_LEDA("Google.es-ES-Chirp3-HD-Leda"), + GOOGLE_ES_ES_CHIRP3_HD_ORUS("Google.es-ES-Chirp3-HD-Orus"), + GOOGLE_ES_ES_CHIRP3_HD_PUCK("Google.es-ES-Chirp3-HD-Puck"), + GOOGLE_ES_ES_CHIRP3_HD_ZEPHYR("Google.es-ES-Chirp3-HD-Zephyr"), GOOGLE_ES_ES_NEURAL2_A("Google.es-ES-Neural2-A"), GOOGLE_ES_ES_NEURAL2_B("Google.es-ES-Neural2-B"), GOOGLE_ES_ES_NEURAL2_C("Google.es-ES-Neural2-C"), GOOGLE_ES_ES_NEURAL2_D("Google.es-ES-Neural2-D"), GOOGLE_ES_ES_NEURAL2_E("Google.es-ES-Neural2-E"), GOOGLE_ES_ES_NEURAL2_F("Google.es-ES-Neural2-F"), + GOOGLE_ES_ES_NEURAL2_G("Google.es-ES-Neural2-G"), + GOOGLE_ES_ES_NEURAL2_H("Google.es-ES-Neural2-H"), + GOOGLE_ES_ES_STANDARD_A("Google.es-ES-Standard-A"), GOOGLE_ES_ES_STANDARD_B("Google.es-ES-Standard-B"), GOOGLE_ES_ES_STANDARD_C("Google.es-ES-Standard-C"), GOOGLE_ES_ES_STANDARD_D("Google.es-ES-Standard-D"), + GOOGLE_ES_ES_STANDARD_E("Google.es-ES-Standard-E"), + GOOGLE_ES_ES_STANDARD_F("Google.es-ES-Standard-F"), + GOOGLE_ES_ES_STANDARD_G("Google.es-ES-Standard-G"), + GOOGLE_ES_ES_STANDARD_H("Google.es-ES-Standard-H"), GOOGLE_ES_ES_WAVENET_B("Google.es-ES-Wavenet-B"), GOOGLE_ES_ES_WAVENET_C("Google.es-ES-Wavenet-C"), GOOGLE_ES_ES_WAVENET_D("Google.es-ES-Wavenet-D"), + GOOGLE_ES_ES_WAVENET_E("Google.es-ES-Wavenet-E"), + GOOGLE_ES_ES_WAVENET_F("Google.es-ES-Wavenet-F"), + GOOGLE_ES_ES_WAVENET_G("Google.es-ES-Wavenet-G"), + GOOGLE_ES_ES_WAVENET_H("Google.es-ES-Wavenet-H"), + GOOGLE_ES_US_CHIRP3_HD_AOEDE("Google.es-US-Chirp3-HD-Aoede"), + GOOGLE_ES_US_CHIRP3_HD_CHARON("Google.es-US-Chirp3-HD-Charon"), + GOOGLE_ES_US_CHIRP3_HD_FENRIR("Google.es-US-Chirp3-HD-Fenrir"), + GOOGLE_ES_US_CHIRP3_HD_KORE("Google.es-US-Chirp3-HD-Kore"), + GOOGLE_ES_US_CHIRP3_HD_LEDA("Google.es-US-Chirp3-HD-Leda"), + GOOGLE_ES_US_CHIRP3_HD_ORUS("Google.es-US-Chirp3-HD-Orus"), + GOOGLE_ES_US_CHIRP3_HD_PUCK("Google.es-US-Chirp3-HD-Puck"), + GOOGLE_ES_US_CHIRP3_HD_ZEPHYR("Google.es-US-Chirp3-HD-Zephyr"), GOOGLE_ES_US_NEURAL2_A("Google.es-US-Neural2-A"), GOOGLE_ES_US_NEURAL2_B("Google.es-US-Neural2-B"), GOOGLE_ES_US_NEURAL2_C("Google.es-US-Neural2-C"), @@ -180,8 +301,13 @@ public enum Voice { GOOGLE_ES_US_WAVENET_B("Google.es-US-Wavenet-B"), GOOGLE_ES_US_WAVENET_C("Google.es-US-Wavenet-C"), GOOGLE_EU_ES_STANDARD_A("Google.eu-ES-Standard-A"), + GOOGLE_EU_ES_STANDARD_B("Google.eu-ES-Standard-B"), GOOGLE_FI_FI_STANDARD_A("Google.fi-FI-Standard-A"), + GOOGLE_FI_FI_STANDARD_B("Google.fi-FI-Standard-B"), GOOGLE_FI_FI_WAVENET_A("Google.fi-FI-Wavenet-A"), + GOOGLE_FI_FI_WAVENET_B("Google.fi-FI-Wavenet-B"), + GOOGLE_FIL_PH_NEURAL2_A("Google.fil-ph-Neural2-A"), + GOOGLE_FIL_PH_NEURAL2_D("Google.fil-ph-Neural2-D"), GOOGLE_FIL_PH_STANDARD_A("Google.fil-PH-Standard-A"), GOOGLE_FIL_PH_STANDARD_B("Google.fil-PH-Standard-B"), GOOGLE_FIL_PH_STANDARD_C("Google.fil-PH-Standard-C"), @@ -190,8 +316,14 @@ public enum Voice { GOOGLE_FIL_PH_WAVENET_B("Google.fil-PH-Wavenet-B"), GOOGLE_FIL_PH_WAVENET_C("Google.fil-PH-Wavenet-C"), GOOGLE_FIL_PH_WAVENET_D("Google.fil-PH-Wavenet-D"), - GOOGLE_FIL_PH_NEURAL2_A("Google.fil-ph-Neural2-A"), - GOOGLE_FIL_PH_NEURAL2_D("Google.fil-ph-Neural2-D"), + GOOGLE_FR_CA_CHIRP3_HD_AOEDE("Google.fr-CA-Chirp3-HD-Aoede"), + GOOGLE_FR_CA_CHIRP3_HD_CHARON("Google.fr-CA-Chirp3-HD-Charon"), + GOOGLE_FR_CA_CHIRP3_HD_FENRIR("Google.fr-CA-Chirp3-HD-Fenrir"), + GOOGLE_FR_CA_CHIRP3_HD_KORE("Google.fr-CA-Chirp3-HD-Kore"), + GOOGLE_FR_CA_CHIRP3_HD_LEDA("Google.fr-CA-Chirp3-HD-Leda"), + GOOGLE_FR_CA_CHIRP3_HD_ORUS("Google.fr-CA-Chirp3-HD-Orus"), + GOOGLE_FR_CA_CHIRP3_HD_PUCK("Google.fr-CA-Chirp3-HD-Puck"), + GOOGLE_FR_CA_CHIRP3_HD_ZEPHYR("Google.fr-CA-Chirp3-HD-Zephyr"), GOOGLE_FR_CA_NEURAL2_A("Google.fr-CA-Neural2-A"), GOOGLE_FR_CA_NEURAL2_B("Google.fr-CA-Neural2-B"), GOOGLE_FR_CA_NEURAL2_C("Google.fr-CA-Neural2-C"), @@ -204,24 +336,51 @@ public enum Voice { GOOGLE_FR_CA_WAVENET_B("Google.fr-CA-Wavenet-B"), GOOGLE_FR_CA_WAVENET_C("Google.fr-CA-Wavenet-C"), GOOGLE_FR_CA_WAVENET_D("Google.fr-CA-Wavenet-D"), + GOOGLE_FR_FR_CHIRP3_HD_AOEDE("Google.fr-FR-Chirp3-HD-Aoede"), + GOOGLE_FR_FR_CHIRP3_HD_CHARON("Google.fr-FR-Chirp3-HD-Charon"), + GOOGLE_FR_FR_CHIRP3_HD_FENRIR("Google.fr-FR-Chirp3-HD-Fenrir"), + GOOGLE_FR_FR_CHIRP3_HD_KORE("Google.fr-FR-Chirp3-HD-Kore"), + GOOGLE_FR_FR_CHIRP3_HD_LEDA("Google.fr-FR-Chirp3-HD-Leda"), + GOOGLE_FR_FR_CHIRP3_HD_ORUS("Google.fr-FR-Chirp3-HD-Orus"), + GOOGLE_FR_FR_CHIRP3_HD_PUCK("Google.fr-FR-Chirp3-HD-Puck"), + GOOGLE_FR_FR_CHIRP3_HD_ZEPHYR("Google.fr-FR-Chirp3-HD-Zephyr"), GOOGLE_FR_FR_NEURAL2_A("Google.fr-FR-Neural2-A"), GOOGLE_FR_FR_NEURAL2_B("Google.fr-FR-Neural2-B"), GOOGLE_FR_FR_NEURAL2_C("Google.fr-FR-Neural2-C"), GOOGLE_FR_FR_NEURAL2_D("Google.fr-FR-Neural2-D"), GOOGLE_FR_FR_NEURAL2_E("Google.fr-FR-Neural2-E"), + GOOGLE_FR_FR_NEURAL2_F("Google.fr-FR-Neural2-F"), + GOOGLE_FR_FR_NEURAL2_G("Google.fr-FR-Neural2-G"), GOOGLE_FR_FR_STANDARD_A("Google.fr-FR-Standard-A"), GOOGLE_FR_FR_STANDARD_B("Google.fr-FR-Standard-B"), GOOGLE_FR_FR_STANDARD_C("Google.fr-FR-Standard-C"), GOOGLE_FR_FR_STANDARD_D("Google.fr-FR-Standard-D"), GOOGLE_FR_FR_STANDARD_E("Google.fr-FR-Standard-E"), + GOOGLE_FR_FR_STANDARD_F("Google.fr-FR-Standard-F"), + GOOGLE_FR_FR_STANDARD_G("Google.fr-FR-Standard-G"), GOOGLE_FR_FR_WAVENET_A("Google.fr-FR-Wavenet-A"), GOOGLE_FR_FR_WAVENET_B("Google.fr-FR-Wavenet-B"), GOOGLE_FR_FR_WAVENET_C("Google.fr-FR-Wavenet-C"), GOOGLE_FR_FR_WAVENET_D("Google.fr-FR-Wavenet-D"), GOOGLE_FR_FR_WAVENET_E("Google.fr-FR-Wavenet-E"), + GOOGLE_FR_FR_WAVENET_F("Google.fr-FR-Wavenet-F"), + GOOGLE_FR_FR_WAVENET_G("Google.fr-FR-Wavenet-G"), GOOGLE_GL_ES_STANDARD_A("Google.gl-ES-Standard-A"), + GOOGLE_GL_ES_STANDARD_B("Google.gl-ES-Standard-B"), + GOOGLE_GU_IN_CHIRP3_HD_AOEDE("Google.gu-IN-Chirp3-HD-Aoede"), + GOOGLE_GU_IN_CHIRP3_HD_CHARON("Google.gu-IN-Chirp3-HD-Charon"), + GOOGLE_GU_IN_CHIRP3_HD_FENRIR("Google.gu-IN-Chirp3-HD-Fenrir"), + GOOGLE_GU_IN_CHIRP3_HD_KORE("Google.gu-IN-Chirp3-HD-Kore"), + GOOGLE_GU_IN_CHIRP3_HD_LEDA("Google.gu-IN-Chirp3-HD-Leda"), + GOOGLE_GU_IN_CHIRP3_HD_ORUS("Google.gu-IN-Chirp3-HD-Orus"), + GOOGLE_GU_IN_CHIRP3_HD_PUCK("Google.gu-IN-Chirp3-HD-Puck"), + GOOGLE_GU_IN_CHIRP3_HD_ZEPHYR("Google.gu-IN-Chirp3-HD-Zephyr"), + GOOGLE_GU_IN_STANDARD_A("Google.gu-IN-Standard-A"), + GOOGLE_GU_IN_STANDARD_B("Google.gu-IN-Standard-B"), GOOGLE_GU_IN_STANDARD_C("Google.gu-IN-Standard-C"), GOOGLE_GU_IN_STANDARD_D("Google.gu-IN-Standard-D"), + GOOGLE_GU_IN_WAVENET_A("Google.gu-IN-Wavenet-A"), + GOOGLE_GU_IN_WAVENET_B("Google.gu-IN-Wavenet-B"), GOOGLE_GU_IN_WAVENET_C("Google.gu-IN-Wavenet-C"), GOOGLE_GU_IN_WAVENET_D("Google.gu-IN-Wavenet-D"), GOOGLE_HE_IL_STANDARD_A("Google.he-IL-Standard-A"), @@ -232,6 +391,14 @@ public enum Voice { GOOGLE_HE_IL_WAVENET_B("Google.he-IL-Wavenet-B"), GOOGLE_HE_IL_WAVENET_C("Google.he-IL-Wavenet-C"), GOOGLE_HE_IL_WAVENET_D("Google.he-IL-Wavenet-D"), + GOOGLE_HI_IN_CHIRP3_HD_AOEDE("Google.hi-IN-Chirp3-HD-Aoede"), + GOOGLE_HI_IN_CHIRP3_HD_CHARON("Google.hi-IN-Chirp3-HD-Charon"), + GOOGLE_HI_IN_CHIRP3_HD_FENRIR("Google.hi-IN-Chirp3-HD-Fenrir"), + GOOGLE_HI_IN_CHIRP3_HD_KORE("Google.hi-IN-Chirp3-HD-Kore"), + GOOGLE_HI_IN_CHIRP3_HD_LEDA("Google.hi-IN-Chirp3-HD-Leda"), + GOOGLE_HI_IN_CHIRP3_HD_ORUS("Google.hi-IN-Chirp3-HD-Orus"), + GOOGLE_HI_IN_CHIRP3_HD_PUCK("Google.hi-IN-Chirp3-HD-Puck"), + GOOGLE_HI_IN_CHIRP3_HD_ZEPHYR("Google.hi-IN-Chirp3-HD-Zephyr"), GOOGLE_HI_IN_NEURAL2_A("Google.hi-IN-Neural2-A"), GOOGLE_HI_IN_NEURAL2_B("Google.hi-IN-Neural2-B"), GOOGLE_HI_IN_NEURAL2_C("Google.hi-IN-Neural2-C"), @@ -240,12 +407,25 @@ public enum Voice { GOOGLE_HI_IN_STANDARD_B("Google.hi-IN-Standard-B"), GOOGLE_HI_IN_STANDARD_C("Google.hi-IN-Standard-C"), GOOGLE_HI_IN_STANDARD_D("Google.hi-IN-Standard-D"), + GOOGLE_HI_IN_STANDARD_E("Google.hi-IN-Standard-E"), + GOOGLE_HI_IN_STANDARD_F("Google.hi-IN-Standard-F"), GOOGLE_HI_IN_WAVENET_A("Google.hi-IN-Wavenet-A"), GOOGLE_HI_IN_WAVENET_B("Google.hi-IN-Wavenet-B"), GOOGLE_HI_IN_WAVENET_C("Google.hi-IN-Wavenet-C"), GOOGLE_HI_IN_WAVENET_D("Google.hi-IN-Wavenet-D"), + GOOGLE_HI_IN_WAVENET_E("Google.hi-IN-Wavenet-E"), + GOOGLE_HI_IN_WAVENET_F("Google.hi-IN-Wavenet-F"), GOOGLE_HU_HU_STANDARD_A("Google.hu-HU-Standard-A"), + GOOGLE_HU_HU_STANDARD_B("Google.hu-HU-Standard-B"), GOOGLE_HU_HU_WAVENET_A("Google.hu-HU-Wavenet-A"), + GOOGLE_ID_ID_CHIRP3_HD_AOEDE("Google.id-ID-Chirp3-HD-Aoede"), + GOOGLE_ID_ID_CHIRP3_HD_CHARON("Google.id-ID-Chirp3-HD-Charon"), + GOOGLE_ID_ID_CHIRP3_HD_FENRIR("Google.id-ID-Chirp3-HD-Fenrir"), + GOOGLE_ID_ID_CHIRP3_HD_KORE("Google.id-ID-Chirp3-HD-Kore"), + GOOGLE_ID_ID_CHIRP3_HD_LEDA("Google.id-ID-Chirp3-HD-Leda"), + GOOGLE_ID_ID_CHIRP3_HD_ORUS("Google.id-ID-Chirp3-HD-Orus"), + GOOGLE_ID_ID_CHIRP3_HD_PUCK("Google.id-ID-Chirp3-HD-Puck"), + GOOGLE_ID_ID_CHIRP3_HD_ZEPHYR("Google.id-ID-Chirp3-HD-Zephyr"), GOOGLE_ID_ID_STANDARD_A("Google.id-ID-Standard-A"), GOOGLE_ID_ID_STANDARD_B("Google.id-ID-Standard-B"), GOOGLE_ID_ID_STANDARD_C("Google.id-ID-Standard-C"), @@ -255,14 +435,38 @@ public enum Voice { GOOGLE_ID_ID_WAVENET_C("Google.id-ID-Wavenet-C"), GOOGLE_ID_ID_WAVENET_D("Google.id-ID-Wavenet-D"), GOOGLE_IS_IS_STANDARD_A("Google.is-IS-Standard-A"), + GOOGLE_IS_IS_STANDARD_B("Google.is-IS-Standard-B"), + GOOGLE_IT_IT_CHIRP3_HD_AOEDE("Google.it-IT-Chirp3-HD-Aoede"), + GOOGLE_IT_IT_CHIRP3_HD_CHARON("Google.it-IT-Chirp3-HD-Charon"), + GOOGLE_IT_IT_CHIRP3_HD_FENRIR("Google.it-IT-Chirp3-HD-Fenrir"), + GOOGLE_IT_IT_CHIRP3_HD_KORE("Google.it-IT-Chirp3-HD-Kore"), + GOOGLE_IT_IT_CHIRP3_HD_LEDA("Google.it-IT-Chirp3-HD-Leda"), + GOOGLE_IT_IT_CHIRP3_HD_ORUS("Google.it-IT-Chirp3-HD-Orus"), + GOOGLE_IT_IT_CHIRP3_HD_PUCK("Google.it-IT-Chirp3-HD-Puck"), + GOOGLE_IT_IT_CHIRP3_HD_ZEPHYR("Google.it-IT-Chirp3-HD-Zephyr"), GOOGLE_IT_IT_NEURAL2_A("Google.it-IT-Neural2-A"), GOOGLE_IT_IT_NEURAL2_C("Google.it-IT-Neural2-C"), + GOOGLE_IT_IT_NEURAL2_F("Google.it-IT-Neural2-F"), + GOOGLE_IT_IT_STANDARD_A("Google.it-IT-Standard-A"), GOOGLE_IT_IT_STANDARD_B("Google.it-IT-Standard-B"), GOOGLE_IT_IT_STANDARD_C("Google.it-IT-Standard-C"), GOOGLE_IT_IT_STANDARD_D("Google.it-IT-Standard-D"), + GOOGLE_IT_IT_STANDARD_E("Google.it-IT-Standard-E"), + GOOGLE_IT_IT_STANDARD_F("Google.it-IT-Standard-F"), + GOOGLE_IT_IT_WAVENET_A("Google.it-IT-Wavenet-A"), GOOGLE_IT_IT_WAVENET_B("Google.it-IT-Wavenet-B"), GOOGLE_IT_IT_WAVENET_C("Google.it-IT-Wavenet-C"), GOOGLE_IT_IT_WAVENET_D("Google.it-IT-Wavenet-D"), + GOOGLE_IT_IT_WAVENET_E("Google.it-IT-Wavenet-E"), + GOOGLE_IT_IT_WAVENET_F("Google.it-IT-Wavenet-F"), + GOOGLE_JA_JP_CHIRP3_HD_AOEDE("Google.ja-JP-Chirp3-HD-Aoede"), + GOOGLE_JA_JP_CHIRP3_HD_CHARON("Google.ja-JP-Chirp3-HD-Charon"), + GOOGLE_JA_JP_CHIRP3_HD_FENRIR("Google.ja-JP-Chirp3-HD-Fenrir"), + GOOGLE_JA_JP_CHIRP3_HD_KORE("Google.ja-JP-Chirp3-HD-Kore"), + GOOGLE_JA_JP_CHIRP3_HD_LEDA("Google.ja-JP-Chirp3-HD-Leda"), + GOOGLE_JA_JP_CHIRP3_HD_ORUS("Google.ja-JP-Chirp3-HD-Orus"), + GOOGLE_JA_JP_CHIRP3_HD_PUCK("Google.ja-JP-Chirp3-HD-Puck"), + GOOGLE_JA_JP_CHIRP3_HD_ZEPHYR("Google.ja-JP-Chirp3-HD-Zephyr"), GOOGLE_JA_JP_NEURAL2_B("Google.ja-JP-Neural2-B"), GOOGLE_JA_JP_NEURAL2_C("Google.ja-JP-Neural2-C"), GOOGLE_JA_JP_NEURAL2_D("Google.ja-JP-Neural2-D"), @@ -274,10 +478,30 @@ public enum Voice { GOOGLE_JA_JP_WAVENET_B("Google.ja-JP-Wavenet-B"), GOOGLE_JA_JP_WAVENET_C("Google.ja-JP-Wavenet-C"), GOOGLE_JA_JP_WAVENET_D("Google.ja-JP-Wavenet-D"), + GOOGLE_KN_IN_CHIRP3_HD_AOEDE("Google.kn-IN-Chirp3-HD-Aoede"), + GOOGLE_KN_IN_CHIRP3_HD_CHARON("Google.kn-IN-Chirp3-HD-Charon"), + GOOGLE_KN_IN_CHIRP3_HD_FENRIR("Google.kn-IN-Chirp3-HD-Fenrir"), + GOOGLE_KN_IN_CHIRP3_HD_KORE("Google.kn-IN-Chirp3-HD-Kore"), + GOOGLE_KN_IN_CHIRP3_HD_LEDA("Google.kn-IN-Chirp3-HD-Leda"), + GOOGLE_KN_IN_CHIRP3_HD_ORUS("Google.kn-IN-Chirp3-HD-Orus"), + GOOGLE_KN_IN_CHIRP3_HD_PUCK("Google.kn-IN-Chirp3-HD-Puck"), + GOOGLE_KN_IN_CHIRP3_HD_ZEPHYR("Google.kn-IN-Chirp3-HD-Zephyr"), + GOOGLE_KN_IN_STANDARD_A("Google.kn-IN-Standard-A"), + GOOGLE_KN_IN_STANDARD_B("Google.kn-IN-Standard-B"), GOOGLE_KN_IN_STANDARD_C("Google.kn-IN-Standard-C"), GOOGLE_KN_IN_STANDARD_D("Google.kn-IN-Standard-D"), + GOOGLE_KN_IN_WAVENET_A("Google.kn-IN-Wavenet-A"), + GOOGLE_KN_IN_WAVENET_B("Google.kn-IN-Wavenet-B"), GOOGLE_KN_IN_WAVENET_C("Google.kn-IN-Wavenet-C"), GOOGLE_KN_IN_WAVENET_D("Google.kn-IN-Wavenet-D"), + GOOGLE_KO_KR_CHIRP3_HD_AOEDE("Google.ko-KR-Chirp3-HD-Aoede"), + GOOGLE_KO_KR_CHIRP3_HD_CHARON("Google.ko-KR-Chirp3-HD-Charon"), + GOOGLE_KO_KR_CHIRP3_HD_FENRIR("Google.ko-KR-Chirp3-HD-Fenrir"), + GOOGLE_KO_KR_CHIRP3_HD_KORE("Google.ko-KR-Chirp3-HD-Kore"), + GOOGLE_KO_KR_CHIRP3_HD_LEDA("Google.ko-KR-Chirp3-HD-Leda"), + GOOGLE_KO_KR_CHIRP3_HD_ORUS("Google.ko-KR-Chirp3-HD-Orus"), + GOOGLE_KO_KR_CHIRP3_HD_PUCK("Google.ko-KR-Chirp3-HD-Puck"), + GOOGLE_KO_KR_CHIRP3_HD_ZEPHYR("Google.ko-KR-Chirp3-HD-Zephyr"), GOOGLE_KO_KR_NEURAL2_A("Google.ko-KR-Neural2-A"), GOOGLE_KO_KR_NEURAL2_B("Google.ko-KR-Neural2-B"), GOOGLE_KO_KR_NEURAL2_C("Google.ko-KR-Neural2-C"), @@ -290,9 +514,33 @@ public enum Voice { GOOGLE_KO_KR_WAVENET_C("Google.ko-KR-Wavenet-C"), GOOGLE_KO_KR_WAVENET_D("Google.ko-KR-Wavenet-D"), GOOGLE_LT_LT_STANDARD_A("Google.lt-LT-Standard-A"), + GOOGLE_LT_LT_STANDARD_B("Google.lt-LT-Standard-B"), GOOGLE_LV_LV_STANDARD_A("Google.lv-LV-Standard-A"), + GOOGLE_LV_LV_STANDARD_B("Google.lv-LV-Standard-B"), + GOOGLE_ML_IN_CHIRP3_HD_AOEDE("Google.ml-IN-Chirp3-HD-Aoede"), + GOOGLE_ML_IN_CHIRP3_HD_CHARON("Google.ml-IN-Chirp3-HD-Charon"), + GOOGLE_ML_IN_CHIRP3_HD_FENRIR("Google.ml-IN-Chirp3-HD-Fenrir"), + GOOGLE_ML_IN_CHIRP3_HD_KORE("Google.ml-IN-Chirp3-HD-Kore"), + GOOGLE_ML_IN_CHIRP3_HD_LEDA("Google.ml-IN-Chirp3-HD-Leda"), + GOOGLE_ML_IN_CHIRP3_HD_ORUS("Google.ml-IN-Chirp3-HD-Orus"), + GOOGLE_ML_IN_CHIRP3_HD_PUCK("Google.ml-IN-Chirp3-HD-Puck"), + GOOGLE_ML_IN_CHIRP3_HD_ZEPHYR("Google.ml-IN-Chirp3-HD-Zephyr"), + GOOGLE_ML_IN_STANDARD_A("Google.ml-IN-Standard-A"), + GOOGLE_ML_IN_STANDARD_B("Google.ml-IN-Standard-B"), + GOOGLE_ML_IN_STANDARD_C("Google.ml-IN-Standard-C"), + GOOGLE_ML_IN_STANDARD_D("Google.ml-IN-Standard-D"), + GOOGLE_ML_IN_WAVENET_A("Google.ml-IN-Wavenet-A"), + GOOGLE_ML_IN_WAVENET_B("Google.ml-IN-Wavenet-B"), GOOGLE_ML_IN_WAVENET_C("Google.ml-IN-Wavenet-C"), GOOGLE_ML_IN_WAVENET_D("Google.ml-IN-Wavenet-D"), + GOOGLE_MR_IN_CHIRP3_HD_AOEDE("Google.mr-IN-Chirp3-HD-Aoede"), + GOOGLE_MR_IN_CHIRP3_HD_CHARON("Google.mr-IN-Chirp3-HD-Charon"), + GOOGLE_MR_IN_CHIRP3_HD_FENRIR("Google.mr-IN-Chirp3-HD-Fenrir"), + GOOGLE_MR_IN_CHIRP3_HD_KORE("Google.mr-IN-Chirp3-HD-Kore"), + GOOGLE_MR_IN_CHIRP3_HD_LEDA("Google.mr-IN-Chirp3-HD-Leda"), + GOOGLE_MR_IN_CHIRP3_HD_ORUS("Google.mr-IN-Chirp3-HD-Orus"), + GOOGLE_MR_IN_CHIRP3_HD_PUCK("Google.mr-IN-Chirp3-HD-Puck"), + GOOGLE_MR_IN_CHIRP3_HD_ZEPHYR("Google.mr-IN-Chirp3-HD-Zephyr"), GOOGLE_MR_IN_STANDARD_A("Google.mr-IN-Standard-A"), GOOGLE_MR_IN_STANDARD_B("Google.mr-IN-Standard-B"), GOOGLE_MR_IN_STANDARD_C("Google.mr-IN-Standard-C"), @@ -312,25 +560,45 @@ public enum Voice { GOOGLE_NB_NO_STANDARD_C("Google.nb-NO-Standard-C"), GOOGLE_NB_NO_STANDARD_D("Google.nb-NO-Standard-D"), GOOGLE_NB_NO_STANDARD_E("Google.nb-NO-Standard-E"), + GOOGLE_NB_NO_STANDARD_F("Google.nb-NO-Standard-F"), + GOOGLE_NB_NO_STANDARD_G("Google.nb-NO-Standard-G"), GOOGLE_NB_NO_WAVENET_A("Google.nb-NO-Wavenet-A"), GOOGLE_NB_NO_WAVENET_B("Google.nb-NO-Wavenet-B"), GOOGLE_NB_NO_WAVENET_C("Google.nb-NO-Wavenet-C"), GOOGLE_NB_NO_WAVENET_D("Google.nb-NO-Wavenet-D"), GOOGLE_NB_NO_WAVENET_E("Google.nb-NO-Wavenet-E"), + GOOGLE_NB_NO_WAVENET_F("Google.nb-NO-Wavenet-F"), + GOOGLE_NB_NO_WAVENET_G("Google.nb-NO-Wavenet-G"), GOOGLE_NL_BE_STANDARD_A("Google.nl-BE-Standard-A"), GOOGLE_NL_BE_STANDARD_B("Google.nl-BE-Standard-B"), + GOOGLE_NL_BE_STANDARD_C("Google.nl-BE-Standard-C"), + GOOGLE_NL_BE_STANDARD_D("Google.nl-BE-Standard-D"), GOOGLE_NL_BE_WAVENET_A("Google.nl-BE-Wavenet-A"), GOOGLE_NL_BE_WAVENET_B("Google.nl-BE-Wavenet-B"), + GOOGLE_NL_BE_WAVENET_C("Google.nl-BE-Wavenet-C"), + GOOGLE_NL_BE_WAVENET_D("Google.nl-BE-Wavenet-D"), + GOOGLE_NL_NL_CHIRP3_HD_AOEDE("Google.nl-NL-Chirp3-HD-Aoede"), + GOOGLE_NL_NL_CHIRP3_HD_CHARON("Google.nl-NL-Chirp3-HD-Charon"), + GOOGLE_NL_NL_CHIRP3_HD_FENRIR("Google.nl-NL-Chirp3-HD-Fenrir"), + GOOGLE_NL_NL_CHIRP3_HD_KORE("Google.nl-NL-Chirp3-HD-Kore"), + GOOGLE_NL_NL_CHIRP3_HD_LEDA("Google.nl-NL-Chirp3-HD-Leda"), + GOOGLE_NL_NL_CHIRP3_HD_ORUS("Google.nl-NL-Chirp3-HD-Orus"), + GOOGLE_NL_NL_CHIRP3_HD_PUCK("Google.nl-NL-Chirp3-HD-Puck"), + GOOGLE_NL_NL_CHIRP3_HD_ZEPHYR("Google.nl-NL-Chirp3-HD-Zephyr"), GOOGLE_NL_NL_STANDARD_A("Google.nl-NL-Standard-A"), GOOGLE_NL_NL_STANDARD_B("Google.nl-NL-Standard-B"), GOOGLE_NL_NL_STANDARD_C("Google.nl-NL-Standard-C"), GOOGLE_NL_NL_STANDARD_D("Google.nl-NL-Standard-D"), GOOGLE_NL_NL_STANDARD_E("Google.nl-NL-Standard-E"), + GOOGLE_NL_NL_STANDARD_F("Google.nl-NL-Standard-F"), + GOOGLE_NL_NL_STANDARD_G("Google.nl-NL-Standard-G"), GOOGLE_NL_NL_WAVENET_A("Google.nl-NL-Wavenet-A"), GOOGLE_NL_NL_WAVENET_B("Google.nl-NL-Wavenet-B"), GOOGLE_NL_NL_WAVENET_C("Google.nl-NL-Wavenet-C"), GOOGLE_NL_NL_WAVENET_D("Google.nl-NL-Wavenet-D"), GOOGLE_NL_NL_WAVENET_E("Google.nl-NL-Wavenet-E"), + GOOGLE_NL_NL_WAVENET_F("Google.nl-NL-Wavenet-F"), + GOOGLE_NL_NL_WAVENET_G("Google.nl-NL-Wavenet-G"), GOOGLE_PA_IN_STANDARD_A("Google.pa-IN-Standard-A"), GOOGLE_PA_IN_STANDARD_B("Google.pa-IN-Standard-B"), GOOGLE_PA_IN_STANDARD_C("Google.pa-IN-Standard-C"), @@ -339,35 +607,73 @@ public enum Voice { GOOGLE_PA_IN_WAVENET_B("Google.pa-IN-Wavenet-B"), GOOGLE_PA_IN_WAVENET_C("Google.pa-IN-Wavenet-C"), GOOGLE_PA_IN_WAVENET_D("Google.pa-IN-Wavenet-D"), + GOOGLE_PL_PL_CHIRP3_HD_AOEDE("Google.pl-PL-Chirp3-HD-Aoede"), + GOOGLE_PL_PL_CHIRP3_HD_CHARON("Google.pl-PL-Chirp3-HD-Charon"), + GOOGLE_PL_PL_CHIRP3_HD_FENRIR("Google.pl-PL-Chirp3-HD-Fenrir"), + GOOGLE_PL_PL_CHIRP3_HD_KORE("Google.pl-PL-Chirp3-HD-Kore"), + GOOGLE_PL_PL_CHIRP3_HD_LEDA("Google.pl-PL-Chirp3-HD-Leda"), + GOOGLE_PL_PL_CHIRP3_HD_ORUS("Google.pl-PL-Chirp3-HD-Orus"), + GOOGLE_PL_PL_CHIRP3_HD_PUCK("Google.pl-PL-Chirp3-HD-Puck"), + GOOGLE_PL_PL_CHIRP3_HD_ZEPHYR("Google.pl-PL-Chirp3-HD-Zephyr"), GOOGLE_PL_PL_STANDARD_A("Google.pl-PL-Standard-A"), GOOGLE_PL_PL_STANDARD_B("Google.pl-PL-Standard-B"), GOOGLE_PL_PL_STANDARD_C("Google.pl-PL-Standard-C"), GOOGLE_PL_PL_STANDARD_D("Google.pl-PL-Standard-D"), GOOGLE_PL_PL_STANDARD_E("Google.pl-PL-Standard-E"), + GOOGLE_PL_PL_STANDARD_F("Google.pl-PL-Standard-F"), + GOOGLE_PL_PL_STANDARD_G("Google.pl-PL-Standard-G"), GOOGLE_PL_PL_WAVENET_A("Google.pl-PL-Wavenet-A"), GOOGLE_PL_PL_WAVENET_B("Google.pl-PL-Wavenet-B"), GOOGLE_PL_PL_WAVENET_C("Google.pl-PL-Wavenet-C"), GOOGLE_PL_PL_WAVENET_D("Google.pl-PL-Wavenet-D"), GOOGLE_PL_PL_WAVENET_E("Google.pl-PL-Wavenet-E"), + GOOGLE_PL_PL_WAVENET_F("Google.pl-PL-Wavenet-F"), + GOOGLE_PL_PL_WAVENET_G("Google.pl-PL-Wavenet-G"), + GOOGLE_PT_BR_CHIRP3_HD_AOEDE("Google.pt-BR-Chirp3-HD-Aoede"), + GOOGLE_PT_BR_CHIRP3_HD_CHARON("Google.pt-BR-Chirp3-HD-Charon"), + GOOGLE_PT_BR_CHIRP3_HD_FENRIR("Google.pt-BR-Chirp3-HD-Fenrir"), + GOOGLE_PT_BR_CHIRP3_HD_KORE("Google.pt-BR-Chirp3-HD-Kore"), + GOOGLE_PT_BR_CHIRP3_HD_LEDA("Google.pt-BR-Chirp3-HD-Leda"), + GOOGLE_PT_BR_CHIRP3_HD_ORUS("Google.pt-BR-Chirp3-HD-Orus"), + GOOGLE_PT_BR_CHIRP3_HD_PUCK("Google.pt-BR-Chirp3-HD-Puck"), + GOOGLE_PT_BR_CHIRP3_HD_ZEPHYR("Google.pt-BR-Chirp3-HD-Zephyr"), GOOGLE_PT_BR_NEURAL2_A("Google.pt-BR-Neural2-A"), GOOGLE_PT_BR_NEURAL2_B("Google.pt-BR-Neural2-B"), GOOGLE_PT_BR_NEURAL2_C("Google.pt-BR-Neural2-C"), GOOGLE_PT_BR_STANDARD_A("Google.pt-BR-Standard-A"), GOOGLE_PT_BR_STANDARD_B("Google.pt-BR-Standard-B"), GOOGLE_PT_BR_STANDARD_C("Google.pt-BR-Standard-C"), + GOOGLE_PT_BR_STANDARD_D("Google.pt-BR-Standard-D"), + GOOGLE_PT_BR_STANDARD_E("Google.pt-BR-Standard-E"), GOOGLE_PT_BR_WAVENET_A("Google.pt-BR-Wavenet-A"), GOOGLE_PT_BR_WAVENET_B("Google.pt-BR-Wavenet-B"), GOOGLE_PT_BR_WAVENET_C("Google.pt-BR-Wavenet-C"), + GOOGLE_PT_BR_WAVENET_D("Google.pt-BR-Wavenet-D"), + GOOGLE_PT_BR_WAVENET_E("Google.pt-BR-Wavenet-E"), GOOGLE_PT_PT_STANDARD_A("Google.pt-PT-Standard-A"), GOOGLE_PT_PT_STANDARD_B("Google.pt-PT-Standard-B"), GOOGLE_PT_PT_STANDARD_C("Google.pt-PT-Standard-C"), GOOGLE_PT_PT_STANDARD_D("Google.pt-PT-Standard-D"), + GOOGLE_PT_PT_STANDARD_E("Google.pt-PT-Standard-E"), + GOOGLE_PT_PT_STANDARD_F("Google.pt-PT-Standard-F"), GOOGLE_PT_PT_WAVENET_A("Google.pt-PT-Wavenet-A"), GOOGLE_PT_PT_WAVENET_B("Google.pt-PT-Wavenet-B"), GOOGLE_PT_PT_WAVENET_C("Google.pt-PT-Wavenet-C"), GOOGLE_PT_PT_WAVENET_D("Google.pt-PT-Wavenet-D"), + GOOGLE_PT_PT_WAVENET_E("Google.pt-PT-Wavenet-E"), + GOOGLE_PT_PT_WAVENET_F("Google.pt-PT-Wavenet-F"), GOOGLE_RO_RO_STANDARD_A("Google.ro-RO-Standard-A"), + GOOGLE_RO_RO_STANDARD_B("Google.ro-RO-Standard-B"), GOOGLE_RO_RO_WAVENET_A("Google.ro-RO-Wavenet-A"), + GOOGLE_RO_RO_WAVENET_B("Google.ro-RO-Wavenet-B"), + GOOGLE_RU_RU_CHIRP3_HD_AOEDE("Google.ru-RU-Chirp3-HD-Aoede"), + GOOGLE_RU_RU_CHIRP3_HD_CHARON("Google.ru-RU-Chirp3-HD-Charon"), + GOOGLE_RU_RU_CHIRP3_HD_FENRIR("Google.ru-RU-Chirp3-HD-Fenrir"), + GOOGLE_RU_RU_CHIRP3_HD_KORE("Google.ru-RU-Chirp3-HD-Kore"), + GOOGLE_RU_RU_CHIRP3_HD_LEDA("Google.ru-RU-Chirp3-HD-Leda"), + GOOGLE_RU_RU_CHIRP3_HD_ORUS("Google.ru-RU-Chirp3-HD-Orus"), + GOOGLE_RU_RU_CHIRP3_HD_PUCK("Google.ru-RU-Chirp3-HD-Puck"), + GOOGLE_RU_RU_CHIRP3_HD_ZEPHYR("Google.ru-RU-Chirp3-HD-Zephyr"), GOOGLE_RU_RU_STANDARD_A("Google.ru-RU-Standard-A"), GOOGLE_RU_RU_STANDARD_B("Google.ru-RU-Standard-B"), GOOGLE_RU_RU_STANDARD_C("Google.ru-RU-Standard-C"), @@ -379,18 +685,32 @@ public enum Voice { GOOGLE_RU_RU_WAVENET_D("Google.ru-RU-Wavenet-D"), GOOGLE_RU_RU_WAVENET_E("Google.ru-RU-Wavenet-E"), GOOGLE_SK_SK_STANDARD_A("Google.sk-SK-Standard-A"), + GOOGLE_SK_SK_STANDARD_B("Google.sk-SK-Standard-B"), GOOGLE_SK_SK_WAVENET_A("Google.sk-SK-Wavenet-A"), + GOOGLE_SK_SK_WAVENET_B("Google.sk-SK-Wavenet-B"), GOOGLE_SR_RS_STANDARD_A("Google.sr-RS-Standard-A"), GOOGLE_SV_SE_STANDARD_A("Google.sv-SE-Standard-A"), GOOGLE_SV_SE_STANDARD_B("Google.sv-SE-Standard-B"), GOOGLE_SV_SE_STANDARD_C("Google.sv-SE-Standard-C"), GOOGLE_SV_SE_STANDARD_D("Google.sv-SE-Standard-D"), GOOGLE_SV_SE_STANDARD_E("Google.sv-SE-Standard-E"), + GOOGLE_SV_SE_STANDARD_F("Google.sv-SE-Standard-F"), + GOOGLE_SV_SE_STANDARD_G("Google.sv-SE-Standard-G"), GOOGLE_SV_SE_WAVENET_A("Google.sv-SE-Wavenet-A"), GOOGLE_SV_SE_WAVENET_B("Google.sv-SE-Wavenet-B"), GOOGLE_SV_SE_WAVENET_C("Google.sv-SE-Wavenet-C"), GOOGLE_SV_SE_WAVENET_D("Google.sv-SE-Wavenet-D"), GOOGLE_SV_SE_WAVENET_E("Google.sv-SE-Wavenet-E"), + GOOGLE_SV_SE_WAVENET_F("Google.sv-SE-Wavenet-F"), + GOOGLE_SV_SE_WAVENET_G("Google.sv-SE-Wavenet-G"), + GOOGLE_TA_IN_CHIRP3_HD_AOEDE("Google.ta-IN-Chirp3-HD-Aoede"), + GOOGLE_TA_IN_CHIRP3_HD_CHARON("Google.ta-IN-Chirp3-HD-Charon"), + GOOGLE_TA_IN_CHIRP3_HD_FENRIR("Google.ta-IN-Chirp3-HD-Fenrir"), + GOOGLE_TA_IN_CHIRP3_HD_KORE("Google.ta-IN-Chirp3-HD-Kore"), + GOOGLE_TA_IN_CHIRP3_HD_LEDA("Google.ta-IN-Chirp3-HD-Leda"), + GOOGLE_TA_IN_CHIRP3_HD_ORUS("Google.ta-IN-Chirp3-HD-Orus"), + GOOGLE_TA_IN_CHIRP3_HD_PUCK("Google.ta-IN-Chirp3-HD-Puck"), + GOOGLE_TA_IN_CHIRP3_HD_ZEPHYR("Google.ta-IN-Chirp3-HD-Zephyr"), GOOGLE_TA_IN_STANDARD_A("Google.ta-IN-Standard-A"), GOOGLE_TA_IN_STANDARD_B("Google.ta-IN-Standard-B"), GOOGLE_TA_IN_STANDARD_C("Google.ta-IN-Standard-C"), @@ -399,10 +719,36 @@ public enum Voice { GOOGLE_TA_IN_WAVENET_B("Google.ta-IN-Wavenet-B"), GOOGLE_TA_IN_WAVENET_C("Google.ta-IN-Wavenet-C"), GOOGLE_TA_IN_WAVENET_D("Google.ta-IN-Wavenet-D"), + GOOGLE_TE_IN_CHIRP3_HD_AOEDE("Google.te-IN-Chirp3-HD-Aoede"), + GOOGLE_TE_IN_CHIRP3_HD_CHARON("Google.te-IN-Chirp3-HD-Charon"), + GOOGLE_TE_IN_CHIRP3_HD_FENRIR("Google.te-IN-Chirp3-HD-Fenrir"), + GOOGLE_TE_IN_CHIRP3_HD_KORE("Google.te-IN-Chirp3-HD-Kore"), + GOOGLE_TE_IN_CHIRP3_HD_LEDA("Google.te-IN-Chirp3-HD-Leda"), + GOOGLE_TE_IN_CHIRP3_HD_ORUS("Google.te-IN-Chirp3-HD-Orus"), + GOOGLE_TE_IN_CHIRP3_HD_PUCK("Google.te-IN-Chirp3-HD-Puck"), + GOOGLE_TE_IN_CHIRP3_HD_ZEPHYR("Google.te-IN-Chirp3-HD-Zephyr"), GOOGLE_TE_IN_STANDARD_A("Google.te-IN-Standard-A"), GOOGLE_TE_IN_STANDARD_B("Google.te-IN-Standard-B"), + GOOGLE_TE_IN_STANDARD_C("Google.te-IN-Standard-C"), + GOOGLE_TE_IN_STANDARD_D("Google.te-IN-Standard-D"), + GOOGLE_TH_TH_CHIRP3_HD_AOEDE("Google.th-TH-Chirp3-HD-Aoede"), + GOOGLE_TH_TH_CHIRP3_HD_CHARON("Google.th-TH-Chirp3-HD-Charon"), + GOOGLE_TH_TH_CHIRP3_HD_FENRIR("Google.th-TH-Chirp3-HD-Fenrir"), + GOOGLE_TH_TH_CHIRP3_HD_KORE("Google.th-TH-Chirp3-HD-Kore"), + GOOGLE_TH_TH_CHIRP3_HD_LEDA("Google.th-TH-Chirp3-HD-Leda"), + GOOGLE_TH_TH_CHIRP3_HD_ORUS("Google.th-TH-Chirp3-HD-Orus"), + GOOGLE_TH_TH_CHIRP3_HD_PUCK("Google.th-TH-Chirp3-HD-Puck"), + GOOGLE_TH_TH_CHIRP3_HD_ZEPHYR("Google.th-TH-Chirp3-HD-Zephyr"), GOOGLE_TH_TH_NEURAL2_C("Google.th-TH-Neural2-C"), GOOGLE_TH_TH_STANDARD_A("Google.th-TH-Standard-A"), + GOOGLE_TR_TR_CHIRP3_HD_AOEDE("Google.tr-TR-Chirp3-HD-Aoede"), + GOOGLE_TR_TR_CHIRP3_HD_CHARON("Google.tr-TR-Chirp3-HD-Charon"), + GOOGLE_TR_TR_CHIRP3_HD_FENRIR("Google.tr-TR-Chirp3-HD-Fenrir"), + GOOGLE_TR_TR_CHIRP3_HD_KORE("Google.tr-TR-Chirp3-HD-Kore"), + GOOGLE_TR_TR_CHIRP3_HD_LEDA("Google.tr-TR-Chirp3-HD-Leda"), + GOOGLE_TR_TR_CHIRP3_HD_ORUS("Google.tr-TR-Chirp3-HD-Orus"), + GOOGLE_TR_TR_CHIRP3_HD_PUCK("Google.tr-TR-Chirp3-HD-Puck"), + GOOGLE_TR_TR_CHIRP3_HD_ZEPHYR("Google.tr-TR-Chirp3-HD-Zephyr"), GOOGLE_TR_TR_STANDARD_A("Google.tr-TR-Standard-A"), GOOGLE_TR_TR_STANDARD_B("Google.tr-TR-Standard-B"), GOOGLE_TR_TR_STANDARD_C("Google.tr-TR-Standard-C"), @@ -415,6 +761,14 @@ public enum Voice { GOOGLE_TR_TR_WAVENET_E("Google.tr-TR-Wavenet-E"), GOOGLE_UK_UA_STANDARD_A("Google.uk-UA-Standard-A"), GOOGLE_UK_UA_WAVENET_A("Google.uk-UA-Wavenet-A"), + GOOGLE_VI_VN_CHIRP3_HD_AOEDE("Google.vi-VN-Chirp3-HD-Aoede"), + GOOGLE_VI_VN_CHIRP3_HD_CHARON("Google.vi-VN-Chirp3-HD-Charon"), + GOOGLE_VI_VN_CHIRP3_HD_FENRIR("Google.vi-VN-Chirp3-HD-Fenrir"), + GOOGLE_VI_VN_CHIRP3_HD_KORE("Google.vi-VN-Chirp3-HD-Kore"), + GOOGLE_VI_VN_CHIRP3_HD_LEDA("Google.vi-VN-Chirp3-HD-Leda"), + GOOGLE_VI_VN_CHIRP3_HD_ORUS("Google.vi-VN-Chirp3-HD-Orus"), + GOOGLE_VI_VN_CHIRP3_HD_PUCK("Google.vi-VN-Chirp3-HD-Puck"), + GOOGLE_VI_VN_CHIRP3_HD_ZEPHYR("Google.vi-VN-Chirp3-HD-Zephyr"), GOOGLE_VI_VN_NEURAL2_A("Google.vi-VN-Neural2-A"), GOOGLE_VI_VN_NEURAL2_D("Google.vi-VN-Neural2-D"), GOOGLE_VI_VN_STANDARD_A("Google.vi-VN-Standard-A"), @@ -459,6 +813,7 @@ public enum Voice { POLLY_JUSTIN("Polly.Justin"), POLLY_KARL("Polly.Karl"), POLLY_KENDRA("Polly.Kendra"), + POLLY_KEVIN("Polly.Kevin"), POLLY_KIMBERLY("Polly.Kimberly"), POLLY_LEA("Polly.Lea"), POLLY_LIV("Polly.Liv"), @@ -498,6 +853,7 @@ public enum Voice { POLLY_AYANDA_NEURAL("Polly.Ayanda-Neural"), POLLY_BIANCA_NEURAL("Polly.Bianca-Neural"), POLLY_BRIAN_NEURAL("Polly.Brian-Neural"), + POLLY_BURCU_NEURAL("Polly.Burcu-Neural"), POLLY_CAMILA_NEURAL("Polly.Camila-Neural"), POLLY_DANIEL_NEURAL("Polly.Daniel-Neural"), POLLY_DANIELLE_NEURAL("Polly.Danielle-Neural"), @@ -541,12 +897,32 @@ public enum Voice { POLLY_STEPHEN_NEURAL("Polly.Stephen-Neural"), POLLY_SUVI_NEURAL("Polly.Suvi-Neural"), POLLY_TAKUMI_NEURAL("Polly.Takumi-Neural"), - POLLY_TOMOKO_NEURAL("Polly.Tomoko-Neural"), POLLY_THIAGO_NEURAL("Polly.Thiago-Neural"), + POLLY_TOMOKO_NEURAL("Polly.Tomoko-Neural"), POLLY_VICKI_NEURAL("Polly.Vicki-Neural"), POLLY_VITORIA_NEURAL("Polly.Vitoria-Neural"), POLLY_ZAYD_NEURAL("Polly.Zayd-Neural"), - POLLY_ZHIYU_NEURAL("Polly.Zhiyu-Neural"); + POLLY_ZHIYU_NEURAL("Polly.Zhiyu-Neural"), + POLLY_AMY_GENERATIVE("Polly.Amy-Generative"), + POLLY_ANDRES_GENERATIVE("Polly.Andres-Generative"), + POLLY_AYANDA_GENERATIVE("Polly.Ayanda-Generative"), + POLLY_BIANCA_GENERATIVE("Polly.Bianca-Generative"), + POLLY_DANIEL_GENERATIVE("Polly.Daniel-Generative"), + POLLY_DANIELLE_GENERATIVE("Polly.Danielle-Generative"), + POLLY_JOANNA_GENERATIVE("Polly.Joanna-Generative"), + POLLY_KAJAL_GENERATIVE("Polly.Kajal-Generative"), + POLLY_LEA_GENERATIVE("Polly.Lea-Generative"), + POLLY_LUCIA_GENERATIVE("Polly.Lucia-Generative"), + POLLY_LUPE_GENERATIVE("Polly.Lupe-Generative"), + POLLY_MATTHEW_GENERATIVE("Polly.Matthew-Generative"), + POLLY_MÍA_GENERATIVE("Polly.Mía-Generative"), + POLLY_OLIVIA_GENERATIVE("Polly.Olivia-Generative"), + POLLY_PEDRO_GENERATIVE("Polly.Pedro-Generative"), + POLLY_RÉMI_GENERATIVE("Polly.Rémi-Generative"), + POLLY_RUTH_GENERATIVE("Polly.Ruth-Generative"), + POLLY_SERGIO_GENERATIVE("Polly.Sergio-Generative"), + POLLY_STEPHEN_GENERATIVE("Polly.Stephen-Generative"), + POLLY_VICKI_GENERATIVE("Polly.Vicki-Generative"); private final String value; diff --git a/src/main/java/com/twilio/twiml/voice/WhatsApp.java b/src/main/java/com/twilio/twiml/voice/WhatsApp.java new file mode 100644 index 0000000000..1556ead3c4 --- /dev/null +++ b/src/main/java/com/twilio/twiml/voice/WhatsApp.java @@ -0,0 +1,299 @@ +/** + * This code was generated by + * \ / _ _ _| _ _ + * | (_)\/(_)(_|\/| |(/_ v1.0.0 + * / / + */ + +package com.twilio.twiml.voice; + +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.fasterxml.jackson.databind.annotation.JsonPOJOBuilder; +import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlProperty; +import com.twilio.converter.Promoter; +import com.twilio.http.HttpMethod; +import com.twilio.twiml.TwiML; +import com.twilio.twiml.TwiMLException; + +import java.net.URI; +import java.util.HashMap; +import java.util.Iterator; +import java.util.List; +import java.util.Map; + +/** + * TwiML wrapper for {@code } + */ +@JsonDeserialize(builder = WhatsApp.Builder.class) +public class WhatsApp extends TwiML { + public enum Event { + INITIATED("initiated"), + RINGING("ringing"), + ANSWERED("answered"), + COMPLETED("completed"); + + private final String value; + + private Event(final String value) { + this.value = value; + } + + public String toString() { + return value; + } + } + + private final URI url; + private final HttpMethod method; + private final List statusCallbackEvent; + private final URI statusCallback; + private final HttpMethod statusCallbackMethod; + private final com.twilio.type.PhoneNumber phoneNumber; + + /** + * For XML Serialization/Deserialization + */ + private WhatsApp() { + this(new Builder((com.twilio.type.PhoneNumber) null)); + } + + /** + * Create a new {@code } element + */ + private WhatsApp(Builder b) { + super("WhatsApp", b); + this.url = b.url; + this.method = b.method; + this.statusCallbackEvent = b.statusCallbackEvent; + this.statusCallback = b.statusCallback; + this.statusCallbackMethod = b.statusCallbackMethod; + this.phoneNumber = b.phoneNumber; + } + + /** + * The body of the TwiML element + * + * @return Element body as a string if present else null + */ + protected String getElementBody() { + return this.getPhoneNumber() == null ? null : this.getPhoneNumber().toString(); + } + + /** + * Attributes to set on the generated XML element + * + * @return A Map of attribute keys to values + */ + protected Map getElementAttributes() { + // Preserve order of attributes + Map attrs = new HashMap<>(); + + if (this.getUrl() != null) { + attrs.put("url", this.getUrl().toString()); + } + if (this.getMethod() != null) { + attrs.put("method", this.getMethod().toString()); + } + if (this.getStatusCallbackEvents() != null) { + attrs.put("statusCallbackEvent", this.getStatusCallbackEventsAsString()); + } + if (this.getStatusCallback() != null) { + attrs.put("statusCallback", this.getStatusCallback().toString()); + } + if (this.getStatusCallbackMethod() != null) { + attrs.put("statusCallbackMethod", this.getStatusCallbackMethod().toString()); + } + + return attrs; + } + + /** + * TwiML URL + * + * @return TwiML URL + */ + public URI getUrl() { + return url; + } + + /** + * TwiML URL Method + * + * @return TwiML URL Method + */ + public HttpMethod getMethod() { + return method; + } + + /** + * Events to trigger status callback + * + * @return Events to trigger status callback + */ + public List getStatusCallbackEvents() { + return statusCallbackEvent; + } + + protected String getStatusCallbackEventsAsString() { + StringBuilder sb = new StringBuilder(); + Iterator iter = this.getStatusCallbackEvents().iterator(); + while (iter.hasNext()) { + sb.append(iter.next().toString()); + if (iter.hasNext()) { + sb.append(" "); + } + } + return sb.toString(); + } + + /** + * Status Callback URL + * + * @return Status Callback URL + */ + public URI getStatusCallback() { + return statusCallback; + } + + /** + * Status Callback URL Method + * + * @return Status Callback URL Method + */ + public HttpMethod getStatusCallbackMethod() { + return statusCallbackMethod; + } + + /** + * WhatsApp Phone Number to dial + * + * @return WhatsApp Phone Number to dial + */ + public com.twilio.type.PhoneNumber getPhoneNumber() { + return phoneNumber; + } + + /** + * Create a new {@code } element + */ + @JsonPOJOBuilder(withPrefix = "") + public static class Builder extends TwiML.Builder { + /** + * Create and return a {@code } from an XML string + */ + public static Builder fromXml(final String xml) throws TwiMLException { + try { + return OBJECT_MAPPER.readValue(xml, Builder.class); + } catch (final JsonProcessingException jpe) { + throw new TwiMLException( + "Failed to deserialize a WhatsApp.Builder from the provided XML string: " + jpe.getMessage()); + } catch (final Exception e) { + throw new TwiMLException("Unhandled exception: " + e.getMessage()); + } + } + + private URI url; + private HttpMethod method; + private List statusCallbackEvent; + private URI statusCallback; + private HttpMethod statusCallbackMethod; + private com.twilio.type.PhoneNumber phoneNumber; + + /** + * Create a {@code } with phoneNumber + */ + public Builder(com.twilio.type.PhoneNumber phoneNumber) { + this.phoneNumber = phoneNumber; + } + + /** + * Create a {@code } with phoneNumber + */ + public Builder(String phoneNumber) { + this.phoneNumber = Promoter.phoneNumberFromString(phoneNumber); + } + + /** + * Create a {@code } (for XML deserialization) + */ + private Builder() { + } + + /** + * TwiML URL + */ + @JacksonXmlProperty(isAttribute = true, localName = "url") + public Builder url(URI url) { + this.url = url; + return this; + } + + /** + * TwiML URL + */ + public Builder url(String url) { + this.url = Promoter.uriFromString(url); + return this; + } + + /** + * TwiML URL Method + */ + @JacksonXmlProperty(isAttribute = true, localName = "method") + public Builder method(HttpMethod method) { + this.method = method; + return this; + } + + /** + * Events to trigger status callback + */ + @JacksonXmlProperty(isAttribute = true, localName = "statusCallbackEvent") + public Builder statusCallbackEvents(List statusCallbackEvent) { + this.statusCallbackEvent = statusCallbackEvent; + return this; + } + + /** + * Events to trigger status callback + */ + public Builder statusCallbackEvents(WhatsApp.Event statusCallbackEvent) { + this.statusCallbackEvent = Promoter.listOfOne(statusCallbackEvent); + return this; + } + + /** + * Status Callback URL + */ + @JacksonXmlProperty(isAttribute = true, localName = "statusCallback") + public Builder statusCallback(URI statusCallback) { + this.statusCallback = statusCallback; + return this; + } + + /** + * Status Callback URL + */ + public Builder statusCallback(String statusCallback) { + this.statusCallback = Promoter.uriFromString(statusCallback); + return this; + } + + /** + * Status Callback URL Method + */ + @JacksonXmlProperty(isAttribute = true, localName = "statusCallbackMethod") + public Builder statusCallbackMethod(HttpMethod statusCallbackMethod) { + this.statusCallbackMethod = statusCallbackMethod; + return this; + } + + /** + * Create and return resulting {@code } element + */ + public WhatsApp build() { + return new WhatsApp(this); + } + } +} \ No newline at end of file diff --git a/src/test/java/com/twilio/ClusterTest.java b/src/test/java/com/twilio/ClusterTest.java index 328609a1c5..48e0fc3f39 100644 --- a/src/test/java/com/twilio/ClusterTest.java +++ b/src/test/java/com/twilio/ClusterTest.java @@ -38,7 +38,7 @@ public class ClusterTest { String clientSecret; String messageSid; TwilioRestClient customRestClient; - + String accountSid; @Before @@ -57,11 +57,11 @@ public void setUp() { orgsClientSecret = System.getenv("TWILIO_ORGS_CLIENT_SECRET"); organisationSid = System.getenv("TWILIO_ORG_SID"); TwilioOrgsTokenAuth.init(grantType, orgsClientId, orgsClientSecret); - + clientId = System.getenv("TWILIO_CLIENT_ID"); clientSecret = System.getenv("TWILIO_CLIENT_SECRET"); messageSid = System.getenv("TWILIO_MESSAGE_SID"); - + // CustomHttpClient customRestClient = new TwilioRestClient.Builder(apiKey, secret).accountSid(accountSid).httpClient(new CustomHttpClient()).build(); } @@ -117,7 +117,7 @@ public void testListParams() { sinkConfiguration.put("destination", "http://example.org/webhook"); sinkConfiguration.put("method", "post"); sinkConfiguration.put("batch_events",false); - List> types = new ArrayList<>(); + List types = new ArrayList<>(); Map types1 = new HashMap<>(); Map types2 = new HashMap<>(); types1.put("type", "com.twilio.messaging.message.delivered"); @@ -175,7 +175,7 @@ public void testMultiPartFormData() { // @Test // public void testPublicOAuthFetchMessage() { // Twilio.init(new ClientCredentialProvider(clientId, clientSecret), accountSid); -// // Fetching an existing message; if this test fails, the SID might be deleted, +// // Fetching an existing message; if this test fails, the SID might be deleted, // // in that case, change TWILIO_MESSAGE_SID in twilio-java repo env variables // Message message = Message.fetcher(messageSid).fetch(); // assertNotNull(message); diff --git a/src/test/java/com/twilio/base/ResourceSetIterationTest.java b/src/test/java/com/twilio/base/ResourceSetIterationTest.java new file mode 100644 index 0000000000..7cc7a8b80f --- /dev/null +++ b/src/test/java/com/twilio/base/ResourceSetIterationTest.java @@ -0,0 +1,148 @@ +package com.twilio.base; + +import com.twilio.http.TwilioRestClient; +import org.junit.Assert; +import org.junit.Before; +import org.junit.Test; +import org.mockito.Mock; +import org.mockito.MockitoAnnotations; + +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Iterator; +import java.util.List; + +import static org.mockito.Mockito.when; + +// Simple test resource for testing ResourceSet iteration +class TestResource extends Resource { + private final String id; + + public TestResource(String id) { + this.id = id; + } + + public String getId() { + return id; + } +} + +// Simple test reader for testing ResourceSet iteration +class TestReader extends Reader { + @Override + public ResourceSet read(TwilioRestClient client) { + return null; // Not needed for our test + } + + @Override + public Page firstPage(TwilioRestClient client) { + return null; // Not needed for our test + } + + @Override + public Page previousPage(Page page, TwilioRestClient client) { + return null; // Not needed for our test + } + + @Override + public Page nextPage(Page page, TwilioRestClient client) { + return null; // Not needed for our test + } + + @Override + public Page getPage(String targetUrl, TwilioRestClient client) { + return null; // Not needed for our test + } +} + +public class ResourceSetIterationTest { + + @Mock + TwilioRestClient client; + + @Mock + Page page; + + @Before + public void init() { + MockitoAnnotations.initMocks(this); + } + + @Test + public void testResourceSetCanBeIteratedMultipleTimes() { + // Setup mock data with concrete objects + TestResource resource1 = new TestResource("resource1"); + TestResource resource2 = new TestResource("resource2"); + List resources = Arrays.asList(resource1, resource2); + + when(page.getRecords()).thenReturn(resources); + when(page.getPageSize()).thenReturn(2); + when(page.hasNextPage()).thenReturn(false); + + Reader reader = new TestReader().limit(2); + ResourceSet resourceSet = new ResourceSet<>(reader, client, page); + + // First iteration - should work + List firstIterationResults = new ArrayList<>(); + for (TestResource resource : resourceSet) { + firstIterationResults.add(resource.getId()); + } + Assert.assertEquals(2, firstIterationResults.size()); + Assert.assertEquals("resource1", firstIterationResults.get(0)); + Assert.assertEquals("resource2", firstIterationResults.get(1)); + + // Second iteration - should also work and return the same results + List secondIterationResults = new ArrayList<>(); + for (TestResource resource : resourceSet) { + secondIterationResults.add(resource.getId()); + } + Assert.assertEquals("Second iteration should return same number of elements", 2, secondIterationResults.size()); + Assert.assertEquals("resource1", secondIterationResults.get(0)); + Assert.assertEquals("resource2", secondIterationResults.get(1)); + + // Third iteration using explicit iterator - should also work + List thirdIterationResults = new ArrayList<>(); + for (Iterator it = resourceSet.iterator(); it.hasNext(); ) { + TestResource resource = it.next(); + thirdIterationResults.add(resource.getId()); + } + Assert.assertEquals("Third iteration should return same number of elements", 2, thirdIterationResults.size()); + Assert.assertEquals("resource1", thirdIterationResults.get(0)); + Assert.assertEquals("resource2", thirdIterationResults.get(1)); + } + + @Test + public void testResourceSetWithLimitCanBeIteratedMultipleTimes() { + // Setup mock data with more resources than the limit + TestResource resource1 = new TestResource("resource1"); + TestResource resource2 = new TestResource("resource2"); + TestResource resource3 = new TestResource("resource3"); + List resources = Arrays.asList(resource1, resource2, resource3); + + when(page.getRecords()).thenReturn(resources); + when(page.getPageSize()).thenReturn(3); + when(page.hasNextPage()).thenReturn(false); + + // Set limit to 2, so only first 2 should be returned + Reader reader = new TestReader().limit(2); + ResourceSet resourceSet = new ResourceSet<>(reader, client, page); + + // First iteration - should only return 2 elements due to limit + List firstIterationResults = new ArrayList<>(); + for (TestResource resource : resourceSet) { + firstIterationResults.add(resource.getId()); + } + Assert.assertEquals("First iteration should respect limit", 2, firstIterationResults.size()); + Assert.assertEquals("resource1", firstIterationResults.get(0)); + Assert.assertEquals("resource2", firstIterationResults.get(1)); + + // Second iteration - should also respect limit and return same results + List secondIterationResults = new ArrayList<>(); + for (TestResource resource : resourceSet) { + secondIterationResults.add(resource.getId()); + } + Assert.assertEquals("Second iteration should respect limit", 2, secondIterationResults.size()); + Assert.assertEquals("resource1", secondIterationResults.get(0)); + Assert.assertEquals("resource2", secondIterationResults.get(1)); + } +} \ No newline at end of file diff --git a/src/test/java/com/twilio/twiml/voice/DialTest.java b/src/test/java/com/twilio/twiml/voice/DialTest.java index df5e2d3b31..8d6da7c853 100644 --- a/src/test/java/com/twilio/twiml/voice/DialTest.java +++ b/src/test/java/com/twilio/twiml/voice/DialTest.java @@ -167,6 +167,14 @@ public void testElementWithChildren() { .copyParentTo(true) .build()); + builder.whatsApp(new WhatsApp.Builder(new com.twilio.type.PhoneNumber("+15017122661")) + .url(URI.create("https://example.com")) + .method(HttpMethod.GET) + .statusCallbackEvents(Promoter.listOfOne(WhatsApp.Event.INITIATED)) + .statusCallback(URI.create("https://example.com")) + .statusCallbackMethod(HttpMethod.GET) + .build()); + Dial elem = builder.build(); Assert.assertEquals( @@ -179,6 +187,7 @@ public void testElementWithChildren() { "DEXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX" + "https://example.com" + "application_sid" + + "+15017122661" + "", elem.toXml() ); @@ -379,6 +388,14 @@ public void testXmlChildrenDeserialization() { .copyParentTo(true) .build()); + builder.whatsApp(new WhatsApp.Builder(new com.twilio.type.PhoneNumber("+15017122661")) + .url(URI.create("https://example.com")) + .method(HttpMethod.GET) + .statusCallbackEvents(Promoter.listOfOne(WhatsApp.Event.INITIATED)) + .statusCallback(URI.create("https://example.com")) + .statusCallbackMethod(HttpMethod.GET) + .build()); + final Dial elem = builder.build(); Assert.assertEquals( @@ -390,6 +407,7 @@ public void testXmlChildrenDeserialization() { "DEXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX" + "https://example.com" + "application_sid" + + "+15017122661" + "").build().toXml(), elem.toXml() ); diff --git a/src/test/java/com/twilio/twiml/voice/WhatsAppTest.java b/src/test/java/com/twilio/twiml/voice/WhatsAppTest.java new file mode 100644 index 0000000000..4c6b47bfa1 --- /dev/null +++ b/src/test/java/com/twilio/twiml/voice/WhatsAppTest.java @@ -0,0 +1,54 @@ +/** + * This code was generated by + * \ / _ _ _| _ _ + * | (_)\/(_)(_|\/| |(/_ v1.0.0 + * / / + */ + +package com.twilio.twiml.voice; + +import com.twilio.converter.Promoter; +import com.twilio.http.HttpMethod; +import org.junit.Assert; +import org.junit.Test; + +import java.net.URI; +import java.util.List; + +/** + * Test class for {@link WhatsApp} + */ +public class WhatsAppTest { + @Test + public void testElementWithParams() { + WhatsApp elem = new WhatsApp.Builder(new com.twilio.type.PhoneNumber("+15017122661")) + .url(URI.create("https://example.com")) + .method(HttpMethod.GET) + .statusCallbackEvents(Promoter.listOfOne(WhatsApp.Event.INITIATED)) + .statusCallback(URI.create("https://example.com")) + .statusCallbackMethod(HttpMethod.GET) + .build(); + + Assert.assertEquals( + "" + + "+15017122661", + elem.toXml() + ); + } + + @Test + public void testXmlAttributesDeserialization() { + final WhatsApp elem = new WhatsApp.Builder(new com.twilio.type.PhoneNumber("+15017122661")) + .url(URI.create("https://example.com")) + .method(HttpMethod.GET) + .statusCallbackEvents(Promoter.listOfOne(WhatsApp.Event.INITIATED)) + .statusCallback(URI.create("https://example.com")) + .statusCallbackMethod(HttpMethod.GET) + .build(); + + Assert.assertEquals( + WhatsApp.Builder.fromXml("+15017122661").build().toXml(), + elem.toXml() + ); + } +} \ No newline at end of file