From 3d9a537f969678240e4117f08d01e9066daedd1f Mon Sep 17 00:00:00 2001 From: Twilio Date: Sun, 14 Jan 2024 14:45:18 +0000 Subject: [PATCH] [Librarian] Regenerated @ 3e6ad1f24c7f9fc3d3bf3465cc2bdd014b1f6311 --- CHANGES.md | 6 + src/main/java/com/twilio/Domains.java | 1 - .../twilio/rest/autopilot/v1/Assistant.java | 261 ----------------- .../rest/autopilot/v1/AssistantCreator.java | 147 ---------- .../rest/autopilot/v1/AssistantDeleter.java | 67 ----- .../rest/autopilot/v1/AssistantFetcher.java | 71 ----- .../rest/autopilot/v1/AssistantReader.java | 133 --------- .../rest/autopilot/v1/AssistantUpdater.java | 158 ---------- .../rest/autopilot/v1/RestoreAssistant.java | 225 --------------- .../autopilot/v1/RestoreAssistantUpdater.java | 84 ------ .../rest/autopilot/v1/assistant/Defaults.java | 150 ---------- .../v1/assistant/DefaultsFetcher.java | 75 ----- .../v1/assistant/DefaultsUpdater.java | 91 ------ .../rest/autopilot/v1/assistant/Dialogue.java | 157 ---------- .../v1/assistant/DialogueFetcher.java | 81 ------ .../autopilot/v1/assistant/FieldType.java | 226 --------------- .../v1/assistant/FieldTypeCreator.java | 104 ------- .../v1/assistant/FieldTypeDeleter.java | 77 ----- .../v1/assistant/FieldTypeFetcher.java | 81 ------ .../v1/assistant/FieldTypeReader.java | 141 --------- .../v1/assistant/FieldTypeUpdater.java | 104 ------- .../autopilot/v1/assistant/ModelBuild.java | 254 ---------------- .../v1/assistant/ModelBuildCreator.java | 105 ------- .../v1/assistant/ModelBuildDeleter.java | 77 ----- .../v1/assistant/ModelBuildFetcher.java | 81 ------ .../v1/assistant/ModelBuildReader.java | 141 --------- .../v1/assistant/ModelBuildUpdater.java | 95 ------ .../rest/autopilot/v1/assistant/Query.java | 272 ------------------ .../autopilot/v1/assistant/QueryCreator.java | 121 -------- .../autopilot/v1/assistant/QueryDeleter.java | 74 ----- .../autopilot/v1/assistant/QueryFetcher.java | 75 ----- .../autopilot/v1/assistant/QueryReader.java | 177 ------------ .../autopilot/v1/assistant/QueryUpdater.java | 98 ------- .../autopilot/v1/assistant/StyleSheet.java | 150 ---------- .../v1/assistant/StyleSheetFetcher.java | 75 ----- .../v1/assistant/StyleSheetUpdater.java | 93 ------ .../rest/autopilot/v1/assistant/Task.java | 235 --------------- .../autopilot/v1/assistant/TaskCreator.java | 127 -------- .../autopilot/v1/assistant/TaskDeleter.java | 74 ----- .../autopilot/v1/assistant/TaskFetcher.java | 75 ----- .../autopilot/v1/assistant/TaskReader.java | 141 --------- .../autopilot/v1/assistant/TaskUpdater.java | 124 -------- .../rest/autopilot/v1/assistant/Webhook.java | 240 ---------------- .../v1/assistant/WebhookCreator.java | 133 --------- .../v1/assistant/WebhookDeleter.java | 74 ----- .../v1/assistant/WebhookFetcher.java | 75 ----- .../autopilot/v1/assistant/WebhookReader.java | 141 --------- .../v1/assistant/WebhookUpdater.java | 122 -------- .../v1/assistant/fieldtype/FieldValue.java | 246 ---------------- .../fieldtype/FieldValueCreator.java | 124 -------- .../fieldtype/FieldValueDeleter.java | 86 ------ .../fieldtype/FieldValueFetcher.java | 90 ------ .../assistant/fieldtype/FieldValueReader.java | 161 ----------- .../autopilot/v1/assistant/task/Field.java | 229 --------------- .../v1/assistant/task/FieldCreator.java | 108 ------- .../v1/assistant/task/FieldDeleter.java | 82 ------ .../v1/assistant/task/FieldFetcher.java | 83 ------ .../v1/assistant/task/FieldReader.java | 147 ---------- .../autopilot/v1/assistant/task/Sample.java | 246 ---------------- .../v1/assistant/task/SampleCreator.java | 117 -------- .../v1/assistant/task/SampleDeleter.java | 82 ------ .../v1/assistant/task/SampleFetcher.java | 83 ------ .../v1/assistant/task/SampleReader.java | 156 ---------- .../v1/assistant/task/SampleUpdater.java | 115 -------- .../v1/assistant/task/TaskActions.java | 164 ----------- .../v1/assistant/task/TaskActionsFetcher.java | 81 ------ .../v1/assistant/task/TaskActionsUpdater.java | 97 ------- .../v1/assistant/task/TaskStatistics.java | 170 ----------- .../assistant/task/TaskStatisticsFetcher.java | 82 ------ .../rest/preview/understand/Assistant.java | 243 ---------------- .../preview/understand/AssistantCreator.java | 166 ----------- .../preview/understand/AssistantDeleter.java | 67 ----- .../preview/understand/AssistantFetcher.java | 71 ----- .../preview/understand/AssistantReader.java | 133 --------- .../preview/understand/AssistantUpdater.java | 168 ----------- .../assistant/AssistantFallbackActions.java | 154 ---------- .../AssistantFallbackActionsFetcher.java | 76 ----- .../AssistantFallbackActionsUpdater.java | 97 ------- .../assistant/AssistantInitiationActions.java | 160 ----------- .../AssistantInitiationActionsFetcher.java | 76 ----- .../AssistantInitiationActionsUpdater.java | 97 ------- .../understand/assistant/Dialogue.java | 157 ---------- .../understand/assistant/DialogueFetcher.java | 81 ------ .../understand/assistant/FieldType.java | 226 --------------- .../assistant/FieldTypeCreator.java | 104 ------- .../assistant/FieldTypeDeleter.java | 77 ----- .../assistant/FieldTypeFetcher.java | 81 ------ .../understand/assistant/FieldTypeReader.java | 141 --------- .../assistant/FieldTypeUpdater.java | 104 ------- .../understand/assistant/ModelBuild.java | 254 ---------------- .../assistant/ModelBuildCreator.java | 105 ------- .../assistant/ModelBuildDeleter.java | 77 ----- .../assistant/ModelBuildFetcher.java | 81 ------ .../assistant/ModelBuildReader.java | 141 --------- .../assistant/ModelBuildUpdater.java | 95 ------ .../preview/understand/assistant/Query.java | 263 ----------------- .../understand/assistant/QueryCreator.java | 130 --------- .../understand/assistant/QueryDeleter.java | 74 ----- .../understand/assistant/QueryFetcher.java | 75 ----- .../understand/assistant/QueryReader.java | 168 ----------- .../understand/assistant/QueryUpdater.java | 98 ------- .../understand/assistant/StyleSheet.java | 150 ---------- .../assistant/StyleSheetFetcher.java | 75 ----- .../assistant/StyleSheetUpdater.java | 93 ------ .../preview/understand/assistant/Task.java | 235 --------------- .../understand/assistant/TaskCreator.java | 127 -------- .../understand/assistant/TaskDeleter.java | 74 ----- .../understand/assistant/TaskFetcher.java | 75 ----- .../understand/assistant/TaskReader.java | 141 --------- .../understand/assistant/TaskUpdater.java | 124 -------- .../assistant/fieldtype/FieldValue.java | 246 ---------------- .../fieldtype/FieldValueCreator.java | 124 -------- .../fieldtype/FieldValueDeleter.java | 86 ------ .../fieldtype/FieldValueFetcher.java | 90 ------ .../assistant/fieldtype/FieldValueReader.java | 161 ----------- .../understand/assistant/task/Field.java | 229 --------------- .../assistant/task/FieldCreator.java | 109 ------- .../assistant/task/FieldDeleter.java | 82 ------ .../assistant/task/FieldFetcher.java | 83 ------ .../assistant/task/FieldReader.java | 148 ---------- .../understand/assistant/task/Sample.java | 246 ---------------- .../assistant/task/SampleCreator.java | 118 -------- .../assistant/task/SampleDeleter.java | 82 ------ .../assistant/task/SampleFetcher.java | 83 ------ .../assistant/task/SampleReader.java | 157 ---------- .../assistant/task/SampleUpdater.java | 115 -------- .../assistant/task/TaskActions.java | 164 ----------- .../assistant/task/TaskActionsFetcher.java | 82 ------ .../assistant/task/TaskActionsUpdater.java | 98 ------- .../assistant/task/TaskStatistics.java | 170 ----------- .../assistant/task/TaskStatisticsFetcher.java | 82 ------ 131 files changed, 6 insertions(+), 16521 deletions(-) delete mode 100644 src/main/java/com/twilio/rest/autopilot/v1/Assistant.java delete mode 100644 src/main/java/com/twilio/rest/autopilot/v1/AssistantCreator.java delete mode 100644 src/main/java/com/twilio/rest/autopilot/v1/AssistantDeleter.java delete mode 100644 src/main/java/com/twilio/rest/autopilot/v1/AssistantFetcher.java delete mode 100644 src/main/java/com/twilio/rest/autopilot/v1/AssistantReader.java delete mode 100644 src/main/java/com/twilio/rest/autopilot/v1/AssistantUpdater.java delete mode 100644 src/main/java/com/twilio/rest/autopilot/v1/RestoreAssistant.java delete mode 100644 src/main/java/com/twilio/rest/autopilot/v1/RestoreAssistantUpdater.java delete mode 100644 src/main/java/com/twilio/rest/autopilot/v1/assistant/Defaults.java delete mode 100644 src/main/java/com/twilio/rest/autopilot/v1/assistant/DefaultsFetcher.java delete mode 100644 src/main/java/com/twilio/rest/autopilot/v1/assistant/DefaultsUpdater.java delete mode 100644 src/main/java/com/twilio/rest/autopilot/v1/assistant/Dialogue.java delete mode 100644 src/main/java/com/twilio/rest/autopilot/v1/assistant/DialogueFetcher.java delete mode 100644 src/main/java/com/twilio/rest/autopilot/v1/assistant/FieldType.java delete mode 100644 src/main/java/com/twilio/rest/autopilot/v1/assistant/FieldTypeCreator.java delete mode 100644 src/main/java/com/twilio/rest/autopilot/v1/assistant/FieldTypeDeleter.java delete mode 100644 src/main/java/com/twilio/rest/autopilot/v1/assistant/FieldTypeFetcher.java delete mode 100644 src/main/java/com/twilio/rest/autopilot/v1/assistant/FieldTypeReader.java delete mode 100644 src/main/java/com/twilio/rest/autopilot/v1/assistant/FieldTypeUpdater.java delete mode 100644 src/main/java/com/twilio/rest/autopilot/v1/assistant/ModelBuild.java delete mode 100644 src/main/java/com/twilio/rest/autopilot/v1/assistant/ModelBuildCreator.java delete mode 100644 src/main/java/com/twilio/rest/autopilot/v1/assistant/ModelBuildDeleter.java delete mode 100644 src/main/java/com/twilio/rest/autopilot/v1/assistant/ModelBuildFetcher.java delete mode 100644 src/main/java/com/twilio/rest/autopilot/v1/assistant/ModelBuildReader.java delete mode 100644 src/main/java/com/twilio/rest/autopilot/v1/assistant/ModelBuildUpdater.java delete mode 100644 src/main/java/com/twilio/rest/autopilot/v1/assistant/Query.java delete mode 100644 src/main/java/com/twilio/rest/autopilot/v1/assistant/QueryCreator.java delete mode 100644 src/main/java/com/twilio/rest/autopilot/v1/assistant/QueryDeleter.java delete mode 100644 src/main/java/com/twilio/rest/autopilot/v1/assistant/QueryFetcher.java delete mode 100644 src/main/java/com/twilio/rest/autopilot/v1/assistant/QueryReader.java delete mode 100644 src/main/java/com/twilio/rest/autopilot/v1/assistant/QueryUpdater.java delete mode 100644 src/main/java/com/twilio/rest/autopilot/v1/assistant/StyleSheet.java delete mode 100644 src/main/java/com/twilio/rest/autopilot/v1/assistant/StyleSheetFetcher.java delete mode 100644 src/main/java/com/twilio/rest/autopilot/v1/assistant/StyleSheetUpdater.java delete mode 100644 src/main/java/com/twilio/rest/autopilot/v1/assistant/Task.java delete mode 100644 src/main/java/com/twilio/rest/autopilot/v1/assistant/TaskCreator.java delete mode 100644 src/main/java/com/twilio/rest/autopilot/v1/assistant/TaskDeleter.java delete mode 100644 src/main/java/com/twilio/rest/autopilot/v1/assistant/TaskFetcher.java delete mode 100644 src/main/java/com/twilio/rest/autopilot/v1/assistant/TaskReader.java delete mode 100644 src/main/java/com/twilio/rest/autopilot/v1/assistant/TaskUpdater.java delete mode 100644 src/main/java/com/twilio/rest/autopilot/v1/assistant/Webhook.java delete mode 100644 src/main/java/com/twilio/rest/autopilot/v1/assistant/WebhookCreator.java delete mode 100644 src/main/java/com/twilio/rest/autopilot/v1/assistant/WebhookDeleter.java delete mode 100644 src/main/java/com/twilio/rest/autopilot/v1/assistant/WebhookFetcher.java delete mode 100644 src/main/java/com/twilio/rest/autopilot/v1/assistant/WebhookReader.java delete mode 100644 src/main/java/com/twilio/rest/autopilot/v1/assistant/WebhookUpdater.java delete mode 100644 src/main/java/com/twilio/rest/autopilot/v1/assistant/fieldtype/FieldValue.java delete mode 100644 src/main/java/com/twilio/rest/autopilot/v1/assistant/fieldtype/FieldValueCreator.java delete mode 100644 src/main/java/com/twilio/rest/autopilot/v1/assistant/fieldtype/FieldValueDeleter.java delete mode 100644 src/main/java/com/twilio/rest/autopilot/v1/assistant/fieldtype/FieldValueFetcher.java delete mode 100644 src/main/java/com/twilio/rest/autopilot/v1/assistant/fieldtype/FieldValueReader.java delete mode 100644 src/main/java/com/twilio/rest/autopilot/v1/assistant/task/Field.java delete mode 100644 src/main/java/com/twilio/rest/autopilot/v1/assistant/task/FieldCreator.java delete mode 100644 src/main/java/com/twilio/rest/autopilot/v1/assistant/task/FieldDeleter.java delete mode 100644 src/main/java/com/twilio/rest/autopilot/v1/assistant/task/FieldFetcher.java delete mode 100644 src/main/java/com/twilio/rest/autopilot/v1/assistant/task/FieldReader.java delete mode 100644 src/main/java/com/twilio/rest/autopilot/v1/assistant/task/Sample.java delete mode 100644 src/main/java/com/twilio/rest/autopilot/v1/assistant/task/SampleCreator.java delete mode 100644 src/main/java/com/twilio/rest/autopilot/v1/assistant/task/SampleDeleter.java delete mode 100644 src/main/java/com/twilio/rest/autopilot/v1/assistant/task/SampleFetcher.java delete mode 100644 src/main/java/com/twilio/rest/autopilot/v1/assistant/task/SampleReader.java delete mode 100644 src/main/java/com/twilio/rest/autopilot/v1/assistant/task/SampleUpdater.java delete mode 100644 src/main/java/com/twilio/rest/autopilot/v1/assistant/task/TaskActions.java delete mode 100644 src/main/java/com/twilio/rest/autopilot/v1/assistant/task/TaskActionsFetcher.java delete mode 100644 src/main/java/com/twilio/rest/autopilot/v1/assistant/task/TaskActionsUpdater.java delete mode 100644 src/main/java/com/twilio/rest/autopilot/v1/assistant/task/TaskStatistics.java delete mode 100644 src/main/java/com/twilio/rest/autopilot/v1/assistant/task/TaskStatisticsFetcher.java delete mode 100644 src/main/java/com/twilio/rest/preview/understand/Assistant.java delete mode 100644 src/main/java/com/twilio/rest/preview/understand/AssistantCreator.java delete mode 100644 src/main/java/com/twilio/rest/preview/understand/AssistantDeleter.java delete mode 100644 src/main/java/com/twilio/rest/preview/understand/AssistantFetcher.java delete mode 100644 src/main/java/com/twilio/rest/preview/understand/AssistantReader.java delete mode 100644 src/main/java/com/twilio/rest/preview/understand/AssistantUpdater.java delete mode 100644 src/main/java/com/twilio/rest/preview/understand/assistant/AssistantFallbackActions.java delete mode 100644 src/main/java/com/twilio/rest/preview/understand/assistant/AssistantFallbackActionsFetcher.java delete mode 100644 src/main/java/com/twilio/rest/preview/understand/assistant/AssistantFallbackActionsUpdater.java delete mode 100644 src/main/java/com/twilio/rest/preview/understand/assistant/AssistantInitiationActions.java delete mode 100644 src/main/java/com/twilio/rest/preview/understand/assistant/AssistantInitiationActionsFetcher.java delete mode 100644 src/main/java/com/twilio/rest/preview/understand/assistant/AssistantInitiationActionsUpdater.java delete mode 100644 src/main/java/com/twilio/rest/preview/understand/assistant/Dialogue.java delete mode 100644 src/main/java/com/twilio/rest/preview/understand/assistant/DialogueFetcher.java delete mode 100644 src/main/java/com/twilio/rest/preview/understand/assistant/FieldType.java delete mode 100644 src/main/java/com/twilio/rest/preview/understand/assistant/FieldTypeCreator.java delete mode 100644 src/main/java/com/twilio/rest/preview/understand/assistant/FieldTypeDeleter.java delete mode 100644 src/main/java/com/twilio/rest/preview/understand/assistant/FieldTypeFetcher.java delete mode 100644 src/main/java/com/twilio/rest/preview/understand/assistant/FieldTypeReader.java delete mode 100644 src/main/java/com/twilio/rest/preview/understand/assistant/FieldTypeUpdater.java delete mode 100644 src/main/java/com/twilio/rest/preview/understand/assistant/ModelBuild.java delete mode 100644 src/main/java/com/twilio/rest/preview/understand/assistant/ModelBuildCreator.java delete mode 100644 src/main/java/com/twilio/rest/preview/understand/assistant/ModelBuildDeleter.java delete mode 100644 src/main/java/com/twilio/rest/preview/understand/assistant/ModelBuildFetcher.java delete mode 100644 src/main/java/com/twilio/rest/preview/understand/assistant/ModelBuildReader.java delete mode 100644 src/main/java/com/twilio/rest/preview/understand/assistant/ModelBuildUpdater.java delete mode 100644 src/main/java/com/twilio/rest/preview/understand/assistant/Query.java delete mode 100644 src/main/java/com/twilio/rest/preview/understand/assistant/QueryCreator.java delete mode 100644 src/main/java/com/twilio/rest/preview/understand/assistant/QueryDeleter.java delete mode 100644 src/main/java/com/twilio/rest/preview/understand/assistant/QueryFetcher.java delete mode 100644 src/main/java/com/twilio/rest/preview/understand/assistant/QueryReader.java delete mode 100644 src/main/java/com/twilio/rest/preview/understand/assistant/QueryUpdater.java delete mode 100644 src/main/java/com/twilio/rest/preview/understand/assistant/StyleSheet.java delete mode 100644 src/main/java/com/twilio/rest/preview/understand/assistant/StyleSheetFetcher.java delete mode 100644 src/main/java/com/twilio/rest/preview/understand/assistant/StyleSheetUpdater.java delete mode 100644 src/main/java/com/twilio/rest/preview/understand/assistant/Task.java delete mode 100644 src/main/java/com/twilio/rest/preview/understand/assistant/TaskCreator.java delete mode 100644 src/main/java/com/twilio/rest/preview/understand/assistant/TaskDeleter.java delete mode 100644 src/main/java/com/twilio/rest/preview/understand/assistant/TaskFetcher.java delete mode 100644 src/main/java/com/twilio/rest/preview/understand/assistant/TaskReader.java delete mode 100644 src/main/java/com/twilio/rest/preview/understand/assistant/TaskUpdater.java delete mode 100644 src/main/java/com/twilio/rest/preview/understand/assistant/fieldtype/FieldValue.java delete mode 100644 src/main/java/com/twilio/rest/preview/understand/assistant/fieldtype/FieldValueCreator.java delete mode 100644 src/main/java/com/twilio/rest/preview/understand/assistant/fieldtype/FieldValueDeleter.java delete mode 100644 src/main/java/com/twilio/rest/preview/understand/assistant/fieldtype/FieldValueFetcher.java delete mode 100644 src/main/java/com/twilio/rest/preview/understand/assistant/fieldtype/FieldValueReader.java delete mode 100644 src/main/java/com/twilio/rest/preview/understand/assistant/task/Field.java delete mode 100644 src/main/java/com/twilio/rest/preview/understand/assistant/task/FieldCreator.java delete mode 100644 src/main/java/com/twilio/rest/preview/understand/assistant/task/FieldDeleter.java delete mode 100644 src/main/java/com/twilio/rest/preview/understand/assistant/task/FieldFetcher.java delete mode 100644 src/main/java/com/twilio/rest/preview/understand/assistant/task/FieldReader.java delete mode 100644 src/main/java/com/twilio/rest/preview/understand/assistant/task/Sample.java delete mode 100644 src/main/java/com/twilio/rest/preview/understand/assistant/task/SampleCreator.java delete mode 100644 src/main/java/com/twilio/rest/preview/understand/assistant/task/SampleDeleter.java delete mode 100644 src/main/java/com/twilio/rest/preview/understand/assistant/task/SampleFetcher.java delete mode 100644 src/main/java/com/twilio/rest/preview/understand/assistant/task/SampleReader.java delete mode 100644 src/main/java/com/twilio/rest/preview/understand/assistant/task/SampleUpdater.java delete mode 100644 src/main/java/com/twilio/rest/preview/understand/assistant/task/TaskActions.java delete mode 100644 src/main/java/com/twilio/rest/preview/understand/assistant/task/TaskActionsFetcher.java delete mode 100644 src/main/java/com/twilio/rest/preview/understand/assistant/task/TaskActionsUpdater.java delete mode 100644 src/main/java/com/twilio/rest/preview/understand/assistant/task/TaskStatistics.java delete mode 100644 src/main/java/com/twilio/rest/preview/understand/assistant/task/TaskStatisticsFetcher.java diff --git a/CHANGES.md b/CHANGES.md index 2117574ec3..314a7f122b 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -1,6 +1,12 @@ twilio-java changelog ===================== +[2024-01-14] Version 9.15.1 +--------------------------- +**Push** +- Migrated to new Push API V4 with Resilient Notification Delivery. + + [2023-12-14] Version 9.15.0 --------------------------- **Api** diff --git a/src/main/java/com/twilio/Domains.java b/src/main/java/com/twilio/Domains.java index f5113aa348..9ccb35058f 100644 --- a/src/main/java/com/twilio/Domains.java +++ b/src/main/java/com/twilio/Domains.java @@ -13,7 +13,6 @@ public enum Domains { ACCOUNTS("accounts"), API("api"), - AUTOPILOT("autopilot"), BULKEXPORTS("bulkexports"), CHAT("chat"), CONTENT("content"), diff --git a/src/main/java/com/twilio/rest/autopilot/v1/Assistant.java b/src/main/java/com/twilio/rest/autopilot/v1/Assistant.java deleted file mode 100644 index 4779c4f7b4..0000000000 --- a/src/main/java/com/twilio/rest/autopilot/v1/Assistant.java +++ /dev/null @@ -1,261 +0,0 @@ -/* - * This code was generated by - * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ - * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ - * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ - * - * Twilio - Autopilot - * 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.autopilot.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 Assistant extends Resource { - - private static final long serialVersionUID = 228555803413487L; - - public static AssistantCreator creator() { - return new AssistantCreator(); - } - - public static AssistantDeleter deleter(final String pathSid) { - return new AssistantDeleter(pathSid); - } - - public static AssistantFetcher fetcher(final String pathSid) { - return new AssistantFetcher(pathSid); - } - - public static AssistantReader reader() { - return new AssistantReader(); - } - - public static AssistantUpdater updater(final String pathSid) { - return new AssistantUpdater(pathSid); - } - - /** - * Converts a JSON String into a Assistant object using the provided ObjectMapper. - * - * @param json Raw JSON String - * @param objectMapper Jackson ObjectMapper - * @return Assistant object represented by the provided JSON - */ - public static Assistant fromJson( - final String json, - final ObjectMapper objectMapper - ) { - // Convert all checked exceptions to Runtime - try { - return objectMapper.readValue(json, Assistant.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 Assistant object using the provided - * ObjectMapper. - * - * @param json Raw JSON InputStream - * @param objectMapper Jackson ObjectMapper - * @return Assistant object represented by the provided JSON - */ - public static Assistant fromJson( - final InputStream json, - final ObjectMapper objectMapper - ) { - // Convert all checked exceptions to Runtime - try { - return objectMapper.readValue(json, Assistant.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 ZonedDateTime dateCreated; - private final ZonedDateTime dateUpdated; - private final String friendlyName; - private final String latestModelBuildSid; - private final Map links; - private final Boolean logQueries; - private final String developmentStage; - private final Boolean needsModelBuild; - private final String sid; - private final String uniqueName; - private final URI url; - private final URI callbackUrl; - private final String callbackEvents; - - @JsonCreator - private Assistant( - @JsonProperty("account_sid") final String accountSid, - @JsonProperty("date_created") final String dateCreated, - @JsonProperty("date_updated") final String dateUpdated, - @JsonProperty("friendly_name") final String friendlyName, - @JsonProperty( - "latest_model_build_sid" - ) final String latestModelBuildSid, - @JsonProperty("links") final Map links, - @JsonProperty("log_queries") final Boolean logQueries, - @JsonProperty("development_stage") final String developmentStage, - @JsonProperty("needs_model_build") final Boolean needsModelBuild, - @JsonProperty("sid") final String sid, - @JsonProperty("unique_name") final String uniqueName, - @JsonProperty("url") final URI url, - @JsonProperty("callback_url") final URI callbackUrl, - @JsonProperty("callback_events") final String callbackEvents - ) { - this.accountSid = accountSid; - this.dateCreated = DateConverter.iso8601DateTimeFromString(dateCreated); - this.dateUpdated = DateConverter.iso8601DateTimeFromString(dateUpdated); - this.friendlyName = friendlyName; - this.latestModelBuildSid = latestModelBuildSid; - this.links = links; - this.logQueries = logQueries; - this.developmentStage = developmentStage; - this.needsModelBuild = needsModelBuild; - this.sid = sid; - this.uniqueName = uniqueName; - this.url = url; - this.callbackUrl = callbackUrl; - this.callbackEvents = callbackEvents; - } - - public final String getAccountSid() { - return this.accountSid; - } - - public final ZonedDateTime getDateCreated() { - return this.dateCreated; - } - - public final ZonedDateTime getDateUpdated() { - return this.dateUpdated; - } - - public final String getFriendlyName() { - return this.friendlyName; - } - - public final String getLatestModelBuildSid() { - return this.latestModelBuildSid; - } - - public final Map getLinks() { - return this.links; - } - - public final Boolean getLogQueries() { - return this.logQueries; - } - - public final String getDevelopmentStage() { - return this.developmentStage; - } - - public final Boolean getNeedsModelBuild() { - return this.needsModelBuild; - } - - public final String getSid() { - return this.sid; - } - - public final String getUniqueName() { - return this.uniqueName; - } - - public final URI getUrl() { - return this.url; - } - - public final URI getCallbackUrl() { - return this.callbackUrl; - } - - public final String getCallbackEvents() { - return this.callbackEvents; - } - - @Override - public boolean equals(final Object o) { - if (this == o) { - return true; - } - - if (o == null || getClass() != o.getClass()) { - return false; - } - - Assistant other = (Assistant) o; - - return ( - Objects.equals(accountSid, other.accountSid) && - Objects.equals(dateCreated, other.dateCreated) && - Objects.equals(dateUpdated, other.dateUpdated) && - Objects.equals(friendlyName, other.friendlyName) && - Objects.equals(latestModelBuildSid, other.latestModelBuildSid) && - Objects.equals(links, other.links) && - Objects.equals(logQueries, other.logQueries) && - Objects.equals(developmentStage, other.developmentStage) && - Objects.equals(needsModelBuild, other.needsModelBuild) && - Objects.equals(sid, other.sid) && - Objects.equals(uniqueName, other.uniqueName) && - Objects.equals(url, other.url) && - Objects.equals(callbackUrl, other.callbackUrl) && - Objects.equals(callbackEvents, other.callbackEvents) - ); - } - - @Override - public int hashCode() { - return Objects.hash( - accountSid, - dateCreated, - dateUpdated, - friendlyName, - latestModelBuildSid, - links, - logQueries, - developmentStage, - needsModelBuild, - sid, - uniqueName, - url, - callbackUrl, - callbackEvents - ); - } -} diff --git a/src/main/java/com/twilio/rest/autopilot/v1/AssistantCreator.java b/src/main/java/com/twilio/rest/autopilot/v1/AssistantCreator.java deleted file mode 100644 index 42b1eb2c4e..0000000000 --- a/src/main/java/com/twilio/rest/autopilot/v1/AssistantCreator.java +++ /dev/null @@ -1,147 +0,0 @@ -/* - * This code was generated by - * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ - * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ - * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ - * - * Twilio - Autopilot - * 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.autopilot.v1; - -import com.twilio.base.Creator; -import com.twilio.constant.EnumConstants; -import com.twilio.converter.Converter; -import com.twilio.converter.Converter; -import com.twilio.converter.Promoter; -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; -import java.net.URI; -import java.net.URI; -import java.util.Map; -import java.util.Map; - -public class AssistantCreator extends Creator { - - private String friendlyName; - private Boolean logQueries; - private String uniqueName; - private URI callbackUrl; - private String callbackEvents; - private Map styleSheet; - private Map defaults; - - public AssistantCreator() {} - - public AssistantCreator setFriendlyName(final String friendlyName) { - this.friendlyName = friendlyName; - return this; - } - - public AssistantCreator setLogQueries(final Boolean logQueries) { - this.logQueries = logQueries; - return this; - } - - public AssistantCreator setUniqueName(final String uniqueName) { - this.uniqueName = uniqueName; - return this; - } - - public AssistantCreator setCallbackUrl(final URI callbackUrl) { - this.callbackUrl = callbackUrl; - return this; - } - - public AssistantCreator setCallbackUrl(final String callbackUrl) { - return setCallbackUrl(Promoter.uriFromString(callbackUrl)); - } - - public AssistantCreator setCallbackEvents(final String callbackEvents) { - this.callbackEvents = callbackEvents; - return this; - } - - public AssistantCreator setStyleSheet( - final Map styleSheet - ) { - this.styleSheet = styleSheet; - return this; - } - - public AssistantCreator setDefaults(final Map defaults) { - this.defaults = defaults; - return this; - } - - @Override - public Assistant create(final TwilioRestClient client) { - String path = "/v1/Assistants"; - - Request request = new Request( - HttpMethod.POST, - Domains.AUTOPILOT.toString(), - path - ); - request.setContentType(EnumConstants.ContentType.FORM_URLENCODED); - addPostParams(request); - Response response = client.request(request); - if (response == null) { - throw new ApiConnectionException( - "Assistant 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 Assistant.fromJson( - response.getStream(), - client.getObjectMapper() - ); - } - - private void addPostParams(final Request request) { - if (friendlyName != null) { - request.addPostParam("FriendlyName", friendlyName); - } - if (logQueries != null) { - request.addPostParam("LogQueries", logQueries.toString()); - } - if (uniqueName != null) { - request.addPostParam("UniqueName", uniqueName); - } - if (callbackUrl != null) { - request.addPostParam("CallbackUrl", callbackUrl.toString()); - } - if (callbackEvents != null) { - request.addPostParam("CallbackEvents", callbackEvents); - } - if (styleSheet != null) { - request.addPostParam("StyleSheet", Converter.mapToJson(styleSheet)); - } - if (defaults != null) { - request.addPostParam("Defaults", Converter.mapToJson(defaults)); - } - } -} diff --git a/src/main/java/com/twilio/rest/autopilot/v1/AssistantDeleter.java b/src/main/java/com/twilio/rest/autopilot/v1/AssistantDeleter.java deleted file mode 100644 index 6b05bb91f3..0000000000 --- a/src/main/java/com/twilio/rest/autopilot/v1/AssistantDeleter.java +++ /dev/null @@ -1,67 +0,0 @@ -/* - * This code was generated by - * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ - * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ - * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ - * - * Twilio - Autopilot - * 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.autopilot.v1; - -import com.twilio.base.Deleter; -import com.twilio.exception.ApiConnectionException; -import com.twilio.exception.ApiException; -import com.twilio.exception.RestException; -import com.twilio.http.HttpMethod; -import com.twilio.http.Request; -import com.twilio.http.Response; -import com.twilio.http.TwilioRestClient; -import com.twilio.rest.Domains; - -public class AssistantDeleter extends Deleter { - - private String pathSid; - - public AssistantDeleter(final String pathSid) { - this.pathSid = pathSid; - } - - @Override - public boolean delete(final TwilioRestClient client) { - String path = "/v1/Assistants/{Sid}"; - - path = path.replace("{" + "Sid" + "}", this.pathSid.toString()); - - Request request = new Request( - HttpMethod.DELETE, - Domains.AUTOPILOT.toString(), - path - ); - Response response = client.request(request); - - if (response == null) { - throw new ApiConnectionException( - "Assistant 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/autopilot/v1/AssistantFetcher.java b/src/main/java/com/twilio/rest/autopilot/v1/AssistantFetcher.java deleted file mode 100644 index cbb952ae1b..0000000000 --- a/src/main/java/com/twilio/rest/autopilot/v1/AssistantFetcher.java +++ /dev/null @@ -1,71 +0,0 @@ -/* - * This code was generated by - * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ - * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ - * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ - * - * Twilio - Autopilot - * 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.autopilot.v1; - -import com.twilio.base.Fetcher; -import com.twilio.exception.ApiConnectionException; -import com.twilio.exception.ApiException; -import com.twilio.exception.RestException; -import com.twilio.http.HttpMethod; -import com.twilio.http.Request; -import com.twilio.http.Response; -import com.twilio.http.TwilioRestClient; -import com.twilio.rest.Domains; - -public class AssistantFetcher extends Fetcher { - - private String pathSid; - - public AssistantFetcher(final String pathSid) { - this.pathSid = pathSid; - } - - @Override - public Assistant fetch(final TwilioRestClient client) { - String path = "/v1/Assistants/{Sid}"; - - path = path.replace("{" + "Sid" + "}", this.pathSid.toString()); - - Request request = new Request( - HttpMethod.GET, - Domains.AUTOPILOT.toString(), - path - ); - Response response = client.request(request); - - if (response == null) { - throw new ApiConnectionException( - "Assistant 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 Assistant.fromJson( - response.getStream(), - client.getObjectMapper() - ); - } -} diff --git a/src/main/java/com/twilio/rest/autopilot/v1/AssistantReader.java b/src/main/java/com/twilio/rest/autopilot/v1/AssistantReader.java deleted file mode 100644 index 1e8155ceb1..0000000000 --- a/src/main/java/com/twilio/rest/autopilot/v1/AssistantReader.java +++ /dev/null @@ -1,133 +0,0 @@ -/* - * This code was generated by - * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ - * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ - * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ - * - * Twilio - Autopilot - * 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.autopilot.v1; - -import com.twilio.base.Page; -import com.twilio.base.Reader; -import com.twilio.base.ResourceSet; -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 AssistantReader extends Reader { - - private Integer pageSize; - - public AssistantReader() {} - - public AssistantReader 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/Assistants"; - - Request request = new Request( - HttpMethod.GET, - Domains.AUTOPILOT.toString(), - path - ); - - addQueryParams(request); - return pageForRequest(client, request); - } - - private Page pageForRequest( - final TwilioRestClient client, - final Request request - ) { - Response response = client.request(request); - - if (response == null) { - throw new ApiConnectionException( - "Assistant 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( - "assistants", - response.getContent(), - Assistant.class, - client.getObjectMapper() - ); - } - - @Override - public Page previousPage( - final Page page, - final TwilioRestClient client - ) { - Request request = new Request( - HttpMethod.GET, - page.getPreviousPageUrl(Domains.AUTOPILOT.toString()) - ); - return pageForRequest(client, request); - } - - @Override - public Page nextPage( - final Page page, - final TwilioRestClient client - ) { - Request request = new Request( - HttpMethod.GET, - page.getNextPageUrl(Domains.AUTOPILOT.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/autopilot/v1/AssistantUpdater.java b/src/main/java/com/twilio/rest/autopilot/v1/AssistantUpdater.java deleted file mode 100644 index f30bd08187..0000000000 --- a/src/main/java/com/twilio/rest/autopilot/v1/AssistantUpdater.java +++ /dev/null @@ -1,158 +0,0 @@ -/* - * This code was generated by - * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ - * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ - * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ - * - * Twilio - Autopilot - * 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.autopilot.v1; - -import com.twilio.base.Updater; -import com.twilio.constant.EnumConstants; -import com.twilio.converter.Converter; -import com.twilio.converter.Promoter; -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; -import java.net.URI; -import java.util.Map; - -public class AssistantUpdater extends Updater { - - private String pathSid; - private String friendlyName; - private Boolean logQueries; - private String uniqueName; - private URI callbackUrl; - private String callbackEvents; - private Map styleSheet; - private Map defaults; - private String developmentStage; - - public AssistantUpdater(final String pathSid) { - this.pathSid = pathSid; - } - - public AssistantUpdater setFriendlyName(final String friendlyName) { - this.friendlyName = friendlyName; - return this; - } - - public AssistantUpdater setLogQueries(final Boolean logQueries) { - this.logQueries = logQueries; - return this; - } - - public AssistantUpdater setUniqueName(final String uniqueName) { - this.uniqueName = uniqueName; - return this; - } - - public AssistantUpdater setCallbackUrl(final URI callbackUrl) { - this.callbackUrl = callbackUrl; - return this; - } - - public AssistantUpdater setCallbackUrl(final String callbackUrl) { - return setCallbackUrl(Promoter.uriFromString(callbackUrl)); - } - - public AssistantUpdater setCallbackEvents(final String callbackEvents) { - this.callbackEvents = callbackEvents; - return this; - } - - public AssistantUpdater setStyleSheet( - final Map styleSheet - ) { - this.styleSheet = styleSheet; - return this; - } - - public AssistantUpdater setDefaults(final Map defaults) { - this.defaults = defaults; - return this; - } - - public AssistantUpdater setDevelopmentStage(final String developmentStage) { - this.developmentStage = developmentStage; - return this; - } - - @Override - public Assistant update(final TwilioRestClient client) { - String path = "/v1/Assistants/{Sid}"; - - path = path.replace("{" + "Sid" + "}", this.pathSid.toString()); - - Request request = new Request( - HttpMethod.POST, - Domains.AUTOPILOT.toString(), - path - ); - request.setContentType(EnumConstants.ContentType.FORM_URLENCODED); - addPostParams(request); - Response response = client.request(request); - if (response == null) { - throw new ApiConnectionException( - "Assistant 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 Assistant.fromJson( - response.getStream(), - client.getObjectMapper() - ); - } - - private void addPostParams(final Request request) { - if (friendlyName != null) { - request.addPostParam("FriendlyName", friendlyName); - } - if (logQueries != null) { - request.addPostParam("LogQueries", logQueries.toString()); - } - if (uniqueName != null) { - request.addPostParam("UniqueName", uniqueName); - } - if (callbackUrl != null) { - request.addPostParam("CallbackUrl", callbackUrl.toString()); - } - if (callbackEvents != null) { - request.addPostParam("CallbackEvents", callbackEvents); - } - if (styleSheet != null) { - request.addPostParam("StyleSheet", Converter.mapToJson(styleSheet)); - } - if (defaults != null) { - request.addPostParam("Defaults", Converter.mapToJson(defaults)); - } - if (developmentStage != null) { - request.addPostParam("DevelopmentStage", developmentStage); - } - } -} diff --git a/src/main/java/com/twilio/rest/autopilot/v1/RestoreAssistant.java b/src/main/java/com/twilio/rest/autopilot/v1/RestoreAssistant.java deleted file mode 100644 index 5ff4db89b8..0000000000 --- a/src/main/java/com/twilio/rest/autopilot/v1/RestoreAssistant.java +++ /dev/null @@ -1,225 +0,0 @@ -/* - * This code was generated by - * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ - * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ - * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ - * - * Twilio - Autopilot - * 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.autopilot.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 RestoreAssistant extends Resource { - - private static final long serialVersionUID = 63917994227032L; - - public static RestoreAssistantUpdater updater(final String assistant) { - return new RestoreAssistantUpdater(assistant); - } - - /** - * Converts a JSON String into a RestoreAssistant object using the provided ObjectMapper. - * - * @param json Raw JSON String - * @param objectMapper Jackson ObjectMapper - * @return RestoreAssistant object represented by the provided JSON - */ - public static RestoreAssistant fromJson( - final String json, - final ObjectMapper objectMapper - ) { - // Convert all checked exceptions to Runtime - try { - return objectMapper.readValue(json, RestoreAssistant.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 RestoreAssistant object using the provided - * ObjectMapper. - * - * @param json Raw JSON InputStream - * @param objectMapper Jackson ObjectMapper - * @return RestoreAssistant object represented by the provided JSON - */ - public static RestoreAssistant fromJson( - final InputStream json, - final ObjectMapper objectMapper - ) { - // Convert all checked exceptions to Runtime - try { - return objectMapper.readValue(json, RestoreAssistant.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 sid; - private final ZonedDateTime dateCreated; - private final ZonedDateTime dateUpdated; - private final String uniqueName; - private final String friendlyName; - private final Boolean needsModelBuild; - private final String latestModelBuildSid; - private final Boolean logQueries; - private final String developmentStage; - private final URI callbackUrl; - private final String callbackEvents; - - @JsonCreator - private RestoreAssistant( - @JsonProperty("account_sid") final String accountSid, - @JsonProperty("sid") final String sid, - @JsonProperty("date_created") final String dateCreated, - @JsonProperty("date_updated") final String dateUpdated, - @JsonProperty("unique_name") final String uniqueName, - @JsonProperty("friendly_name") final String friendlyName, - @JsonProperty("needs_model_build") final Boolean needsModelBuild, - @JsonProperty( - "latest_model_build_sid" - ) final String latestModelBuildSid, - @JsonProperty("log_queries") final Boolean logQueries, - @JsonProperty("development_stage") final String developmentStage, - @JsonProperty("callback_url") final URI callbackUrl, - @JsonProperty("callback_events") final String callbackEvents - ) { - this.accountSid = accountSid; - this.sid = sid; - this.dateCreated = DateConverter.iso8601DateTimeFromString(dateCreated); - this.dateUpdated = DateConverter.iso8601DateTimeFromString(dateUpdated); - this.uniqueName = uniqueName; - this.friendlyName = friendlyName; - this.needsModelBuild = needsModelBuild; - this.latestModelBuildSid = latestModelBuildSid; - this.logQueries = logQueries; - this.developmentStage = developmentStage; - this.callbackUrl = callbackUrl; - this.callbackEvents = callbackEvents; - } - - public final String getAccountSid() { - return this.accountSid; - } - - public final String getSid() { - return this.sid; - } - - public final ZonedDateTime getDateCreated() { - return this.dateCreated; - } - - public final ZonedDateTime getDateUpdated() { - return this.dateUpdated; - } - - public final String getUniqueName() { - return this.uniqueName; - } - - public final String getFriendlyName() { - return this.friendlyName; - } - - public final Boolean getNeedsModelBuild() { - return this.needsModelBuild; - } - - public final String getLatestModelBuildSid() { - return this.latestModelBuildSid; - } - - public final Boolean getLogQueries() { - return this.logQueries; - } - - public final String getDevelopmentStage() { - return this.developmentStage; - } - - public final URI getCallbackUrl() { - return this.callbackUrl; - } - - public final String getCallbackEvents() { - return this.callbackEvents; - } - - @Override - public boolean equals(final Object o) { - if (this == o) { - return true; - } - - if (o == null || getClass() != o.getClass()) { - return false; - } - - RestoreAssistant other = (RestoreAssistant) o; - - return ( - Objects.equals(accountSid, other.accountSid) && - Objects.equals(sid, other.sid) && - Objects.equals(dateCreated, other.dateCreated) && - Objects.equals(dateUpdated, other.dateUpdated) && - Objects.equals(uniqueName, other.uniqueName) && - Objects.equals(friendlyName, other.friendlyName) && - Objects.equals(needsModelBuild, other.needsModelBuild) && - Objects.equals(latestModelBuildSid, other.latestModelBuildSid) && - Objects.equals(logQueries, other.logQueries) && - Objects.equals(developmentStage, other.developmentStage) && - Objects.equals(callbackUrl, other.callbackUrl) && - Objects.equals(callbackEvents, other.callbackEvents) - ); - } - - @Override - public int hashCode() { - return Objects.hash( - accountSid, - sid, - dateCreated, - dateUpdated, - uniqueName, - friendlyName, - needsModelBuild, - latestModelBuildSid, - logQueries, - developmentStage, - callbackUrl, - callbackEvents - ); - } -} diff --git a/src/main/java/com/twilio/rest/autopilot/v1/RestoreAssistantUpdater.java b/src/main/java/com/twilio/rest/autopilot/v1/RestoreAssistantUpdater.java deleted file mode 100644 index 64e01ac61c..0000000000 --- a/src/main/java/com/twilio/rest/autopilot/v1/RestoreAssistantUpdater.java +++ /dev/null @@ -1,84 +0,0 @@ -/* - * This code was generated by - * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ - * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ - * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ - * - * Twilio - Autopilot - * 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.autopilot.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 RestoreAssistantUpdater extends Updater { - - private String assistant; - - public RestoreAssistantUpdater(final String assistant) { - this.assistant = assistant; - } - - public RestoreAssistantUpdater setAssistant(final String assistant) { - this.assistant = assistant; - return this; - } - - @Override - public RestoreAssistant update(final TwilioRestClient client) { - String path = "/v1/Assistants/Restore"; - - path = path.replace("{" + "Assistant" + "}", this.assistant.toString()); - - Request request = new Request( - HttpMethod.POST, - Domains.AUTOPILOT.toString(), - path - ); - request.setContentType(EnumConstants.ContentType.FORM_URLENCODED); - addPostParams(request); - Response response = client.request(request); - if (response == null) { - throw new ApiConnectionException( - "RestoreAssistant 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 RestoreAssistant.fromJson( - response.getStream(), - client.getObjectMapper() - ); - } - - private void addPostParams(final Request request) { - if (assistant != null) { - request.addPostParam("Assistant", assistant); - } - } -} diff --git a/src/main/java/com/twilio/rest/autopilot/v1/assistant/Defaults.java b/src/main/java/com/twilio/rest/autopilot/v1/assistant/Defaults.java deleted file mode 100644 index 9b1f901eb0..0000000000 --- a/src/main/java/com/twilio/rest/autopilot/v1/assistant/Defaults.java +++ /dev/null @@ -1,150 +0,0 @@ -/* - * This code was generated by - * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ - * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ - * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ - * - * Twilio - Autopilot - * 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.autopilot.v1.assistant; - -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.exception.ApiConnectionException; -import com.twilio.exception.ApiException; -import java.io.IOException; -import java.io.InputStream; -import java.net.URI; -import java.util.Map; -import java.util.Map; -import java.util.Objects; -import lombok.ToString; -import lombok.ToString; - -@JsonIgnoreProperties(ignoreUnknown = true) -@ToString -public class Defaults extends Resource { - - private static final long serialVersionUID = 52727905251134L; - - public static DefaultsFetcher fetcher(final String pathAssistantSid) { - return new DefaultsFetcher(pathAssistantSid); - } - - public static DefaultsUpdater updater(final String pathAssistantSid) { - return new DefaultsUpdater(pathAssistantSid); - } - - /** - * Converts a JSON String into a Defaults object using the provided ObjectMapper. - * - * @param json Raw JSON String - * @param objectMapper Jackson ObjectMapper - * @return Defaults object represented by the provided JSON - */ - public static Defaults fromJson( - final String json, - final ObjectMapper objectMapper - ) { - // Convert all checked exceptions to Runtime - try { - return objectMapper.readValue(json, Defaults.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 Defaults object using the provided - * ObjectMapper. - * - * @param json Raw JSON InputStream - * @param objectMapper Jackson ObjectMapper - * @return Defaults object represented by the provided JSON - */ - public static Defaults fromJson( - final InputStream json, - final ObjectMapper objectMapper - ) { - // Convert all checked exceptions to Runtime - try { - return objectMapper.readValue(json, Defaults.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 assistantSid; - private final URI url; - private final Map data; - - @JsonCreator - private Defaults( - @JsonProperty("account_sid") final String accountSid, - @JsonProperty("assistant_sid") final String assistantSid, - @JsonProperty("url") final URI url, - @JsonProperty("data") final Map data - ) { - this.accountSid = accountSid; - this.assistantSid = assistantSid; - this.url = url; - this.data = data; - } - - public final String getAccountSid() { - return this.accountSid; - } - - public final String getAssistantSid() { - return this.assistantSid; - } - - public final URI getUrl() { - return this.url; - } - - public final Map getData() { - return this.data; - } - - @Override - public boolean equals(final Object o) { - if (this == o) { - return true; - } - - if (o == null || getClass() != o.getClass()) { - return false; - } - - Defaults other = (Defaults) o; - - return ( - Objects.equals(accountSid, other.accountSid) && - Objects.equals(assistantSid, other.assistantSid) && - Objects.equals(url, other.url) && - Objects.equals(data, other.data) - ); - } - - @Override - public int hashCode() { - return Objects.hash(accountSid, assistantSid, url, data); - } -} diff --git a/src/main/java/com/twilio/rest/autopilot/v1/assistant/DefaultsFetcher.java b/src/main/java/com/twilio/rest/autopilot/v1/assistant/DefaultsFetcher.java deleted file mode 100644 index adf675234e..0000000000 --- a/src/main/java/com/twilio/rest/autopilot/v1/assistant/DefaultsFetcher.java +++ /dev/null @@ -1,75 +0,0 @@ -/* - * This code was generated by - * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ - * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ - * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ - * - * Twilio - Autopilot - * 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.autopilot.v1.assistant; - -import com.twilio.base.Fetcher; -import com.twilio.exception.ApiConnectionException; -import com.twilio.exception.ApiException; -import com.twilio.exception.RestException; -import com.twilio.http.HttpMethod; -import com.twilio.http.Request; -import com.twilio.http.Response; -import com.twilio.http.TwilioRestClient; -import com.twilio.rest.Domains; - -public class DefaultsFetcher extends Fetcher { - - private String pathAssistantSid; - - public DefaultsFetcher(final String pathAssistantSid) { - this.pathAssistantSid = pathAssistantSid; - } - - @Override - public Defaults fetch(final TwilioRestClient client) { - String path = "/v1/Assistants/{AssistantSid}/Defaults"; - - path = - path.replace( - "{" + "AssistantSid" + "}", - this.pathAssistantSid.toString() - ); - - Request request = new Request( - HttpMethod.GET, - Domains.AUTOPILOT.toString(), - path - ); - Response response = client.request(request); - - if (response == null) { - throw new ApiConnectionException( - "Defaults 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 Defaults.fromJson( - response.getStream(), - client.getObjectMapper() - ); - } -} diff --git a/src/main/java/com/twilio/rest/autopilot/v1/assistant/DefaultsUpdater.java b/src/main/java/com/twilio/rest/autopilot/v1/assistant/DefaultsUpdater.java deleted file mode 100644 index ce069a2232..0000000000 --- a/src/main/java/com/twilio/rest/autopilot/v1/assistant/DefaultsUpdater.java +++ /dev/null @@ -1,91 +0,0 @@ -/* - * This code was generated by - * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ - * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ - * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ - * - * Twilio - Autopilot - * 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.autopilot.v1.assistant; - -import com.twilio.base.Updater; -import com.twilio.constant.EnumConstants; -import com.twilio.converter.Converter; -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; -import java.util.Map; - -public class DefaultsUpdater extends Updater { - - private String pathAssistantSid; - private Map defaults; - - public DefaultsUpdater(final String pathAssistantSid) { - this.pathAssistantSid = pathAssistantSid; - } - - public DefaultsUpdater setDefaults(final Map defaults) { - this.defaults = defaults; - return this; - } - - @Override - public Defaults update(final TwilioRestClient client) { - String path = "/v1/Assistants/{AssistantSid}/Defaults"; - - path = - path.replace( - "{" + "AssistantSid" + "}", - this.pathAssistantSid.toString() - ); - - Request request = new Request( - HttpMethod.POST, - Domains.AUTOPILOT.toString(), - path - ); - request.setContentType(EnumConstants.ContentType.FORM_URLENCODED); - addPostParams(request); - Response response = client.request(request); - if (response == null) { - throw new ApiConnectionException( - "Defaults 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 Defaults.fromJson( - response.getStream(), - client.getObjectMapper() - ); - } - - private void addPostParams(final Request request) { - if (defaults != null) { - request.addPostParam("Defaults", Converter.mapToJson(defaults)); - } - } -} diff --git a/src/main/java/com/twilio/rest/autopilot/v1/assistant/Dialogue.java b/src/main/java/com/twilio/rest/autopilot/v1/assistant/Dialogue.java deleted file mode 100644 index a51e1a8aea..0000000000 --- a/src/main/java/com/twilio/rest/autopilot/v1/assistant/Dialogue.java +++ /dev/null @@ -1,157 +0,0 @@ -/* - * This code was generated by - * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ - * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ - * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ - * - * Twilio - Autopilot - * 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.autopilot.v1.assistant; - -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.exception.ApiConnectionException; -import com.twilio.exception.ApiException; -import java.io.IOException; -import java.io.InputStream; -import java.net.URI; -import java.util.Map; -import java.util.Map; -import java.util.Objects; -import lombok.ToString; -import lombok.ToString; - -@JsonIgnoreProperties(ignoreUnknown = true) -@ToString -public class Dialogue extends Resource { - - private static final long serialVersionUID = 270949613735802L; - - public static DialogueFetcher fetcher( - final String pathAssistantSid, - final String pathSid - ) { - return new DialogueFetcher(pathAssistantSid, pathSid); - } - - /** - * Converts a JSON String into a Dialogue object using the provided ObjectMapper. - * - * @param json Raw JSON String - * @param objectMapper Jackson ObjectMapper - * @return Dialogue object represented by the provided JSON - */ - public static Dialogue fromJson( - final String json, - final ObjectMapper objectMapper - ) { - // Convert all checked exceptions to Runtime - try { - return objectMapper.readValue(json, Dialogue.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 Dialogue object using the provided - * ObjectMapper. - * - * @param json Raw JSON InputStream - * @param objectMapper Jackson ObjectMapper - * @return Dialogue object represented by the provided JSON - */ - public static Dialogue fromJson( - final InputStream json, - final ObjectMapper objectMapper - ) { - // Convert all checked exceptions to Runtime - try { - return objectMapper.readValue(json, Dialogue.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 assistantSid; - private final String sid; - private final Map data; - private final URI url; - - @JsonCreator - private Dialogue( - @JsonProperty("account_sid") final String accountSid, - @JsonProperty("assistant_sid") final String assistantSid, - @JsonProperty("sid") final String sid, - @JsonProperty("data") final Map data, - @JsonProperty("url") final URI url - ) { - this.accountSid = accountSid; - this.assistantSid = assistantSid; - this.sid = sid; - this.data = data; - this.url = url; - } - - public final String getAccountSid() { - return this.accountSid; - } - - public final String getAssistantSid() { - return this.assistantSid; - } - - public final String getSid() { - return this.sid; - } - - public final Map getData() { - return this.data; - } - - 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; - } - - Dialogue other = (Dialogue) o; - - return ( - Objects.equals(accountSid, other.accountSid) && - Objects.equals(assistantSid, other.assistantSid) && - Objects.equals(sid, other.sid) && - Objects.equals(data, other.data) && - Objects.equals(url, other.url) - ); - } - - @Override - public int hashCode() { - return Objects.hash(accountSid, assistantSid, sid, data, url); - } -} diff --git a/src/main/java/com/twilio/rest/autopilot/v1/assistant/DialogueFetcher.java b/src/main/java/com/twilio/rest/autopilot/v1/assistant/DialogueFetcher.java deleted file mode 100644 index 59f6750715..0000000000 --- a/src/main/java/com/twilio/rest/autopilot/v1/assistant/DialogueFetcher.java +++ /dev/null @@ -1,81 +0,0 @@ -/* - * This code was generated by - * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ - * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ - * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ - * - * Twilio - Autopilot - * 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.autopilot.v1.assistant; - -import com.twilio.base.Fetcher; -import com.twilio.exception.ApiConnectionException; -import com.twilio.exception.ApiException; -import com.twilio.exception.RestException; -import com.twilio.http.HttpMethod; -import com.twilio.http.Request; -import com.twilio.http.Response; -import com.twilio.http.TwilioRestClient; -import com.twilio.rest.Domains; - -public class DialogueFetcher extends Fetcher { - - private String pathAssistantSid; - private String pathSid; - - public DialogueFetcher( - final String pathAssistantSid, - final String pathSid - ) { - this.pathAssistantSid = pathAssistantSid; - this.pathSid = pathSid; - } - - @Override - public Dialogue fetch(final TwilioRestClient client) { - String path = "/v1/Assistants/{AssistantSid}/Dialogues/{Sid}"; - - path = - path.replace( - "{" + "AssistantSid" + "}", - this.pathAssistantSid.toString() - ); - path = path.replace("{" + "Sid" + "}", this.pathSid.toString()); - - Request request = new Request( - HttpMethod.GET, - Domains.AUTOPILOT.toString(), - path - ); - Response response = client.request(request); - - if (response == null) { - throw new ApiConnectionException( - "Dialogue 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 Dialogue.fromJson( - response.getStream(), - client.getObjectMapper() - ); - } -} diff --git a/src/main/java/com/twilio/rest/autopilot/v1/assistant/FieldType.java b/src/main/java/com/twilio/rest/autopilot/v1/assistant/FieldType.java deleted file mode 100644 index 65a194610b..0000000000 --- a/src/main/java/com/twilio/rest/autopilot/v1/assistant/FieldType.java +++ /dev/null @@ -1,226 +0,0 @@ -/* - * This code was generated by - * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ - * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ - * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ - * - * Twilio - Autopilot - * 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.autopilot.v1.assistant; - -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 FieldType extends Resource { - - private static final long serialVersionUID = 124097769891823L; - - public static FieldTypeCreator creator( - final String pathAssistantSid, - final String uniqueName - ) { - return new FieldTypeCreator(pathAssistantSid, uniqueName); - } - - public static FieldTypeDeleter deleter( - final String pathAssistantSid, - final String pathSid - ) { - return new FieldTypeDeleter(pathAssistantSid, pathSid); - } - - public static FieldTypeFetcher fetcher( - final String pathAssistantSid, - final String pathSid - ) { - return new FieldTypeFetcher(pathAssistantSid, pathSid); - } - - public static FieldTypeReader reader(final String pathAssistantSid) { - return new FieldTypeReader(pathAssistantSid); - } - - public static FieldTypeUpdater updater( - final String pathAssistantSid, - final String pathSid - ) { - return new FieldTypeUpdater(pathAssistantSid, pathSid); - } - - /** - * Converts a JSON String into a FieldType object using the provided ObjectMapper. - * - * @param json Raw JSON String - * @param objectMapper Jackson ObjectMapper - * @return FieldType object represented by the provided JSON - */ - public static FieldType fromJson( - final String json, - final ObjectMapper objectMapper - ) { - // Convert all checked exceptions to Runtime - try { - return objectMapper.readValue(json, FieldType.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 FieldType object using the provided - * ObjectMapper. - * - * @param json Raw JSON InputStream - * @param objectMapper Jackson ObjectMapper - * @return FieldType object represented by the provided JSON - */ - public static FieldType fromJson( - final InputStream json, - final ObjectMapper objectMapper - ) { - // Convert all checked exceptions to Runtime - try { - return objectMapper.readValue(json, FieldType.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 ZonedDateTime dateCreated; - private final ZonedDateTime dateUpdated; - private final String friendlyName; - private final Map links; - private final String assistantSid; - private final String sid; - private final String uniqueName; - private final URI url; - - @JsonCreator - private FieldType( - @JsonProperty("account_sid") final String accountSid, - @JsonProperty("date_created") final String dateCreated, - @JsonProperty("date_updated") final String dateUpdated, - @JsonProperty("friendly_name") final String friendlyName, - @JsonProperty("links") final Map links, - @JsonProperty("assistant_sid") final String assistantSid, - @JsonProperty("sid") final String sid, - @JsonProperty("unique_name") final String uniqueName, - @JsonProperty("url") final URI url - ) { - this.accountSid = accountSid; - this.dateCreated = DateConverter.iso8601DateTimeFromString(dateCreated); - this.dateUpdated = DateConverter.iso8601DateTimeFromString(dateUpdated); - this.friendlyName = friendlyName; - this.links = links; - this.assistantSid = assistantSid; - this.sid = sid; - this.uniqueName = uniqueName; - this.url = url; - } - - public final String getAccountSid() { - return this.accountSid; - } - - public final ZonedDateTime getDateCreated() { - return this.dateCreated; - } - - public final ZonedDateTime getDateUpdated() { - return this.dateUpdated; - } - - public final String getFriendlyName() { - return this.friendlyName; - } - - public final Map getLinks() { - return this.links; - } - - public final String getAssistantSid() { - return this.assistantSid; - } - - public final String getSid() { - return this.sid; - } - - public final String getUniqueName() { - return this.uniqueName; - } - - 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; - } - - FieldType other = (FieldType) o; - - return ( - Objects.equals(accountSid, other.accountSid) && - Objects.equals(dateCreated, other.dateCreated) && - Objects.equals(dateUpdated, other.dateUpdated) && - Objects.equals(friendlyName, other.friendlyName) && - Objects.equals(links, other.links) && - Objects.equals(assistantSid, other.assistantSid) && - Objects.equals(sid, other.sid) && - Objects.equals(uniqueName, other.uniqueName) && - Objects.equals(url, other.url) - ); - } - - @Override - public int hashCode() { - return Objects.hash( - accountSid, - dateCreated, - dateUpdated, - friendlyName, - links, - assistantSid, - sid, - uniqueName, - url - ); - } -} diff --git a/src/main/java/com/twilio/rest/autopilot/v1/assistant/FieldTypeCreator.java b/src/main/java/com/twilio/rest/autopilot/v1/assistant/FieldTypeCreator.java deleted file mode 100644 index 181df57466..0000000000 --- a/src/main/java/com/twilio/rest/autopilot/v1/assistant/FieldTypeCreator.java +++ /dev/null @@ -1,104 +0,0 @@ -/* - * This code was generated by - * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ - * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ - * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ - * - * Twilio - Autopilot - * 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.autopilot.v1.assistant; - -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 FieldTypeCreator extends Creator { - - private String pathAssistantSid; - private String uniqueName; - private String friendlyName; - - public FieldTypeCreator( - final String pathAssistantSid, - final String uniqueName - ) { - this.pathAssistantSid = pathAssistantSid; - this.uniqueName = uniqueName; - } - - public FieldTypeCreator setUniqueName(final String uniqueName) { - this.uniqueName = uniqueName; - return this; - } - - public FieldTypeCreator setFriendlyName(final String friendlyName) { - this.friendlyName = friendlyName; - return this; - } - - @Override - public FieldType create(final TwilioRestClient client) { - String path = "/v1/Assistants/{AssistantSid}/FieldTypes"; - - path = - path.replace( - "{" + "AssistantSid" + "}", - this.pathAssistantSid.toString() - ); - path = - path.replace("{" + "UniqueName" + "}", this.uniqueName.toString()); - - Request request = new Request( - HttpMethod.POST, - Domains.AUTOPILOT.toString(), - path - ); - request.setContentType(EnumConstants.ContentType.FORM_URLENCODED); - addPostParams(request); - Response response = client.request(request); - if (response == null) { - throw new ApiConnectionException( - "FieldType 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 FieldType.fromJson( - response.getStream(), - client.getObjectMapper() - ); - } - - private void addPostParams(final Request request) { - if (uniqueName != null) { - request.addPostParam("UniqueName", uniqueName); - } - if (friendlyName != null) { - request.addPostParam("FriendlyName", friendlyName); - } - } -} diff --git a/src/main/java/com/twilio/rest/autopilot/v1/assistant/FieldTypeDeleter.java b/src/main/java/com/twilio/rest/autopilot/v1/assistant/FieldTypeDeleter.java deleted file mode 100644 index a3e5031d3b..0000000000 --- a/src/main/java/com/twilio/rest/autopilot/v1/assistant/FieldTypeDeleter.java +++ /dev/null @@ -1,77 +0,0 @@ -/* - * This code was generated by - * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ - * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ - * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ - * - * Twilio - Autopilot - * 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.autopilot.v1.assistant; - -import com.twilio.base.Deleter; -import com.twilio.exception.ApiConnectionException; -import com.twilio.exception.ApiException; -import com.twilio.exception.RestException; -import com.twilio.http.HttpMethod; -import com.twilio.http.Request; -import com.twilio.http.Response; -import com.twilio.http.TwilioRestClient; -import com.twilio.rest.Domains; - -public class FieldTypeDeleter extends Deleter { - - private String pathAssistantSid; - private String pathSid; - - public FieldTypeDeleter( - final String pathAssistantSid, - final String pathSid - ) { - this.pathAssistantSid = pathAssistantSid; - this.pathSid = pathSid; - } - - @Override - public boolean delete(final TwilioRestClient client) { - String path = "/v1/Assistants/{AssistantSid}/FieldTypes/{Sid}"; - - path = - path.replace( - "{" + "AssistantSid" + "}", - this.pathAssistantSid.toString() - ); - path = path.replace("{" + "Sid" + "}", this.pathSid.toString()); - - Request request = new Request( - HttpMethod.DELETE, - Domains.AUTOPILOT.toString(), - path - ); - Response response = client.request(request); - - if (response == null) { - throw new ApiConnectionException( - "FieldType 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/autopilot/v1/assistant/FieldTypeFetcher.java b/src/main/java/com/twilio/rest/autopilot/v1/assistant/FieldTypeFetcher.java deleted file mode 100644 index 31b4b2f501..0000000000 --- a/src/main/java/com/twilio/rest/autopilot/v1/assistant/FieldTypeFetcher.java +++ /dev/null @@ -1,81 +0,0 @@ -/* - * This code was generated by - * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ - * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ - * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ - * - * Twilio - Autopilot - * 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.autopilot.v1.assistant; - -import com.twilio.base.Fetcher; -import com.twilio.exception.ApiConnectionException; -import com.twilio.exception.ApiException; -import com.twilio.exception.RestException; -import com.twilio.http.HttpMethod; -import com.twilio.http.Request; -import com.twilio.http.Response; -import com.twilio.http.TwilioRestClient; -import com.twilio.rest.Domains; - -public class FieldTypeFetcher extends Fetcher { - - private String pathAssistantSid; - private String pathSid; - - public FieldTypeFetcher( - final String pathAssistantSid, - final String pathSid - ) { - this.pathAssistantSid = pathAssistantSid; - this.pathSid = pathSid; - } - - @Override - public FieldType fetch(final TwilioRestClient client) { - String path = "/v1/Assistants/{AssistantSid}/FieldTypes/{Sid}"; - - path = - path.replace( - "{" + "AssistantSid" + "}", - this.pathAssistantSid.toString() - ); - path = path.replace("{" + "Sid" + "}", this.pathSid.toString()); - - Request request = new Request( - HttpMethod.GET, - Domains.AUTOPILOT.toString(), - path - ); - Response response = client.request(request); - - if (response == null) { - throw new ApiConnectionException( - "FieldType 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 FieldType.fromJson( - response.getStream(), - client.getObjectMapper() - ); - } -} diff --git a/src/main/java/com/twilio/rest/autopilot/v1/assistant/FieldTypeReader.java b/src/main/java/com/twilio/rest/autopilot/v1/assistant/FieldTypeReader.java deleted file mode 100644 index c07574d727..0000000000 --- a/src/main/java/com/twilio/rest/autopilot/v1/assistant/FieldTypeReader.java +++ /dev/null @@ -1,141 +0,0 @@ -/* - * This code was generated by - * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ - * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ - * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ - * - * Twilio - Autopilot - * 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.autopilot.v1.assistant; - -import com.twilio.base.Page; -import com.twilio.base.Reader; -import com.twilio.base.ResourceSet; -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 FieldTypeReader extends Reader { - - private String pathAssistantSid; - private Integer pageSize; - - public FieldTypeReader(final String pathAssistantSid) { - this.pathAssistantSid = pathAssistantSid; - } - - public FieldTypeReader 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/Assistants/{AssistantSid}/FieldTypes"; - path = - path.replace( - "{" + "AssistantSid" + "}", - this.pathAssistantSid.toString() - ); - - Request request = new Request( - HttpMethod.GET, - Domains.AUTOPILOT.toString(), - path - ); - - addQueryParams(request); - return pageForRequest(client, request); - } - - private Page pageForRequest( - final TwilioRestClient client, - final Request request - ) { - Response response = client.request(request); - - if (response == null) { - throw new ApiConnectionException( - "FieldType 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( - "field_types", - response.getContent(), - FieldType.class, - client.getObjectMapper() - ); - } - - @Override - public Page previousPage( - final Page page, - final TwilioRestClient client - ) { - Request request = new Request( - HttpMethod.GET, - page.getPreviousPageUrl(Domains.AUTOPILOT.toString()) - ); - return pageForRequest(client, request); - } - - @Override - public Page nextPage( - final Page page, - final TwilioRestClient client - ) { - Request request = new Request( - HttpMethod.GET, - page.getNextPageUrl(Domains.AUTOPILOT.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/autopilot/v1/assistant/FieldTypeUpdater.java b/src/main/java/com/twilio/rest/autopilot/v1/assistant/FieldTypeUpdater.java deleted file mode 100644 index ea51282722..0000000000 --- a/src/main/java/com/twilio/rest/autopilot/v1/assistant/FieldTypeUpdater.java +++ /dev/null @@ -1,104 +0,0 @@ -/* - * This code was generated by - * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ - * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ - * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ - * - * Twilio - Autopilot - * 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.autopilot.v1.assistant; - -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 FieldTypeUpdater extends Updater { - - private String pathAssistantSid; - private String pathSid; - private String friendlyName; - private String uniqueName; - - public FieldTypeUpdater( - final String pathAssistantSid, - final String pathSid - ) { - this.pathAssistantSid = pathAssistantSid; - this.pathSid = pathSid; - } - - public FieldTypeUpdater setFriendlyName(final String friendlyName) { - this.friendlyName = friendlyName; - return this; - } - - public FieldTypeUpdater setUniqueName(final String uniqueName) { - this.uniqueName = uniqueName; - return this; - } - - @Override - public FieldType update(final TwilioRestClient client) { - String path = "/v1/Assistants/{AssistantSid}/FieldTypes/{Sid}"; - - path = - path.replace( - "{" + "AssistantSid" + "}", - this.pathAssistantSid.toString() - ); - path = path.replace("{" + "Sid" + "}", this.pathSid.toString()); - - Request request = new Request( - HttpMethod.POST, - Domains.AUTOPILOT.toString(), - path - ); - request.setContentType(EnumConstants.ContentType.FORM_URLENCODED); - addPostParams(request); - Response response = client.request(request); - if (response == null) { - throw new ApiConnectionException( - "FieldType 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 FieldType.fromJson( - response.getStream(), - client.getObjectMapper() - ); - } - - private void addPostParams(final Request request) { - if (friendlyName != null) { - request.addPostParam("FriendlyName", friendlyName); - } - if (uniqueName != null) { - request.addPostParam("UniqueName", uniqueName); - } - } -} diff --git a/src/main/java/com/twilio/rest/autopilot/v1/assistant/ModelBuild.java b/src/main/java/com/twilio/rest/autopilot/v1/assistant/ModelBuild.java deleted file mode 100644 index ee15a1c871..0000000000 --- a/src/main/java/com/twilio/rest/autopilot/v1/assistant/ModelBuild.java +++ /dev/null @@ -1,254 +0,0 @@ -/* - * This code was generated by - * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ - * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ - * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ - * - * Twilio - Autopilot - * 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.autopilot.v1.assistant; - -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.Objects; -import lombok.ToString; -import lombok.ToString; - -@JsonIgnoreProperties(ignoreUnknown = true) -@ToString -public class ModelBuild extends Resource { - - private static final long serialVersionUID = 226055418389205L; - - public static ModelBuildCreator creator(final String pathAssistantSid) { - return new ModelBuildCreator(pathAssistantSid); - } - - public static ModelBuildDeleter deleter( - final String pathAssistantSid, - final String pathSid - ) { - return new ModelBuildDeleter(pathAssistantSid, pathSid); - } - - public static ModelBuildFetcher fetcher( - final String pathAssistantSid, - final String pathSid - ) { - return new ModelBuildFetcher(pathAssistantSid, pathSid); - } - - public static ModelBuildReader reader(final String pathAssistantSid) { - return new ModelBuildReader(pathAssistantSid); - } - - public static ModelBuildUpdater updater( - final String pathAssistantSid, - final String pathSid - ) { - return new ModelBuildUpdater(pathAssistantSid, pathSid); - } - - /** - * Converts a JSON String into a ModelBuild object using the provided ObjectMapper. - * - * @param json Raw JSON String - * @param objectMapper Jackson ObjectMapper - * @return ModelBuild object represented by the provided JSON - */ - public static ModelBuild fromJson( - final String json, - final ObjectMapper objectMapper - ) { - // Convert all checked exceptions to Runtime - try { - return objectMapper.readValue(json, ModelBuild.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 ModelBuild object using the provided - * ObjectMapper. - * - * @param json Raw JSON InputStream - * @param objectMapper Jackson ObjectMapper - * @return ModelBuild object represented by the provided JSON - */ - public static ModelBuild fromJson( - final InputStream json, - final ObjectMapper objectMapper - ) { - // Convert all checked exceptions to Runtime - try { - return objectMapper.readValue(json, ModelBuild.class); - } catch (final JsonMappingException | JsonParseException e) { - throw new ApiException(e.getMessage(), e); - } catch (final IOException e) { - throw new ApiConnectionException(e.getMessage(), e); - } - } - - public enum Status { - ENQUEUED("enqueued"), - BUILDING("building"), - COMPLETED("completed"), - FAILED("failed"), - CANCELED("canceled"); - - private final String value; - - private Status(final String value) { - this.value = value; - } - - public String toString() { - return value; - } - - @JsonCreator - public static Status forValue(final String value) { - return Promoter.enumFromString(value, Status.values()); - } - } - - private final String accountSid; - private final ZonedDateTime dateCreated; - private final ZonedDateTime dateUpdated; - private final String assistantSid; - private final String sid; - private final ModelBuild.Status status; - private final String uniqueName; - private final URI url; - private final Integer buildDuration; - private final Integer errorCode; - - @JsonCreator - private ModelBuild( - @JsonProperty("account_sid") final String accountSid, - @JsonProperty("date_created") final String dateCreated, - @JsonProperty("date_updated") final String dateUpdated, - @JsonProperty("assistant_sid") final String assistantSid, - @JsonProperty("sid") final String sid, - @JsonProperty("status") final ModelBuild.Status status, - @JsonProperty("unique_name") final String uniqueName, - @JsonProperty("url") final URI url, - @JsonProperty("build_duration") final Integer buildDuration, - @JsonProperty("error_code") final Integer errorCode - ) { - this.accountSid = accountSid; - this.dateCreated = DateConverter.iso8601DateTimeFromString(dateCreated); - this.dateUpdated = DateConverter.iso8601DateTimeFromString(dateUpdated); - this.assistantSid = assistantSid; - this.sid = sid; - this.status = status; - this.uniqueName = uniqueName; - this.url = url; - this.buildDuration = buildDuration; - this.errorCode = errorCode; - } - - public final String getAccountSid() { - return this.accountSid; - } - - public final ZonedDateTime getDateCreated() { - return this.dateCreated; - } - - public final ZonedDateTime getDateUpdated() { - return this.dateUpdated; - } - - public final String getAssistantSid() { - return this.assistantSid; - } - - public final String getSid() { - return this.sid; - } - - public final ModelBuild.Status getStatus() { - return this.status; - } - - public final String getUniqueName() { - return this.uniqueName; - } - - public final URI getUrl() { - return this.url; - } - - public final Integer getBuildDuration() { - return this.buildDuration; - } - - public final Integer getErrorCode() { - return this.errorCode; - } - - @Override - public boolean equals(final Object o) { - if (this == o) { - return true; - } - - if (o == null || getClass() != o.getClass()) { - return false; - } - - ModelBuild other = (ModelBuild) o; - - return ( - Objects.equals(accountSid, other.accountSid) && - Objects.equals(dateCreated, other.dateCreated) && - Objects.equals(dateUpdated, other.dateUpdated) && - Objects.equals(assistantSid, other.assistantSid) && - Objects.equals(sid, other.sid) && - Objects.equals(status, other.status) && - Objects.equals(uniqueName, other.uniqueName) && - Objects.equals(url, other.url) && - Objects.equals(buildDuration, other.buildDuration) && - Objects.equals(errorCode, other.errorCode) - ); - } - - @Override - public int hashCode() { - return Objects.hash( - accountSid, - dateCreated, - dateUpdated, - assistantSid, - sid, - status, - uniqueName, - url, - buildDuration, - errorCode - ); - } -} diff --git a/src/main/java/com/twilio/rest/autopilot/v1/assistant/ModelBuildCreator.java b/src/main/java/com/twilio/rest/autopilot/v1/assistant/ModelBuildCreator.java deleted file mode 100644 index 1f0a6acad3..0000000000 --- a/src/main/java/com/twilio/rest/autopilot/v1/assistant/ModelBuildCreator.java +++ /dev/null @@ -1,105 +0,0 @@ -/* - * This code was generated by - * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ - * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ - * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ - * - * Twilio - Autopilot - * 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.autopilot.v1.assistant; - -import com.twilio.base.Creator; -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; -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; -import java.net.URI; -import java.net.URI; - -public class ModelBuildCreator extends Creator { - - private String pathAssistantSid; - private URI statusCallback; - private String uniqueName; - - public ModelBuildCreator(final String pathAssistantSid) { - this.pathAssistantSid = pathAssistantSid; - } - - public ModelBuildCreator setStatusCallback(final URI statusCallback) { - this.statusCallback = statusCallback; - return this; - } - - public ModelBuildCreator setStatusCallback(final String statusCallback) { - return setStatusCallback(Promoter.uriFromString(statusCallback)); - } - - public ModelBuildCreator setUniqueName(final String uniqueName) { - this.uniqueName = uniqueName; - return this; - } - - @Override - public ModelBuild create(final TwilioRestClient client) { - String path = "/v1/Assistants/{AssistantSid}/ModelBuilds"; - - path = - path.replace( - "{" + "AssistantSid" + "}", - this.pathAssistantSid.toString() - ); - - Request request = new Request( - HttpMethod.POST, - Domains.AUTOPILOT.toString(), - path - ); - request.setContentType(EnumConstants.ContentType.FORM_URLENCODED); - addPostParams(request); - Response response = client.request(request); - if (response == null) { - throw new ApiConnectionException( - "ModelBuild 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 ModelBuild.fromJson( - response.getStream(), - client.getObjectMapper() - ); - } - - private void addPostParams(final Request request) { - if (statusCallback != null) { - request.addPostParam("StatusCallback", statusCallback.toString()); - } - if (uniqueName != null) { - request.addPostParam("UniqueName", uniqueName); - } - } -} diff --git a/src/main/java/com/twilio/rest/autopilot/v1/assistant/ModelBuildDeleter.java b/src/main/java/com/twilio/rest/autopilot/v1/assistant/ModelBuildDeleter.java deleted file mode 100644 index e9ffbee280..0000000000 --- a/src/main/java/com/twilio/rest/autopilot/v1/assistant/ModelBuildDeleter.java +++ /dev/null @@ -1,77 +0,0 @@ -/* - * This code was generated by - * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ - * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ - * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ - * - * Twilio - Autopilot - * 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.autopilot.v1.assistant; - -import com.twilio.base.Deleter; -import com.twilio.exception.ApiConnectionException; -import com.twilio.exception.ApiException; -import com.twilio.exception.RestException; -import com.twilio.http.HttpMethod; -import com.twilio.http.Request; -import com.twilio.http.Response; -import com.twilio.http.TwilioRestClient; -import com.twilio.rest.Domains; - -public class ModelBuildDeleter extends Deleter { - - private String pathAssistantSid; - private String pathSid; - - public ModelBuildDeleter( - final String pathAssistantSid, - final String pathSid - ) { - this.pathAssistantSid = pathAssistantSid; - this.pathSid = pathSid; - } - - @Override - public boolean delete(final TwilioRestClient client) { - String path = "/v1/Assistants/{AssistantSid}/ModelBuilds/{Sid}"; - - path = - path.replace( - "{" + "AssistantSid" + "}", - this.pathAssistantSid.toString() - ); - path = path.replace("{" + "Sid" + "}", this.pathSid.toString()); - - Request request = new Request( - HttpMethod.DELETE, - Domains.AUTOPILOT.toString(), - path - ); - Response response = client.request(request); - - if (response == null) { - throw new ApiConnectionException( - "ModelBuild 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/autopilot/v1/assistant/ModelBuildFetcher.java b/src/main/java/com/twilio/rest/autopilot/v1/assistant/ModelBuildFetcher.java deleted file mode 100644 index db185af438..0000000000 --- a/src/main/java/com/twilio/rest/autopilot/v1/assistant/ModelBuildFetcher.java +++ /dev/null @@ -1,81 +0,0 @@ -/* - * This code was generated by - * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ - * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ - * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ - * - * Twilio - Autopilot - * 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.autopilot.v1.assistant; - -import com.twilio.base.Fetcher; -import com.twilio.exception.ApiConnectionException; -import com.twilio.exception.ApiException; -import com.twilio.exception.RestException; -import com.twilio.http.HttpMethod; -import com.twilio.http.Request; -import com.twilio.http.Response; -import com.twilio.http.TwilioRestClient; -import com.twilio.rest.Domains; - -public class ModelBuildFetcher extends Fetcher { - - private String pathAssistantSid; - private String pathSid; - - public ModelBuildFetcher( - final String pathAssistantSid, - final String pathSid - ) { - this.pathAssistantSid = pathAssistantSid; - this.pathSid = pathSid; - } - - @Override - public ModelBuild fetch(final TwilioRestClient client) { - String path = "/v1/Assistants/{AssistantSid}/ModelBuilds/{Sid}"; - - path = - path.replace( - "{" + "AssistantSid" + "}", - this.pathAssistantSid.toString() - ); - path = path.replace("{" + "Sid" + "}", this.pathSid.toString()); - - Request request = new Request( - HttpMethod.GET, - Domains.AUTOPILOT.toString(), - path - ); - Response response = client.request(request); - - if (response == null) { - throw new ApiConnectionException( - "ModelBuild 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 ModelBuild.fromJson( - response.getStream(), - client.getObjectMapper() - ); - } -} diff --git a/src/main/java/com/twilio/rest/autopilot/v1/assistant/ModelBuildReader.java b/src/main/java/com/twilio/rest/autopilot/v1/assistant/ModelBuildReader.java deleted file mode 100644 index 182b6d2fcd..0000000000 --- a/src/main/java/com/twilio/rest/autopilot/v1/assistant/ModelBuildReader.java +++ /dev/null @@ -1,141 +0,0 @@ -/* - * This code was generated by - * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ - * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ - * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ - * - * Twilio - Autopilot - * 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.autopilot.v1.assistant; - -import com.twilio.base.Page; -import com.twilio.base.Reader; -import com.twilio.base.ResourceSet; -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 ModelBuildReader extends Reader { - - private String pathAssistantSid; - private Integer pageSize; - - public ModelBuildReader(final String pathAssistantSid) { - this.pathAssistantSid = pathAssistantSid; - } - - public ModelBuildReader 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/Assistants/{AssistantSid}/ModelBuilds"; - path = - path.replace( - "{" + "AssistantSid" + "}", - this.pathAssistantSid.toString() - ); - - Request request = new Request( - HttpMethod.GET, - Domains.AUTOPILOT.toString(), - path - ); - - addQueryParams(request); - return pageForRequest(client, request); - } - - private Page pageForRequest( - final TwilioRestClient client, - final Request request - ) { - Response response = client.request(request); - - if (response == null) { - throw new ApiConnectionException( - "ModelBuild 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( - "model_builds", - response.getContent(), - ModelBuild.class, - client.getObjectMapper() - ); - } - - @Override - public Page previousPage( - final Page page, - final TwilioRestClient client - ) { - Request request = new Request( - HttpMethod.GET, - page.getPreviousPageUrl(Domains.AUTOPILOT.toString()) - ); - return pageForRequest(client, request); - } - - @Override - public Page nextPage( - final Page page, - final TwilioRestClient client - ) { - Request request = new Request( - HttpMethod.GET, - page.getNextPageUrl(Domains.AUTOPILOT.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/autopilot/v1/assistant/ModelBuildUpdater.java b/src/main/java/com/twilio/rest/autopilot/v1/assistant/ModelBuildUpdater.java deleted file mode 100644 index a7f609a1f7..0000000000 --- a/src/main/java/com/twilio/rest/autopilot/v1/assistant/ModelBuildUpdater.java +++ /dev/null @@ -1,95 +0,0 @@ -/* - * This code was generated by - * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ - * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ - * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ - * - * Twilio - Autopilot - * 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.autopilot.v1.assistant; - -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 ModelBuildUpdater extends Updater { - - private String pathAssistantSid; - private String pathSid; - private String uniqueName; - - public ModelBuildUpdater( - final String pathAssistantSid, - final String pathSid - ) { - this.pathAssistantSid = pathAssistantSid; - this.pathSid = pathSid; - } - - public ModelBuildUpdater setUniqueName(final String uniqueName) { - this.uniqueName = uniqueName; - return this; - } - - @Override - public ModelBuild update(final TwilioRestClient client) { - String path = "/v1/Assistants/{AssistantSid}/ModelBuilds/{Sid}"; - - path = - path.replace( - "{" + "AssistantSid" + "}", - this.pathAssistantSid.toString() - ); - path = path.replace("{" + "Sid" + "}", this.pathSid.toString()); - - Request request = new Request( - HttpMethod.POST, - Domains.AUTOPILOT.toString(), - path - ); - request.setContentType(EnumConstants.ContentType.FORM_URLENCODED); - addPostParams(request); - Response response = client.request(request); - if (response == null) { - throw new ApiConnectionException( - "ModelBuild 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 ModelBuild.fromJson( - response.getStream(), - client.getObjectMapper() - ); - } - - private void addPostParams(final Request request) { - if (uniqueName != null) { - request.addPostParam("UniqueName", uniqueName); - } - } -} diff --git a/src/main/java/com/twilio/rest/autopilot/v1/assistant/Query.java b/src/main/java/com/twilio/rest/autopilot/v1/assistant/Query.java deleted file mode 100644 index fdede9fe61..0000000000 --- a/src/main/java/com/twilio/rest/autopilot/v1/assistant/Query.java +++ /dev/null @@ -1,272 +0,0 @@ -/* - * This code was generated by - * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ - * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ - * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ - * - * Twilio - Autopilot - * 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.autopilot.v1.assistant; - -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 Query extends Resource { - - private static final long serialVersionUID = 205347249812282L; - - public static QueryCreator creator( - final String pathAssistantSid, - final String language, - final String query - ) { - return new QueryCreator(pathAssistantSid, language, query); - } - - public static QueryDeleter deleter( - final String pathAssistantSid, - final String pathSid - ) { - return new QueryDeleter(pathAssistantSid, pathSid); - } - - public static QueryFetcher fetcher( - final String pathAssistantSid, - final String pathSid - ) { - return new QueryFetcher(pathAssistantSid, pathSid); - } - - public static QueryReader reader(final String pathAssistantSid) { - return new QueryReader(pathAssistantSid); - } - - public static QueryUpdater updater( - final String pathAssistantSid, - final String pathSid - ) { - return new QueryUpdater(pathAssistantSid, pathSid); - } - - /** - * 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); - } - } - - private final String accountSid; - private final ZonedDateTime dateCreated; - private final ZonedDateTime dateUpdated; - private final Map results; - private final String language; - private final String modelBuildSid; - private final String query; - private final String sampleSid; - private final String assistantSid; - private final String sid; - private final String status; - private final URI url; - private final String sourceChannel; - private final String dialogueSid; - - @JsonCreator - private Query( - @JsonProperty("account_sid") final String accountSid, - @JsonProperty("date_created") final String dateCreated, - @JsonProperty("date_updated") final String dateUpdated, - @JsonProperty("results") final Map results, - @JsonProperty("language") final String language, - @JsonProperty("model_build_sid") final String modelBuildSid, - @JsonProperty("query") final String query, - @JsonProperty("sample_sid") final String sampleSid, - @JsonProperty("assistant_sid") final String assistantSid, - @JsonProperty("sid") final String sid, - @JsonProperty("status") final String status, - @JsonProperty("url") final URI url, - @JsonProperty("source_channel") final String sourceChannel, - @JsonProperty("dialogue_sid") final String dialogueSid - ) { - this.accountSid = accountSid; - this.dateCreated = DateConverter.iso8601DateTimeFromString(dateCreated); - this.dateUpdated = DateConverter.iso8601DateTimeFromString(dateUpdated); - this.results = results; - this.language = language; - this.modelBuildSid = modelBuildSid; - this.query = query; - this.sampleSid = sampleSid; - this.assistantSid = assistantSid; - this.sid = sid; - this.status = status; - this.url = url; - this.sourceChannel = sourceChannel; - this.dialogueSid = dialogueSid; - } - - public final String getAccountSid() { - return this.accountSid; - } - - public final ZonedDateTime getDateCreated() { - return this.dateCreated; - } - - public final ZonedDateTime getDateUpdated() { - return this.dateUpdated; - } - - public final Map getResults() { - return this.results; - } - - public final String getLanguage() { - return this.language; - } - - public final String getModelBuildSid() { - return this.modelBuildSid; - } - - public final String getQuery() { - return this.query; - } - - public final String getSampleSid() { - return this.sampleSid; - } - - public final String getAssistantSid() { - return this.assistantSid; - } - - public final String getSid() { - return this.sid; - } - - public final String getStatus() { - return this.status; - } - - public final URI getUrl() { - return this.url; - } - - public final String getSourceChannel() { - return this.sourceChannel; - } - - public final String getDialogueSid() { - return this.dialogueSid; - } - - @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(accountSid, other.accountSid) && - Objects.equals(dateCreated, other.dateCreated) && - Objects.equals(dateUpdated, other.dateUpdated) && - Objects.equals(results, other.results) && - Objects.equals(language, other.language) && - Objects.equals(modelBuildSid, other.modelBuildSid) && - Objects.equals(query, other.query) && - Objects.equals(sampleSid, other.sampleSid) && - Objects.equals(assistantSid, other.assistantSid) && - Objects.equals(sid, other.sid) && - Objects.equals(status, other.status) && - Objects.equals(url, other.url) && - Objects.equals(sourceChannel, other.sourceChannel) && - Objects.equals(dialogueSid, other.dialogueSid) - ); - } - - @Override - public int hashCode() { - return Objects.hash( - accountSid, - dateCreated, - dateUpdated, - results, - language, - modelBuildSid, - query, - sampleSid, - assistantSid, - sid, - status, - url, - sourceChannel, - dialogueSid - ); - } -} diff --git a/src/main/java/com/twilio/rest/autopilot/v1/assistant/QueryCreator.java b/src/main/java/com/twilio/rest/autopilot/v1/assistant/QueryCreator.java deleted file mode 100644 index 8f16964a16..0000000000 --- a/src/main/java/com/twilio/rest/autopilot/v1/assistant/QueryCreator.java +++ /dev/null @@ -1,121 +0,0 @@ -/* - * This code was generated by - * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ - * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ - * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ - * - * Twilio - Autopilot - * 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.autopilot.v1.assistant; - -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 QueryCreator extends Creator { - - private String pathAssistantSid; - private String language; - private String query; - private String tasks; - private String modelBuild; - - public QueryCreator( - final String pathAssistantSid, - final String language, - final String query - ) { - this.pathAssistantSid = pathAssistantSid; - this.language = language; - this.query = query; - } - - public QueryCreator setLanguage(final String language) { - this.language = language; - return this; - } - - public QueryCreator setQuery(final String query) { - this.query = query; - return this; - } - - public QueryCreator setTasks(final String tasks) { - this.tasks = tasks; - return this; - } - - public QueryCreator setModelBuild(final String modelBuild) { - this.modelBuild = modelBuild; - return this; - } - - @Override - public Query create(final TwilioRestClient client) { - String path = "/v1/Assistants/{AssistantSid}/Queries"; - - path = - path.replace( - "{" + "AssistantSid" + "}", - this.pathAssistantSid.toString() - ); - path = path.replace("{" + "Language" + "}", this.language.toString()); - path = path.replace("{" + "Query" + "}", this.query.toString()); - - Request request = new Request( - HttpMethod.POST, - Domains.AUTOPILOT.toString(), - path - ); - request.setContentType(EnumConstants.ContentType.FORM_URLENCODED); - addPostParams(request); - Response response = client.request(request); - if (response == null) { - throw new ApiConnectionException( - "Query 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 Query.fromJson(response.getStream(), client.getObjectMapper()); - } - - private void addPostParams(final Request request) { - if (language != null) { - request.addPostParam("Language", language); - } - if (query != null) { - request.addPostParam("Query", query); - } - if (tasks != null) { - request.addPostParam("Tasks", tasks); - } - if (modelBuild != null) { - request.addPostParam("ModelBuild", modelBuild); - } - } -} diff --git a/src/main/java/com/twilio/rest/autopilot/v1/assistant/QueryDeleter.java b/src/main/java/com/twilio/rest/autopilot/v1/assistant/QueryDeleter.java deleted file mode 100644 index d5ea6edc3c..0000000000 --- a/src/main/java/com/twilio/rest/autopilot/v1/assistant/QueryDeleter.java +++ /dev/null @@ -1,74 +0,0 @@ -/* - * This code was generated by - * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ - * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ - * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ - * - * Twilio - Autopilot - * 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.autopilot.v1.assistant; - -import com.twilio.base.Deleter; -import com.twilio.exception.ApiConnectionException; -import com.twilio.exception.ApiException; -import com.twilio.exception.RestException; -import com.twilio.http.HttpMethod; -import com.twilio.http.Request; -import com.twilio.http.Response; -import com.twilio.http.TwilioRestClient; -import com.twilio.rest.Domains; - -public class QueryDeleter extends Deleter { - - private String pathAssistantSid; - private String pathSid; - - public QueryDeleter(final String pathAssistantSid, final String pathSid) { - this.pathAssistantSid = pathAssistantSid; - this.pathSid = pathSid; - } - - @Override - public boolean delete(final TwilioRestClient client) { - String path = "/v1/Assistants/{AssistantSid}/Queries/{Sid}"; - - path = - path.replace( - "{" + "AssistantSid" + "}", - this.pathAssistantSid.toString() - ); - path = path.replace("{" + "Sid" + "}", this.pathSid.toString()); - - Request request = new Request( - HttpMethod.DELETE, - Domains.AUTOPILOT.toString(), - path - ); - Response response = client.request(request); - - if (response == null) { - throw new ApiConnectionException( - "Query 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/autopilot/v1/assistant/QueryFetcher.java b/src/main/java/com/twilio/rest/autopilot/v1/assistant/QueryFetcher.java deleted file mode 100644 index 3ab6dbd68a..0000000000 --- a/src/main/java/com/twilio/rest/autopilot/v1/assistant/QueryFetcher.java +++ /dev/null @@ -1,75 +0,0 @@ -/* - * This code was generated by - * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ - * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ - * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ - * - * Twilio - Autopilot - * 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.autopilot.v1.assistant; - -import com.twilio.base.Fetcher; -import com.twilio.exception.ApiConnectionException; -import com.twilio.exception.ApiException; -import com.twilio.exception.RestException; -import com.twilio.http.HttpMethod; -import com.twilio.http.Request; -import com.twilio.http.Response; -import com.twilio.http.TwilioRestClient; -import com.twilio.rest.Domains; - -public class QueryFetcher extends Fetcher { - - private String pathAssistantSid; - private String pathSid; - - public QueryFetcher(final String pathAssistantSid, final String pathSid) { - this.pathAssistantSid = pathAssistantSid; - this.pathSid = pathSid; - } - - @Override - public Query fetch(final TwilioRestClient client) { - String path = "/v1/Assistants/{AssistantSid}/Queries/{Sid}"; - - path = - path.replace( - "{" + "AssistantSid" + "}", - this.pathAssistantSid.toString() - ); - path = path.replace("{" + "Sid" + "}", this.pathSid.toString()); - - Request request = new Request( - HttpMethod.GET, - Domains.AUTOPILOT.toString(), - path - ); - Response response = client.request(request); - - if (response == null) { - throw new ApiConnectionException( - "Query 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 Query.fromJson(response.getStream(), client.getObjectMapper()); - } -} diff --git a/src/main/java/com/twilio/rest/autopilot/v1/assistant/QueryReader.java b/src/main/java/com/twilio/rest/autopilot/v1/assistant/QueryReader.java deleted file mode 100644 index 4a45e8f45e..0000000000 --- a/src/main/java/com/twilio/rest/autopilot/v1/assistant/QueryReader.java +++ /dev/null @@ -1,177 +0,0 @@ -/* - * This code was generated by - * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ - * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ - * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ - * - * Twilio - Autopilot - * 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.autopilot.v1.assistant; - -import com.twilio.base.Page; -import com.twilio.base.Reader; -import com.twilio.base.ResourceSet; -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 QueryReader extends Reader { - - private String pathAssistantSid; - private String language; - private String modelBuild; - private String status; - private String dialogueSid; - private Integer pageSize; - - public QueryReader(final String pathAssistantSid) { - this.pathAssistantSid = pathAssistantSid; - } - - public QueryReader setLanguage(final String language) { - this.language = language; - return this; - } - - public QueryReader setModelBuild(final String modelBuild) { - this.modelBuild = modelBuild; - return this; - } - - public QueryReader setStatus(final String status) { - this.status = status; - return this; - } - - public QueryReader setDialogueSid(final String dialogueSid) { - this.dialogueSid = dialogueSid; - return this; - } - - public QueryReader 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/Assistants/{AssistantSid}/Queries"; - path = - path.replace( - "{" + "AssistantSid" + "}", - this.pathAssistantSid.toString() - ); - - Request request = new Request( - HttpMethod.GET, - Domains.AUTOPILOT.toString(), - path - ); - - addQueryParams(request); - return pageForRequest(client, request); - } - - private Page pageForRequest( - final TwilioRestClient client, - final Request request - ) { - Response response = client.request(request); - - if (response == null) { - throw new ApiConnectionException( - "Query 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( - "queries", - response.getContent(), - Query.class, - client.getObjectMapper() - ); - } - - @Override - public Page previousPage( - final Page page, - final TwilioRestClient client - ) { - Request request = new Request( - HttpMethod.GET, - page.getPreviousPageUrl(Domains.AUTOPILOT.toString()) - ); - return pageForRequest(client, request); - } - - @Override - public Page nextPage( - final Page page, - final TwilioRestClient client - ) { - Request request = new Request( - HttpMethod.GET, - page.getNextPageUrl(Domains.AUTOPILOT.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 (language != null) { - request.addQueryParam("Language", language); - } - if (modelBuild != null) { - request.addQueryParam("ModelBuild", modelBuild); - } - if (status != null) { - request.addQueryParam("Status", status); - } - if (dialogueSid != null) { - request.addQueryParam("DialogueSid", dialogueSid); - } - 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/autopilot/v1/assistant/QueryUpdater.java b/src/main/java/com/twilio/rest/autopilot/v1/assistant/QueryUpdater.java deleted file mode 100644 index 4c3ab96d0c..0000000000 --- a/src/main/java/com/twilio/rest/autopilot/v1/assistant/QueryUpdater.java +++ /dev/null @@ -1,98 +0,0 @@ -/* - * This code was generated by - * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ - * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ - * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ - * - * Twilio - Autopilot - * 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.autopilot.v1.assistant; - -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 QueryUpdater extends Updater { - - private String pathAssistantSid; - private String pathSid; - private String sampleSid; - private String status; - - public QueryUpdater(final String pathAssistantSid, final String pathSid) { - this.pathAssistantSid = pathAssistantSid; - this.pathSid = pathSid; - } - - public QueryUpdater setSampleSid(final String sampleSid) { - this.sampleSid = sampleSid; - return this; - } - - public QueryUpdater setStatus(final String status) { - this.status = status; - return this; - } - - @Override - public Query update(final TwilioRestClient client) { - String path = "/v1/Assistants/{AssistantSid}/Queries/{Sid}"; - - path = - path.replace( - "{" + "AssistantSid" + "}", - this.pathAssistantSid.toString() - ); - path = path.replace("{" + "Sid" + "}", this.pathSid.toString()); - - Request request = new Request( - HttpMethod.POST, - Domains.AUTOPILOT.toString(), - path - ); - request.setContentType(EnumConstants.ContentType.FORM_URLENCODED); - addPostParams(request); - Response response = client.request(request); - if (response == null) { - throw new ApiConnectionException( - "Query 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 Query.fromJson(response.getStream(), client.getObjectMapper()); - } - - private void addPostParams(final Request request) { - if (sampleSid != null) { - request.addPostParam("SampleSid", sampleSid); - } - if (status != null) { - request.addPostParam("Status", status); - } - } -} diff --git a/src/main/java/com/twilio/rest/autopilot/v1/assistant/StyleSheet.java b/src/main/java/com/twilio/rest/autopilot/v1/assistant/StyleSheet.java deleted file mode 100644 index 2c366c9b67..0000000000 --- a/src/main/java/com/twilio/rest/autopilot/v1/assistant/StyleSheet.java +++ /dev/null @@ -1,150 +0,0 @@ -/* - * This code was generated by - * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ - * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ - * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ - * - * Twilio - Autopilot - * 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.autopilot.v1.assistant; - -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.exception.ApiConnectionException; -import com.twilio.exception.ApiException; -import java.io.IOException; -import java.io.InputStream; -import java.net.URI; -import java.util.Map; -import java.util.Map; -import java.util.Objects; -import lombok.ToString; -import lombok.ToString; - -@JsonIgnoreProperties(ignoreUnknown = true) -@ToString -public class StyleSheet extends Resource { - - private static final long serialVersionUID = 52727905251134L; - - public static StyleSheetFetcher fetcher(final String pathAssistantSid) { - return new StyleSheetFetcher(pathAssistantSid); - } - - public static StyleSheetUpdater updater(final String pathAssistantSid) { - return new StyleSheetUpdater(pathAssistantSid); - } - - /** - * Converts a JSON String into a StyleSheet object using the provided ObjectMapper. - * - * @param json Raw JSON String - * @param objectMapper Jackson ObjectMapper - * @return StyleSheet object represented by the provided JSON - */ - public static StyleSheet fromJson( - final String json, - final ObjectMapper objectMapper - ) { - // Convert all checked exceptions to Runtime - try { - return objectMapper.readValue(json, StyleSheet.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 StyleSheet object using the provided - * ObjectMapper. - * - * @param json Raw JSON InputStream - * @param objectMapper Jackson ObjectMapper - * @return StyleSheet object represented by the provided JSON - */ - public static StyleSheet fromJson( - final InputStream json, - final ObjectMapper objectMapper - ) { - // Convert all checked exceptions to Runtime - try { - return objectMapper.readValue(json, StyleSheet.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 assistantSid; - private final URI url; - private final Map data; - - @JsonCreator - private StyleSheet( - @JsonProperty("account_sid") final String accountSid, - @JsonProperty("assistant_sid") final String assistantSid, - @JsonProperty("url") final URI url, - @JsonProperty("data") final Map data - ) { - this.accountSid = accountSid; - this.assistantSid = assistantSid; - this.url = url; - this.data = data; - } - - public final String getAccountSid() { - return this.accountSid; - } - - public final String getAssistantSid() { - return this.assistantSid; - } - - public final URI getUrl() { - return this.url; - } - - public final Map getData() { - return this.data; - } - - @Override - public boolean equals(final Object o) { - if (this == o) { - return true; - } - - if (o == null || getClass() != o.getClass()) { - return false; - } - - StyleSheet other = (StyleSheet) o; - - return ( - Objects.equals(accountSid, other.accountSid) && - Objects.equals(assistantSid, other.assistantSid) && - Objects.equals(url, other.url) && - Objects.equals(data, other.data) - ); - } - - @Override - public int hashCode() { - return Objects.hash(accountSid, assistantSid, url, data); - } -} diff --git a/src/main/java/com/twilio/rest/autopilot/v1/assistant/StyleSheetFetcher.java b/src/main/java/com/twilio/rest/autopilot/v1/assistant/StyleSheetFetcher.java deleted file mode 100644 index 6b6afe74cb..0000000000 --- a/src/main/java/com/twilio/rest/autopilot/v1/assistant/StyleSheetFetcher.java +++ /dev/null @@ -1,75 +0,0 @@ -/* - * This code was generated by - * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ - * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ - * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ - * - * Twilio - Autopilot - * 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.autopilot.v1.assistant; - -import com.twilio.base.Fetcher; -import com.twilio.exception.ApiConnectionException; -import com.twilio.exception.ApiException; -import com.twilio.exception.RestException; -import com.twilio.http.HttpMethod; -import com.twilio.http.Request; -import com.twilio.http.Response; -import com.twilio.http.TwilioRestClient; -import com.twilio.rest.Domains; - -public class StyleSheetFetcher extends Fetcher { - - private String pathAssistantSid; - - public StyleSheetFetcher(final String pathAssistantSid) { - this.pathAssistantSid = pathAssistantSid; - } - - @Override - public StyleSheet fetch(final TwilioRestClient client) { - String path = "/v1/Assistants/{AssistantSid}/StyleSheet"; - - path = - path.replace( - "{" + "AssistantSid" + "}", - this.pathAssistantSid.toString() - ); - - Request request = new Request( - HttpMethod.GET, - Domains.AUTOPILOT.toString(), - path - ); - Response response = client.request(request); - - if (response == null) { - throw new ApiConnectionException( - "StyleSheet 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 StyleSheet.fromJson( - response.getStream(), - client.getObjectMapper() - ); - } -} diff --git a/src/main/java/com/twilio/rest/autopilot/v1/assistant/StyleSheetUpdater.java b/src/main/java/com/twilio/rest/autopilot/v1/assistant/StyleSheetUpdater.java deleted file mode 100644 index a353352fd3..0000000000 --- a/src/main/java/com/twilio/rest/autopilot/v1/assistant/StyleSheetUpdater.java +++ /dev/null @@ -1,93 +0,0 @@ -/* - * This code was generated by - * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ - * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ - * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ - * - * Twilio - Autopilot - * 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.autopilot.v1.assistant; - -import com.twilio.base.Updater; -import com.twilio.constant.EnumConstants; -import com.twilio.converter.Converter; -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; -import java.util.Map; - -public class StyleSheetUpdater extends Updater { - - private String pathAssistantSid; - private Map styleSheet; - - public StyleSheetUpdater(final String pathAssistantSid) { - this.pathAssistantSid = pathAssistantSid; - } - - public StyleSheetUpdater setStyleSheet( - final Map styleSheet - ) { - this.styleSheet = styleSheet; - return this; - } - - @Override - public StyleSheet update(final TwilioRestClient client) { - String path = "/v1/Assistants/{AssistantSid}/StyleSheet"; - - path = - path.replace( - "{" + "AssistantSid" + "}", - this.pathAssistantSid.toString() - ); - - Request request = new Request( - HttpMethod.POST, - Domains.AUTOPILOT.toString(), - path - ); - request.setContentType(EnumConstants.ContentType.FORM_URLENCODED); - addPostParams(request); - Response response = client.request(request); - if (response == null) { - throw new ApiConnectionException( - "StyleSheet 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 StyleSheet.fromJson( - response.getStream(), - client.getObjectMapper() - ); - } - - private void addPostParams(final Request request) { - if (styleSheet != null) { - request.addPostParam("StyleSheet", Converter.mapToJson(styleSheet)); - } - } -} diff --git a/src/main/java/com/twilio/rest/autopilot/v1/assistant/Task.java b/src/main/java/com/twilio/rest/autopilot/v1/assistant/Task.java deleted file mode 100644 index 4b7c574301..0000000000 --- a/src/main/java/com/twilio/rest/autopilot/v1/assistant/Task.java +++ /dev/null @@ -1,235 +0,0 @@ -/* - * This code was generated by - * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ - * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ - * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ - * - * Twilio - Autopilot - * 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.autopilot.v1.assistant; - -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 Task extends Resource { - - private static final long serialVersionUID = 59959992200143L; - - public static TaskCreator creator( - final String pathAssistantSid, - final String uniqueName - ) { - return new TaskCreator(pathAssistantSid, uniqueName); - } - - public static TaskDeleter deleter( - final String pathAssistantSid, - final String pathSid - ) { - return new TaskDeleter(pathAssistantSid, pathSid); - } - - public static TaskFetcher fetcher( - final String pathAssistantSid, - final String pathSid - ) { - return new TaskFetcher(pathAssistantSid, pathSid); - } - - public static TaskReader reader(final String pathAssistantSid) { - return new TaskReader(pathAssistantSid); - } - - public static TaskUpdater updater( - final String pathAssistantSid, - final String pathSid - ) { - return new TaskUpdater(pathAssistantSid, pathSid); - } - - /** - * Converts a JSON String into a Task object using the provided ObjectMapper. - * - * @param json Raw JSON String - * @param objectMapper Jackson ObjectMapper - * @return Task object represented by the provided JSON - */ - public static Task fromJson( - final String json, - final ObjectMapper objectMapper - ) { - // Convert all checked exceptions to Runtime - try { - return objectMapper.readValue(json, Task.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 Task object using the provided - * ObjectMapper. - * - * @param json Raw JSON InputStream - * @param objectMapper Jackson ObjectMapper - * @return Task object represented by the provided JSON - */ - public static Task fromJson( - final InputStream json, - final ObjectMapper objectMapper - ) { - // Convert all checked exceptions to Runtime - try { - return objectMapper.readValue(json, Task.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 ZonedDateTime dateCreated; - private final ZonedDateTime dateUpdated; - private final String friendlyName; - private final Map links; - private final String assistantSid; - private final String sid; - private final String uniqueName; - private final URI actionsUrl; - private final URI url; - - @JsonCreator - private Task( - @JsonProperty("account_sid") final String accountSid, - @JsonProperty("date_created") final String dateCreated, - @JsonProperty("date_updated") final String dateUpdated, - @JsonProperty("friendly_name") final String friendlyName, - @JsonProperty("links") final Map links, - @JsonProperty("assistant_sid") final String assistantSid, - @JsonProperty("sid") final String sid, - @JsonProperty("unique_name") final String uniqueName, - @JsonProperty("actions_url") final URI actionsUrl, - @JsonProperty("url") final URI url - ) { - this.accountSid = accountSid; - this.dateCreated = DateConverter.iso8601DateTimeFromString(dateCreated); - this.dateUpdated = DateConverter.iso8601DateTimeFromString(dateUpdated); - this.friendlyName = friendlyName; - this.links = links; - this.assistantSid = assistantSid; - this.sid = sid; - this.uniqueName = uniqueName; - this.actionsUrl = actionsUrl; - this.url = url; - } - - public final String getAccountSid() { - return this.accountSid; - } - - public final ZonedDateTime getDateCreated() { - return this.dateCreated; - } - - public final ZonedDateTime getDateUpdated() { - return this.dateUpdated; - } - - public final String getFriendlyName() { - return this.friendlyName; - } - - public final Map getLinks() { - return this.links; - } - - public final String getAssistantSid() { - return this.assistantSid; - } - - public final String getSid() { - return this.sid; - } - - public final String getUniqueName() { - return this.uniqueName; - } - - public final URI getActionsUrl() { - return this.actionsUrl; - } - - 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; - } - - Task other = (Task) o; - - return ( - Objects.equals(accountSid, other.accountSid) && - Objects.equals(dateCreated, other.dateCreated) && - Objects.equals(dateUpdated, other.dateUpdated) && - Objects.equals(friendlyName, other.friendlyName) && - Objects.equals(links, other.links) && - Objects.equals(assistantSid, other.assistantSid) && - Objects.equals(sid, other.sid) && - Objects.equals(uniqueName, other.uniqueName) && - Objects.equals(actionsUrl, other.actionsUrl) && - Objects.equals(url, other.url) - ); - } - - @Override - public int hashCode() { - return Objects.hash( - accountSid, - dateCreated, - dateUpdated, - friendlyName, - links, - assistantSid, - sid, - uniqueName, - actionsUrl, - url - ); - } -} diff --git a/src/main/java/com/twilio/rest/autopilot/v1/assistant/TaskCreator.java b/src/main/java/com/twilio/rest/autopilot/v1/assistant/TaskCreator.java deleted file mode 100644 index 9797f44068..0000000000 --- a/src/main/java/com/twilio/rest/autopilot/v1/assistant/TaskCreator.java +++ /dev/null @@ -1,127 +0,0 @@ -/* - * This code was generated by - * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ - * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ - * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ - * - * Twilio - Autopilot - * 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.autopilot.v1.assistant; - -import com.twilio.base.Creator; -import com.twilio.constant.EnumConstants; -import com.twilio.converter.Converter; -import com.twilio.converter.Converter; -import com.twilio.converter.Promoter; -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; -import java.net.URI; -import java.net.URI; -import java.util.Map; -import java.util.Map; - -public class TaskCreator extends Creator { - - private String pathAssistantSid; - private String uniqueName; - private String friendlyName; - private Map actions; - private URI actionsUrl; - - public TaskCreator(final String pathAssistantSid, final String uniqueName) { - this.pathAssistantSid = pathAssistantSid; - this.uniqueName = uniqueName; - } - - public TaskCreator setUniqueName(final String uniqueName) { - this.uniqueName = uniqueName; - return this; - } - - public TaskCreator setFriendlyName(final String friendlyName) { - this.friendlyName = friendlyName; - return this; - } - - public TaskCreator setActions(final Map actions) { - this.actions = actions; - return this; - } - - public TaskCreator setActionsUrl(final URI actionsUrl) { - this.actionsUrl = actionsUrl; - return this; - } - - public TaskCreator setActionsUrl(final String actionsUrl) { - return setActionsUrl(Promoter.uriFromString(actionsUrl)); - } - - @Override - public Task create(final TwilioRestClient client) { - String path = "/v1/Assistants/{AssistantSid}/Tasks"; - - path = - path.replace( - "{" + "AssistantSid" + "}", - this.pathAssistantSid.toString() - ); - path = - path.replace("{" + "UniqueName" + "}", this.uniqueName.toString()); - - Request request = new Request( - HttpMethod.POST, - Domains.AUTOPILOT.toString(), - path - ); - request.setContentType(EnumConstants.ContentType.FORM_URLENCODED); - addPostParams(request); - Response response = client.request(request); - if (response == null) { - throw new ApiConnectionException( - "Task 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 Task.fromJson(response.getStream(), client.getObjectMapper()); - } - - private void addPostParams(final Request request) { - if (uniqueName != null) { - request.addPostParam("UniqueName", uniqueName); - } - if (friendlyName != null) { - request.addPostParam("FriendlyName", friendlyName); - } - if (actions != null) { - request.addPostParam("Actions", Converter.mapToJson(actions)); - } - if (actionsUrl != null) { - request.addPostParam("ActionsUrl", actionsUrl.toString()); - } - } -} diff --git a/src/main/java/com/twilio/rest/autopilot/v1/assistant/TaskDeleter.java b/src/main/java/com/twilio/rest/autopilot/v1/assistant/TaskDeleter.java deleted file mode 100644 index e240468708..0000000000 --- a/src/main/java/com/twilio/rest/autopilot/v1/assistant/TaskDeleter.java +++ /dev/null @@ -1,74 +0,0 @@ -/* - * This code was generated by - * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ - * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ - * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ - * - * Twilio - Autopilot - * 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.autopilot.v1.assistant; - -import com.twilio.base.Deleter; -import com.twilio.exception.ApiConnectionException; -import com.twilio.exception.ApiException; -import com.twilio.exception.RestException; -import com.twilio.http.HttpMethod; -import com.twilio.http.Request; -import com.twilio.http.Response; -import com.twilio.http.TwilioRestClient; -import com.twilio.rest.Domains; - -public class TaskDeleter extends Deleter { - - private String pathAssistantSid; - private String pathSid; - - public TaskDeleter(final String pathAssistantSid, final String pathSid) { - this.pathAssistantSid = pathAssistantSid; - this.pathSid = pathSid; - } - - @Override - public boolean delete(final TwilioRestClient client) { - String path = "/v1/Assistants/{AssistantSid}/Tasks/{Sid}"; - - path = - path.replace( - "{" + "AssistantSid" + "}", - this.pathAssistantSid.toString() - ); - path = path.replace("{" + "Sid" + "}", this.pathSid.toString()); - - Request request = new Request( - HttpMethod.DELETE, - Domains.AUTOPILOT.toString(), - path - ); - Response response = client.request(request); - - if (response == null) { - throw new ApiConnectionException( - "Task 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/autopilot/v1/assistant/TaskFetcher.java b/src/main/java/com/twilio/rest/autopilot/v1/assistant/TaskFetcher.java deleted file mode 100644 index 3a6e46a02c..0000000000 --- a/src/main/java/com/twilio/rest/autopilot/v1/assistant/TaskFetcher.java +++ /dev/null @@ -1,75 +0,0 @@ -/* - * This code was generated by - * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ - * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ - * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ - * - * Twilio - Autopilot - * 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.autopilot.v1.assistant; - -import com.twilio.base.Fetcher; -import com.twilio.exception.ApiConnectionException; -import com.twilio.exception.ApiException; -import com.twilio.exception.RestException; -import com.twilio.http.HttpMethod; -import com.twilio.http.Request; -import com.twilio.http.Response; -import com.twilio.http.TwilioRestClient; -import com.twilio.rest.Domains; - -public class TaskFetcher extends Fetcher { - - private String pathAssistantSid; - private String pathSid; - - public TaskFetcher(final String pathAssistantSid, final String pathSid) { - this.pathAssistantSid = pathAssistantSid; - this.pathSid = pathSid; - } - - @Override - public Task fetch(final TwilioRestClient client) { - String path = "/v1/Assistants/{AssistantSid}/Tasks/{Sid}"; - - path = - path.replace( - "{" + "AssistantSid" + "}", - this.pathAssistantSid.toString() - ); - path = path.replace("{" + "Sid" + "}", this.pathSid.toString()); - - Request request = new Request( - HttpMethod.GET, - Domains.AUTOPILOT.toString(), - path - ); - Response response = client.request(request); - - if (response == null) { - throw new ApiConnectionException( - "Task 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 Task.fromJson(response.getStream(), client.getObjectMapper()); - } -} diff --git a/src/main/java/com/twilio/rest/autopilot/v1/assistant/TaskReader.java b/src/main/java/com/twilio/rest/autopilot/v1/assistant/TaskReader.java deleted file mode 100644 index f50d61f60b..0000000000 --- a/src/main/java/com/twilio/rest/autopilot/v1/assistant/TaskReader.java +++ /dev/null @@ -1,141 +0,0 @@ -/* - * This code was generated by - * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ - * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ - * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ - * - * Twilio - Autopilot - * 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.autopilot.v1.assistant; - -import com.twilio.base.Page; -import com.twilio.base.Reader; -import com.twilio.base.ResourceSet; -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 TaskReader extends Reader { - - private String pathAssistantSid; - private Integer pageSize; - - public TaskReader(final String pathAssistantSid) { - this.pathAssistantSid = pathAssistantSid; - } - - public TaskReader 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/Assistants/{AssistantSid}/Tasks"; - path = - path.replace( - "{" + "AssistantSid" + "}", - this.pathAssistantSid.toString() - ); - - Request request = new Request( - HttpMethod.GET, - Domains.AUTOPILOT.toString(), - path - ); - - addQueryParams(request); - return pageForRequest(client, request); - } - - private Page pageForRequest( - final TwilioRestClient client, - final Request request - ) { - Response response = client.request(request); - - if (response == null) { - throw new ApiConnectionException( - "Task 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( - "tasks", - response.getContent(), - Task.class, - client.getObjectMapper() - ); - } - - @Override - public Page previousPage( - final Page page, - final TwilioRestClient client - ) { - Request request = new Request( - HttpMethod.GET, - page.getPreviousPageUrl(Domains.AUTOPILOT.toString()) - ); - return pageForRequest(client, request); - } - - @Override - public Page nextPage( - final Page page, - final TwilioRestClient client - ) { - Request request = new Request( - HttpMethod.GET, - page.getNextPageUrl(Domains.AUTOPILOT.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/autopilot/v1/assistant/TaskUpdater.java b/src/main/java/com/twilio/rest/autopilot/v1/assistant/TaskUpdater.java deleted file mode 100644 index 9465f44063..0000000000 --- a/src/main/java/com/twilio/rest/autopilot/v1/assistant/TaskUpdater.java +++ /dev/null @@ -1,124 +0,0 @@ -/* - * This code was generated by - * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ - * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ - * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ - * - * Twilio - Autopilot - * 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.autopilot.v1.assistant; - -import com.twilio.base.Updater; -import com.twilio.constant.EnumConstants; -import com.twilio.converter.Converter; -import com.twilio.converter.Promoter; -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; -import java.net.URI; -import java.util.Map; - -public class TaskUpdater extends Updater { - - private String pathAssistantSid; - private String pathSid; - private String friendlyName; - private String uniqueName; - private Map actions; - private URI actionsUrl; - - public TaskUpdater(final String pathAssistantSid, final String pathSid) { - this.pathAssistantSid = pathAssistantSid; - this.pathSid = pathSid; - } - - public TaskUpdater setFriendlyName(final String friendlyName) { - this.friendlyName = friendlyName; - return this; - } - - public TaskUpdater setUniqueName(final String uniqueName) { - this.uniqueName = uniqueName; - return this; - } - - public TaskUpdater setActions(final Map actions) { - this.actions = actions; - return this; - } - - public TaskUpdater setActionsUrl(final URI actionsUrl) { - this.actionsUrl = actionsUrl; - return this; - } - - public TaskUpdater setActionsUrl(final String actionsUrl) { - return setActionsUrl(Promoter.uriFromString(actionsUrl)); - } - - @Override - public Task update(final TwilioRestClient client) { - String path = "/v1/Assistants/{AssistantSid}/Tasks/{Sid}"; - - path = - path.replace( - "{" + "AssistantSid" + "}", - this.pathAssistantSid.toString() - ); - path = path.replace("{" + "Sid" + "}", this.pathSid.toString()); - - Request request = new Request( - HttpMethod.POST, - Domains.AUTOPILOT.toString(), - path - ); - request.setContentType(EnumConstants.ContentType.FORM_URLENCODED); - addPostParams(request); - Response response = client.request(request); - if (response == null) { - throw new ApiConnectionException( - "Task 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 Task.fromJson(response.getStream(), client.getObjectMapper()); - } - - private void addPostParams(final Request request) { - if (friendlyName != null) { - request.addPostParam("FriendlyName", friendlyName); - } - if (uniqueName != null) { - request.addPostParam("UniqueName", uniqueName); - } - if (actions != null) { - request.addPostParam("Actions", Converter.mapToJson(actions)); - } - if (actionsUrl != null) { - request.addPostParam("ActionsUrl", actionsUrl.toString()); - } - } -} diff --git a/src/main/java/com/twilio/rest/autopilot/v1/assistant/Webhook.java b/src/main/java/com/twilio/rest/autopilot/v1/assistant/Webhook.java deleted file mode 100644 index 8606d167a3..0000000000 --- a/src/main/java/com/twilio/rest/autopilot/v1/assistant/Webhook.java +++ /dev/null @@ -1,240 +0,0 @@ -/* - * This code was generated by - * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ - * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ - * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ - * - * Twilio - Autopilot - * 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.autopilot.v1.assistant; - -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 Webhook extends Resource { - - private static final long serialVersionUID = 211848885870919L; - - public static WebhookCreator creator( - final String pathAssistantSid, - final String uniqueName, - final String events, - final URI webhookUrl - ) { - return new WebhookCreator( - pathAssistantSid, - uniqueName, - events, - webhookUrl - ); - } - - public static WebhookDeleter deleter( - final String pathAssistantSid, - final String pathSid - ) { - return new WebhookDeleter(pathAssistantSid, pathSid); - } - - public static WebhookFetcher fetcher( - final String pathAssistantSid, - final String pathSid - ) { - return new WebhookFetcher(pathAssistantSid, pathSid); - } - - public static WebhookReader reader(final String pathAssistantSid) { - return new WebhookReader(pathAssistantSid); - } - - public static WebhookUpdater updater( - final String pathAssistantSid, - final String pathSid - ) { - return new WebhookUpdater(pathAssistantSid, pathSid); - } - - /** - * Converts a JSON String into a Webhook object using the provided ObjectMapper. - * - * @param json Raw JSON String - * @param objectMapper Jackson ObjectMapper - * @return Webhook object represented by the provided JSON - */ - public static Webhook fromJson( - final String json, - final ObjectMapper objectMapper - ) { - // Convert all checked exceptions to Runtime - try { - return objectMapper.readValue(json, Webhook.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 Webhook object using the provided - * ObjectMapper. - * - * @param json Raw JSON InputStream - * @param objectMapper Jackson ObjectMapper - * @return Webhook object represented by the provided JSON - */ - public static Webhook fromJson( - final InputStream json, - final ObjectMapper objectMapper - ) { - // Convert all checked exceptions to Runtime - try { - return objectMapper.readValue(json, Webhook.class); - } catch (final JsonMappingException | JsonParseException e) { - throw new ApiException(e.getMessage(), e); - } catch (final IOException e) { - throw new ApiConnectionException(e.getMessage(), e); - } - } - - private final URI url; - private final String accountSid; - private final ZonedDateTime dateCreated; - private final ZonedDateTime dateUpdated; - private final String assistantSid; - private final String sid; - private final String uniqueName; - private final String events; - private final URI webhookUrl; - private final String webhookMethod; - - @JsonCreator - private Webhook( - @JsonProperty("url") final URI url, - @JsonProperty("account_sid") final String accountSid, - @JsonProperty("date_created") final String dateCreated, - @JsonProperty("date_updated") final String dateUpdated, - @JsonProperty("assistant_sid") final String assistantSid, - @JsonProperty("sid") final String sid, - @JsonProperty("unique_name") final String uniqueName, - @JsonProperty("events") final String events, - @JsonProperty("webhook_url") final URI webhookUrl, - @JsonProperty("webhook_method") final String webhookMethod - ) { - this.url = url; - this.accountSid = accountSid; - this.dateCreated = DateConverter.iso8601DateTimeFromString(dateCreated); - this.dateUpdated = DateConverter.iso8601DateTimeFromString(dateUpdated); - this.assistantSid = assistantSid; - this.sid = sid; - this.uniqueName = uniqueName; - this.events = events; - this.webhookUrl = webhookUrl; - this.webhookMethod = webhookMethod; - } - - public final URI getUrl() { - return this.url; - } - - public final String getAccountSid() { - return this.accountSid; - } - - public final ZonedDateTime getDateCreated() { - return this.dateCreated; - } - - public final ZonedDateTime getDateUpdated() { - return this.dateUpdated; - } - - public final String getAssistantSid() { - return this.assistantSid; - } - - public final String getSid() { - return this.sid; - } - - public final String getUniqueName() { - return this.uniqueName; - } - - public final String getEvents() { - return this.events; - } - - public final URI getWebhookUrl() { - return this.webhookUrl; - } - - public final String getWebhookMethod() { - return this.webhookMethod; - } - - @Override - public boolean equals(final Object o) { - if (this == o) { - return true; - } - - if (o == null || getClass() != o.getClass()) { - return false; - } - - Webhook other = (Webhook) o; - - return ( - Objects.equals(url, other.url) && - Objects.equals(accountSid, other.accountSid) && - Objects.equals(dateCreated, other.dateCreated) && - Objects.equals(dateUpdated, other.dateUpdated) && - Objects.equals(assistantSid, other.assistantSid) && - Objects.equals(sid, other.sid) && - Objects.equals(uniqueName, other.uniqueName) && - Objects.equals(events, other.events) && - Objects.equals(webhookUrl, other.webhookUrl) && - Objects.equals(webhookMethod, other.webhookMethod) - ); - } - - @Override - public int hashCode() { - return Objects.hash( - url, - accountSid, - dateCreated, - dateUpdated, - assistantSid, - sid, - uniqueName, - events, - webhookUrl, - webhookMethod - ); - } -} diff --git a/src/main/java/com/twilio/rest/autopilot/v1/assistant/WebhookCreator.java b/src/main/java/com/twilio/rest/autopilot/v1/assistant/WebhookCreator.java deleted file mode 100644 index 5fe3f2dc24..0000000000 --- a/src/main/java/com/twilio/rest/autopilot/v1/assistant/WebhookCreator.java +++ /dev/null @@ -1,133 +0,0 @@ -/* - * This code was generated by - * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ - * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ - * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ - * - * Twilio - Autopilot - * 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.autopilot.v1.assistant; - -import com.twilio.base.Creator; -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; -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; -import java.net.URI; -import java.net.URI; - -public class WebhookCreator extends Creator { - - private String pathAssistantSid; - private String uniqueName; - private String events; - private URI webhookUrl; - private String webhookMethod; - - public WebhookCreator( - final String pathAssistantSid, - final String uniqueName, - final String events, - final URI webhookUrl - ) { - this.pathAssistantSid = pathAssistantSid; - this.uniqueName = uniqueName; - this.events = events; - this.webhookUrl = webhookUrl; - } - - public WebhookCreator setUniqueName(final String uniqueName) { - this.uniqueName = uniqueName; - return this; - } - - public WebhookCreator setEvents(final String events) { - this.events = events; - return this; - } - - public WebhookCreator setWebhookUrl(final URI webhookUrl) { - this.webhookUrl = webhookUrl; - return this; - } - - public WebhookCreator setWebhookUrl(final String webhookUrl) { - return setWebhookUrl(Promoter.uriFromString(webhookUrl)); - } - - public WebhookCreator setWebhookMethod(final String webhookMethod) { - this.webhookMethod = webhookMethod; - return this; - } - - @Override - public Webhook create(final TwilioRestClient client) { - String path = "/v1/Assistants/{AssistantSid}/Webhooks"; - - path = - path.replace( - "{" + "AssistantSid" + "}", - this.pathAssistantSid.toString() - ); - path = - path.replace("{" + "UniqueName" + "}", this.uniqueName.toString()); - path = path.replace("{" + "Events" + "}", this.events.toString()); - path = - path.replace("{" + "WebhookUrl" + "}", this.webhookUrl.toString()); - - Request request = new Request( - HttpMethod.POST, - Domains.AUTOPILOT.toString(), - path - ); - request.setContentType(EnumConstants.ContentType.FORM_URLENCODED); - addPostParams(request); - Response response = client.request(request); - if (response == null) { - throw new ApiConnectionException( - "Webhook 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 Webhook.fromJson(response.getStream(), client.getObjectMapper()); - } - - private void addPostParams(final Request request) { - if (uniqueName != null) { - request.addPostParam("UniqueName", uniqueName); - } - if (events != null) { - request.addPostParam("Events", events); - } - if (webhookUrl != null) { - request.addPostParam("WebhookUrl", webhookUrl.toString()); - } - if (webhookMethod != null) { - request.addPostParam("WebhookMethod", webhookMethod); - } - } -} diff --git a/src/main/java/com/twilio/rest/autopilot/v1/assistant/WebhookDeleter.java b/src/main/java/com/twilio/rest/autopilot/v1/assistant/WebhookDeleter.java deleted file mode 100644 index b878427f8b..0000000000 --- a/src/main/java/com/twilio/rest/autopilot/v1/assistant/WebhookDeleter.java +++ /dev/null @@ -1,74 +0,0 @@ -/* - * This code was generated by - * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ - * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ - * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ - * - * Twilio - Autopilot - * 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.autopilot.v1.assistant; - -import com.twilio.base.Deleter; -import com.twilio.exception.ApiConnectionException; -import com.twilio.exception.ApiException; -import com.twilio.exception.RestException; -import com.twilio.http.HttpMethod; -import com.twilio.http.Request; -import com.twilio.http.Response; -import com.twilio.http.TwilioRestClient; -import com.twilio.rest.Domains; - -public class WebhookDeleter extends Deleter { - - private String pathAssistantSid; - private String pathSid; - - public WebhookDeleter(final String pathAssistantSid, final String pathSid) { - this.pathAssistantSid = pathAssistantSid; - this.pathSid = pathSid; - } - - @Override - public boolean delete(final TwilioRestClient client) { - String path = "/v1/Assistants/{AssistantSid}/Webhooks/{Sid}"; - - path = - path.replace( - "{" + "AssistantSid" + "}", - this.pathAssistantSid.toString() - ); - path = path.replace("{" + "Sid" + "}", this.pathSid.toString()); - - Request request = new Request( - HttpMethod.DELETE, - Domains.AUTOPILOT.toString(), - path - ); - Response response = client.request(request); - - if (response == null) { - throw new ApiConnectionException( - "Webhook 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/autopilot/v1/assistant/WebhookFetcher.java b/src/main/java/com/twilio/rest/autopilot/v1/assistant/WebhookFetcher.java deleted file mode 100644 index 8547d03a01..0000000000 --- a/src/main/java/com/twilio/rest/autopilot/v1/assistant/WebhookFetcher.java +++ /dev/null @@ -1,75 +0,0 @@ -/* - * This code was generated by - * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ - * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ - * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ - * - * Twilio - Autopilot - * 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.autopilot.v1.assistant; - -import com.twilio.base.Fetcher; -import com.twilio.exception.ApiConnectionException; -import com.twilio.exception.ApiException; -import com.twilio.exception.RestException; -import com.twilio.http.HttpMethod; -import com.twilio.http.Request; -import com.twilio.http.Response; -import com.twilio.http.TwilioRestClient; -import com.twilio.rest.Domains; - -public class WebhookFetcher extends Fetcher { - - private String pathAssistantSid; - private String pathSid; - - public WebhookFetcher(final String pathAssistantSid, final String pathSid) { - this.pathAssistantSid = pathAssistantSid; - this.pathSid = pathSid; - } - - @Override - public Webhook fetch(final TwilioRestClient client) { - String path = "/v1/Assistants/{AssistantSid}/Webhooks/{Sid}"; - - path = - path.replace( - "{" + "AssistantSid" + "}", - this.pathAssistantSid.toString() - ); - path = path.replace("{" + "Sid" + "}", this.pathSid.toString()); - - Request request = new Request( - HttpMethod.GET, - Domains.AUTOPILOT.toString(), - path - ); - Response response = client.request(request); - - if (response == null) { - throw new ApiConnectionException( - "Webhook 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 Webhook.fromJson(response.getStream(), client.getObjectMapper()); - } -} diff --git a/src/main/java/com/twilio/rest/autopilot/v1/assistant/WebhookReader.java b/src/main/java/com/twilio/rest/autopilot/v1/assistant/WebhookReader.java deleted file mode 100644 index 698fbb5223..0000000000 --- a/src/main/java/com/twilio/rest/autopilot/v1/assistant/WebhookReader.java +++ /dev/null @@ -1,141 +0,0 @@ -/* - * This code was generated by - * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ - * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ - * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ - * - * Twilio - Autopilot - * 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.autopilot.v1.assistant; - -import com.twilio.base.Page; -import com.twilio.base.Reader; -import com.twilio.base.ResourceSet; -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 WebhookReader extends Reader { - - private String pathAssistantSid; - private Integer pageSize; - - public WebhookReader(final String pathAssistantSid) { - this.pathAssistantSid = pathAssistantSid; - } - - public WebhookReader 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/Assistants/{AssistantSid}/Webhooks"; - path = - path.replace( - "{" + "AssistantSid" + "}", - this.pathAssistantSid.toString() - ); - - Request request = new Request( - HttpMethod.GET, - Domains.AUTOPILOT.toString(), - path - ); - - addQueryParams(request); - return pageForRequest(client, request); - } - - private Page pageForRequest( - final TwilioRestClient client, - final Request request - ) { - Response response = client.request(request); - - if (response == null) { - throw new ApiConnectionException( - "Webhook 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( - "webhooks", - response.getContent(), - Webhook.class, - client.getObjectMapper() - ); - } - - @Override - public Page previousPage( - final Page page, - final TwilioRestClient client - ) { - Request request = new Request( - HttpMethod.GET, - page.getPreviousPageUrl(Domains.AUTOPILOT.toString()) - ); - return pageForRequest(client, request); - } - - @Override - public Page nextPage( - final Page page, - final TwilioRestClient client - ) { - Request request = new Request( - HttpMethod.GET, - page.getNextPageUrl(Domains.AUTOPILOT.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/autopilot/v1/assistant/WebhookUpdater.java b/src/main/java/com/twilio/rest/autopilot/v1/assistant/WebhookUpdater.java deleted file mode 100644 index 4af7d9bc7b..0000000000 --- a/src/main/java/com/twilio/rest/autopilot/v1/assistant/WebhookUpdater.java +++ /dev/null @@ -1,122 +0,0 @@ -/* - * This code was generated by - * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ - * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ - * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ - * - * Twilio - Autopilot - * 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.autopilot.v1.assistant; - -import com.twilio.base.Updater; -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; -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; -import java.net.URI; - -public class WebhookUpdater extends Updater { - - private String pathAssistantSid; - private String pathSid; - private String uniqueName; - private String events; - private URI webhookUrl; - private String webhookMethod; - - public WebhookUpdater(final String pathAssistantSid, final String pathSid) { - this.pathAssistantSid = pathAssistantSid; - this.pathSid = pathSid; - } - - public WebhookUpdater setUniqueName(final String uniqueName) { - this.uniqueName = uniqueName; - return this; - } - - public WebhookUpdater setEvents(final String events) { - this.events = events; - return this; - } - - public WebhookUpdater setWebhookUrl(final URI webhookUrl) { - this.webhookUrl = webhookUrl; - return this; - } - - public WebhookUpdater setWebhookUrl(final String webhookUrl) { - return setWebhookUrl(Promoter.uriFromString(webhookUrl)); - } - - public WebhookUpdater setWebhookMethod(final String webhookMethod) { - this.webhookMethod = webhookMethod; - return this; - } - - @Override - public Webhook update(final TwilioRestClient client) { - String path = "/v1/Assistants/{AssistantSid}/Webhooks/{Sid}"; - - path = - path.replace( - "{" + "AssistantSid" + "}", - this.pathAssistantSid.toString() - ); - path = path.replace("{" + "Sid" + "}", this.pathSid.toString()); - - Request request = new Request( - HttpMethod.POST, - Domains.AUTOPILOT.toString(), - path - ); - request.setContentType(EnumConstants.ContentType.FORM_URLENCODED); - addPostParams(request); - Response response = client.request(request); - if (response == null) { - throw new ApiConnectionException( - "Webhook 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 Webhook.fromJson(response.getStream(), client.getObjectMapper()); - } - - private void addPostParams(final Request request) { - if (uniqueName != null) { - request.addPostParam("UniqueName", uniqueName); - } - if (events != null) { - request.addPostParam("Events", events); - } - if (webhookUrl != null) { - request.addPostParam("WebhookUrl", webhookUrl.toString()); - } - if (webhookMethod != null) { - request.addPostParam("WebhookMethod", webhookMethod); - } - } -} diff --git a/src/main/java/com/twilio/rest/autopilot/v1/assistant/fieldtype/FieldValue.java b/src/main/java/com/twilio/rest/autopilot/v1/assistant/fieldtype/FieldValue.java deleted file mode 100644 index 3f7d602130..0000000000 --- a/src/main/java/com/twilio/rest/autopilot/v1/assistant/fieldtype/FieldValue.java +++ /dev/null @@ -1,246 +0,0 @@ -/* - * This code was generated by - * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ - * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ - * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ - * - * Twilio - Autopilot - * 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.autopilot.v1.assistant.fieldtype; - -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 FieldValue extends Resource { - - private static final long serialVersionUID = 181490262234152L; - - public static FieldValueCreator creator( - final String pathAssistantSid, - final String pathFieldTypeSid, - final String language, - final String value - ) { - return new FieldValueCreator( - pathAssistantSid, - pathFieldTypeSid, - language, - value - ); - } - - public static FieldValueDeleter deleter( - final String pathAssistantSid, - final String pathFieldTypeSid, - final String pathSid - ) { - return new FieldValueDeleter( - pathAssistantSid, - pathFieldTypeSid, - pathSid - ); - } - - public static FieldValueFetcher fetcher( - final String pathAssistantSid, - final String pathFieldTypeSid, - final String pathSid - ) { - return new FieldValueFetcher( - pathAssistantSid, - pathFieldTypeSid, - pathSid - ); - } - - public static FieldValueReader reader( - final String pathAssistantSid, - final String pathFieldTypeSid - ) { - return new FieldValueReader(pathAssistantSid, pathFieldTypeSid); - } - - /** - * Converts a JSON String into a FieldValue object using the provided ObjectMapper. - * - * @param json Raw JSON String - * @param objectMapper Jackson ObjectMapper - * @return FieldValue object represented by the provided JSON - */ - public static FieldValue fromJson( - final String json, - final ObjectMapper objectMapper - ) { - // Convert all checked exceptions to Runtime - try { - return objectMapper.readValue(json, FieldValue.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 FieldValue object using the provided - * ObjectMapper. - * - * @param json Raw JSON InputStream - * @param objectMapper Jackson ObjectMapper - * @return FieldValue object represented by the provided JSON - */ - public static FieldValue fromJson( - final InputStream json, - final ObjectMapper objectMapper - ) { - // Convert all checked exceptions to Runtime - try { - return objectMapper.readValue(json, FieldValue.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 ZonedDateTime dateCreated; - private final ZonedDateTime dateUpdated; - private final String fieldTypeSid; - private final String language; - private final String assistantSid; - private final String sid; - private final String value; - private final URI url; - private final String synonymOf; - - @JsonCreator - private FieldValue( - @JsonProperty("account_sid") final String accountSid, - @JsonProperty("date_created") final String dateCreated, - @JsonProperty("date_updated") final String dateUpdated, - @JsonProperty("field_type_sid") final String fieldTypeSid, - @JsonProperty("language") final String language, - @JsonProperty("assistant_sid") final String assistantSid, - @JsonProperty("sid") final String sid, - @JsonProperty("value") final String value, - @JsonProperty("url") final URI url, - @JsonProperty("synonym_of") final String synonymOf - ) { - this.accountSid = accountSid; - this.dateCreated = DateConverter.iso8601DateTimeFromString(dateCreated); - this.dateUpdated = DateConverter.iso8601DateTimeFromString(dateUpdated); - this.fieldTypeSid = fieldTypeSid; - this.language = language; - this.assistantSid = assistantSid; - this.sid = sid; - this.value = value; - this.url = url; - this.synonymOf = synonymOf; - } - - public final String getAccountSid() { - return this.accountSid; - } - - public final ZonedDateTime getDateCreated() { - return this.dateCreated; - } - - public final ZonedDateTime getDateUpdated() { - return this.dateUpdated; - } - - public final String getFieldTypeSid() { - return this.fieldTypeSid; - } - - public final String getLanguage() { - return this.language; - } - - public final String getAssistantSid() { - return this.assistantSid; - } - - public final String getSid() { - return this.sid; - } - - public final String getValue() { - return this.value; - } - - public final URI getUrl() { - return this.url; - } - - public final String getSynonymOf() { - return this.synonymOf; - } - - @Override - public boolean equals(final Object o) { - if (this == o) { - return true; - } - - if (o == null || getClass() != o.getClass()) { - return false; - } - - FieldValue other = (FieldValue) o; - - return ( - Objects.equals(accountSid, other.accountSid) && - Objects.equals(dateCreated, other.dateCreated) && - Objects.equals(dateUpdated, other.dateUpdated) && - Objects.equals(fieldTypeSid, other.fieldTypeSid) && - Objects.equals(language, other.language) && - Objects.equals(assistantSid, other.assistantSid) && - Objects.equals(sid, other.sid) && - Objects.equals(value, other.value) && - Objects.equals(url, other.url) && - Objects.equals(synonymOf, other.synonymOf) - ); - } - - @Override - public int hashCode() { - return Objects.hash( - accountSid, - dateCreated, - dateUpdated, - fieldTypeSid, - language, - assistantSid, - sid, - value, - url, - synonymOf - ); - } -} diff --git a/src/main/java/com/twilio/rest/autopilot/v1/assistant/fieldtype/FieldValueCreator.java b/src/main/java/com/twilio/rest/autopilot/v1/assistant/fieldtype/FieldValueCreator.java deleted file mode 100644 index 00fe6179a1..0000000000 --- a/src/main/java/com/twilio/rest/autopilot/v1/assistant/fieldtype/FieldValueCreator.java +++ /dev/null @@ -1,124 +0,0 @@ -/* - * This code was generated by - * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ - * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ - * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ - * - * Twilio - Autopilot - * 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.autopilot.v1.assistant.fieldtype; - -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 FieldValueCreator extends Creator { - - private String pathAssistantSid; - private String pathFieldTypeSid; - private String language; - private String value; - private String synonymOf; - - public FieldValueCreator( - final String pathAssistantSid, - final String pathFieldTypeSid, - final String language, - final String value - ) { - this.pathAssistantSid = pathAssistantSid; - this.pathFieldTypeSid = pathFieldTypeSid; - this.language = language; - this.value = value; - } - - public FieldValueCreator setLanguage(final String language) { - this.language = language; - return this; - } - - public FieldValueCreator setValue(final String value) { - this.value = value; - return this; - } - - public FieldValueCreator setSynonymOf(final String synonymOf) { - this.synonymOf = synonymOf; - return this; - } - - @Override - public FieldValue create(final TwilioRestClient client) { - String path = - "/v1/Assistants/{AssistantSid}/FieldTypes/{FieldTypeSid}/FieldValues"; - - path = - path.replace( - "{" + "AssistantSid" + "}", - this.pathAssistantSid.toString() - ); - path = - path.replace( - "{" + "FieldTypeSid" + "}", - this.pathFieldTypeSid.toString() - ); - path = path.replace("{" + "Language" + "}", this.language.toString()); - path = path.replace("{" + "Value" + "}", this.value.toString()); - - Request request = new Request( - HttpMethod.POST, - Domains.AUTOPILOT.toString(), - path - ); - request.setContentType(EnumConstants.ContentType.FORM_URLENCODED); - addPostParams(request); - Response response = client.request(request); - if (response == null) { - throw new ApiConnectionException( - "FieldValue 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 FieldValue.fromJson( - response.getStream(), - client.getObjectMapper() - ); - } - - private void addPostParams(final Request request) { - if (language != null) { - request.addPostParam("Language", language); - } - if (value != null) { - request.addPostParam("Value", value); - } - if (synonymOf != null) { - request.addPostParam("SynonymOf", synonymOf); - } - } -} diff --git a/src/main/java/com/twilio/rest/autopilot/v1/assistant/fieldtype/FieldValueDeleter.java b/src/main/java/com/twilio/rest/autopilot/v1/assistant/fieldtype/FieldValueDeleter.java deleted file mode 100644 index 44cbf7841e..0000000000 --- a/src/main/java/com/twilio/rest/autopilot/v1/assistant/fieldtype/FieldValueDeleter.java +++ /dev/null @@ -1,86 +0,0 @@ -/* - * This code was generated by - * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ - * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ - * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ - * - * Twilio - Autopilot - * 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.autopilot.v1.assistant.fieldtype; - -import com.twilio.base.Deleter; -import com.twilio.exception.ApiConnectionException; -import com.twilio.exception.ApiException; -import com.twilio.exception.RestException; -import com.twilio.http.HttpMethod; -import com.twilio.http.Request; -import com.twilio.http.Response; -import com.twilio.http.TwilioRestClient; -import com.twilio.rest.Domains; - -public class FieldValueDeleter extends Deleter { - - private String pathAssistantSid; - private String pathFieldTypeSid; - private String pathSid; - - public FieldValueDeleter( - final String pathAssistantSid, - final String pathFieldTypeSid, - final String pathSid - ) { - this.pathAssistantSid = pathAssistantSid; - this.pathFieldTypeSid = pathFieldTypeSid; - this.pathSid = pathSid; - } - - @Override - public boolean delete(final TwilioRestClient client) { - String path = - "/v1/Assistants/{AssistantSid}/FieldTypes/{FieldTypeSid}/FieldValues/{Sid}"; - - path = - path.replace( - "{" + "AssistantSid" + "}", - this.pathAssistantSid.toString() - ); - path = - path.replace( - "{" + "FieldTypeSid" + "}", - this.pathFieldTypeSid.toString() - ); - path = path.replace("{" + "Sid" + "}", this.pathSid.toString()); - - Request request = new Request( - HttpMethod.DELETE, - Domains.AUTOPILOT.toString(), - path - ); - Response response = client.request(request); - - if (response == null) { - throw new ApiConnectionException( - "FieldValue 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/autopilot/v1/assistant/fieldtype/FieldValueFetcher.java b/src/main/java/com/twilio/rest/autopilot/v1/assistant/fieldtype/FieldValueFetcher.java deleted file mode 100644 index 8a0867fd6c..0000000000 --- a/src/main/java/com/twilio/rest/autopilot/v1/assistant/fieldtype/FieldValueFetcher.java +++ /dev/null @@ -1,90 +0,0 @@ -/* - * This code was generated by - * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ - * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ - * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ - * - * Twilio - Autopilot - * 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.autopilot.v1.assistant.fieldtype; - -import com.twilio.base.Fetcher; -import com.twilio.exception.ApiConnectionException; -import com.twilio.exception.ApiException; -import com.twilio.exception.RestException; -import com.twilio.http.HttpMethod; -import com.twilio.http.Request; -import com.twilio.http.Response; -import com.twilio.http.TwilioRestClient; -import com.twilio.rest.Domains; - -public class FieldValueFetcher extends Fetcher { - - private String pathAssistantSid; - private String pathFieldTypeSid; - private String pathSid; - - public FieldValueFetcher( - final String pathAssistantSid, - final String pathFieldTypeSid, - final String pathSid - ) { - this.pathAssistantSid = pathAssistantSid; - this.pathFieldTypeSid = pathFieldTypeSid; - this.pathSid = pathSid; - } - - @Override - public FieldValue fetch(final TwilioRestClient client) { - String path = - "/v1/Assistants/{AssistantSid}/FieldTypes/{FieldTypeSid}/FieldValues/{Sid}"; - - path = - path.replace( - "{" + "AssistantSid" + "}", - this.pathAssistantSid.toString() - ); - path = - path.replace( - "{" + "FieldTypeSid" + "}", - this.pathFieldTypeSid.toString() - ); - path = path.replace("{" + "Sid" + "}", this.pathSid.toString()); - - Request request = new Request( - HttpMethod.GET, - Domains.AUTOPILOT.toString(), - path - ); - Response response = client.request(request); - - if (response == null) { - throw new ApiConnectionException( - "FieldValue 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 FieldValue.fromJson( - response.getStream(), - client.getObjectMapper() - ); - } -} diff --git a/src/main/java/com/twilio/rest/autopilot/v1/assistant/fieldtype/FieldValueReader.java b/src/main/java/com/twilio/rest/autopilot/v1/assistant/fieldtype/FieldValueReader.java deleted file mode 100644 index 38f1216211..0000000000 --- a/src/main/java/com/twilio/rest/autopilot/v1/assistant/fieldtype/FieldValueReader.java +++ /dev/null @@ -1,161 +0,0 @@ -/* - * This code was generated by - * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ - * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ - * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ - * - * Twilio - Autopilot - * 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.autopilot.v1.assistant.fieldtype; - -import com.twilio.base.Page; -import com.twilio.base.Reader; -import com.twilio.base.ResourceSet; -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 FieldValueReader extends Reader { - - private String pathAssistantSid; - private String pathFieldTypeSid; - private String language; - private Integer pageSize; - - public FieldValueReader( - final String pathAssistantSid, - final String pathFieldTypeSid - ) { - this.pathAssistantSid = pathAssistantSid; - this.pathFieldTypeSid = pathFieldTypeSid; - } - - public FieldValueReader setLanguage(final String language) { - this.language = language; - return this; - } - - public FieldValueReader 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/Assistants/{AssistantSid}/FieldTypes/{FieldTypeSid}/FieldValues"; - path = - path.replace( - "{" + "AssistantSid" + "}", - this.pathAssistantSid.toString() - ); - path = - path.replace( - "{" + "FieldTypeSid" + "}", - this.pathFieldTypeSid.toString() - ); - - Request request = new Request( - HttpMethod.GET, - Domains.AUTOPILOT.toString(), - path - ); - - addQueryParams(request); - return pageForRequest(client, request); - } - - private Page pageForRequest( - final TwilioRestClient client, - final Request request - ) { - Response response = client.request(request); - - if (response == null) { - throw new ApiConnectionException( - "FieldValue 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( - "field_values", - response.getContent(), - FieldValue.class, - client.getObjectMapper() - ); - } - - @Override - public Page previousPage( - final Page page, - final TwilioRestClient client - ) { - Request request = new Request( - HttpMethod.GET, - page.getPreviousPageUrl(Domains.AUTOPILOT.toString()) - ); - return pageForRequest(client, request); - } - - @Override - public Page nextPage( - final Page page, - final TwilioRestClient client - ) { - Request request = new Request( - HttpMethod.GET, - page.getNextPageUrl(Domains.AUTOPILOT.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 (language != null) { - request.addQueryParam("Language", language); - } - 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/autopilot/v1/assistant/task/Field.java b/src/main/java/com/twilio/rest/autopilot/v1/assistant/task/Field.java deleted file mode 100644 index d5b6c23d5c..0000000000 --- a/src/main/java/com/twilio/rest/autopilot/v1/assistant/task/Field.java +++ /dev/null @@ -1,229 +0,0 @@ -/* - * This code was generated by - * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ - * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ - * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ - * - * Twilio - Autopilot - * 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.autopilot.v1.assistant.task; - -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 Field extends Resource { - - private static final long serialVersionUID = 118531839027400L; - - public static FieldCreator creator( - final String pathAssistantSid, - final String pathTaskSid, - final String fieldType, - final String uniqueName - ) { - return new FieldCreator( - pathAssistantSid, - pathTaskSid, - fieldType, - uniqueName - ); - } - - public static FieldDeleter deleter( - final String pathAssistantSid, - final String pathTaskSid, - final String pathSid - ) { - return new FieldDeleter(pathAssistantSid, pathTaskSid, pathSid); - } - - public static FieldFetcher fetcher( - final String pathAssistantSid, - final String pathTaskSid, - final String pathSid - ) { - return new FieldFetcher(pathAssistantSid, pathTaskSid, pathSid); - } - - public static FieldReader reader( - final String pathAssistantSid, - final String pathTaskSid - ) { - return new FieldReader(pathAssistantSid, pathTaskSid); - } - - /** - * Converts a JSON String into a Field object using the provided ObjectMapper. - * - * @param json Raw JSON String - * @param objectMapper Jackson ObjectMapper - * @return Field object represented by the provided JSON - */ - public static Field fromJson( - final String json, - final ObjectMapper objectMapper - ) { - // Convert all checked exceptions to Runtime - try { - return objectMapper.readValue(json, Field.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 Field object using the provided - * ObjectMapper. - * - * @param json Raw JSON InputStream - * @param objectMapper Jackson ObjectMapper - * @return Field object represented by the provided JSON - */ - public static Field fromJson( - final InputStream json, - final ObjectMapper objectMapper - ) { - // Convert all checked exceptions to Runtime - try { - return objectMapper.readValue(json, Field.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 ZonedDateTime dateCreated; - private final ZonedDateTime dateUpdated; - private final String fieldType; - private final String taskSid; - private final String assistantSid; - private final String sid; - private final String uniqueName; - private final URI url; - - @JsonCreator - private Field( - @JsonProperty("account_sid") final String accountSid, - @JsonProperty("date_created") final String dateCreated, - @JsonProperty("date_updated") final String dateUpdated, - @JsonProperty("field_type") final String fieldType, - @JsonProperty("task_sid") final String taskSid, - @JsonProperty("assistant_sid") final String assistantSid, - @JsonProperty("sid") final String sid, - @JsonProperty("unique_name") final String uniqueName, - @JsonProperty("url") final URI url - ) { - this.accountSid = accountSid; - this.dateCreated = DateConverter.iso8601DateTimeFromString(dateCreated); - this.dateUpdated = DateConverter.iso8601DateTimeFromString(dateUpdated); - this.fieldType = fieldType; - this.taskSid = taskSid; - this.assistantSid = assistantSid; - this.sid = sid; - this.uniqueName = uniqueName; - this.url = url; - } - - public final String getAccountSid() { - return this.accountSid; - } - - public final ZonedDateTime getDateCreated() { - return this.dateCreated; - } - - public final ZonedDateTime getDateUpdated() { - return this.dateUpdated; - } - - public final String getFieldType() { - return this.fieldType; - } - - public final String getTaskSid() { - return this.taskSid; - } - - public final String getAssistantSid() { - return this.assistantSid; - } - - public final String getSid() { - return this.sid; - } - - public final String getUniqueName() { - return this.uniqueName; - } - - 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; - } - - Field other = (Field) o; - - return ( - Objects.equals(accountSid, other.accountSid) && - Objects.equals(dateCreated, other.dateCreated) && - Objects.equals(dateUpdated, other.dateUpdated) && - Objects.equals(fieldType, other.fieldType) && - Objects.equals(taskSid, other.taskSid) && - Objects.equals(assistantSid, other.assistantSid) && - Objects.equals(sid, other.sid) && - Objects.equals(uniqueName, other.uniqueName) && - Objects.equals(url, other.url) - ); - } - - @Override - public int hashCode() { - return Objects.hash( - accountSid, - dateCreated, - dateUpdated, - fieldType, - taskSid, - assistantSid, - sid, - uniqueName, - url - ); - } -} diff --git a/src/main/java/com/twilio/rest/autopilot/v1/assistant/task/FieldCreator.java b/src/main/java/com/twilio/rest/autopilot/v1/assistant/task/FieldCreator.java deleted file mode 100644 index d1bb2929d2..0000000000 --- a/src/main/java/com/twilio/rest/autopilot/v1/assistant/task/FieldCreator.java +++ /dev/null @@ -1,108 +0,0 @@ -/* - * This code was generated by - * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ - * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ - * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ - * - * Twilio - Autopilot - * 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.autopilot.v1.assistant.task; - -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 FieldCreator extends Creator { - - private String pathAssistantSid; - private String pathTaskSid; - private String fieldType; - private String uniqueName; - - public FieldCreator( - final String pathAssistantSid, - final String pathTaskSid, - final String fieldType, - final String uniqueName - ) { - this.pathAssistantSid = pathAssistantSid; - this.pathTaskSid = pathTaskSid; - this.fieldType = fieldType; - this.uniqueName = uniqueName; - } - - public FieldCreator setFieldType(final String fieldType) { - this.fieldType = fieldType; - return this; - } - - public FieldCreator setUniqueName(final String uniqueName) { - this.uniqueName = uniqueName; - return this; - } - - @Override - public Field create(final TwilioRestClient client) { - String path = "/v1/Assistants/{AssistantSid}/Tasks/{TaskSid}/Fields"; - - path = - path.replace( - "{" + "AssistantSid" + "}", - this.pathAssistantSid.toString() - ); - path = path.replace("{" + "TaskSid" + "}", this.pathTaskSid.toString()); - path = path.replace("{" + "FieldType" + "}", this.fieldType.toString()); - path = - path.replace("{" + "UniqueName" + "}", this.uniqueName.toString()); - - Request request = new Request( - HttpMethod.POST, - Domains.AUTOPILOT.toString(), - path - ); - request.setContentType(EnumConstants.ContentType.FORM_URLENCODED); - addPostParams(request); - Response response = client.request(request); - if (response == null) { - throw new ApiConnectionException( - "Field 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 Field.fromJson(response.getStream(), client.getObjectMapper()); - } - - private void addPostParams(final Request request) { - if (fieldType != null) { - request.addPostParam("FieldType", fieldType); - } - if (uniqueName != null) { - request.addPostParam("UniqueName", uniqueName); - } - } -} diff --git a/src/main/java/com/twilio/rest/autopilot/v1/assistant/task/FieldDeleter.java b/src/main/java/com/twilio/rest/autopilot/v1/assistant/task/FieldDeleter.java deleted file mode 100644 index 16cc4b3c7d..0000000000 --- a/src/main/java/com/twilio/rest/autopilot/v1/assistant/task/FieldDeleter.java +++ /dev/null @@ -1,82 +0,0 @@ -/* - * This code was generated by - * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ - * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ - * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ - * - * Twilio - Autopilot - * 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.autopilot.v1.assistant.task; - -import com.twilio.base.Deleter; -import com.twilio.exception.ApiConnectionException; -import com.twilio.exception.ApiException; -import com.twilio.exception.RestException; -import com.twilio.http.HttpMethod; -import com.twilio.http.Request; -import com.twilio.http.Response; -import com.twilio.http.TwilioRestClient; -import com.twilio.rest.Domains; - -public class FieldDeleter extends Deleter { - - private String pathAssistantSid; - private String pathTaskSid; - private String pathSid; - - public FieldDeleter( - final String pathAssistantSid, - final String pathTaskSid, - final String pathSid - ) { - this.pathAssistantSid = pathAssistantSid; - this.pathTaskSid = pathTaskSid; - this.pathSid = pathSid; - } - - @Override - public boolean delete(final TwilioRestClient client) { - String path = - "/v1/Assistants/{AssistantSid}/Tasks/{TaskSid}/Fields/{Sid}"; - - path = - path.replace( - "{" + "AssistantSid" + "}", - this.pathAssistantSid.toString() - ); - path = path.replace("{" + "TaskSid" + "}", this.pathTaskSid.toString()); - path = path.replace("{" + "Sid" + "}", this.pathSid.toString()); - - Request request = new Request( - HttpMethod.DELETE, - Domains.AUTOPILOT.toString(), - path - ); - Response response = client.request(request); - - if (response == null) { - throw new ApiConnectionException( - "Field 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/autopilot/v1/assistant/task/FieldFetcher.java b/src/main/java/com/twilio/rest/autopilot/v1/assistant/task/FieldFetcher.java deleted file mode 100644 index c390c14b6f..0000000000 --- a/src/main/java/com/twilio/rest/autopilot/v1/assistant/task/FieldFetcher.java +++ /dev/null @@ -1,83 +0,0 @@ -/* - * This code was generated by - * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ - * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ - * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ - * - * Twilio - Autopilot - * 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.autopilot.v1.assistant.task; - -import com.twilio.base.Fetcher; -import com.twilio.exception.ApiConnectionException; -import com.twilio.exception.ApiException; -import com.twilio.exception.RestException; -import com.twilio.http.HttpMethod; -import com.twilio.http.Request; -import com.twilio.http.Response; -import com.twilio.http.TwilioRestClient; -import com.twilio.rest.Domains; - -public class FieldFetcher extends Fetcher { - - private String pathAssistantSid; - private String pathTaskSid; - private String pathSid; - - public FieldFetcher( - final String pathAssistantSid, - final String pathTaskSid, - final String pathSid - ) { - this.pathAssistantSid = pathAssistantSid; - this.pathTaskSid = pathTaskSid; - this.pathSid = pathSid; - } - - @Override - public Field fetch(final TwilioRestClient client) { - String path = - "/v1/Assistants/{AssistantSid}/Tasks/{TaskSid}/Fields/{Sid}"; - - path = - path.replace( - "{" + "AssistantSid" + "}", - this.pathAssistantSid.toString() - ); - path = path.replace("{" + "TaskSid" + "}", this.pathTaskSid.toString()); - path = path.replace("{" + "Sid" + "}", this.pathSid.toString()); - - Request request = new Request( - HttpMethod.GET, - Domains.AUTOPILOT.toString(), - path - ); - Response response = client.request(request); - - if (response == null) { - throw new ApiConnectionException( - "Field 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 Field.fromJson(response.getStream(), client.getObjectMapper()); - } -} diff --git a/src/main/java/com/twilio/rest/autopilot/v1/assistant/task/FieldReader.java b/src/main/java/com/twilio/rest/autopilot/v1/assistant/task/FieldReader.java deleted file mode 100644 index 61f0da4557..0000000000 --- a/src/main/java/com/twilio/rest/autopilot/v1/assistant/task/FieldReader.java +++ /dev/null @@ -1,147 +0,0 @@ -/* - * This code was generated by - * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ - * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ - * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ - * - * Twilio - Autopilot - * 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.autopilot.v1.assistant.task; - -import com.twilio.base.Page; -import com.twilio.base.Reader; -import com.twilio.base.ResourceSet; -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 FieldReader extends Reader { - - private String pathAssistantSid; - private String pathTaskSid; - private Integer pageSize; - - public FieldReader( - final String pathAssistantSid, - final String pathTaskSid - ) { - this.pathAssistantSid = pathAssistantSid; - this.pathTaskSid = pathTaskSid; - } - - public FieldReader 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/Assistants/{AssistantSid}/Tasks/{TaskSid}/Fields"; - path = - path.replace( - "{" + "AssistantSid" + "}", - this.pathAssistantSid.toString() - ); - path = path.replace("{" + "TaskSid" + "}", this.pathTaskSid.toString()); - - Request request = new Request( - HttpMethod.GET, - Domains.AUTOPILOT.toString(), - path - ); - - addQueryParams(request); - return pageForRequest(client, request); - } - - private Page pageForRequest( - final TwilioRestClient client, - final Request request - ) { - Response response = client.request(request); - - if (response == null) { - throw new ApiConnectionException( - "Field 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( - "fields", - response.getContent(), - Field.class, - client.getObjectMapper() - ); - } - - @Override - public Page previousPage( - final Page page, - final TwilioRestClient client - ) { - Request request = new Request( - HttpMethod.GET, - page.getPreviousPageUrl(Domains.AUTOPILOT.toString()) - ); - return pageForRequest(client, request); - } - - @Override - public Page nextPage( - final Page page, - final TwilioRestClient client - ) { - Request request = new Request( - HttpMethod.GET, - page.getNextPageUrl(Domains.AUTOPILOT.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/autopilot/v1/assistant/task/Sample.java b/src/main/java/com/twilio/rest/autopilot/v1/assistant/task/Sample.java deleted file mode 100644 index 0781b85f09..0000000000 --- a/src/main/java/com/twilio/rest/autopilot/v1/assistant/task/Sample.java +++ /dev/null @@ -1,246 +0,0 @@ -/* - * This code was generated by - * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ - * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ - * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ - * - * Twilio - Autopilot - * 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.autopilot.v1.assistant.task; - -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 Sample extends Resource { - - private static final long serialVersionUID = 197447215274163L; - - public static SampleCreator creator( - final String pathAssistantSid, - final String pathTaskSid, - final String language, - final String taggedText - ) { - return new SampleCreator( - pathAssistantSid, - pathTaskSid, - language, - taggedText - ); - } - - public static SampleDeleter deleter( - final String pathAssistantSid, - final String pathTaskSid, - final String pathSid - ) { - return new SampleDeleter(pathAssistantSid, pathTaskSid, pathSid); - } - - public static SampleFetcher fetcher( - final String pathAssistantSid, - final String pathTaskSid, - final String pathSid - ) { - return new SampleFetcher(pathAssistantSid, pathTaskSid, pathSid); - } - - public static SampleReader reader( - final String pathAssistantSid, - final String pathTaskSid - ) { - return new SampleReader(pathAssistantSid, pathTaskSid); - } - - public static SampleUpdater updater( - final String pathAssistantSid, - final String pathTaskSid, - final String pathSid - ) { - return new SampleUpdater(pathAssistantSid, pathTaskSid, pathSid); - } - - /** - * Converts a JSON String into a Sample object using the provided ObjectMapper. - * - * @param json Raw JSON String - * @param objectMapper Jackson ObjectMapper - * @return Sample object represented by the provided JSON - */ - public static Sample fromJson( - final String json, - final ObjectMapper objectMapper - ) { - // Convert all checked exceptions to Runtime - try { - return objectMapper.readValue(json, Sample.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 Sample object using the provided - * ObjectMapper. - * - * @param json Raw JSON InputStream - * @param objectMapper Jackson ObjectMapper - * @return Sample object represented by the provided JSON - */ - public static Sample fromJson( - final InputStream json, - final ObjectMapper objectMapper - ) { - // Convert all checked exceptions to Runtime - try { - return objectMapper.readValue(json, Sample.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 ZonedDateTime dateCreated; - private final ZonedDateTime dateUpdated; - private final String taskSid; - private final String language; - private final String assistantSid; - private final String sid; - private final String taggedText; - private final URI url; - private final String sourceChannel; - - @JsonCreator - private Sample( - @JsonProperty("account_sid") final String accountSid, - @JsonProperty("date_created") final String dateCreated, - @JsonProperty("date_updated") final String dateUpdated, - @JsonProperty("task_sid") final String taskSid, - @JsonProperty("language") final String language, - @JsonProperty("assistant_sid") final String assistantSid, - @JsonProperty("sid") final String sid, - @JsonProperty("tagged_text") final String taggedText, - @JsonProperty("url") final URI url, - @JsonProperty("source_channel") final String sourceChannel - ) { - this.accountSid = accountSid; - this.dateCreated = DateConverter.iso8601DateTimeFromString(dateCreated); - this.dateUpdated = DateConverter.iso8601DateTimeFromString(dateUpdated); - this.taskSid = taskSid; - this.language = language; - this.assistantSid = assistantSid; - this.sid = sid; - this.taggedText = taggedText; - this.url = url; - this.sourceChannel = sourceChannel; - } - - public final String getAccountSid() { - return this.accountSid; - } - - public final ZonedDateTime getDateCreated() { - return this.dateCreated; - } - - public final ZonedDateTime getDateUpdated() { - return this.dateUpdated; - } - - public final String getTaskSid() { - return this.taskSid; - } - - public final String getLanguage() { - return this.language; - } - - public final String getAssistantSid() { - return this.assistantSid; - } - - public final String getSid() { - return this.sid; - } - - public final String getTaggedText() { - return this.taggedText; - } - - public final URI getUrl() { - return this.url; - } - - public final String getSourceChannel() { - return this.sourceChannel; - } - - @Override - public boolean equals(final Object o) { - if (this == o) { - return true; - } - - if (o == null || getClass() != o.getClass()) { - return false; - } - - Sample other = (Sample) o; - - return ( - Objects.equals(accountSid, other.accountSid) && - Objects.equals(dateCreated, other.dateCreated) && - Objects.equals(dateUpdated, other.dateUpdated) && - Objects.equals(taskSid, other.taskSid) && - Objects.equals(language, other.language) && - Objects.equals(assistantSid, other.assistantSid) && - Objects.equals(sid, other.sid) && - Objects.equals(taggedText, other.taggedText) && - Objects.equals(url, other.url) && - Objects.equals(sourceChannel, other.sourceChannel) - ); - } - - @Override - public int hashCode() { - return Objects.hash( - accountSid, - dateCreated, - dateUpdated, - taskSid, - language, - assistantSid, - sid, - taggedText, - url, - sourceChannel - ); - } -} diff --git a/src/main/java/com/twilio/rest/autopilot/v1/assistant/task/SampleCreator.java b/src/main/java/com/twilio/rest/autopilot/v1/assistant/task/SampleCreator.java deleted file mode 100644 index 567b088380..0000000000 --- a/src/main/java/com/twilio/rest/autopilot/v1/assistant/task/SampleCreator.java +++ /dev/null @@ -1,117 +0,0 @@ -/* - * This code was generated by - * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ - * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ - * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ - * - * Twilio - Autopilot - * 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.autopilot.v1.assistant.task; - -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 SampleCreator extends Creator { - - private String pathAssistantSid; - private String pathTaskSid; - private String language; - private String taggedText; - private String sourceChannel; - - public SampleCreator( - final String pathAssistantSid, - final String pathTaskSid, - final String language, - final String taggedText - ) { - this.pathAssistantSid = pathAssistantSid; - this.pathTaskSid = pathTaskSid; - this.language = language; - this.taggedText = taggedText; - } - - public SampleCreator setLanguage(final String language) { - this.language = language; - return this; - } - - public SampleCreator setTaggedText(final String taggedText) { - this.taggedText = taggedText; - return this; - } - - public SampleCreator setSourceChannel(final String sourceChannel) { - this.sourceChannel = sourceChannel; - return this; - } - - @Override - public Sample create(final TwilioRestClient client) { - String path = "/v1/Assistants/{AssistantSid}/Tasks/{TaskSid}/Samples"; - - path = - path.replace( - "{" + "AssistantSid" + "}", - this.pathAssistantSid.toString() - ); - path = path.replace("{" + "TaskSid" + "}", this.pathTaskSid.toString()); - path = path.replace("{" + "Language" + "}", this.language.toString()); - path = - path.replace("{" + "TaggedText" + "}", this.taggedText.toString()); - - Request request = new Request( - HttpMethod.POST, - Domains.AUTOPILOT.toString(), - path - ); - request.setContentType(EnumConstants.ContentType.FORM_URLENCODED); - addPostParams(request); - Response response = client.request(request); - if (response == null) { - throw new ApiConnectionException( - "Sample 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 Sample.fromJson(response.getStream(), client.getObjectMapper()); - } - - private void addPostParams(final Request request) { - if (language != null) { - request.addPostParam("Language", language); - } - if (taggedText != null) { - request.addPostParam("TaggedText", taggedText); - } - if (sourceChannel != null) { - request.addPostParam("SourceChannel", sourceChannel); - } - } -} diff --git a/src/main/java/com/twilio/rest/autopilot/v1/assistant/task/SampleDeleter.java b/src/main/java/com/twilio/rest/autopilot/v1/assistant/task/SampleDeleter.java deleted file mode 100644 index a2be92db66..0000000000 --- a/src/main/java/com/twilio/rest/autopilot/v1/assistant/task/SampleDeleter.java +++ /dev/null @@ -1,82 +0,0 @@ -/* - * This code was generated by - * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ - * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ - * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ - * - * Twilio - Autopilot - * 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.autopilot.v1.assistant.task; - -import com.twilio.base.Deleter; -import com.twilio.exception.ApiConnectionException; -import com.twilio.exception.ApiException; -import com.twilio.exception.RestException; -import com.twilio.http.HttpMethod; -import com.twilio.http.Request; -import com.twilio.http.Response; -import com.twilio.http.TwilioRestClient; -import com.twilio.rest.Domains; - -public class SampleDeleter extends Deleter { - - private String pathAssistantSid; - private String pathTaskSid; - private String pathSid; - - public SampleDeleter( - final String pathAssistantSid, - final String pathTaskSid, - final String pathSid - ) { - this.pathAssistantSid = pathAssistantSid; - this.pathTaskSid = pathTaskSid; - this.pathSid = pathSid; - } - - @Override - public boolean delete(final TwilioRestClient client) { - String path = - "/v1/Assistants/{AssistantSid}/Tasks/{TaskSid}/Samples/{Sid}"; - - path = - path.replace( - "{" + "AssistantSid" + "}", - this.pathAssistantSid.toString() - ); - path = path.replace("{" + "TaskSid" + "}", this.pathTaskSid.toString()); - path = path.replace("{" + "Sid" + "}", this.pathSid.toString()); - - Request request = new Request( - HttpMethod.DELETE, - Domains.AUTOPILOT.toString(), - path - ); - Response response = client.request(request); - - if (response == null) { - throw new ApiConnectionException( - "Sample 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/autopilot/v1/assistant/task/SampleFetcher.java b/src/main/java/com/twilio/rest/autopilot/v1/assistant/task/SampleFetcher.java deleted file mode 100644 index 437b39fed2..0000000000 --- a/src/main/java/com/twilio/rest/autopilot/v1/assistant/task/SampleFetcher.java +++ /dev/null @@ -1,83 +0,0 @@ -/* - * This code was generated by - * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ - * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ - * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ - * - * Twilio - Autopilot - * 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.autopilot.v1.assistant.task; - -import com.twilio.base.Fetcher; -import com.twilio.exception.ApiConnectionException; -import com.twilio.exception.ApiException; -import com.twilio.exception.RestException; -import com.twilio.http.HttpMethod; -import com.twilio.http.Request; -import com.twilio.http.Response; -import com.twilio.http.TwilioRestClient; -import com.twilio.rest.Domains; - -public class SampleFetcher extends Fetcher { - - private String pathAssistantSid; - private String pathTaskSid; - private String pathSid; - - public SampleFetcher( - final String pathAssistantSid, - final String pathTaskSid, - final String pathSid - ) { - this.pathAssistantSid = pathAssistantSid; - this.pathTaskSid = pathTaskSid; - this.pathSid = pathSid; - } - - @Override - public Sample fetch(final TwilioRestClient client) { - String path = - "/v1/Assistants/{AssistantSid}/Tasks/{TaskSid}/Samples/{Sid}"; - - path = - path.replace( - "{" + "AssistantSid" + "}", - this.pathAssistantSid.toString() - ); - path = path.replace("{" + "TaskSid" + "}", this.pathTaskSid.toString()); - path = path.replace("{" + "Sid" + "}", this.pathSid.toString()); - - Request request = new Request( - HttpMethod.GET, - Domains.AUTOPILOT.toString(), - path - ); - Response response = client.request(request); - - if (response == null) { - throw new ApiConnectionException( - "Sample 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 Sample.fromJson(response.getStream(), client.getObjectMapper()); - } -} diff --git a/src/main/java/com/twilio/rest/autopilot/v1/assistant/task/SampleReader.java b/src/main/java/com/twilio/rest/autopilot/v1/assistant/task/SampleReader.java deleted file mode 100644 index 7b5c0d333c..0000000000 --- a/src/main/java/com/twilio/rest/autopilot/v1/assistant/task/SampleReader.java +++ /dev/null @@ -1,156 +0,0 @@ -/* - * This code was generated by - * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ - * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ - * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ - * - * Twilio - Autopilot - * 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.autopilot.v1.assistant.task; - -import com.twilio.base.Page; -import com.twilio.base.Reader; -import com.twilio.base.ResourceSet; -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 SampleReader extends Reader { - - private String pathAssistantSid; - private String pathTaskSid; - private String language; - private Integer pageSize; - - public SampleReader( - final String pathAssistantSid, - final String pathTaskSid - ) { - this.pathAssistantSid = pathAssistantSid; - this.pathTaskSid = pathTaskSid; - } - - public SampleReader setLanguage(final String language) { - this.language = language; - return this; - } - - public SampleReader 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/Assistants/{AssistantSid}/Tasks/{TaskSid}/Samples"; - path = - path.replace( - "{" + "AssistantSid" + "}", - this.pathAssistantSid.toString() - ); - path = path.replace("{" + "TaskSid" + "}", this.pathTaskSid.toString()); - - Request request = new Request( - HttpMethod.GET, - Domains.AUTOPILOT.toString(), - path - ); - - addQueryParams(request); - return pageForRequest(client, request); - } - - private Page pageForRequest( - final TwilioRestClient client, - final Request request - ) { - Response response = client.request(request); - - if (response == null) { - throw new ApiConnectionException( - "Sample 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( - "samples", - response.getContent(), - Sample.class, - client.getObjectMapper() - ); - } - - @Override - public Page previousPage( - final Page page, - final TwilioRestClient client - ) { - Request request = new Request( - HttpMethod.GET, - page.getPreviousPageUrl(Domains.AUTOPILOT.toString()) - ); - return pageForRequest(client, request); - } - - @Override - public Page nextPage( - final Page page, - final TwilioRestClient client - ) { - Request request = new Request( - HttpMethod.GET, - page.getNextPageUrl(Domains.AUTOPILOT.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 (language != null) { - request.addQueryParam("Language", language); - } - 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/autopilot/v1/assistant/task/SampleUpdater.java b/src/main/java/com/twilio/rest/autopilot/v1/assistant/task/SampleUpdater.java deleted file mode 100644 index 9de46efb67..0000000000 --- a/src/main/java/com/twilio/rest/autopilot/v1/assistant/task/SampleUpdater.java +++ /dev/null @@ -1,115 +0,0 @@ -/* - * This code was generated by - * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ - * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ - * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ - * - * Twilio - Autopilot - * 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.autopilot.v1.assistant.task; - -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 SampleUpdater extends Updater { - - private String pathAssistantSid; - private String pathTaskSid; - private String pathSid; - private String language; - private String taggedText; - private String sourceChannel; - - public SampleUpdater( - final String pathAssistantSid, - final String pathTaskSid, - final String pathSid - ) { - this.pathAssistantSid = pathAssistantSid; - this.pathTaskSid = pathTaskSid; - this.pathSid = pathSid; - } - - public SampleUpdater setLanguage(final String language) { - this.language = language; - return this; - } - - public SampleUpdater setTaggedText(final String taggedText) { - this.taggedText = taggedText; - return this; - } - - public SampleUpdater setSourceChannel(final String sourceChannel) { - this.sourceChannel = sourceChannel; - return this; - } - - @Override - public Sample update(final TwilioRestClient client) { - String path = - "/v1/Assistants/{AssistantSid}/Tasks/{TaskSid}/Samples/{Sid}"; - - path = - path.replace( - "{" + "AssistantSid" + "}", - this.pathAssistantSid.toString() - ); - path = path.replace("{" + "TaskSid" + "}", this.pathTaskSid.toString()); - path = path.replace("{" + "Sid" + "}", this.pathSid.toString()); - - Request request = new Request( - HttpMethod.POST, - Domains.AUTOPILOT.toString(), - path - ); - request.setContentType(EnumConstants.ContentType.FORM_URLENCODED); - addPostParams(request); - Response response = client.request(request); - if (response == null) { - throw new ApiConnectionException( - "Sample 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 Sample.fromJson(response.getStream(), client.getObjectMapper()); - } - - private void addPostParams(final Request request) { - if (language != null) { - request.addPostParam("Language", language); - } - if (taggedText != null) { - request.addPostParam("TaggedText", taggedText); - } - if (sourceChannel != null) { - request.addPostParam("SourceChannel", sourceChannel); - } - } -} diff --git a/src/main/java/com/twilio/rest/autopilot/v1/assistant/task/TaskActions.java b/src/main/java/com/twilio/rest/autopilot/v1/assistant/task/TaskActions.java deleted file mode 100644 index 58501a51f9..0000000000 --- a/src/main/java/com/twilio/rest/autopilot/v1/assistant/task/TaskActions.java +++ /dev/null @@ -1,164 +0,0 @@ -/* - * This code was generated by - * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ - * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ - * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ - * - * Twilio - Autopilot - * 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.autopilot.v1.assistant.task; - -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.exception.ApiConnectionException; -import com.twilio.exception.ApiException; -import java.io.IOException; -import java.io.InputStream; -import java.net.URI; -import java.util.Map; -import java.util.Map; -import java.util.Objects; -import lombok.ToString; -import lombok.ToString; - -@JsonIgnoreProperties(ignoreUnknown = true) -@ToString -public class TaskActions extends Resource { - - private static final long serialVersionUID = 36530790788418L; - - public static TaskActionsFetcher fetcher( - final String pathAssistantSid, - final String pathTaskSid - ) { - return new TaskActionsFetcher(pathAssistantSid, pathTaskSid); - } - - public static TaskActionsUpdater updater( - final String pathAssistantSid, - final String pathTaskSid - ) { - return new TaskActionsUpdater(pathAssistantSid, pathTaskSid); - } - - /** - * Converts a JSON String into a TaskActions object using the provided ObjectMapper. - * - * @param json Raw JSON String - * @param objectMapper Jackson ObjectMapper - * @return TaskActions object represented by the provided JSON - */ - public static TaskActions fromJson( - final String json, - final ObjectMapper objectMapper - ) { - // Convert all checked exceptions to Runtime - try { - return objectMapper.readValue(json, TaskActions.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 TaskActions object using the provided - * ObjectMapper. - * - * @param json Raw JSON InputStream - * @param objectMapper Jackson ObjectMapper - * @return TaskActions object represented by the provided JSON - */ - public static TaskActions fromJson( - final InputStream json, - final ObjectMapper objectMapper - ) { - // Convert all checked exceptions to Runtime - try { - return objectMapper.readValue(json, TaskActions.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 assistantSid; - private final String taskSid; - private final URI url; - private final Map data; - - @JsonCreator - private TaskActions( - @JsonProperty("account_sid") final String accountSid, - @JsonProperty("assistant_sid") final String assistantSid, - @JsonProperty("task_sid") final String taskSid, - @JsonProperty("url") final URI url, - @JsonProperty("data") final Map data - ) { - this.accountSid = accountSid; - this.assistantSid = assistantSid; - this.taskSid = taskSid; - this.url = url; - this.data = data; - } - - public final String getAccountSid() { - return this.accountSid; - } - - public final String getAssistantSid() { - return this.assistantSid; - } - - public final String getTaskSid() { - return this.taskSid; - } - - public final URI getUrl() { - return this.url; - } - - public final Map getData() { - return this.data; - } - - @Override - public boolean equals(final Object o) { - if (this == o) { - return true; - } - - if (o == null || getClass() != o.getClass()) { - return false; - } - - TaskActions other = (TaskActions) o; - - return ( - Objects.equals(accountSid, other.accountSid) && - Objects.equals(assistantSid, other.assistantSid) && - Objects.equals(taskSid, other.taskSid) && - Objects.equals(url, other.url) && - Objects.equals(data, other.data) - ); - } - - @Override - public int hashCode() { - return Objects.hash(accountSid, assistantSid, taskSid, url, data); - } -} diff --git a/src/main/java/com/twilio/rest/autopilot/v1/assistant/task/TaskActionsFetcher.java b/src/main/java/com/twilio/rest/autopilot/v1/assistant/task/TaskActionsFetcher.java deleted file mode 100644 index b24797bf5e..0000000000 --- a/src/main/java/com/twilio/rest/autopilot/v1/assistant/task/TaskActionsFetcher.java +++ /dev/null @@ -1,81 +0,0 @@ -/* - * This code was generated by - * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ - * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ - * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ - * - * Twilio - Autopilot - * 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.autopilot.v1.assistant.task; - -import com.twilio.base.Fetcher; -import com.twilio.exception.ApiConnectionException; -import com.twilio.exception.ApiException; -import com.twilio.exception.RestException; -import com.twilio.http.HttpMethod; -import com.twilio.http.Request; -import com.twilio.http.Response; -import com.twilio.http.TwilioRestClient; -import com.twilio.rest.Domains; - -public class TaskActionsFetcher extends Fetcher { - - private String pathAssistantSid; - private String pathTaskSid; - - public TaskActionsFetcher( - final String pathAssistantSid, - final String pathTaskSid - ) { - this.pathAssistantSid = pathAssistantSid; - this.pathTaskSid = pathTaskSid; - } - - @Override - public TaskActions fetch(final TwilioRestClient client) { - String path = "/v1/Assistants/{AssistantSid}/Tasks/{TaskSid}/Actions"; - - path = - path.replace( - "{" + "AssistantSid" + "}", - this.pathAssistantSid.toString() - ); - path = path.replace("{" + "TaskSid" + "}", this.pathTaskSid.toString()); - - Request request = new Request( - HttpMethod.GET, - Domains.AUTOPILOT.toString(), - path - ); - Response response = client.request(request); - - if (response == null) { - throw new ApiConnectionException( - "TaskActions 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 TaskActions.fromJson( - response.getStream(), - client.getObjectMapper() - ); - } -} diff --git a/src/main/java/com/twilio/rest/autopilot/v1/assistant/task/TaskActionsUpdater.java b/src/main/java/com/twilio/rest/autopilot/v1/assistant/task/TaskActionsUpdater.java deleted file mode 100644 index f6886ce025..0000000000 --- a/src/main/java/com/twilio/rest/autopilot/v1/assistant/task/TaskActionsUpdater.java +++ /dev/null @@ -1,97 +0,0 @@ -/* - * This code was generated by - * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ - * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ - * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ - * - * Twilio - Autopilot - * 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.autopilot.v1.assistant.task; - -import com.twilio.base.Updater; -import com.twilio.constant.EnumConstants; -import com.twilio.converter.Converter; -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; -import java.util.Map; - -public class TaskActionsUpdater extends Updater { - - private String pathAssistantSid; - private String pathTaskSid; - private Map actions; - - public TaskActionsUpdater( - final String pathAssistantSid, - final String pathTaskSid - ) { - this.pathAssistantSid = pathAssistantSid; - this.pathTaskSid = pathTaskSid; - } - - public TaskActionsUpdater setActions(final Map actions) { - this.actions = actions; - return this; - } - - @Override - public TaskActions update(final TwilioRestClient client) { - String path = "/v1/Assistants/{AssistantSid}/Tasks/{TaskSid}/Actions"; - - path = - path.replace( - "{" + "AssistantSid" + "}", - this.pathAssistantSid.toString() - ); - path = path.replace("{" + "TaskSid" + "}", this.pathTaskSid.toString()); - - Request request = new Request( - HttpMethod.POST, - Domains.AUTOPILOT.toString(), - path - ); - request.setContentType(EnumConstants.ContentType.FORM_URLENCODED); - addPostParams(request); - Response response = client.request(request); - if (response == null) { - throw new ApiConnectionException( - "TaskActions 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 TaskActions.fromJson( - response.getStream(), - client.getObjectMapper() - ); - } - - private void addPostParams(final Request request) { - if (actions != null) { - request.addPostParam("Actions", Converter.mapToJson(actions)); - } - } -} diff --git a/src/main/java/com/twilio/rest/autopilot/v1/assistant/task/TaskStatistics.java b/src/main/java/com/twilio/rest/autopilot/v1/assistant/task/TaskStatistics.java deleted file mode 100644 index f52556b4e6..0000000000 --- a/src/main/java/com/twilio/rest/autopilot/v1/assistant/task/TaskStatistics.java +++ /dev/null @@ -1,170 +0,0 @@ -/* - * This code was generated by - * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ - * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ - * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ - * - * Twilio - Autopilot - * 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.autopilot.v1.assistant.task; - -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.exception.ApiConnectionException; -import com.twilio.exception.ApiException; -import java.io.IOException; -import java.io.InputStream; -import java.net.URI; -import java.util.Objects; -import lombok.ToString; -import lombok.ToString; - -@JsonIgnoreProperties(ignoreUnknown = true) -@ToString -public class TaskStatistics extends Resource { - - private static final long serialVersionUID = 99044881135361L; - - public static TaskStatisticsFetcher fetcher( - final String pathAssistantSid, - final String pathTaskSid - ) { - return new TaskStatisticsFetcher(pathAssistantSid, pathTaskSid); - } - - /** - * Converts a JSON String into a TaskStatistics object using the provided ObjectMapper. - * - * @param json Raw JSON String - * @param objectMapper Jackson ObjectMapper - * @return TaskStatistics object represented by the provided JSON - */ - public static TaskStatistics fromJson( - final String json, - final ObjectMapper objectMapper - ) { - // Convert all checked exceptions to Runtime - try { - return objectMapper.readValue(json, TaskStatistics.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 TaskStatistics object using the provided - * ObjectMapper. - * - * @param json Raw JSON InputStream - * @param objectMapper Jackson ObjectMapper - * @return TaskStatistics object represented by the provided JSON - */ - public static TaskStatistics fromJson( - final InputStream json, - final ObjectMapper objectMapper - ) { - // Convert all checked exceptions to Runtime - try { - return objectMapper.readValue(json, TaskStatistics.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 assistantSid; - private final String taskSid; - private final Integer samplesCount; - private final Integer fieldsCount; - private final URI url; - - @JsonCreator - private TaskStatistics( - @JsonProperty("account_sid") final String accountSid, - @JsonProperty("assistant_sid") final String assistantSid, - @JsonProperty("task_sid") final String taskSid, - @JsonProperty("samples_count") final Integer samplesCount, - @JsonProperty("fields_count") final Integer fieldsCount, - @JsonProperty("url") final URI url - ) { - this.accountSid = accountSid; - this.assistantSid = assistantSid; - this.taskSid = taskSid; - this.samplesCount = samplesCount; - this.fieldsCount = fieldsCount; - this.url = url; - } - - public final String getAccountSid() { - return this.accountSid; - } - - public final String getAssistantSid() { - return this.assistantSid; - } - - public final String getTaskSid() { - return this.taskSid; - } - - public final Integer getSamplesCount() { - return this.samplesCount; - } - - public final Integer getFieldsCount() { - return this.fieldsCount; - } - - 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; - } - - TaskStatistics other = (TaskStatistics) o; - - return ( - Objects.equals(accountSid, other.accountSid) && - Objects.equals(assistantSid, other.assistantSid) && - Objects.equals(taskSid, other.taskSid) && - Objects.equals(samplesCount, other.samplesCount) && - Objects.equals(fieldsCount, other.fieldsCount) && - Objects.equals(url, other.url) - ); - } - - @Override - public int hashCode() { - return Objects.hash( - accountSid, - assistantSid, - taskSid, - samplesCount, - fieldsCount, - url - ); - } -} diff --git a/src/main/java/com/twilio/rest/autopilot/v1/assistant/task/TaskStatisticsFetcher.java b/src/main/java/com/twilio/rest/autopilot/v1/assistant/task/TaskStatisticsFetcher.java deleted file mode 100644 index 5f3d2fa07c..0000000000 --- a/src/main/java/com/twilio/rest/autopilot/v1/assistant/task/TaskStatisticsFetcher.java +++ /dev/null @@ -1,82 +0,0 @@ -/* - * This code was generated by - * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ - * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ - * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ - * - * Twilio - Autopilot - * 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.autopilot.v1.assistant.task; - -import com.twilio.base.Fetcher; -import com.twilio.exception.ApiConnectionException; -import com.twilio.exception.ApiException; -import com.twilio.exception.RestException; -import com.twilio.http.HttpMethod; -import com.twilio.http.Request; -import com.twilio.http.Response; -import com.twilio.http.TwilioRestClient; -import com.twilio.rest.Domains; - -public class TaskStatisticsFetcher extends Fetcher { - - private String pathAssistantSid; - private String pathTaskSid; - - public TaskStatisticsFetcher( - final String pathAssistantSid, - final String pathTaskSid - ) { - this.pathAssistantSid = pathAssistantSid; - this.pathTaskSid = pathTaskSid; - } - - @Override - public TaskStatistics fetch(final TwilioRestClient client) { - String path = - "/v1/Assistants/{AssistantSid}/Tasks/{TaskSid}/Statistics"; - - path = - path.replace( - "{" + "AssistantSid" + "}", - this.pathAssistantSid.toString() - ); - path = path.replace("{" + "TaskSid" + "}", this.pathTaskSid.toString()); - - Request request = new Request( - HttpMethod.GET, - Domains.AUTOPILOT.toString(), - path - ); - Response response = client.request(request); - - if (response == null) { - throw new ApiConnectionException( - "TaskStatistics 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 TaskStatistics.fromJson( - response.getStream(), - client.getObjectMapper() - ); - } -} diff --git a/src/main/java/com/twilio/rest/preview/understand/Assistant.java b/src/main/java/com/twilio/rest/preview/understand/Assistant.java deleted file mode 100644 index 0fcdf8642f..0000000000 --- a/src/main/java/com/twilio/rest/preview/understand/Assistant.java +++ /dev/null @@ -1,243 +0,0 @@ -/* - * This code was generated by - * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ - * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ - * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ - * - * Twilio - Preview - * 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.preview.understand; - -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 Assistant extends Resource { - - private static final long serialVersionUID = 164340193709329L; - - public static AssistantCreator creator() { - return new AssistantCreator(); - } - - public static AssistantDeleter deleter(final String pathSid) { - return new AssistantDeleter(pathSid); - } - - public static AssistantFetcher fetcher(final String pathSid) { - return new AssistantFetcher(pathSid); - } - - public static AssistantReader reader() { - return new AssistantReader(); - } - - public static AssistantUpdater updater(final String pathSid) { - return new AssistantUpdater(pathSid); - } - - /** - * Converts a JSON String into a Assistant object using the provided ObjectMapper. - * - * @param json Raw JSON String - * @param objectMapper Jackson ObjectMapper - * @return Assistant object represented by the provided JSON - */ - public static Assistant fromJson( - final String json, - final ObjectMapper objectMapper - ) { - // Convert all checked exceptions to Runtime - try { - return objectMapper.readValue(json, Assistant.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 Assistant object using the provided - * ObjectMapper. - * - * @param json Raw JSON InputStream - * @param objectMapper Jackson ObjectMapper - * @return Assistant object represented by the provided JSON - */ - public static Assistant fromJson( - final InputStream json, - final ObjectMapper objectMapper - ) { - // Convert all checked exceptions to Runtime - try { - return objectMapper.readValue(json, Assistant.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 ZonedDateTime dateCreated; - private final ZonedDateTime dateUpdated; - private final String friendlyName; - private final String latestModelBuildSid; - private final Map links; - private final Boolean logQueries; - private final String sid; - private final String uniqueName; - private final URI url; - private final URI callbackUrl; - private final String callbackEvents; - - @JsonCreator - private Assistant( - @JsonProperty("account_sid") final String accountSid, - @JsonProperty("date_created") final String dateCreated, - @JsonProperty("date_updated") final String dateUpdated, - @JsonProperty("friendly_name") final String friendlyName, - @JsonProperty( - "latest_model_build_sid" - ) final String latestModelBuildSid, - @JsonProperty("links") final Map links, - @JsonProperty("log_queries") final Boolean logQueries, - @JsonProperty("sid") final String sid, - @JsonProperty("unique_name") final String uniqueName, - @JsonProperty("url") final URI url, - @JsonProperty("callback_url") final URI callbackUrl, - @JsonProperty("callback_events") final String callbackEvents - ) { - this.accountSid = accountSid; - this.dateCreated = DateConverter.iso8601DateTimeFromString(dateCreated); - this.dateUpdated = DateConverter.iso8601DateTimeFromString(dateUpdated); - this.friendlyName = friendlyName; - this.latestModelBuildSid = latestModelBuildSid; - this.links = links; - this.logQueries = logQueries; - this.sid = sid; - this.uniqueName = uniqueName; - this.url = url; - this.callbackUrl = callbackUrl; - this.callbackEvents = callbackEvents; - } - - public final String getAccountSid() { - return this.accountSid; - } - - public final ZonedDateTime getDateCreated() { - return this.dateCreated; - } - - public final ZonedDateTime getDateUpdated() { - return this.dateUpdated; - } - - public final String getFriendlyName() { - return this.friendlyName; - } - - public final String getLatestModelBuildSid() { - return this.latestModelBuildSid; - } - - public final Map getLinks() { - return this.links; - } - - public final Boolean getLogQueries() { - return this.logQueries; - } - - public final String getSid() { - return this.sid; - } - - public final String getUniqueName() { - return this.uniqueName; - } - - public final URI getUrl() { - return this.url; - } - - public final URI getCallbackUrl() { - return this.callbackUrl; - } - - public final String getCallbackEvents() { - return this.callbackEvents; - } - - @Override - public boolean equals(final Object o) { - if (this == o) { - return true; - } - - if (o == null || getClass() != o.getClass()) { - return false; - } - - Assistant other = (Assistant) o; - - return ( - Objects.equals(accountSid, other.accountSid) && - Objects.equals(dateCreated, other.dateCreated) && - Objects.equals(dateUpdated, other.dateUpdated) && - Objects.equals(friendlyName, other.friendlyName) && - Objects.equals(latestModelBuildSid, other.latestModelBuildSid) && - Objects.equals(links, other.links) && - Objects.equals(logQueries, other.logQueries) && - Objects.equals(sid, other.sid) && - Objects.equals(uniqueName, other.uniqueName) && - Objects.equals(url, other.url) && - Objects.equals(callbackUrl, other.callbackUrl) && - Objects.equals(callbackEvents, other.callbackEvents) - ); - } - - @Override - public int hashCode() { - return Objects.hash( - accountSid, - dateCreated, - dateUpdated, - friendlyName, - latestModelBuildSid, - links, - logQueries, - sid, - uniqueName, - url, - callbackUrl, - callbackEvents - ); - } -} diff --git a/src/main/java/com/twilio/rest/preview/understand/AssistantCreator.java b/src/main/java/com/twilio/rest/preview/understand/AssistantCreator.java deleted file mode 100644 index 63f2fb415a..0000000000 --- a/src/main/java/com/twilio/rest/preview/understand/AssistantCreator.java +++ /dev/null @@ -1,166 +0,0 @@ -/* - * This code was generated by - * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ - * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ - * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ - * - * Twilio - Preview - * 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.preview.understand; - -import com.twilio.base.Creator; -import com.twilio.constant.EnumConstants; -import com.twilio.converter.Converter; -import com.twilio.converter.Converter; -import com.twilio.converter.Promoter; -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; -import java.net.URI; -import java.net.URI; -import java.util.Map; -import java.util.Map; - -public class AssistantCreator extends Creator { - - private String friendlyName; - private Boolean logQueries; - private String uniqueName; - private URI callbackUrl; - private String callbackEvents; - private Map fallbackActions; - private Map initiationActions; - private Map styleSheet; - - public AssistantCreator() {} - - public AssistantCreator setFriendlyName(final String friendlyName) { - this.friendlyName = friendlyName; - return this; - } - - public AssistantCreator setLogQueries(final Boolean logQueries) { - this.logQueries = logQueries; - return this; - } - - public AssistantCreator setUniqueName(final String uniqueName) { - this.uniqueName = uniqueName; - return this; - } - - public AssistantCreator setCallbackUrl(final URI callbackUrl) { - this.callbackUrl = callbackUrl; - return this; - } - - public AssistantCreator setCallbackUrl(final String callbackUrl) { - return setCallbackUrl(Promoter.uriFromString(callbackUrl)); - } - - public AssistantCreator setCallbackEvents(final String callbackEvents) { - this.callbackEvents = callbackEvents; - return this; - } - - public AssistantCreator setFallbackActions( - final Map fallbackActions - ) { - this.fallbackActions = fallbackActions; - return this; - } - - public AssistantCreator setInitiationActions( - final Map initiationActions - ) { - this.initiationActions = initiationActions; - return this; - } - - public AssistantCreator setStyleSheet( - final Map styleSheet - ) { - this.styleSheet = styleSheet; - return this; - } - - @Override - public Assistant create(final TwilioRestClient client) { - String path = "/understand/Assistants"; - - Request request = new Request( - HttpMethod.POST, - Domains.PREVIEW.toString(), - path - ); - request.setContentType(EnumConstants.ContentType.FORM_URLENCODED); - addPostParams(request); - Response response = client.request(request); - if (response == null) { - throw new ApiConnectionException( - "Assistant 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 Assistant.fromJson( - response.getStream(), - client.getObjectMapper() - ); - } - - private void addPostParams(final Request request) { - if (friendlyName != null) { - request.addPostParam("FriendlyName", friendlyName); - } - if (logQueries != null) { - request.addPostParam("LogQueries", logQueries.toString()); - } - if (uniqueName != null) { - request.addPostParam("UniqueName", uniqueName); - } - if (callbackUrl != null) { - request.addPostParam("CallbackUrl", callbackUrl.toString()); - } - if (callbackEvents != null) { - request.addPostParam("CallbackEvents", callbackEvents); - } - if (fallbackActions != null) { - request.addPostParam( - "FallbackActions", - Converter.mapToJson(fallbackActions) - ); - } - if (initiationActions != null) { - request.addPostParam( - "InitiationActions", - Converter.mapToJson(initiationActions) - ); - } - if (styleSheet != null) { - request.addPostParam("StyleSheet", Converter.mapToJson(styleSheet)); - } - } -} diff --git a/src/main/java/com/twilio/rest/preview/understand/AssistantDeleter.java b/src/main/java/com/twilio/rest/preview/understand/AssistantDeleter.java deleted file mode 100644 index 4561d52ed2..0000000000 --- a/src/main/java/com/twilio/rest/preview/understand/AssistantDeleter.java +++ /dev/null @@ -1,67 +0,0 @@ -/* - * This code was generated by - * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ - * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ - * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ - * - * Twilio - Preview - * 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.preview.understand; - -import com.twilio.base.Deleter; -import com.twilio.exception.ApiConnectionException; -import com.twilio.exception.ApiException; -import com.twilio.exception.RestException; -import com.twilio.http.HttpMethod; -import com.twilio.http.Request; -import com.twilio.http.Response; -import com.twilio.http.TwilioRestClient; -import com.twilio.rest.Domains; - -public class AssistantDeleter extends Deleter { - - private String pathSid; - - public AssistantDeleter(final String pathSid) { - this.pathSid = pathSid; - } - - @Override - public boolean delete(final TwilioRestClient client) { - String path = "/understand/Assistants/{Sid}"; - - path = path.replace("{" + "Sid" + "}", this.pathSid.toString()); - - Request request = new Request( - HttpMethod.DELETE, - Domains.PREVIEW.toString(), - path - ); - Response response = client.request(request); - - if (response == null) { - throw new ApiConnectionException( - "Assistant 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/preview/understand/AssistantFetcher.java b/src/main/java/com/twilio/rest/preview/understand/AssistantFetcher.java deleted file mode 100644 index 77752b3bf5..0000000000 --- a/src/main/java/com/twilio/rest/preview/understand/AssistantFetcher.java +++ /dev/null @@ -1,71 +0,0 @@ -/* - * This code was generated by - * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ - * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ - * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ - * - * Twilio - Preview - * 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.preview.understand; - -import com.twilio.base.Fetcher; -import com.twilio.exception.ApiConnectionException; -import com.twilio.exception.ApiException; -import com.twilio.exception.RestException; -import com.twilio.http.HttpMethod; -import com.twilio.http.Request; -import com.twilio.http.Response; -import com.twilio.http.TwilioRestClient; -import com.twilio.rest.Domains; - -public class AssistantFetcher extends Fetcher { - - private String pathSid; - - public AssistantFetcher(final String pathSid) { - this.pathSid = pathSid; - } - - @Override - public Assistant fetch(final TwilioRestClient client) { - String path = "/understand/Assistants/{Sid}"; - - path = path.replace("{" + "Sid" + "}", this.pathSid.toString()); - - Request request = new Request( - HttpMethod.GET, - Domains.PREVIEW.toString(), - path - ); - Response response = client.request(request); - - if (response == null) { - throw new ApiConnectionException( - "Assistant 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 Assistant.fromJson( - response.getStream(), - client.getObjectMapper() - ); - } -} diff --git a/src/main/java/com/twilio/rest/preview/understand/AssistantReader.java b/src/main/java/com/twilio/rest/preview/understand/AssistantReader.java deleted file mode 100644 index 80e84b766e..0000000000 --- a/src/main/java/com/twilio/rest/preview/understand/AssistantReader.java +++ /dev/null @@ -1,133 +0,0 @@ -/* - * This code was generated by - * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ - * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ - * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ - * - * Twilio - Preview - * 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.preview.understand; - -import com.twilio.base.Page; -import com.twilio.base.Reader; -import com.twilio.base.ResourceSet; -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 AssistantReader extends Reader { - - private Integer pageSize; - - public AssistantReader() {} - - public AssistantReader 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 = "/understand/Assistants"; - - Request request = new Request( - HttpMethod.GET, - Domains.PREVIEW.toString(), - path - ); - - addQueryParams(request); - return pageForRequest(client, request); - } - - private Page pageForRequest( - final TwilioRestClient client, - final Request request - ) { - Response response = client.request(request); - - if (response == null) { - throw new ApiConnectionException( - "Assistant 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( - "assistants", - response.getContent(), - Assistant.class, - client.getObjectMapper() - ); - } - - @Override - public Page previousPage( - final Page page, - final TwilioRestClient client - ) { - Request request = new Request( - HttpMethod.GET, - page.getPreviousPageUrl(Domains.PREVIEW.toString()) - ); - return pageForRequest(client, request); - } - - @Override - public Page nextPage( - final Page page, - final TwilioRestClient client - ) { - Request request = new Request( - HttpMethod.GET, - page.getNextPageUrl(Domains.PREVIEW.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/preview/understand/AssistantUpdater.java b/src/main/java/com/twilio/rest/preview/understand/AssistantUpdater.java deleted file mode 100644 index 4843f0c0eb..0000000000 --- a/src/main/java/com/twilio/rest/preview/understand/AssistantUpdater.java +++ /dev/null @@ -1,168 +0,0 @@ -/* - * This code was generated by - * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ - * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ - * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ - * - * Twilio - Preview - * 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.preview.understand; - -import com.twilio.base.Updater; -import com.twilio.constant.EnumConstants; -import com.twilio.converter.Converter; -import com.twilio.converter.Promoter; -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; -import java.net.URI; -import java.util.Map; - -public class AssistantUpdater extends Updater { - - private String pathSid; - private String friendlyName; - private Boolean logQueries; - private String uniqueName; - private URI callbackUrl; - private String callbackEvents; - private Map fallbackActions; - private Map initiationActions; - private Map styleSheet; - - public AssistantUpdater(final String pathSid) { - this.pathSid = pathSid; - } - - public AssistantUpdater setFriendlyName(final String friendlyName) { - this.friendlyName = friendlyName; - return this; - } - - public AssistantUpdater setLogQueries(final Boolean logQueries) { - this.logQueries = logQueries; - return this; - } - - public AssistantUpdater setUniqueName(final String uniqueName) { - this.uniqueName = uniqueName; - return this; - } - - public AssistantUpdater setCallbackUrl(final URI callbackUrl) { - this.callbackUrl = callbackUrl; - return this; - } - - public AssistantUpdater setCallbackUrl(final String callbackUrl) { - return setCallbackUrl(Promoter.uriFromString(callbackUrl)); - } - - public AssistantUpdater setCallbackEvents(final String callbackEvents) { - this.callbackEvents = callbackEvents; - return this; - } - - public AssistantUpdater setFallbackActions( - final Map fallbackActions - ) { - this.fallbackActions = fallbackActions; - return this; - } - - public AssistantUpdater setInitiationActions( - final Map initiationActions - ) { - this.initiationActions = initiationActions; - return this; - } - - public AssistantUpdater setStyleSheet( - final Map styleSheet - ) { - this.styleSheet = styleSheet; - return this; - } - - @Override - public Assistant update(final TwilioRestClient client) { - String path = "/understand/Assistants/{Sid}"; - - path = path.replace("{" + "Sid" + "}", this.pathSid.toString()); - - Request request = new Request( - HttpMethod.POST, - Domains.PREVIEW.toString(), - path - ); - request.setContentType(EnumConstants.ContentType.FORM_URLENCODED); - addPostParams(request); - Response response = client.request(request); - if (response == null) { - throw new ApiConnectionException( - "Assistant 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 Assistant.fromJson( - response.getStream(), - client.getObjectMapper() - ); - } - - private void addPostParams(final Request request) { - if (friendlyName != null) { - request.addPostParam("FriendlyName", friendlyName); - } - if (logQueries != null) { - request.addPostParam("LogQueries", logQueries.toString()); - } - if (uniqueName != null) { - request.addPostParam("UniqueName", uniqueName); - } - if (callbackUrl != null) { - request.addPostParam("CallbackUrl", callbackUrl.toString()); - } - if (callbackEvents != null) { - request.addPostParam("CallbackEvents", callbackEvents); - } - if (fallbackActions != null) { - request.addPostParam( - "FallbackActions", - Converter.mapToJson(fallbackActions) - ); - } - if (initiationActions != null) { - request.addPostParam( - "InitiationActions", - Converter.mapToJson(initiationActions) - ); - } - if (styleSheet != null) { - request.addPostParam("StyleSheet", Converter.mapToJson(styleSheet)); - } - } -} diff --git a/src/main/java/com/twilio/rest/preview/understand/assistant/AssistantFallbackActions.java b/src/main/java/com/twilio/rest/preview/understand/assistant/AssistantFallbackActions.java deleted file mode 100644 index 8e5a5d5091..0000000000 --- a/src/main/java/com/twilio/rest/preview/understand/assistant/AssistantFallbackActions.java +++ /dev/null @@ -1,154 +0,0 @@ -/* - * This code was generated by - * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ - * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ - * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ - * - * Twilio - Preview - * 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.preview.understand.assistant; - -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.exception.ApiConnectionException; -import com.twilio.exception.ApiException; -import java.io.IOException; -import java.io.InputStream; -import java.net.URI; -import java.util.Map; -import java.util.Map; -import java.util.Objects; -import lombok.ToString; -import lombok.ToString; - -@JsonIgnoreProperties(ignoreUnknown = true) -@ToString -public class AssistantFallbackActions extends Resource { - - private static final long serialVersionUID = 52727905251134L; - - public static AssistantFallbackActionsFetcher fetcher( - final String pathAssistantSid - ) { - return new AssistantFallbackActionsFetcher(pathAssistantSid); - } - - public static AssistantFallbackActionsUpdater updater( - final String pathAssistantSid - ) { - return new AssistantFallbackActionsUpdater(pathAssistantSid); - } - - /** - * Converts a JSON String into a AssistantFallbackActions object using the provided ObjectMapper. - * - * @param json Raw JSON String - * @param objectMapper Jackson ObjectMapper - * @return AssistantFallbackActions object represented by the provided JSON - */ - public static AssistantFallbackActions fromJson( - final String json, - final ObjectMapper objectMapper - ) { - // Convert all checked exceptions to Runtime - try { - return objectMapper.readValue(json, AssistantFallbackActions.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 AssistantFallbackActions object using the provided - * ObjectMapper. - * - * @param json Raw JSON InputStream - * @param objectMapper Jackson ObjectMapper - * @return AssistantFallbackActions object represented by the provided JSON - */ - public static AssistantFallbackActions fromJson( - final InputStream json, - final ObjectMapper objectMapper - ) { - // Convert all checked exceptions to Runtime - try { - return objectMapper.readValue(json, AssistantFallbackActions.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 assistantSid; - private final URI url; - private final Map data; - - @JsonCreator - private AssistantFallbackActions( - @JsonProperty("account_sid") final String accountSid, - @JsonProperty("assistant_sid") final String assistantSid, - @JsonProperty("url") final URI url, - @JsonProperty("data") final Map data - ) { - this.accountSid = accountSid; - this.assistantSid = assistantSid; - this.url = url; - this.data = data; - } - - public final String getAccountSid() { - return this.accountSid; - } - - public final String getAssistantSid() { - return this.assistantSid; - } - - public final URI getUrl() { - return this.url; - } - - public final Map getData() { - return this.data; - } - - @Override - public boolean equals(final Object o) { - if (this == o) { - return true; - } - - if (o == null || getClass() != o.getClass()) { - return false; - } - - AssistantFallbackActions other = (AssistantFallbackActions) o; - - return ( - Objects.equals(accountSid, other.accountSid) && - Objects.equals(assistantSid, other.assistantSid) && - Objects.equals(url, other.url) && - Objects.equals(data, other.data) - ); - } - - @Override - public int hashCode() { - return Objects.hash(accountSid, assistantSid, url, data); - } -} diff --git a/src/main/java/com/twilio/rest/preview/understand/assistant/AssistantFallbackActionsFetcher.java b/src/main/java/com/twilio/rest/preview/understand/assistant/AssistantFallbackActionsFetcher.java deleted file mode 100644 index b72f95f5af..0000000000 --- a/src/main/java/com/twilio/rest/preview/understand/assistant/AssistantFallbackActionsFetcher.java +++ /dev/null @@ -1,76 +0,0 @@ -/* - * This code was generated by - * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ - * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ - * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ - * - * Twilio - Preview - * 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.preview.understand.assistant; - -import com.twilio.base.Fetcher; -import com.twilio.exception.ApiConnectionException; -import com.twilio.exception.ApiException; -import com.twilio.exception.RestException; -import com.twilio.http.HttpMethod; -import com.twilio.http.Request; -import com.twilio.http.Response; -import com.twilio.http.TwilioRestClient; -import com.twilio.rest.Domains; - -public class AssistantFallbackActionsFetcher - extends Fetcher { - - private String pathAssistantSid; - - public AssistantFallbackActionsFetcher(final String pathAssistantSid) { - this.pathAssistantSid = pathAssistantSid; - } - - @Override - public AssistantFallbackActions fetch(final TwilioRestClient client) { - String path = "/understand/Assistants/{AssistantSid}/FallbackActions"; - - path = - path.replace( - "{" + "AssistantSid" + "}", - this.pathAssistantSid.toString() - ); - - Request request = new Request( - HttpMethod.GET, - Domains.PREVIEW.toString(), - path - ); - Response response = client.request(request); - - if (response == null) { - throw new ApiConnectionException( - "AssistantFallbackActions 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 AssistantFallbackActions.fromJson( - response.getStream(), - client.getObjectMapper() - ); - } -} diff --git a/src/main/java/com/twilio/rest/preview/understand/assistant/AssistantFallbackActionsUpdater.java b/src/main/java/com/twilio/rest/preview/understand/assistant/AssistantFallbackActionsUpdater.java deleted file mode 100644 index 5efded38f5..0000000000 --- a/src/main/java/com/twilio/rest/preview/understand/assistant/AssistantFallbackActionsUpdater.java +++ /dev/null @@ -1,97 +0,0 @@ -/* - * This code was generated by - * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ - * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ - * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ - * - * Twilio - Preview - * 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.preview.understand.assistant; - -import com.twilio.base.Updater; -import com.twilio.constant.EnumConstants; -import com.twilio.converter.Converter; -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; -import java.util.Map; - -public class AssistantFallbackActionsUpdater - extends Updater { - - private String pathAssistantSid; - private Map fallbackActions; - - public AssistantFallbackActionsUpdater(final String pathAssistantSid) { - this.pathAssistantSid = pathAssistantSid; - } - - public AssistantFallbackActionsUpdater setFallbackActions( - final Map fallbackActions - ) { - this.fallbackActions = fallbackActions; - return this; - } - - @Override - public AssistantFallbackActions update(final TwilioRestClient client) { - String path = "/understand/Assistants/{AssistantSid}/FallbackActions"; - - path = - path.replace( - "{" + "AssistantSid" + "}", - this.pathAssistantSid.toString() - ); - - Request request = new Request( - HttpMethod.POST, - Domains.PREVIEW.toString(), - path - ); - request.setContentType(EnumConstants.ContentType.FORM_URLENCODED); - addPostParams(request); - Response response = client.request(request); - if (response == null) { - throw new ApiConnectionException( - "AssistantFallbackActions 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 AssistantFallbackActions.fromJson( - response.getStream(), - client.getObjectMapper() - ); - } - - private void addPostParams(final Request request) { - if (fallbackActions != null) { - request.addPostParam( - "FallbackActions", - Converter.mapToJson(fallbackActions) - ); - } - } -} diff --git a/src/main/java/com/twilio/rest/preview/understand/assistant/AssistantInitiationActions.java b/src/main/java/com/twilio/rest/preview/understand/assistant/AssistantInitiationActions.java deleted file mode 100644 index 9b3f435637..0000000000 --- a/src/main/java/com/twilio/rest/preview/understand/assistant/AssistantInitiationActions.java +++ /dev/null @@ -1,160 +0,0 @@ -/* - * This code was generated by - * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ - * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ - * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ - * - * Twilio - Preview - * 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.preview.understand.assistant; - -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.exception.ApiConnectionException; -import com.twilio.exception.ApiException; -import java.io.IOException; -import java.io.InputStream; -import java.net.URI; -import java.util.Map; -import java.util.Map; -import java.util.Objects; -import lombok.ToString; -import lombok.ToString; - -@JsonIgnoreProperties(ignoreUnknown = true) -@ToString -public class AssistantInitiationActions extends Resource { - - private static final long serialVersionUID = 52727905251134L; - - public static AssistantInitiationActionsFetcher fetcher( - final String pathAssistantSid - ) { - return new AssistantInitiationActionsFetcher(pathAssistantSid); - } - - public static AssistantInitiationActionsUpdater updater( - final String pathAssistantSid - ) { - return new AssistantInitiationActionsUpdater(pathAssistantSid); - } - - /** - * Converts a JSON String into a AssistantInitiationActions object using the provided ObjectMapper. - * - * @param json Raw JSON String - * @param objectMapper Jackson ObjectMapper - * @return AssistantInitiationActions object represented by the provided JSON - */ - public static AssistantInitiationActions fromJson( - final String json, - final ObjectMapper objectMapper - ) { - // Convert all checked exceptions to Runtime - try { - return objectMapper.readValue( - json, - AssistantInitiationActions.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 AssistantInitiationActions object using the provided - * ObjectMapper. - * - * @param json Raw JSON InputStream - * @param objectMapper Jackson ObjectMapper - * @return AssistantInitiationActions object represented by the provided JSON - */ - public static AssistantInitiationActions fromJson( - final InputStream json, - final ObjectMapper objectMapper - ) { - // Convert all checked exceptions to Runtime - try { - return objectMapper.readValue( - json, - AssistantInitiationActions.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 assistantSid; - private final URI url; - private final Map data; - - @JsonCreator - private AssistantInitiationActions( - @JsonProperty("account_sid") final String accountSid, - @JsonProperty("assistant_sid") final String assistantSid, - @JsonProperty("url") final URI url, - @JsonProperty("data") final Map data - ) { - this.accountSid = accountSid; - this.assistantSid = assistantSid; - this.url = url; - this.data = data; - } - - public final String getAccountSid() { - return this.accountSid; - } - - public final String getAssistantSid() { - return this.assistantSid; - } - - public final URI getUrl() { - return this.url; - } - - public final Map getData() { - return this.data; - } - - @Override - public boolean equals(final Object o) { - if (this == o) { - return true; - } - - if (o == null || getClass() != o.getClass()) { - return false; - } - - AssistantInitiationActions other = (AssistantInitiationActions) o; - - return ( - Objects.equals(accountSid, other.accountSid) && - Objects.equals(assistantSid, other.assistantSid) && - Objects.equals(url, other.url) && - Objects.equals(data, other.data) - ); - } - - @Override - public int hashCode() { - return Objects.hash(accountSid, assistantSid, url, data); - } -} diff --git a/src/main/java/com/twilio/rest/preview/understand/assistant/AssistantInitiationActionsFetcher.java b/src/main/java/com/twilio/rest/preview/understand/assistant/AssistantInitiationActionsFetcher.java deleted file mode 100644 index c40a694e8b..0000000000 --- a/src/main/java/com/twilio/rest/preview/understand/assistant/AssistantInitiationActionsFetcher.java +++ /dev/null @@ -1,76 +0,0 @@ -/* - * This code was generated by - * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ - * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ - * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ - * - * Twilio - Preview - * 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.preview.understand.assistant; - -import com.twilio.base.Fetcher; -import com.twilio.exception.ApiConnectionException; -import com.twilio.exception.ApiException; -import com.twilio.exception.RestException; -import com.twilio.http.HttpMethod; -import com.twilio.http.Request; -import com.twilio.http.Response; -import com.twilio.http.TwilioRestClient; -import com.twilio.rest.Domains; - -public class AssistantInitiationActionsFetcher - extends Fetcher { - - private String pathAssistantSid; - - public AssistantInitiationActionsFetcher(final String pathAssistantSid) { - this.pathAssistantSid = pathAssistantSid; - } - - @Override - public AssistantInitiationActions fetch(final TwilioRestClient client) { - String path = "/understand/Assistants/{AssistantSid}/InitiationActions"; - - path = - path.replace( - "{" + "AssistantSid" + "}", - this.pathAssistantSid.toString() - ); - - Request request = new Request( - HttpMethod.GET, - Domains.PREVIEW.toString(), - path - ); - Response response = client.request(request); - - if (response == null) { - throw new ApiConnectionException( - "AssistantInitiationActions 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 AssistantInitiationActions.fromJson( - response.getStream(), - client.getObjectMapper() - ); - } -} diff --git a/src/main/java/com/twilio/rest/preview/understand/assistant/AssistantInitiationActionsUpdater.java b/src/main/java/com/twilio/rest/preview/understand/assistant/AssistantInitiationActionsUpdater.java deleted file mode 100644 index 426cff16b0..0000000000 --- a/src/main/java/com/twilio/rest/preview/understand/assistant/AssistantInitiationActionsUpdater.java +++ /dev/null @@ -1,97 +0,0 @@ -/* - * This code was generated by - * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ - * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ - * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ - * - * Twilio - Preview - * 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.preview.understand.assistant; - -import com.twilio.base.Updater; -import com.twilio.constant.EnumConstants; -import com.twilio.converter.Converter; -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; -import java.util.Map; - -public class AssistantInitiationActionsUpdater - extends Updater { - - private String pathAssistantSid; - private Map initiationActions; - - public AssistantInitiationActionsUpdater(final String pathAssistantSid) { - this.pathAssistantSid = pathAssistantSid; - } - - public AssistantInitiationActionsUpdater setInitiationActions( - final Map initiationActions - ) { - this.initiationActions = initiationActions; - return this; - } - - @Override - public AssistantInitiationActions update(final TwilioRestClient client) { - String path = "/understand/Assistants/{AssistantSid}/InitiationActions"; - - path = - path.replace( - "{" + "AssistantSid" + "}", - this.pathAssistantSid.toString() - ); - - Request request = new Request( - HttpMethod.POST, - Domains.PREVIEW.toString(), - path - ); - request.setContentType(EnumConstants.ContentType.FORM_URLENCODED); - addPostParams(request); - Response response = client.request(request); - if (response == null) { - throw new ApiConnectionException( - "AssistantInitiationActions 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 AssistantInitiationActions.fromJson( - response.getStream(), - client.getObjectMapper() - ); - } - - private void addPostParams(final Request request) { - if (initiationActions != null) { - request.addPostParam( - "InitiationActions", - Converter.mapToJson(initiationActions) - ); - } - } -} diff --git a/src/main/java/com/twilio/rest/preview/understand/assistant/Dialogue.java b/src/main/java/com/twilio/rest/preview/understand/assistant/Dialogue.java deleted file mode 100644 index bec8ac0c07..0000000000 --- a/src/main/java/com/twilio/rest/preview/understand/assistant/Dialogue.java +++ /dev/null @@ -1,157 +0,0 @@ -/* - * This code was generated by - * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ - * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ - * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ - * - * Twilio - Preview - * 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.preview.understand.assistant; - -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.exception.ApiConnectionException; -import com.twilio.exception.ApiException; -import java.io.IOException; -import java.io.InputStream; -import java.net.URI; -import java.util.Map; -import java.util.Map; -import java.util.Objects; -import lombok.ToString; -import lombok.ToString; - -@JsonIgnoreProperties(ignoreUnknown = true) -@ToString -public class Dialogue extends Resource { - - private static final long serialVersionUID = 270949613735802L; - - public static DialogueFetcher fetcher( - final String pathAssistantSid, - final String pathSid - ) { - return new DialogueFetcher(pathAssistantSid, pathSid); - } - - /** - * Converts a JSON String into a Dialogue object using the provided ObjectMapper. - * - * @param json Raw JSON String - * @param objectMapper Jackson ObjectMapper - * @return Dialogue object represented by the provided JSON - */ - public static Dialogue fromJson( - final String json, - final ObjectMapper objectMapper - ) { - // Convert all checked exceptions to Runtime - try { - return objectMapper.readValue(json, Dialogue.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 Dialogue object using the provided - * ObjectMapper. - * - * @param json Raw JSON InputStream - * @param objectMapper Jackson ObjectMapper - * @return Dialogue object represented by the provided JSON - */ - public static Dialogue fromJson( - final InputStream json, - final ObjectMapper objectMapper - ) { - // Convert all checked exceptions to Runtime - try { - return objectMapper.readValue(json, Dialogue.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 assistantSid; - private final String sid; - private final Map data; - private final URI url; - - @JsonCreator - private Dialogue( - @JsonProperty("account_sid") final String accountSid, - @JsonProperty("assistant_sid") final String assistantSid, - @JsonProperty("sid") final String sid, - @JsonProperty("data") final Map data, - @JsonProperty("url") final URI url - ) { - this.accountSid = accountSid; - this.assistantSid = assistantSid; - this.sid = sid; - this.data = data; - this.url = url; - } - - public final String getAccountSid() { - return this.accountSid; - } - - public final String getAssistantSid() { - return this.assistantSid; - } - - public final String getSid() { - return this.sid; - } - - public final Map getData() { - return this.data; - } - - 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; - } - - Dialogue other = (Dialogue) o; - - return ( - Objects.equals(accountSid, other.accountSid) && - Objects.equals(assistantSid, other.assistantSid) && - Objects.equals(sid, other.sid) && - Objects.equals(data, other.data) && - Objects.equals(url, other.url) - ); - } - - @Override - public int hashCode() { - return Objects.hash(accountSid, assistantSid, sid, data, url); - } -} diff --git a/src/main/java/com/twilio/rest/preview/understand/assistant/DialogueFetcher.java b/src/main/java/com/twilio/rest/preview/understand/assistant/DialogueFetcher.java deleted file mode 100644 index 7d43730383..0000000000 --- a/src/main/java/com/twilio/rest/preview/understand/assistant/DialogueFetcher.java +++ /dev/null @@ -1,81 +0,0 @@ -/* - * This code was generated by - * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ - * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ - * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ - * - * Twilio - Preview - * 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.preview.understand.assistant; - -import com.twilio.base.Fetcher; -import com.twilio.exception.ApiConnectionException; -import com.twilio.exception.ApiException; -import com.twilio.exception.RestException; -import com.twilio.http.HttpMethod; -import com.twilio.http.Request; -import com.twilio.http.Response; -import com.twilio.http.TwilioRestClient; -import com.twilio.rest.Domains; - -public class DialogueFetcher extends Fetcher { - - private String pathAssistantSid; - private String pathSid; - - public DialogueFetcher( - final String pathAssistantSid, - final String pathSid - ) { - this.pathAssistantSid = pathAssistantSid; - this.pathSid = pathSid; - } - - @Override - public Dialogue fetch(final TwilioRestClient client) { - String path = "/understand/Assistants/{AssistantSid}/Dialogues/{Sid}"; - - path = - path.replace( - "{" + "AssistantSid" + "}", - this.pathAssistantSid.toString() - ); - path = path.replace("{" + "Sid" + "}", this.pathSid.toString()); - - Request request = new Request( - HttpMethod.GET, - Domains.PREVIEW.toString(), - path - ); - Response response = client.request(request); - - if (response == null) { - throw new ApiConnectionException( - "Dialogue 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 Dialogue.fromJson( - response.getStream(), - client.getObjectMapper() - ); - } -} diff --git a/src/main/java/com/twilio/rest/preview/understand/assistant/FieldType.java b/src/main/java/com/twilio/rest/preview/understand/assistant/FieldType.java deleted file mode 100644 index 75b1de9725..0000000000 --- a/src/main/java/com/twilio/rest/preview/understand/assistant/FieldType.java +++ /dev/null @@ -1,226 +0,0 @@ -/* - * This code was generated by - * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ - * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ - * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ - * - * Twilio - Preview - * 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.preview.understand.assistant; - -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 FieldType extends Resource { - - private static final long serialVersionUID = 124097769891823L; - - public static FieldTypeCreator creator( - final String pathAssistantSid, - final String uniqueName - ) { - return new FieldTypeCreator(pathAssistantSid, uniqueName); - } - - public static FieldTypeDeleter deleter( - final String pathAssistantSid, - final String pathSid - ) { - return new FieldTypeDeleter(pathAssistantSid, pathSid); - } - - public static FieldTypeFetcher fetcher( - final String pathAssistantSid, - final String pathSid - ) { - return new FieldTypeFetcher(pathAssistantSid, pathSid); - } - - public static FieldTypeReader reader(final String pathAssistantSid) { - return new FieldTypeReader(pathAssistantSid); - } - - public static FieldTypeUpdater updater( - final String pathAssistantSid, - final String pathSid - ) { - return new FieldTypeUpdater(pathAssistantSid, pathSid); - } - - /** - * Converts a JSON String into a FieldType object using the provided ObjectMapper. - * - * @param json Raw JSON String - * @param objectMapper Jackson ObjectMapper - * @return FieldType object represented by the provided JSON - */ - public static FieldType fromJson( - final String json, - final ObjectMapper objectMapper - ) { - // Convert all checked exceptions to Runtime - try { - return objectMapper.readValue(json, FieldType.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 FieldType object using the provided - * ObjectMapper. - * - * @param json Raw JSON InputStream - * @param objectMapper Jackson ObjectMapper - * @return FieldType object represented by the provided JSON - */ - public static FieldType fromJson( - final InputStream json, - final ObjectMapper objectMapper - ) { - // Convert all checked exceptions to Runtime - try { - return objectMapper.readValue(json, FieldType.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 ZonedDateTime dateCreated; - private final ZonedDateTime dateUpdated; - private final String friendlyName; - private final Map links; - private final String assistantSid; - private final String sid; - private final String uniqueName; - private final URI url; - - @JsonCreator - private FieldType( - @JsonProperty("account_sid") final String accountSid, - @JsonProperty("date_created") final String dateCreated, - @JsonProperty("date_updated") final String dateUpdated, - @JsonProperty("friendly_name") final String friendlyName, - @JsonProperty("links") final Map links, - @JsonProperty("assistant_sid") final String assistantSid, - @JsonProperty("sid") final String sid, - @JsonProperty("unique_name") final String uniqueName, - @JsonProperty("url") final URI url - ) { - this.accountSid = accountSid; - this.dateCreated = DateConverter.iso8601DateTimeFromString(dateCreated); - this.dateUpdated = DateConverter.iso8601DateTimeFromString(dateUpdated); - this.friendlyName = friendlyName; - this.links = links; - this.assistantSid = assistantSid; - this.sid = sid; - this.uniqueName = uniqueName; - this.url = url; - } - - public final String getAccountSid() { - return this.accountSid; - } - - public final ZonedDateTime getDateCreated() { - return this.dateCreated; - } - - public final ZonedDateTime getDateUpdated() { - return this.dateUpdated; - } - - public final String getFriendlyName() { - return this.friendlyName; - } - - public final Map getLinks() { - return this.links; - } - - public final String getAssistantSid() { - return this.assistantSid; - } - - public final String getSid() { - return this.sid; - } - - public final String getUniqueName() { - return this.uniqueName; - } - - 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; - } - - FieldType other = (FieldType) o; - - return ( - Objects.equals(accountSid, other.accountSid) && - Objects.equals(dateCreated, other.dateCreated) && - Objects.equals(dateUpdated, other.dateUpdated) && - Objects.equals(friendlyName, other.friendlyName) && - Objects.equals(links, other.links) && - Objects.equals(assistantSid, other.assistantSid) && - Objects.equals(sid, other.sid) && - Objects.equals(uniqueName, other.uniqueName) && - Objects.equals(url, other.url) - ); - } - - @Override - public int hashCode() { - return Objects.hash( - accountSid, - dateCreated, - dateUpdated, - friendlyName, - links, - assistantSid, - sid, - uniqueName, - url - ); - } -} diff --git a/src/main/java/com/twilio/rest/preview/understand/assistant/FieldTypeCreator.java b/src/main/java/com/twilio/rest/preview/understand/assistant/FieldTypeCreator.java deleted file mode 100644 index 8d26b20955..0000000000 --- a/src/main/java/com/twilio/rest/preview/understand/assistant/FieldTypeCreator.java +++ /dev/null @@ -1,104 +0,0 @@ -/* - * This code was generated by - * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ - * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ - * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ - * - * Twilio - Preview - * 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.preview.understand.assistant; - -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 FieldTypeCreator extends Creator { - - private String pathAssistantSid; - private String uniqueName; - private String friendlyName; - - public FieldTypeCreator( - final String pathAssistantSid, - final String uniqueName - ) { - this.pathAssistantSid = pathAssistantSid; - this.uniqueName = uniqueName; - } - - public FieldTypeCreator setUniqueName(final String uniqueName) { - this.uniqueName = uniqueName; - return this; - } - - public FieldTypeCreator setFriendlyName(final String friendlyName) { - this.friendlyName = friendlyName; - return this; - } - - @Override - public FieldType create(final TwilioRestClient client) { - String path = "/understand/Assistants/{AssistantSid}/FieldTypes"; - - path = - path.replace( - "{" + "AssistantSid" + "}", - this.pathAssistantSid.toString() - ); - path = - path.replace("{" + "UniqueName" + "}", this.uniqueName.toString()); - - Request request = new Request( - HttpMethod.POST, - Domains.PREVIEW.toString(), - path - ); - request.setContentType(EnumConstants.ContentType.FORM_URLENCODED); - addPostParams(request); - Response response = client.request(request); - if (response == null) { - throw new ApiConnectionException( - "FieldType 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 FieldType.fromJson( - response.getStream(), - client.getObjectMapper() - ); - } - - private void addPostParams(final Request request) { - if (uniqueName != null) { - request.addPostParam("UniqueName", uniqueName); - } - if (friendlyName != null) { - request.addPostParam("FriendlyName", friendlyName); - } - } -} diff --git a/src/main/java/com/twilio/rest/preview/understand/assistant/FieldTypeDeleter.java b/src/main/java/com/twilio/rest/preview/understand/assistant/FieldTypeDeleter.java deleted file mode 100644 index 7633775750..0000000000 --- a/src/main/java/com/twilio/rest/preview/understand/assistant/FieldTypeDeleter.java +++ /dev/null @@ -1,77 +0,0 @@ -/* - * This code was generated by - * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ - * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ - * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ - * - * Twilio - Preview - * 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.preview.understand.assistant; - -import com.twilio.base.Deleter; -import com.twilio.exception.ApiConnectionException; -import com.twilio.exception.ApiException; -import com.twilio.exception.RestException; -import com.twilio.http.HttpMethod; -import com.twilio.http.Request; -import com.twilio.http.Response; -import com.twilio.http.TwilioRestClient; -import com.twilio.rest.Domains; - -public class FieldTypeDeleter extends Deleter { - - private String pathAssistantSid; - private String pathSid; - - public FieldTypeDeleter( - final String pathAssistantSid, - final String pathSid - ) { - this.pathAssistantSid = pathAssistantSid; - this.pathSid = pathSid; - } - - @Override - public boolean delete(final TwilioRestClient client) { - String path = "/understand/Assistants/{AssistantSid}/FieldTypes/{Sid}"; - - path = - path.replace( - "{" + "AssistantSid" + "}", - this.pathAssistantSid.toString() - ); - path = path.replace("{" + "Sid" + "}", this.pathSid.toString()); - - Request request = new Request( - HttpMethod.DELETE, - Domains.PREVIEW.toString(), - path - ); - Response response = client.request(request); - - if (response == null) { - throw new ApiConnectionException( - "FieldType 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/preview/understand/assistant/FieldTypeFetcher.java b/src/main/java/com/twilio/rest/preview/understand/assistant/FieldTypeFetcher.java deleted file mode 100644 index 436fb9153c..0000000000 --- a/src/main/java/com/twilio/rest/preview/understand/assistant/FieldTypeFetcher.java +++ /dev/null @@ -1,81 +0,0 @@ -/* - * This code was generated by - * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ - * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ - * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ - * - * Twilio - Preview - * 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.preview.understand.assistant; - -import com.twilio.base.Fetcher; -import com.twilio.exception.ApiConnectionException; -import com.twilio.exception.ApiException; -import com.twilio.exception.RestException; -import com.twilio.http.HttpMethod; -import com.twilio.http.Request; -import com.twilio.http.Response; -import com.twilio.http.TwilioRestClient; -import com.twilio.rest.Domains; - -public class FieldTypeFetcher extends Fetcher { - - private String pathAssistantSid; - private String pathSid; - - public FieldTypeFetcher( - final String pathAssistantSid, - final String pathSid - ) { - this.pathAssistantSid = pathAssistantSid; - this.pathSid = pathSid; - } - - @Override - public FieldType fetch(final TwilioRestClient client) { - String path = "/understand/Assistants/{AssistantSid}/FieldTypes/{Sid}"; - - path = - path.replace( - "{" + "AssistantSid" + "}", - this.pathAssistantSid.toString() - ); - path = path.replace("{" + "Sid" + "}", this.pathSid.toString()); - - Request request = new Request( - HttpMethod.GET, - Domains.PREVIEW.toString(), - path - ); - Response response = client.request(request); - - if (response == null) { - throw new ApiConnectionException( - "FieldType 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 FieldType.fromJson( - response.getStream(), - client.getObjectMapper() - ); - } -} diff --git a/src/main/java/com/twilio/rest/preview/understand/assistant/FieldTypeReader.java b/src/main/java/com/twilio/rest/preview/understand/assistant/FieldTypeReader.java deleted file mode 100644 index 43e908dd40..0000000000 --- a/src/main/java/com/twilio/rest/preview/understand/assistant/FieldTypeReader.java +++ /dev/null @@ -1,141 +0,0 @@ -/* - * This code was generated by - * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ - * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ - * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ - * - * Twilio - Preview - * 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.preview.understand.assistant; - -import com.twilio.base.Page; -import com.twilio.base.Reader; -import com.twilio.base.ResourceSet; -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 FieldTypeReader extends Reader { - - private String pathAssistantSid; - private Integer pageSize; - - public FieldTypeReader(final String pathAssistantSid) { - this.pathAssistantSid = pathAssistantSid; - } - - public FieldTypeReader 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 = "/understand/Assistants/{AssistantSid}/FieldTypes"; - path = - path.replace( - "{" + "AssistantSid" + "}", - this.pathAssistantSid.toString() - ); - - Request request = new Request( - HttpMethod.GET, - Domains.PREVIEW.toString(), - path - ); - - addQueryParams(request); - return pageForRequest(client, request); - } - - private Page pageForRequest( - final TwilioRestClient client, - final Request request - ) { - Response response = client.request(request); - - if (response == null) { - throw new ApiConnectionException( - "FieldType 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( - "field_types", - response.getContent(), - FieldType.class, - client.getObjectMapper() - ); - } - - @Override - public Page previousPage( - final Page page, - final TwilioRestClient client - ) { - Request request = new Request( - HttpMethod.GET, - page.getPreviousPageUrl(Domains.PREVIEW.toString()) - ); - return pageForRequest(client, request); - } - - @Override - public Page nextPage( - final Page page, - final TwilioRestClient client - ) { - Request request = new Request( - HttpMethod.GET, - page.getNextPageUrl(Domains.PREVIEW.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/preview/understand/assistant/FieldTypeUpdater.java b/src/main/java/com/twilio/rest/preview/understand/assistant/FieldTypeUpdater.java deleted file mode 100644 index 4132099036..0000000000 --- a/src/main/java/com/twilio/rest/preview/understand/assistant/FieldTypeUpdater.java +++ /dev/null @@ -1,104 +0,0 @@ -/* - * This code was generated by - * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ - * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ - * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ - * - * Twilio - Preview - * 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.preview.understand.assistant; - -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 FieldTypeUpdater extends Updater { - - private String pathAssistantSid; - private String pathSid; - private String friendlyName; - private String uniqueName; - - public FieldTypeUpdater( - final String pathAssistantSid, - final String pathSid - ) { - this.pathAssistantSid = pathAssistantSid; - this.pathSid = pathSid; - } - - public FieldTypeUpdater setFriendlyName(final String friendlyName) { - this.friendlyName = friendlyName; - return this; - } - - public FieldTypeUpdater setUniqueName(final String uniqueName) { - this.uniqueName = uniqueName; - return this; - } - - @Override - public FieldType update(final TwilioRestClient client) { - String path = "/understand/Assistants/{AssistantSid}/FieldTypes/{Sid}"; - - path = - path.replace( - "{" + "AssistantSid" + "}", - this.pathAssistantSid.toString() - ); - path = path.replace("{" + "Sid" + "}", this.pathSid.toString()); - - Request request = new Request( - HttpMethod.POST, - Domains.PREVIEW.toString(), - path - ); - request.setContentType(EnumConstants.ContentType.FORM_URLENCODED); - addPostParams(request); - Response response = client.request(request); - if (response == null) { - throw new ApiConnectionException( - "FieldType 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 FieldType.fromJson( - response.getStream(), - client.getObjectMapper() - ); - } - - private void addPostParams(final Request request) { - if (friendlyName != null) { - request.addPostParam("FriendlyName", friendlyName); - } - if (uniqueName != null) { - request.addPostParam("UniqueName", uniqueName); - } - } -} diff --git a/src/main/java/com/twilio/rest/preview/understand/assistant/ModelBuild.java b/src/main/java/com/twilio/rest/preview/understand/assistant/ModelBuild.java deleted file mode 100644 index e27bb2b354..0000000000 --- a/src/main/java/com/twilio/rest/preview/understand/assistant/ModelBuild.java +++ /dev/null @@ -1,254 +0,0 @@ -/* - * This code was generated by - * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ - * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ - * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ - * - * Twilio - Preview - * 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.preview.understand.assistant; - -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.Objects; -import lombok.ToString; -import lombok.ToString; - -@JsonIgnoreProperties(ignoreUnknown = true) -@ToString -public class ModelBuild extends Resource { - - private static final long serialVersionUID = 226055418389205L; - - public static ModelBuildCreator creator(final String pathAssistantSid) { - return new ModelBuildCreator(pathAssistantSid); - } - - public static ModelBuildDeleter deleter( - final String pathAssistantSid, - final String pathSid - ) { - return new ModelBuildDeleter(pathAssistantSid, pathSid); - } - - public static ModelBuildFetcher fetcher( - final String pathAssistantSid, - final String pathSid - ) { - return new ModelBuildFetcher(pathAssistantSid, pathSid); - } - - public static ModelBuildReader reader(final String pathAssistantSid) { - return new ModelBuildReader(pathAssistantSid); - } - - public static ModelBuildUpdater updater( - final String pathAssistantSid, - final String pathSid - ) { - return new ModelBuildUpdater(pathAssistantSid, pathSid); - } - - /** - * Converts a JSON String into a ModelBuild object using the provided ObjectMapper. - * - * @param json Raw JSON String - * @param objectMapper Jackson ObjectMapper - * @return ModelBuild object represented by the provided JSON - */ - public static ModelBuild fromJson( - final String json, - final ObjectMapper objectMapper - ) { - // Convert all checked exceptions to Runtime - try { - return objectMapper.readValue(json, ModelBuild.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 ModelBuild object using the provided - * ObjectMapper. - * - * @param json Raw JSON InputStream - * @param objectMapper Jackson ObjectMapper - * @return ModelBuild object represented by the provided JSON - */ - public static ModelBuild fromJson( - final InputStream json, - final ObjectMapper objectMapper - ) { - // Convert all checked exceptions to Runtime - try { - return objectMapper.readValue(json, ModelBuild.class); - } catch (final JsonMappingException | JsonParseException e) { - throw new ApiException(e.getMessage(), e); - } catch (final IOException e) { - throw new ApiConnectionException(e.getMessage(), e); - } - } - - public enum Status { - ENQUEUED("enqueued"), - BUILDING("building"), - COMPLETED("completed"), - FAILED("failed"), - CANCELED("canceled"); - - private final String value; - - private Status(final String value) { - this.value = value; - } - - public String toString() { - return value; - } - - @JsonCreator - public static Status forValue(final String value) { - return Promoter.enumFromString(value, Status.values()); - } - } - - private final String accountSid; - private final ZonedDateTime dateCreated; - private final ZonedDateTime dateUpdated; - private final String assistantSid; - private final String sid; - private final ModelBuild.Status status; - private final String uniqueName; - private final URI url; - private final Integer buildDuration; - private final Integer errorCode; - - @JsonCreator - private ModelBuild( - @JsonProperty("account_sid") final String accountSid, - @JsonProperty("date_created") final String dateCreated, - @JsonProperty("date_updated") final String dateUpdated, - @JsonProperty("assistant_sid") final String assistantSid, - @JsonProperty("sid") final String sid, - @JsonProperty("status") final ModelBuild.Status status, - @JsonProperty("unique_name") final String uniqueName, - @JsonProperty("url") final URI url, - @JsonProperty("build_duration") final Integer buildDuration, - @JsonProperty("error_code") final Integer errorCode - ) { - this.accountSid = accountSid; - this.dateCreated = DateConverter.iso8601DateTimeFromString(dateCreated); - this.dateUpdated = DateConverter.iso8601DateTimeFromString(dateUpdated); - this.assistantSid = assistantSid; - this.sid = sid; - this.status = status; - this.uniqueName = uniqueName; - this.url = url; - this.buildDuration = buildDuration; - this.errorCode = errorCode; - } - - public final String getAccountSid() { - return this.accountSid; - } - - public final ZonedDateTime getDateCreated() { - return this.dateCreated; - } - - public final ZonedDateTime getDateUpdated() { - return this.dateUpdated; - } - - public final String getAssistantSid() { - return this.assistantSid; - } - - public final String getSid() { - return this.sid; - } - - public final ModelBuild.Status getStatus() { - return this.status; - } - - public final String getUniqueName() { - return this.uniqueName; - } - - public final URI getUrl() { - return this.url; - } - - public final Integer getBuildDuration() { - return this.buildDuration; - } - - public final Integer getErrorCode() { - return this.errorCode; - } - - @Override - public boolean equals(final Object o) { - if (this == o) { - return true; - } - - if (o == null || getClass() != o.getClass()) { - return false; - } - - ModelBuild other = (ModelBuild) o; - - return ( - Objects.equals(accountSid, other.accountSid) && - Objects.equals(dateCreated, other.dateCreated) && - Objects.equals(dateUpdated, other.dateUpdated) && - Objects.equals(assistantSid, other.assistantSid) && - Objects.equals(sid, other.sid) && - Objects.equals(status, other.status) && - Objects.equals(uniqueName, other.uniqueName) && - Objects.equals(url, other.url) && - Objects.equals(buildDuration, other.buildDuration) && - Objects.equals(errorCode, other.errorCode) - ); - } - - @Override - public int hashCode() { - return Objects.hash( - accountSid, - dateCreated, - dateUpdated, - assistantSid, - sid, - status, - uniqueName, - url, - buildDuration, - errorCode - ); - } -} diff --git a/src/main/java/com/twilio/rest/preview/understand/assistant/ModelBuildCreator.java b/src/main/java/com/twilio/rest/preview/understand/assistant/ModelBuildCreator.java deleted file mode 100644 index d40f01fbeb..0000000000 --- a/src/main/java/com/twilio/rest/preview/understand/assistant/ModelBuildCreator.java +++ /dev/null @@ -1,105 +0,0 @@ -/* - * This code was generated by - * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ - * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ - * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ - * - * Twilio - Preview - * 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.preview.understand.assistant; - -import com.twilio.base.Creator; -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; -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; -import java.net.URI; -import java.net.URI; - -public class ModelBuildCreator extends Creator { - - private String pathAssistantSid; - private URI statusCallback; - private String uniqueName; - - public ModelBuildCreator(final String pathAssistantSid) { - this.pathAssistantSid = pathAssistantSid; - } - - public ModelBuildCreator setStatusCallback(final URI statusCallback) { - this.statusCallback = statusCallback; - return this; - } - - public ModelBuildCreator setStatusCallback(final String statusCallback) { - return setStatusCallback(Promoter.uriFromString(statusCallback)); - } - - public ModelBuildCreator setUniqueName(final String uniqueName) { - this.uniqueName = uniqueName; - return this; - } - - @Override - public ModelBuild create(final TwilioRestClient client) { - String path = "/understand/Assistants/{AssistantSid}/ModelBuilds"; - - path = - path.replace( - "{" + "AssistantSid" + "}", - this.pathAssistantSid.toString() - ); - - Request request = new Request( - HttpMethod.POST, - Domains.PREVIEW.toString(), - path - ); - request.setContentType(EnumConstants.ContentType.FORM_URLENCODED); - addPostParams(request); - Response response = client.request(request); - if (response == null) { - throw new ApiConnectionException( - "ModelBuild 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 ModelBuild.fromJson( - response.getStream(), - client.getObjectMapper() - ); - } - - private void addPostParams(final Request request) { - if (statusCallback != null) { - request.addPostParam("StatusCallback", statusCallback.toString()); - } - if (uniqueName != null) { - request.addPostParam("UniqueName", uniqueName); - } - } -} diff --git a/src/main/java/com/twilio/rest/preview/understand/assistant/ModelBuildDeleter.java b/src/main/java/com/twilio/rest/preview/understand/assistant/ModelBuildDeleter.java deleted file mode 100644 index a25ecf920d..0000000000 --- a/src/main/java/com/twilio/rest/preview/understand/assistant/ModelBuildDeleter.java +++ /dev/null @@ -1,77 +0,0 @@ -/* - * This code was generated by - * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ - * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ - * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ - * - * Twilio - Preview - * 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.preview.understand.assistant; - -import com.twilio.base.Deleter; -import com.twilio.exception.ApiConnectionException; -import com.twilio.exception.ApiException; -import com.twilio.exception.RestException; -import com.twilio.http.HttpMethod; -import com.twilio.http.Request; -import com.twilio.http.Response; -import com.twilio.http.TwilioRestClient; -import com.twilio.rest.Domains; - -public class ModelBuildDeleter extends Deleter { - - private String pathAssistantSid; - private String pathSid; - - public ModelBuildDeleter( - final String pathAssistantSid, - final String pathSid - ) { - this.pathAssistantSid = pathAssistantSid; - this.pathSid = pathSid; - } - - @Override - public boolean delete(final TwilioRestClient client) { - String path = "/understand/Assistants/{AssistantSid}/ModelBuilds/{Sid}"; - - path = - path.replace( - "{" + "AssistantSid" + "}", - this.pathAssistantSid.toString() - ); - path = path.replace("{" + "Sid" + "}", this.pathSid.toString()); - - Request request = new Request( - HttpMethod.DELETE, - Domains.PREVIEW.toString(), - path - ); - Response response = client.request(request); - - if (response == null) { - throw new ApiConnectionException( - "ModelBuild 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/preview/understand/assistant/ModelBuildFetcher.java b/src/main/java/com/twilio/rest/preview/understand/assistant/ModelBuildFetcher.java deleted file mode 100644 index 2af81a3bde..0000000000 --- a/src/main/java/com/twilio/rest/preview/understand/assistant/ModelBuildFetcher.java +++ /dev/null @@ -1,81 +0,0 @@ -/* - * This code was generated by - * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ - * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ - * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ - * - * Twilio - Preview - * 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.preview.understand.assistant; - -import com.twilio.base.Fetcher; -import com.twilio.exception.ApiConnectionException; -import com.twilio.exception.ApiException; -import com.twilio.exception.RestException; -import com.twilio.http.HttpMethod; -import com.twilio.http.Request; -import com.twilio.http.Response; -import com.twilio.http.TwilioRestClient; -import com.twilio.rest.Domains; - -public class ModelBuildFetcher extends Fetcher { - - private String pathAssistantSid; - private String pathSid; - - public ModelBuildFetcher( - final String pathAssistantSid, - final String pathSid - ) { - this.pathAssistantSid = pathAssistantSid; - this.pathSid = pathSid; - } - - @Override - public ModelBuild fetch(final TwilioRestClient client) { - String path = "/understand/Assistants/{AssistantSid}/ModelBuilds/{Sid}"; - - path = - path.replace( - "{" + "AssistantSid" + "}", - this.pathAssistantSid.toString() - ); - path = path.replace("{" + "Sid" + "}", this.pathSid.toString()); - - Request request = new Request( - HttpMethod.GET, - Domains.PREVIEW.toString(), - path - ); - Response response = client.request(request); - - if (response == null) { - throw new ApiConnectionException( - "ModelBuild 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 ModelBuild.fromJson( - response.getStream(), - client.getObjectMapper() - ); - } -} diff --git a/src/main/java/com/twilio/rest/preview/understand/assistant/ModelBuildReader.java b/src/main/java/com/twilio/rest/preview/understand/assistant/ModelBuildReader.java deleted file mode 100644 index 6fdef58bb9..0000000000 --- a/src/main/java/com/twilio/rest/preview/understand/assistant/ModelBuildReader.java +++ /dev/null @@ -1,141 +0,0 @@ -/* - * This code was generated by - * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ - * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ - * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ - * - * Twilio - Preview - * 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.preview.understand.assistant; - -import com.twilio.base.Page; -import com.twilio.base.Reader; -import com.twilio.base.ResourceSet; -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 ModelBuildReader extends Reader { - - private String pathAssistantSid; - private Integer pageSize; - - public ModelBuildReader(final String pathAssistantSid) { - this.pathAssistantSid = pathAssistantSid; - } - - public ModelBuildReader 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 = "/understand/Assistants/{AssistantSid}/ModelBuilds"; - path = - path.replace( - "{" + "AssistantSid" + "}", - this.pathAssistantSid.toString() - ); - - Request request = new Request( - HttpMethod.GET, - Domains.PREVIEW.toString(), - path - ); - - addQueryParams(request); - return pageForRequest(client, request); - } - - private Page pageForRequest( - final TwilioRestClient client, - final Request request - ) { - Response response = client.request(request); - - if (response == null) { - throw new ApiConnectionException( - "ModelBuild 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( - "model_builds", - response.getContent(), - ModelBuild.class, - client.getObjectMapper() - ); - } - - @Override - public Page previousPage( - final Page page, - final TwilioRestClient client - ) { - Request request = new Request( - HttpMethod.GET, - page.getPreviousPageUrl(Domains.PREVIEW.toString()) - ); - return pageForRequest(client, request); - } - - @Override - public Page nextPage( - final Page page, - final TwilioRestClient client - ) { - Request request = new Request( - HttpMethod.GET, - page.getNextPageUrl(Domains.PREVIEW.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/preview/understand/assistant/ModelBuildUpdater.java b/src/main/java/com/twilio/rest/preview/understand/assistant/ModelBuildUpdater.java deleted file mode 100644 index 5a92044f9c..0000000000 --- a/src/main/java/com/twilio/rest/preview/understand/assistant/ModelBuildUpdater.java +++ /dev/null @@ -1,95 +0,0 @@ -/* - * This code was generated by - * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ - * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ - * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ - * - * Twilio - Preview - * 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.preview.understand.assistant; - -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 ModelBuildUpdater extends Updater { - - private String pathAssistantSid; - private String pathSid; - private String uniqueName; - - public ModelBuildUpdater( - final String pathAssistantSid, - final String pathSid - ) { - this.pathAssistantSid = pathAssistantSid; - this.pathSid = pathSid; - } - - public ModelBuildUpdater setUniqueName(final String uniqueName) { - this.uniqueName = uniqueName; - return this; - } - - @Override - public ModelBuild update(final TwilioRestClient client) { - String path = "/understand/Assistants/{AssistantSid}/ModelBuilds/{Sid}"; - - path = - path.replace( - "{" + "AssistantSid" + "}", - this.pathAssistantSid.toString() - ); - path = path.replace("{" + "Sid" + "}", this.pathSid.toString()); - - Request request = new Request( - HttpMethod.POST, - Domains.PREVIEW.toString(), - path - ); - request.setContentType(EnumConstants.ContentType.FORM_URLENCODED); - addPostParams(request); - Response response = client.request(request); - if (response == null) { - throw new ApiConnectionException( - "ModelBuild 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 ModelBuild.fromJson( - response.getStream(), - client.getObjectMapper() - ); - } - - private void addPostParams(final Request request) { - if (uniqueName != null) { - request.addPostParam("UniqueName", uniqueName); - } - } -} diff --git a/src/main/java/com/twilio/rest/preview/understand/assistant/Query.java b/src/main/java/com/twilio/rest/preview/understand/assistant/Query.java deleted file mode 100644 index b0934d9170..0000000000 --- a/src/main/java/com/twilio/rest/preview/understand/assistant/Query.java +++ /dev/null @@ -1,263 +0,0 @@ -/* - * This code was generated by - * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ - * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ - * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ - * - * Twilio - Preview - * 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.preview.understand.assistant; - -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 Query extends Resource { - - private static final long serialVersionUID = 180519234688811L; - - public static QueryCreator creator( - final String pathAssistantSid, - final String language, - final String query - ) { - return new QueryCreator(pathAssistantSid, language, query); - } - - public static QueryDeleter deleter( - final String pathAssistantSid, - final String pathSid - ) { - return new QueryDeleter(pathAssistantSid, pathSid); - } - - public static QueryFetcher fetcher( - final String pathAssistantSid, - final String pathSid - ) { - return new QueryFetcher(pathAssistantSid, pathSid); - } - - public static QueryReader reader(final String pathAssistantSid) { - return new QueryReader(pathAssistantSid); - } - - public static QueryUpdater updater( - final String pathAssistantSid, - final String pathSid - ) { - return new QueryUpdater(pathAssistantSid, pathSid); - } - - /** - * 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); - } - } - - private final String accountSid; - private final ZonedDateTime dateCreated; - private final ZonedDateTime dateUpdated; - private final Map results; - private final String language; - private final String modelBuildSid; - private final String query; - private final String sampleSid; - private final String assistantSid; - private final String sid; - private final String status; - private final URI url; - private final String sourceChannel; - - @JsonCreator - private Query( - @JsonProperty("account_sid") final String accountSid, - @JsonProperty("date_created") final String dateCreated, - @JsonProperty("date_updated") final String dateUpdated, - @JsonProperty("results") final Map results, - @JsonProperty("language") final String language, - @JsonProperty("model_build_sid") final String modelBuildSid, - @JsonProperty("query") final String query, - @JsonProperty("sample_sid") final String sampleSid, - @JsonProperty("assistant_sid") final String assistantSid, - @JsonProperty("sid") final String sid, - @JsonProperty("status") final String status, - @JsonProperty("url") final URI url, - @JsonProperty("source_channel") final String sourceChannel - ) { - this.accountSid = accountSid; - this.dateCreated = DateConverter.iso8601DateTimeFromString(dateCreated); - this.dateUpdated = DateConverter.iso8601DateTimeFromString(dateUpdated); - this.results = results; - this.language = language; - this.modelBuildSid = modelBuildSid; - this.query = query; - this.sampleSid = sampleSid; - this.assistantSid = assistantSid; - this.sid = sid; - this.status = status; - this.url = url; - this.sourceChannel = sourceChannel; - } - - public final String getAccountSid() { - return this.accountSid; - } - - public final ZonedDateTime getDateCreated() { - return this.dateCreated; - } - - public final ZonedDateTime getDateUpdated() { - return this.dateUpdated; - } - - public final Map getResults() { - return this.results; - } - - public final String getLanguage() { - return this.language; - } - - public final String getModelBuildSid() { - return this.modelBuildSid; - } - - public final String getQuery() { - return this.query; - } - - public final String getSampleSid() { - return this.sampleSid; - } - - public final String getAssistantSid() { - return this.assistantSid; - } - - public final String getSid() { - return this.sid; - } - - public final String getStatus() { - return this.status; - } - - public final URI getUrl() { - return this.url; - } - - public final String getSourceChannel() { - return this.sourceChannel; - } - - @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(accountSid, other.accountSid) && - Objects.equals(dateCreated, other.dateCreated) && - Objects.equals(dateUpdated, other.dateUpdated) && - Objects.equals(results, other.results) && - Objects.equals(language, other.language) && - Objects.equals(modelBuildSid, other.modelBuildSid) && - Objects.equals(query, other.query) && - Objects.equals(sampleSid, other.sampleSid) && - Objects.equals(assistantSid, other.assistantSid) && - Objects.equals(sid, other.sid) && - Objects.equals(status, other.status) && - Objects.equals(url, other.url) && - Objects.equals(sourceChannel, other.sourceChannel) - ); - } - - @Override - public int hashCode() { - return Objects.hash( - accountSid, - dateCreated, - dateUpdated, - results, - language, - modelBuildSid, - query, - sampleSid, - assistantSid, - sid, - status, - url, - sourceChannel - ); - } -} diff --git a/src/main/java/com/twilio/rest/preview/understand/assistant/QueryCreator.java b/src/main/java/com/twilio/rest/preview/understand/assistant/QueryCreator.java deleted file mode 100644 index 80d41d4cdc..0000000000 --- a/src/main/java/com/twilio/rest/preview/understand/assistant/QueryCreator.java +++ /dev/null @@ -1,130 +0,0 @@ -/* - * This code was generated by - * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ - * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ - * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ - * - * Twilio - Preview - * 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.preview.understand.assistant; - -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 QueryCreator extends Creator { - - private String pathAssistantSid; - private String language; - private String query; - private String tasks; - private String modelBuild; - private String field; - - public QueryCreator( - final String pathAssistantSid, - final String language, - final String query - ) { - this.pathAssistantSid = pathAssistantSid; - this.language = language; - this.query = query; - } - - public QueryCreator setLanguage(final String language) { - this.language = language; - return this; - } - - public QueryCreator setQuery(final String query) { - this.query = query; - return this; - } - - public QueryCreator setTasks(final String tasks) { - this.tasks = tasks; - return this; - } - - public QueryCreator setModelBuild(final String modelBuild) { - this.modelBuild = modelBuild; - return this; - } - - public QueryCreator setField(final String field) { - this.field = field; - return this; - } - - @Override - public Query create(final TwilioRestClient client) { - String path = "/understand/Assistants/{AssistantSid}/Queries"; - - path = - path.replace( - "{" + "AssistantSid" + "}", - this.pathAssistantSid.toString() - ); - path = path.replace("{" + "Language" + "}", this.language.toString()); - path = path.replace("{" + "Query" + "}", this.query.toString()); - - Request request = new Request( - HttpMethod.POST, - Domains.PREVIEW.toString(), - path - ); - request.setContentType(EnumConstants.ContentType.FORM_URLENCODED); - addPostParams(request); - Response response = client.request(request); - if (response == null) { - throw new ApiConnectionException( - "Query 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 Query.fromJson(response.getStream(), client.getObjectMapper()); - } - - private void addPostParams(final Request request) { - if (language != null) { - request.addPostParam("Language", language); - } - if (query != null) { - request.addPostParam("Query", query); - } - if (tasks != null) { - request.addPostParam("Tasks", tasks); - } - if (modelBuild != null) { - request.addPostParam("ModelBuild", modelBuild); - } - if (field != null) { - request.addPostParam("Field", field); - } - } -} diff --git a/src/main/java/com/twilio/rest/preview/understand/assistant/QueryDeleter.java b/src/main/java/com/twilio/rest/preview/understand/assistant/QueryDeleter.java deleted file mode 100644 index 21bdc32399..0000000000 --- a/src/main/java/com/twilio/rest/preview/understand/assistant/QueryDeleter.java +++ /dev/null @@ -1,74 +0,0 @@ -/* - * This code was generated by - * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ - * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ - * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ - * - * Twilio - Preview - * 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.preview.understand.assistant; - -import com.twilio.base.Deleter; -import com.twilio.exception.ApiConnectionException; -import com.twilio.exception.ApiException; -import com.twilio.exception.RestException; -import com.twilio.http.HttpMethod; -import com.twilio.http.Request; -import com.twilio.http.Response; -import com.twilio.http.TwilioRestClient; -import com.twilio.rest.Domains; - -public class QueryDeleter extends Deleter { - - private String pathAssistantSid; - private String pathSid; - - public QueryDeleter(final String pathAssistantSid, final String pathSid) { - this.pathAssistantSid = pathAssistantSid; - this.pathSid = pathSid; - } - - @Override - public boolean delete(final TwilioRestClient client) { - String path = "/understand/Assistants/{AssistantSid}/Queries/{Sid}"; - - path = - path.replace( - "{" + "AssistantSid" + "}", - this.pathAssistantSid.toString() - ); - path = path.replace("{" + "Sid" + "}", this.pathSid.toString()); - - Request request = new Request( - HttpMethod.DELETE, - Domains.PREVIEW.toString(), - path - ); - Response response = client.request(request); - - if (response == null) { - throw new ApiConnectionException( - "Query 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/preview/understand/assistant/QueryFetcher.java b/src/main/java/com/twilio/rest/preview/understand/assistant/QueryFetcher.java deleted file mode 100644 index 6d396c68e4..0000000000 --- a/src/main/java/com/twilio/rest/preview/understand/assistant/QueryFetcher.java +++ /dev/null @@ -1,75 +0,0 @@ -/* - * This code was generated by - * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ - * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ - * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ - * - * Twilio - Preview - * 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.preview.understand.assistant; - -import com.twilio.base.Fetcher; -import com.twilio.exception.ApiConnectionException; -import com.twilio.exception.ApiException; -import com.twilio.exception.RestException; -import com.twilio.http.HttpMethod; -import com.twilio.http.Request; -import com.twilio.http.Response; -import com.twilio.http.TwilioRestClient; -import com.twilio.rest.Domains; - -public class QueryFetcher extends Fetcher { - - private String pathAssistantSid; - private String pathSid; - - public QueryFetcher(final String pathAssistantSid, final String pathSid) { - this.pathAssistantSid = pathAssistantSid; - this.pathSid = pathSid; - } - - @Override - public Query fetch(final TwilioRestClient client) { - String path = "/understand/Assistants/{AssistantSid}/Queries/{Sid}"; - - path = - path.replace( - "{" + "AssistantSid" + "}", - this.pathAssistantSid.toString() - ); - path = path.replace("{" + "Sid" + "}", this.pathSid.toString()); - - Request request = new Request( - HttpMethod.GET, - Domains.PREVIEW.toString(), - path - ); - Response response = client.request(request); - - if (response == null) { - throw new ApiConnectionException( - "Query 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 Query.fromJson(response.getStream(), client.getObjectMapper()); - } -} diff --git a/src/main/java/com/twilio/rest/preview/understand/assistant/QueryReader.java b/src/main/java/com/twilio/rest/preview/understand/assistant/QueryReader.java deleted file mode 100644 index 62b5aa8a4c..0000000000 --- a/src/main/java/com/twilio/rest/preview/understand/assistant/QueryReader.java +++ /dev/null @@ -1,168 +0,0 @@ -/* - * This code was generated by - * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ - * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ - * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ - * - * Twilio - Preview - * 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.preview.understand.assistant; - -import com.twilio.base.Page; -import com.twilio.base.Reader; -import com.twilio.base.ResourceSet; -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 QueryReader extends Reader { - - private String pathAssistantSid; - private String language; - private String modelBuild; - private String status; - private Integer pageSize; - - public QueryReader(final String pathAssistantSid) { - this.pathAssistantSid = pathAssistantSid; - } - - public QueryReader setLanguage(final String language) { - this.language = language; - return this; - } - - public QueryReader setModelBuild(final String modelBuild) { - this.modelBuild = modelBuild; - return this; - } - - public QueryReader setStatus(final String status) { - this.status = status; - return this; - } - - public QueryReader 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 = "/understand/Assistants/{AssistantSid}/Queries"; - path = - path.replace( - "{" + "AssistantSid" + "}", - this.pathAssistantSid.toString() - ); - - Request request = new Request( - HttpMethod.GET, - Domains.PREVIEW.toString(), - path - ); - - addQueryParams(request); - return pageForRequest(client, request); - } - - private Page pageForRequest( - final TwilioRestClient client, - final Request request - ) { - Response response = client.request(request); - - if (response == null) { - throw new ApiConnectionException( - "Query 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( - "queries", - response.getContent(), - Query.class, - client.getObjectMapper() - ); - } - - @Override - public Page previousPage( - final Page page, - final TwilioRestClient client - ) { - Request request = new Request( - HttpMethod.GET, - page.getPreviousPageUrl(Domains.PREVIEW.toString()) - ); - return pageForRequest(client, request); - } - - @Override - public Page nextPage( - final Page page, - final TwilioRestClient client - ) { - Request request = new Request( - HttpMethod.GET, - page.getNextPageUrl(Domains.PREVIEW.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 (language != null) { - request.addQueryParam("Language", language); - } - if (modelBuild != null) { - request.addQueryParam("ModelBuild", modelBuild); - } - if (status != null) { - request.addQueryParam("Status", status); - } - 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/preview/understand/assistant/QueryUpdater.java b/src/main/java/com/twilio/rest/preview/understand/assistant/QueryUpdater.java deleted file mode 100644 index 94548cb28a..0000000000 --- a/src/main/java/com/twilio/rest/preview/understand/assistant/QueryUpdater.java +++ /dev/null @@ -1,98 +0,0 @@ -/* - * This code was generated by - * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ - * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ - * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ - * - * Twilio - Preview - * 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.preview.understand.assistant; - -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 QueryUpdater extends Updater { - - private String pathAssistantSid; - private String pathSid; - private String sampleSid; - private String status; - - public QueryUpdater(final String pathAssistantSid, final String pathSid) { - this.pathAssistantSid = pathAssistantSid; - this.pathSid = pathSid; - } - - public QueryUpdater setSampleSid(final String sampleSid) { - this.sampleSid = sampleSid; - return this; - } - - public QueryUpdater setStatus(final String status) { - this.status = status; - return this; - } - - @Override - public Query update(final TwilioRestClient client) { - String path = "/understand/Assistants/{AssistantSid}/Queries/{Sid}"; - - path = - path.replace( - "{" + "AssistantSid" + "}", - this.pathAssistantSid.toString() - ); - path = path.replace("{" + "Sid" + "}", this.pathSid.toString()); - - Request request = new Request( - HttpMethod.POST, - Domains.PREVIEW.toString(), - path - ); - request.setContentType(EnumConstants.ContentType.FORM_URLENCODED); - addPostParams(request); - Response response = client.request(request); - if (response == null) { - throw new ApiConnectionException( - "Query 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 Query.fromJson(response.getStream(), client.getObjectMapper()); - } - - private void addPostParams(final Request request) { - if (sampleSid != null) { - request.addPostParam("SampleSid", sampleSid); - } - if (status != null) { - request.addPostParam("Status", status); - } - } -} diff --git a/src/main/java/com/twilio/rest/preview/understand/assistant/StyleSheet.java b/src/main/java/com/twilio/rest/preview/understand/assistant/StyleSheet.java deleted file mode 100644 index 6f8ff4aa5d..0000000000 --- a/src/main/java/com/twilio/rest/preview/understand/assistant/StyleSheet.java +++ /dev/null @@ -1,150 +0,0 @@ -/* - * This code was generated by - * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ - * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ - * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ - * - * Twilio - Preview - * 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.preview.understand.assistant; - -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.exception.ApiConnectionException; -import com.twilio.exception.ApiException; -import java.io.IOException; -import java.io.InputStream; -import java.net.URI; -import java.util.Map; -import java.util.Map; -import java.util.Objects; -import lombok.ToString; -import lombok.ToString; - -@JsonIgnoreProperties(ignoreUnknown = true) -@ToString -public class StyleSheet extends Resource { - - private static final long serialVersionUID = 52727905251134L; - - public static StyleSheetFetcher fetcher(final String pathAssistantSid) { - return new StyleSheetFetcher(pathAssistantSid); - } - - public static StyleSheetUpdater updater(final String pathAssistantSid) { - return new StyleSheetUpdater(pathAssistantSid); - } - - /** - * Converts a JSON String into a StyleSheet object using the provided ObjectMapper. - * - * @param json Raw JSON String - * @param objectMapper Jackson ObjectMapper - * @return StyleSheet object represented by the provided JSON - */ - public static StyleSheet fromJson( - final String json, - final ObjectMapper objectMapper - ) { - // Convert all checked exceptions to Runtime - try { - return objectMapper.readValue(json, StyleSheet.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 StyleSheet object using the provided - * ObjectMapper. - * - * @param json Raw JSON InputStream - * @param objectMapper Jackson ObjectMapper - * @return StyleSheet object represented by the provided JSON - */ - public static StyleSheet fromJson( - final InputStream json, - final ObjectMapper objectMapper - ) { - // Convert all checked exceptions to Runtime - try { - return objectMapper.readValue(json, StyleSheet.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 assistantSid; - private final URI url; - private final Map data; - - @JsonCreator - private StyleSheet( - @JsonProperty("account_sid") final String accountSid, - @JsonProperty("assistant_sid") final String assistantSid, - @JsonProperty("url") final URI url, - @JsonProperty("data") final Map data - ) { - this.accountSid = accountSid; - this.assistantSid = assistantSid; - this.url = url; - this.data = data; - } - - public final String getAccountSid() { - return this.accountSid; - } - - public final String getAssistantSid() { - return this.assistantSid; - } - - public final URI getUrl() { - return this.url; - } - - public final Map getData() { - return this.data; - } - - @Override - public boolean equals(final Object o) { - if (this == o) { - return true; - } - - if (o == null || getClass() != o.getClass()) { - return false; - } - - StyleSheet other = (StyleSheet) o; - - return ( - Objects.equals(accountSid, other.accountSid) && - Objects.equals(assistantSid, other.assistantSid) && - Objects.equals(url, other.url) && - Objects.equals(data, other.data) - ); - } - - @Override - public int hashCode() { - return Objects.hash(accountSid, assistantSid, url, data); - } -} diff --git a/src/main/java/com/twilio/rest/preview/understand/assistant/StyleSheetFetcher.java b/src/main/java/com/twilio/rest/preview/understand/assistant/StyleSheetFetcher.java deleted file mode 100644 index 6d4e0188f3..0000000000 --- a/src/main/java/com/twilio/rest/preview/understand/assistant/StyleSheetFetcher.java +++ /dev/null @@ -1,75 +0,0 @@ -/* - * This code was generated by - * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ - * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ - * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ - * - * Twilio - Preview - * 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.preview.understand.assistant; - -import com.twilio.base.Fetcher; -import com.twilio.exception.ApiConnectionException; -import com.twilio.exception.ApiException; -import com.twilio.exception.RestException; -import com.twilio.http.HttpMethod; -import com.twilio.http.Request; -import com.twilio.http.Response; -import com.twilio.http.TwilioRestClient; -import com.twilio.rest.Domains; - -public class StyleSheetFetcher extends Fetcher { - - private String pathAssistantSid; - - public StyleSheetFetcher(final String pathAssistantSid) { - this.pathAssistantSid = pathAssistantSid; - } - - @Override - public StyleSheet fetch(final TwilioRestClient client) { - String path = "/understand/Assistants/{AssistantSid}/StyleSheet"; - - path = - path.replace( - "{" + "AssistantSid" + "}", - this.pathAssistantSid.toString() - ); - - Request request = new Request( - HttpMethod.GET, - Domains.PREVIEW.toString(), - path - ); - Response response = client.request(request); - - if (response == null) { - throw new ApiConnectionException( - "StyleSheet 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 StyleSheet.fromJson( - response.getStream(), - client.getObjectMapper() - ); - } -} diff --git a/src/main/java/com/twilio/rest/preview/understand/assistant/StyleSheetUpdater.java b/src/main/java/com/twilio/rest/preview/understand/assistant/StyleSheetUpdater.java deleted file mode 100644 index 3549066f64..0000000000 --- a/src/main/java/com/twilio/rest/preview/understand/assistant/StyleSheetUpdater.java +++ /dev/null @@ -1,93 +0,0 @@ -/* - * This code was generated by - * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ - * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ - * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ - * - * Twilio - Preview - * 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.preview.understand.assistant; - -import com.twilio.base.Updater; -import com.twilio.constant.EnumConstants; -import com.twilio.converter.Converter; -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; -import java.util.Map; - -public class StyleSheetUpdater extends Updater { - - private String pathAssistantSid; - private Map styleSheet; - - public StyleSheetUpdater(final String pathAssistantSid) { - this.pathAssistantSid = pathAssistantSid; - } - - public StyleSheetUpdater setStyleSheet( - final Map styleSheet - ) { - this.styleSheet = styleSheet; - return this; - } - - @Override - public StyleSheet update(final TwilioRestClient client) { - String path = "/understand/Assistants/{AssistantSid}/StyleSheet"; - - path = - path.replace( - "{" + "AssistantSid" + "}", - this.pathAssistantSid.toString() - ); - - Request request = new Request( - HttpMethod.POST, - Domains.PREVIEW.toString(), - path - ); - request.setContentType(EnumConstants.ContentType.FORM_URLENCODED); - addPostParams(request); - Response response = client.request(request); - if (response == null) { - throw new ApiConnectionException( - "StyleSheet 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 StyleSheet.fromJson( - response.getStream(), - client.getObjectMapper() - ); - } - - private void addPostParams(final Request request) { - if (styleSheet != null) { - request.addPostParam("StyleSheet", Converter.mapToJson(styleSheet)); - } - } -} diff --git a/src/main/java/com/twilio/rest/preview/understand/assistant/Task.java b/src/main/java/com/twilio/rest/preview/understand/assistant/Task.java deleted file mode 100644 index 8e09c271d0..0000000000 --- a/src/main/java/com/twilio/rest/preview/understand/assistant/Task.java +++ /dev/null @@ -1,235 +0,0 @@ -/* - * This code was generated by - * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ - * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ - * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ - * - * Twilio - Preview - * 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.preview.understand.assistant; - -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 Task extends Resource { - - private static final long serialVersionUID = 59959992200143L; - - public static TaskCreator creator( - final String pathAssistantSid, - final String uniqueName - ) { - return new TaskCreator(pathAssistantSid, uniqueName); - } - - public static TaskDeleter deleter( - final String pathAssistantSid, - final String pathSid - ) { - return new TaskDeleter(pathAssistantSid, pathSid); - } - - public static TaskFetcher fetcher( - final String pathAssistantSid, - final String pathSid - ) { - return new TaskFetcher(pathAssistantSid, pathSid); - } - - public static TaskReader reader(final String pathAssistantSid) { - return new TaskReader(pathAssistantSid); - } - - public static TaskUpdater updater( - final String pathAssistantSid, - final String pathSid - ) { - return new TaskUpdater(pathAssistantSid, pathSid); - } - - /** - * Converts a JSON String into a Task object using the provided ObjectMapper. - * - * @param json Raw JSON String - * @param objectMapper Jackson ObjectMapper - * @return Task object represented by the provided JSON - */ - public static Task fromJson( - final String json, - final ObjectMapper objectMapper - ) { - // Convert all checked exceptions to Runtime - try { - return objectMapper.readValue(json, Task.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 Task object using the provided - * ObjectMapper. - * - * @param json Raw JSON InputStream - * @param objectMapper Jackson ObjectMapper - * @return Task object represented by the provided JSON - */ - public static Task fromJson( - final InputStream json, - final ObjectMapper objectMapper - ) { - // Convert all checked exceptions to Runtime - try { - return objectMapper.readValue(json, Task.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 ZonedDateTime dateCreated; - private final ZonedDateTime dateUpdated; - private final String friendlyName; - private final Map links; - private final String assistantSid; - private final String sid; - private final String uniqueName; - private final URI actionsUrl; - private final URI url; - - @JsonCreator - private Task( - @JsonProperty("account_sid") final String accountSid, - @JsonProperty("date_created") final String dateCreated, - @JsonProperty("date_updated") final String dateUpdated, - @JsonProperty("friendly_name") final String friendlyName, - @JsonProperty("links") final Map links, - @JsonProperty("assistant_sid") final String assistantSid, - @JsonProperty("sid") final String sid, - @JsonProperty("unique_name") final String uniqueName, - @JsonProperty("actions_url") final URI actionsUrl, - @JsonProperty("url") final URI url - ) { - this.accountSid = accountSid; - this.dateCreated = DateConverter.iso8601DateTimeFromString(dateCreated); - this.dateUpdated = DateConverter.iso8601DateTimeFromString(dateUpdated); - this.friendlyName = friendlyName; - this.links = links; - this.assistantSid = assistantSid; - this.sid = sid; - this.uniqueName = uniqueName; - this.actionsUrl = actionsUrl; - this.url = url; - } - - public final String getAccountSid() { - return this.accountSid; - } - - public final ZonedDateTime getDateCreated() { - return this.dateCreated; - } - - public final ZonedDateTime getDateUpdated() { - return this.dateUpdated; - } - - public final String getFriendlyName() { - return this.friendlyName; - } - - public final Map getLinks() { - return this.links; - } - - public final String getAssistantSid() { - return this.assistantSid; - } - - public final String getSid() { - return this.sid; - } - - public final String getUniqueName() { - return this.uniqueName; - } - - public final URI getActionsUrl() { - return this.actionsUrl; - } - - 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; - } - - Task other = (Task) o; - - return ( - Objects.equals(accountSid, other.accountSid) && - Objects.equals(dateCreated, other.dateCreated) && - Objects.equals(dateUpdated, other.dateUpdated) && - Objects.equals(friendlyName, other.friendlyName) && - Objects.equals(links, other.links) && - Objects.equals(assistantSid, other.assistantSid) && - Objects.equals(sid, other.sid) && - Objects.equals(uniqueName, other.uniqueName) && - Objects.equals(actionsUrl, other.actionsUrl) && - Objects.equals(url, other.url) - ); - } - - @Override - public int hashCode() { - return Objects.hash( - accountSid, - dateCreated, - dateUpdated, - friendlyName, - links, - assistantSid, - sid, - uniqueName, - actionsUrl, - url - ); - } -} diff --git a/src/main/java/com/twilio/rest/preview/understand/assistant/TaskCreator.java b/src/main/java/com/twilio/rest/preview/understand/assistant/TaskCreator.java deleted file mode 100644 index f93a9bf401..0000000000 --- a/src/main/java/com/twilio/rest/preview/understand/assistant/TaskCreator.java +++ /dev/null @@ -1,127 +0,0 @@ -/* - * This code was generated by - * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ - * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ - * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ - * - * Twilio - Preview - * 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.preview.understand.assistant; - -import com.twilio.base.Creator; -import com.twilio.constant.EnumConstants; -import com.twilio.converter.Converter; -import com.twilio.converter.Converter; -import com.twilio.converter.Promoter; -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; -import java.net.URI; -import java.net.URI; -import java.util.Map; -import java.util.Map; - -public class TaskCreator extends Creator { - - private String pathAssistantSid; - private String uniqueName; - private String friendlyName; - private Map actions; - private URI actionsUrl; - - public TaskCreator(final String pathAssistantSid, final String uniqueName) { - this.pathAssistantSid = pathAssistantSid; - this.uniqueName = uniqueName; - } - - public TaskCreator setUniqueName(final String uniqueName) { - this.uniqueName = uniqueName; - return this; - } - - public TaskCreator setFriendlyName(final String friendlyName) { - this.friendlyName = friendlyName; - return this; - } - - public TaskCreator setActions(final Map actions) { - this.actions = actions; - return this; - } - - public TaskCreator setActionsUrl(final URI actionsUrl) { - this.actionsUrl = actionsUrl; - return this; - } - - public TaskCreator setActionsUrl(final String actionsUrl) { - return setActionsUrl(Promoter.uriFromString(actionsUrl)); - } - - @Override - public Task create(final TwilioRestClient client) { - String path = "/understand/Assistants/{AssistantSid}/Tasks"; - - path = - path.replace( - "{" + "AssistantSid" + "}", - this.pathAssistantSid.toString() - ); - path = - path.replace("{" + "UniqueName" + "}", this.uniqueName.toString()); - - Request request = new Request( - HttpMethod.POST, - Domains.PREVIEW.toString(), - path - ); - request.setContentType(EnumConstants.ContentType.FORM_URLENCODED); - addPostParams(request); - Response response = client.request(request); - if (response == null) { - throw new ApiConnectionException( - "Task 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 Task.fromJson(response.getStream(), client.getObjectMapper()); - } - - private void addPostParams(final Request request) { - if (uniqueName != null) { - request.addPostParam("UniqueName", uniqueName); - } - if (friendlyName != null) { - request.addPostParam("FriendlyName", friendlyName); - } - if (actions != null) { - request.addPostParam("Actions", Converter.mapToJson(actions)); - } - if (actionsUrl != null) { - request.addPostParam("ActionsUrl", actionsUrl.toString()); - } - } -} diff --git a/src/main/java/com/twilio/rest/preview/understand/assistant/TaskDeleter.java b/src/main/java/com/twilio/rest/preview/understand/assistant/TaskDeleter.java deleted file mode 100644 index 30b31ecad1..0000000000 --- a/src/main/java/com/twilio/rest/preview/understand/assistant/TaskDeleter.java +++ /dev/null @@ -1,74 +0,0 @@ -/* - * This code was generated by - * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ - * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ - * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ - * - * Twilio - Preview - * 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.preview.understand.assistant; - -import com.twilio.base.Deleter; -import com.twilio.exception.ApiConnectionException; -import com.twilio.exception.ApiException; -import com.twilio.exception.RestException; -import com.twilio.http.HttpMethod; -import com.twilio.http.Request; -import com.twilio.http.Response; -import com.twilio.http.TwilioRestClient; -import com.twilio.rest.Domains; - -public class TaskDeleter extends Deleter { - - private String pathAssistantSid; - private String pathSid; - - public TaskDeleter(final String pathAssistantSid, final String pathSid) { - this.pathAssistantSid = pathAssistantSid; - this.pathSid = pathSid; - } - - @Override - public boolean delete(final TwilioRestClient client) { - String path = "/understand/Assistants/{AssistantSid}/Tasks/{Sid}"; - - path = - path.replace( - "{" + "AssistantSid" + "}", - this.pathAssistantSid.toString() - ); - path = path.replace("{" + "Sid" + "}", this.pathSid.toString()); - - Request request = new Request( - HttpMethod.DELETE, - Domains.PREVIEW.toString(), - path - ); - Response response = client.request(request); - - if (response == null) { - throw new ApiConnectionException( - "Task 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/preview/understand/assistant/TaskFetcher.java b/src/main/java/com/twilio/rest/preview/understand/assistant/TaskFetcher.java deleted file mode 100644 index 416b467f18..0000000000 --- a/src/main/java/com/twilio/rest/preview/understand/assistant/TaskFetcher.java +++ /dev/null @@ -1,75 +0,0 @@ -/* - * This code was generated by - * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ - * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ - * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ - * - * Twilio - Preview - * 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.preview.understand.assistant; - -import com.twilio.base.Fetcher; -import com.twilio.exception.ApiConnectionException; -import com.twilio.exception.ApiException; -import com.twilio.exception.RestException; -import com.twilio.http.HttpMethod; -import com.twilio.http.Request; -import com.twilio.http.Response; -import com.twilio.http.TwilioRestClient; -import com.twilio.rest.Domains; - -public class TaskFetcher extends Fetcher { - - private String pathAssistantSid; - private String pathSid; - - public TaskFetcher(final String pathAssistantSid, final String pathSid) { - this.pathAssistantSid = pathAssistantSid; - this.pathSid = pathSid; - } - - @Override - public Task fetch(final TwilioRestClient client) { - String path = "/understand/Assistants/{AssistantSid}/Tasks/{Sid}"; - - path = - path.replace( - "{" + "AssistantSid" + "}", - this.pathAssistantSid.toString() - ); - path = path.replace("{" + "Sid" + "}", this.pathSid.toString()); - - Request request = new Request( - HttpMethod.GET, - Domains.PREVIEW.toString(), - path - ); - Response response = client.request(request); - - if (response == null) { - throw new ApiConnectionException( - "Task 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 Task.fromJson(response.getStream(), client.getObjectMapper()); - } -} diff --git a/src/main/java/com/twilio/rest/preview/understand/assistant/TaskReader.java b/src/main/java/com/twilio/rest/preview/understand/assistant/TaskReader.java deleted file mode 100644 index 81d3ef050e..0000000000 --- a/src/main/java/com/twilio/rest/preview/understand/assistant/TaskReader.java +++ /dev/null @@ -1,141 +0,0 @@ -/* - * This code was generated by - * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ - * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ - * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ - * - * Twilio - Preview - * 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.preview.understand.assistant; - -import com.twilio.base.Page; -import com.twilio.base.Reader; -import com.twilio.base.ResourceSet; -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 TaskReader extends Reader { - - private String pathAssistantSid; - private Integer pageSize; - - public TaskReader(final String pathAssistantSid) { - this.pathAssistantSid = pathAssistantSid; - } - - public TaskReader 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 = "/understand/Assistants/{AssistantSid}/Tasks"; - path = - path.replace( - "{" + "AssistantSid" + "}", - this.pathAssistantSid.toString() - ); - - Request request = new Request( - HttpMethod.GET, - Domains.PREVIEW.toString(), - path - ); - - addQueryParams(request); - return pageForRequest(client, request); - } - - private Page pageForRequest( - final TwilioRestClient client, - final Request request - ) { - Response response = client.request(request); - - if (response == null) { - throw new ApiConnectionException( - "Task 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( - "tasks", - response.getContent(), - Task.class, - client.getObjectMapper() - ); - } - - @Override - public Page previousPage( - final Page page, - final TwilioRestClient client - ) { - Request request = new Request( - HttpMethod.GET, - page.getPreviousPageUrl(Domains.PREVIEW.toString()) - ); - return pageForRequest(client, request); - } - - @Override - public Page nextPage( - final Page page, - final TwilioRestClient client - ) { - Request request = new Request( - HttpMethod.GET, - page.getNextPageUrl(Domains.PREVIEW.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/preview/understand/assistant/TaskUpdater.java b/src/main/java/com/twilio/rest/preview/understand/assistant/TaskUpdater.java deleted file mode 100644 index 729b3126c7..0000000000 --- a/src/main/java/com/twilio/rest/preview/understand/assistant/TaskUpdater.java +++ /dev/null @@ -1,124 +0,0 @@ -/* - * This code was generated by - * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ - * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ - * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ - * - * Twilio - Preview - * 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.preview.understand.assistant; - -import com.twilio.base.Updater; -import com.twilio.constant.EnumConstants; -import com.twilio.converter.Converter; -import com.twilio.converter.Promoter; -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; -import java.net.URI; -import java.util.Map; - -public class TaskUpdater extends Updater { - - private String pathAssistantSid; - private String pathSid; - private String friendlyName; - private String uniqueName; - private Map actions; - private URI actionsUrl; - - public TaskUpdater(final String pathAssistantSid, final String pathSid) { - this.pathAssistantSid = pathAssistantSid; - this.pathSid = pathSid; - } - - public TaskUpdater setFriendlyName(final String friendlyName) { - this.friendlyName = friendlyName; - return this; - } - - public TaskUpdater setUniqueName(final String uniqueName) { - this.uniqueName = uniqueName; - return this; - } - - public TaskUpdater setActions(final Map actions) { - this.actions = actions; - return this; - } - - public TaskUpdater setActionsUrl(final URI actionsUrl) { - this.actionsUrl = actionsUrl; - return this; - } - - public TaskUpdater setActionsUrl(final String actionsUrl) { - return setActionsUrl(Promoter.uriFromString(actionsUrl)); - } - - @Override - public Task update(final TwilioRestClient client) { - String path = "/understand/Assistants/{AssistantSid}/Tasks/{Sid}"; - - path = - path.replace( - "{" + "AssistantSid" + "}", - this.pathAssistantSid.toString() - ); - path = path.replace("{" + "Sid" + "}", this.pathSid.toString()); - - Request request = new Request( - HttpMethod.POST, - Domains.PREVIEW.toString(), - path - ); - request.setContentType(EnumConstants.ContentType.FORM_URLENCODED); - addPostParams(request); - Response response = client.request(request); - if (response == null) { - throw new ApiConnectionException( - "Task 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 Task.fromJson(response.getStream(), client.getObjectMapper()); - } - - private void addPostParams(final Request request) { - if (friendlyName != null) { - request.addPostParam("FriendlyName", friendlyName); - } - if (uniqueName != null) { - request.addPostParam("UniqueName", uniqueName); - } - if (actions != null) { - request.addPostParam("Actions", Converter.mapToJson(actions)); - } - if (actionsUrl != null) { - request.addPostParam("ActionsUrl", actionsUrl.toString()); - } - } -} diff --git a/src/main/java/com/twilio/rest/preview/understand/assistant/fieldtype/FieldValue.java b/src/main/java/com/twilio/rest/preview/understand/assistant/fieldtype/FieldValue.java deleted file mode 100644 index 9e633257c3..0000000000 --- a/src/main/java/com/twilio/rest/preview/understand/assistant/fieldtype/FieldValue.java +++ /dev/null @@ -1,246 +0,0 @@ -/* - * This code was generated by - * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ - * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ - * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ - * - * Twilio - Preview - * 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.preview.understand.assistant.fieldtype; - -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 FieldValue extends Resource { - - private static final long serialVersionUID = 181490262234152L; - - public static FieldValueCreator creator( - final String pathAssistantSid, - final String pathFieldTypeSid, - final String language, - final String value - ) { - return new FieldValueCreator( - pathAssistantSid, - pathFieldTypeSid, - language, - value - ); - } - - public static FieldValueDeleter deleter( - final String pathAssistantSid, - final String pathFieldTypeSid, - final String pathSid - ) { - return new FieldValueDeleter( - pathAssistantSid, - pathFieldTypeSid, - pathSid - ); - } - - public static FieldValueFetcher fetcher( - final String pathAssistantSid, - final String pathFieldTypeSid, - final String pathSid - ) { - return new FieldValueFetcher( - pathAssistantSid, - pathFieldTypeSid, - pathSid - ); - } - - public static FieldValueReader reader( - final String pathAssistantSid, - final String pathFieldTypeSid - ) { - return new FieldValueReader(pathAssistantSid, pathFieldTypeSid); - } - - /** - * Converts a JSON String into a FieldValue object using the provided ObjectMapper. - * - * @param json Raw JSON String - * @param objectMapper Jackson ObjectMapper - * @return FieldValue object represented by the provided JSON - */ - public static FieldValue fromJson( - final String json, - final ObjectMapper objectMapper - ) { - // Convert all checked exceptions to Runtime - try { - return objectMapper.readValue(json, FieldValue.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 FieldValue object using the provided - * ObjectMapper. - * - * @param json Raw JSON InputStream - * @param objectMapper Jackson ObjectMapper - * @return FieldValue object represented by the provided JSON - */ - public static FieldValue fromJson( - final InputStream json, - final ObjectMapper objectMapper - ) { - // Convert all checked exceptions to Runtime - try { - return objectMapper.readValue(json, FieldValue.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 ZonedDateTime dateCreated; - private final ZonedDateTime dateUpdated; - private final String fieldTypeSid; - private final String language; - private final String assistantSid; - private final String sid; - private final String value; - private final URI url; - private final String synonymOf; - - @JsonCreator - private FieldValue( - @JsonProperty("account_sid") final String accountSid, - @JsonProperty("date_created") final String dateCreated, - @JsonProperty("date_updated") final String dateUpdated, - @JsonProperty("field_type_sid") final String fieldTypeSid, - @JsonProperty("language") final String language, - @JsonProperty("assistant_sid") final String assistantSid, - @JsonProperty("sid") final String sid, - @JsonProperty("value") final String value, - @JsonProperty("url") final URI url, - @JsonProperty("synonym_of") final String synonymOf - ) { - this.accountSid = accountSid; - this.dateCreated = DateConverter.iso8601DateTimeFromString(dateCreated); - this.dateUpdated = DateConverter.iso8601DateTimeFromString(dateUpdated); - this.fieldTypeSid = fieldTypeSid; - this.language = language; - this.assistantSid = assistantSid; - this.sid = sid; - this.value = value; - this.url = url; - this.synonymOf = synonymOf; - } - - public final String getAccountSid() { - return this.accountSid; - } - - public final ZonedDateTime getDateCreated() { - return this.dateCreated; - } - - public final ZonedDateTime getDateUpdated() { - return this.dateUpdated; - } - - public final String getFieldTypeSid() { - return this.fieldTypeSid; - } - - public final String getLanguage() { - return this.language; - } - - public final String getAssistantSid() { - return this.assistantSid; - } - - public final String getSid() { - return this.sid; - } - - public final String getValue() { - return this.value; - } - - public final URI getUrl() { - return this.url; - } - - public final String getSynonymOf() { - return this.synonymOf; - } - - @Override - public boolean equals(final Object o) { - if (this == o) { - return true; - } - - if (o == null || getClass() != o.getClass()) { - return false; - } - - FieldValue other = (FieldValue) o; - - return ( - Objects.equals(accountSid, other.accountSid) && - Objects.equals(dateCreated, other.dateCreated) && - Objects.equals(dateUpdated, other.dateUpdated) && - Objects.equals(fieldTypeSid, other.fieldTypeSid) && - Objects.equals(language, other.language) && - Objects.equals(assistantSid, other.assistantSid) && - Objects.equals(sid, other.sid) && - Objects.equals(value, other.value) && - Objects.equals(url, other.url) && - Objects.equals(synonymOf, other.synonymOf) - ); - } - - @Override - public int hashCode() { - return Objects.hash( - accountSid, - dateCreated, - dateUpdated, - fieldTypeSid, - language, - assistantSid, - sid, - value, - url, - synonymOf - ); - } -} diff --git a/src/main/java/com/twilio/rest/preview/understand/assistant/fieldtype/FieldValueCreator.java b/src/main/java/com/twilio/rest/preview/understand/assistant/fieldtype/FieldValueCreator.java deleted file mode 100644 index 7ab3b4bc6b..0000000000 --- a/src/main/java/com/twilio/rest/preview/understand/assistant/fieldtype/FieldValueCreator.java +++ /dev/null @@ -1,124 +0,0 @@ -/* - * This code was generated by - * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ - * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ - * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ - * - * Twilio - Preview - * 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.preview.understand.assistant.fieldtype; - -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 FieldValueCreator extends Creator { - - private String pathAssistantSid; - private String pathFieldTypeSid; - private String language; - private String value; - private String synonymOf; - - public FieldValueCreator( - final String pathAssistantSid, - final String pathFieldTypeSid, - final String language, - final String value - ) { - this.pathAssistantSid = pathAssistantSid; - this.pathFieldTypeSid = pathFieldTypeSid; - this.language = language; - this.value = value; - } - - public FieldValueCreator setLanguage(final String language) { - this.language = language; - return this; - } - - public FieldValueCreator setValue(final String value) { - this.value = value; - return this; - } - - public FieldValueCreator setSynonymOf(final String synonymOf) { - this.synonymOf = synonymOf; - return this; - } - - @Override - public FieldValue create(final TwilioRestClient client) { - String path = - "/understand/Assistants/{AssistantSid}/FieldTypes/{FieldTypeSid}/FieldValues"; - - path = - path.replace( - "{" + "AssistantSid" + "}", - this.pathAssistantSid.toString() - ); - path = - path.replace( - "{" + "FieldTypeSid" + "}", - this.pathFieldTypeSid.toString() - ); - path = path.replace("{" + "Language" + "}", this.language.toString()); - path = path.replace("{" + "Value" + "}", this.value.toString()); - - Request request = new Request( - HttpMethod.POST, - Domains.PREVIEW.toString(), - path - ); - request.setContentType(EnumConstants.ContentType.FORM_URLENCODED); - addPostParams(request); - Response response = client.request(request); - if (response == null) { - throw new ApiConnectionException( - "FieldValue 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 FieldValue.fromJson( - response.getStream(), - client.getObjectMapper() - ); - } - - private void addPostParams(final Request request) { - if (language != null) { - request.addPostParam("Language", language); - } - if (value != null) { - request.addPostParam("Value", value); - } - if (synonymOf != null) { - request.addPostParam("SynonymOf", synonymOf); - } - } -} diff --git a/src/main/java/com/twilio/rest/preview/understand/assistant/fieldtype/FieldValueDeleter.java b/src/main/java/com/twilio/rest/preview/understand/assistant/fieldtype/FieldValueDeleter.java deleted file mode 100644 index d7424a0ce3..0000000000 --- a/src/main/java/com/twilio/rest/preview/understand/assistant/fieldtype/FieldValueDeleter.java +++ /dev/null @@ -1,86 +0,0 @@ -/* - * This code was generated by - * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ - * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ - * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ - * - * Twilio - Preview - * 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.preview.understand.assistant.fieldtype; - -import com.twilio.base.Deleter; -import com.twilio.exception.ApiConnectionException; -import com.twilio.exception.ApiException; -import com.twilio.exception.RestException; -import com.twilio.http.HttpMethod; -import com.twilio.http.Request; -import com.twilio.http.Response; -import com.twilio.http.TwilioRestClient; -import com.twilio.rest.Domains; - -public class FieldValueDeleter extends Deleter { - - private String pathAssistantSid; - private String pathFieldTypeSid; - private String pathSid; - - public FieldValueDeleter( - final String pathAssistantSid, - final String pathFieldTypeSid, - final String pathSid - ) { - this.pathAssistantSid = pathAssistantSid; - this.pathFieldTypeSid = pathFieldTypeSid; - this.pathSid = pathSid; - } - - @Override - public boolean delete(final TwilioRestClient client) { - String path = - "/understand/Assistants/{AssistantSid}/FieldTypes/{FieldTypeSid}/FieldValues/{Sid}"; - - path = - path.replace( - "{" + "AssistantSid" + "}", - this.pathAssistantSid.toString() - ); - path = - path.replace( - "{" + "FieldTypeSid" + "}", - this.pathFieldTypeSid.toString() - ); - path = path.replace("{" + "Sid" + "}", this.pathSid.toString()); - - Request request = new Request( - HttpMethod.DELETE, - Domains.PREVIEW.toString(), - path - ); - Response response = client.request(request); - - if (response == null) { - throw new ApiConnectionException( - "FieldValue 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/preview/understand/assistant/fieldtype/FieldValueFetcher.java b/src/main/java/com/twilio/rest/preview/understand/assistant/fieldtype/FieldValueFetcher.java deleted file mode 100644 index 4da928ac6c..0000000000 --- a/src/main/java/com/twilio/rest/preview/understand/assistant/fieldtype/FieldValueFetcher.java +++ /dev/null @@ -1,90 +0,0 @@ -/* - * This code was generated by - * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ - * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ - * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ - * - * Twilio - Preview - * 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.preview.understand.assistant.fieldtype; - -import com.twilio.base.Fetcher; -import com.twilio.exception.ApiConnectionException; -import com.twilio.exception.ApiException; -import com.twilio.exception.RestException; -import com.twilio.http.HttpMethod; -import com.twilio.http.Request; -import com.twilio.http.Response; -import com.twilio.http.TwilioRestClient; -import com.twilio.rest.Domains; - -public class FieldValueFetcher extends Fetcher { - - private String pathAssistantSid; - private String pathFieldTypeSid; - private String pathSid; - - public FieldValueFetcher( - final String pathAssistantSid, - final String pathFieldTypeSid, - final String pathSid - ) { - this.pathAssistantSid = pathAssistantSid; - this.pathFieldTypeSid = pathFieldTypeSid; - this.pathSid = pathSid; - } - - @Override - public FieldValue fetch(final TwilioRestClient client) { - String path = - "/understand/Assistants/{AssistantSid}/FieldTypes/{FieldTypeSid}/FieldValues/{Sid}"; - - path = - path.replace( - "{" + "AssistantSid" + "}", - this.pathAssistantSid.toString() - ); - path = - path.replace( - "{" + "FieldTypeSid" + "}", - this.pathFieldTypeSid.toString() - ); - path = path.replace("{" + "Sid" + "}", this.pathSid.toString()); - - Request request = new Request( - HttpMethod.GET, - Domains.PREVIEW.toString(), - path - ); - Response response = client.request(request); - - if (response == null) { - throw new ApiConnectionException( - "FieldValue 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 FieldValue.fromJson( - response.getStream(), - client.getObjectMapper() - ); - } -} diff --git a/src/main/java/com/twilio/rest/preview/understand/assistant/fieldtype/FieldValueReader.java b/src/main/java/com/twilio/rest/preview/understand/assistant/fieldtype/FieldValueReader.java deleted file mode 100644 index dbb46eb5a5..0000000000 --- a/src/main/java/com/twilio/rest/preview/understand/assistant/fieldtype/FieldValueReader.java +++ /dev/null @@ -1,161 +0,0 @@ -/* - * This code was generated by - * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ - * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ - * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ - * - * Twilio - Preview - * 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.preview.understand.assistant.fieldtype; - -import com.twilio.base.Page; -import com.twilio.base.Reader; -import com.twilio.base.ResourceSet; -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 FieldValueReader extends Reader { - - private String pathAssistantSid; - private String pathFieldTypeSid; - private String language; - private Integer pageSize; - - public FieldValueReader( - final String pathAssistantSid, - final String pathFieldTypeSid - ) { - this.pathAssistantSid = pathAssistantSid; - this.pathFieldTypeSid = pathFieldTypeSid; - } - - public FieldValueReader setLanguage(final String language) { - this.language = language; - return this; - } - - public FieldValueReader 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 = - "/understand/Assistants/{AssistantSid}/FieldTypes/{FieldTypeSid}/FieldValues"; - path = - path.replace( - "{" + "AssistantSid" + "}", - this.pathAssistantSid.toString() - ); - path = - path.replace( - "{" + "FieldTypeSid" + "}", - this.pathFieldTypeSid.toString() - ); - - Request request = new Request( - HttpMethod.GET, - Domains.PREVIEW.toString(), - path - ); - - addQueryParams(request); - return pageForRequest(client, request); - } - - private Page pageForRequest( - final TwilioRestClient client, - final Request request - ) { - Response response = client.request(request); - - if (response == null) { - throw new ApiConnectionException( - "FieldValue 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( - "field_values", - response.getContent(), - FieldValue.class, - client.getObjectMapper() - ); - } - - @Override - public Page previousPage( - final Page page, - final TwilioRestClient client - ) { - Request request = new Request( - HttpMethod.GET, - page.getPreviousPageUrl(Domains.PREVIEW.toString()) - ); - return pageForRequest(client, request); - } - - @Override - public Page nextPage( - final Page page, - final TwilioRestClient client - ) { - Request request = new Request( - HttpMethod.GET, - page.getNextPageUrl(Domains.PREVIEW.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 (language != null) { - request.addQueryParam("Language", language); - } - 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/preview/understand/assistant/task/Field.java b/src/main/java/com/twilio/rest/preview/understand/assistant/task/Field.java deleted file mode 100644 index 1b6c6c74cd..0000000000 --- a/src/main/java/com/twilio/rest/preview/understand/assistant/task/Field.java +++ /dev/null @@ -1,229 +0,0 @@ -/* - * This code was generated by - * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ - * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ - * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ - * - * Twilio - Preview - * 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.preview.understand.assistant.task; - -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 Field extends Resource { - - private static final long serialVersionUID = 118531839027400L; - - public static FieldCreator creator( - final String pathAssistantSid, - final String pathTaskSid, - final String fieldType, - final String uniqueName - ) { - return new FieldCreator( - pathAssistantSid, - pathTaskSid, - fieldType, - uniqueName - ); - } - - public static FieldDeleter deleter( - final String pathAssistantSid, - final String pathTaskSid, - final String pathSid - ) { - return new FieldDeleter(pathAssistantSid, pathTaskSid, pathSid); - } - - public static FieldFetcher fetcher( - final String pathAssistantSid, - final String pathTaskSid, - final String pathSid - ) { - return new FieldFetcher(pathAssistantSid, pathTaskSid, pathSid); - } - - public static FieldReader reader( - final String pathAssistantSid, - final String pathTaskSid - ) { - return new FieldReader(pathAssistantSid, pathTaskSid); - } - - /** - * Converts a JSON String into a Field object using the provided ObjectMapper. - * - * @param json Raw JSON String - * @param objectMapper Jackson ObjectMapper - * @return Field object represented by the provided JSON - */ - public static Field fromJson( - final String json, - final ObjectMapper objectMapper - ) { - // Convert all checked exceptions to Runtime - try { - return objectMapper.readValue(json, Field.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 Field object using the provided - * ObjectMapper. - * - * @param json Raw JSON InputStream - * @param objectMapper Jackson ObjectMapper - * @return Field object represented by the provided JSON - */ - public static Field fromJson( - final InputStream json, - final ObjectMapper objectMapper - ) { - // Convert all checked exceptions to Runtime - try { - return objectMapper.readValue(json, Field.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 ZonedDateTime dateCreated; - private final ZonedDateTime dateUpdated; - private final String fieldType; - private final String taskSid; - private final String assistantSid; - private final String sid; - private final String uniqueName; - private final URI url; - - @JsonCreator - private Field( - @JsonProperty("account_sid") final String accountSid, - @JsonProperty("date_created") final String dateCreated, - @JsonProperty("date_updated") final String dateUpdated, - @JsonProperty("field_type") final String fieldType, - @JsonProperty("task_sid") final String taskSid, - @JsonProperty("assistant_sid") final String assistantSid, - @JsonProperty("sid") final String sid, - @JsonProperty("unique_name") final String uniqueName, - @JsonProperty("url") final URI url - ) { - this.accountSid = accountSid; - this.dateCreated = DateConverter.iso8601DateTimeFromString(dateCreated); - this.dateUpdated = DateConverter.iso8601DateTimeFromString(dateUpdated); - this.fieldType = fieldType; - this.taskSid = taskSid; - this.assistantSid = assistantSid; - this.sid = sid; - this.uniqueName = uniqueName; - this.url = url; - } - - public final String getAccountSid() { - return this.accountSid; - } - - public final ZonedDateTime getDateCreated() { - return this.dateCreated; - } - - public final ZonedDateTime getDateUpdated() { - return this.dateUpdated; - } - - public final String getFieldType() { - return this.fieldType; - } - - public final String getTaskSid() { - return this.taskSid; - } - - public final String getAssistantSid() { - return this.assistantSid; - } - - public final String getSid() { - return this.sid; - } - - public final String getUniqueName() { - return this.uniqueName; - } - - 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; - } - - Field other = (Field) o; - - return ( - Objects.equals(accountSid, other.accountSid) && - Objects.equals(dateCreated, other.dateCreated) && - Objects.equals(dateUpdated, other.dateUpdated) && - Objects.equals(fieldType, other.fieldType) && - Objects.equals(taskSid, other.taskSid) && - Objects.equals(assistantSid, other.assistantSid) && - Objects.equals(sid, other.sid) && - Objects.equals(uniqueName, other.uniqueName) && - Objects.equals(url, other.url) - ); - } - - @Override - public int hashCode() { - return Objects.hash( - accountSid, - dateCreated, - dateUpdated, - fieldType, - taskSid, - assistantSid, - sid, - uniqueName, - url - ); - } -} diff --git a/src/main/java/com/twilio/rest/preview/understand/assistant/task/FieldCreator.java b/src/main/java/com/twilio/rest/preview/understand/assistant/task/FieldCreator.java deleted file mode 100644 index 6bce29c337..0000000000 --- a/src/main/java/com/twilio/rest/preview/understand/assistant/task/FieldCreator.java +++ /dev/null @@ -1,109 +0,0 @@ -/* - * This code was generated by - * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ - * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ - * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ - * - * Twilio - Preview - * 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.preview.understand.assistant.task; - -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 FieldCreator extends Creator { - - private String pathAssistantSid; - private String pathTaskSid; - private String fieldType; - private String uniqueName; - - public FieldCreator( - final String pathAssistantSid, - final String pathTaskSid, - final String fieldType, - final String uniqueName - ) { - this.pathAssistantSid = pathAssistantSid; - this.pathTaskSid = pathTaskSid; - this.fieldType = fieldType; - this.uniqueName = uniqueName; - } - - public FieldCreator setFieldType(final String fieldType) { - this.fieldType = fieldType; - return this; - } - - public FieldCreator setUniqueName(final String uniqueName) { - this.uniqueName = uniqueName; - return this; - } - - @Override - public Field create(final TwilioRestClient client) { - String path = - "/understand/Assistants/{AssistantSid}/Tasks/{TaskSid}/Fields"; - - path = - path.replace( - "{" + "AssistantSid" + "}", - this.pathAssistantSid.toString() - ); - path = path.replace("{" + "TaskSid" + "}", this.pathTaskSid.toString()); - path = path.replace("{" + "FieldType" + "}", this.fieldType.toString()); - path = - path.replace("{" + "UniqueName" + "}", this.uniqueName.toString()); - - Request request = new Request( - HttpMethod.POST, - Domains.PREVIEW.toString(), - path - ); - request.setContentType(EnumConstants.ContentType.FORM_URLENCODED); - addPostParams(request); - Response response = client.request(request); - if (response == null) { - throw new ApiConnectionException( - "Field 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 Field.fromJson(response.getStream(), client.getObjectMapper()); - } - - private void addPostParams(final Request request) { - if (fieldType != null) { - request.addPostParam("FieldType", fieldType); - } - if (uniqueName != null) { - request.addPostParam("UniqueName", uniqueName); - } - } -} diff --git a/src/main/java/com/twilio/rest/preview/understand/assistant/task/FieldDeleter.java b/src/main/java/com/twilio/rest/preview/understand/assistant/task/FieldDeleter.java deleted file mode 100644 index 6731cd4cd5..0000000000 --- a/src/main/java/com/twilio/rest/preview/understand/assistant/task/FieldDeleter.java +++ /dev/null @@ -1,82 +0,0 @@ -/* - * This code was generated by - * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ - * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ - * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ - * - * Twilio - Preview - * 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.preview.understand.assistant.task; - -import com.twilio.base.Deleter; -import com.twilio.exception.ApiConnectionException; -import com.twilio.exception.ApiException; -import com.twilio.exception.RestException; -import com.twilio.http.HttpMethod; -import com.twilio.http.Request; -import com.twilio.http.Response; -import com.twilio.http.TwilioRestClient; -import com.twilio.rest.Domains; - -public class FieldDeleter extends Deleter { - - private String pathAssistantSid; - private String pathTaskSid; - private String pathSid; - - public FieldDeleter( - final String pathAssistantSid, - final String pathTaskSid, - final String pathSid - ) { - this.pathAssistantSid = pathAssistantSid; - this.pathTaskSid = pathTaskSid; - this.pathSid = pathSid; - } - - @Override - public boolean delete(final TwilioRestClient client) { - String path = - "/understand/Assistants/{AssistantSid}/Tasks/{TaskSid}/Fields/{Sid}"; - - path = - path.replace( - "{" + "AssistantSid" + "}", - this.pathAssistantSid.toString() - ); - path = path.replace("{" + "TaskSid" + "}", this.pathTaskSid.toString()); - path = path.replace("{" + "Sid" + "}", this.pathSid.toString()); - - Request request = new Request( - HttpMethod.DELETE, - Domains.PREVIEW.toString(), - path - ); - Response response = client.request(request); - - if (response == null) { - throw new ApiConnectionException( - "Field 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/preview/understand/assistant/task/FieldFetcher.java b/src/main/java/com/twilio/rest/preview/understand/assistant/task/FieldFetcher.java deleted file mode 100644 index f67483b179..0000000000 --- a/src/main/java/com/twilio/rest/preview/understand/assistant/task/FieldFetcher.java +++ /dev/null @@ -1,83 +0,0 @@ -/* - * This code was generated by - * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ - * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ - * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ - * - * Twilio - Preview - * 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.preview.understand.assistant.task; - -import com.twilio.base.Fetcher; -import com.twilio.exception.ApiConnectionException; -import com.twilio.exception.ApiException; -import com.twilio.exception.RestException; -import com.twilio.http.HttpMethod; -import com.twilio.http.Request; -import com.twilio.http.Response; -import com.twilio.http.TwilioRestClient; -import com.twilio.rest.Domains; - -public class FieldFetcher extends Fetcher { - - private String pathAssistantSid; - private String pathTaskSid; - private String pathSid; - - public FieldFetcher( - final String pathAssistantSid, - final String pathTaskSid, - final String pathSid - ) { - this.pathAssistantSid = pathAssistantSid; - this.pathTaskSid = pathTaskSid; - this.pathSid = pathSid; - } - - @Override - public Field fetch(final TwilioRestClient client) { - String path = - "/understand/Assistants/{AssistantSid}/Tasks/{TaskSid}/Fields/{Sid}"; - - path = - path.replace( - "{" + "AssistantSid" + "}", - this.pathAssistantSid.toString() - ); - path = path.replace("{" + "TaskSid" + "}", this.pathTaskSid.toString()); - path = path.replace("{" + "Sid" + "}", this.pathSid.toString()); - - Request request = new Request( - HttpMethod.GET, - Domains.PREVIEW.toString(), - path - ); - Response response = client.request(request); - - if (response == null) { - throw new ApiConnectionException( - "Field 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 Field.fromJson(response.getStream(), client.getObjectMapper()); - } -} diff --git a/src/main/java/com/twilio/rest/preview/understand/assistant/task/FieldReader.java b/src/main/java/com/twilio/rest/preview/understand/assistant/task/FieldReader.java deleted file mode 100644 index 5ce8edd613..0000000000 --- a/src/main/java/com/twilio/rest/preview/understand/assistant/task/FieldReader.java +++ /dev/null @@ -1,148 +0,0 @@ -/* - * This code was generated by - * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ - * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ - * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ - * - * Twilio - Preview - * 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.preview.understand.assistant.task; - -import com.twilio.base.Page; -import com.twilio.base.Reader; -import com.twilio.base.ResourceSet; -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 FieldReader extends Reader { - - private String pathAssistantSid; - private String pathTaskSid; - private Integer pageSize; - - public FieldReader( - final String pathAssistantSid, - final String pathTaskSid - ) { - this.pathAssistantSid = pathAssistantSid; - this.pathTaskSid = pathTaskSid; - } - - public FieldReader 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 = - "/understand/Assistants/{AssistantSid}/Tasks/{TaskSid}/Fields"; - path = - path.replace( - "{" + "AssistantSid" + "}", - this.pathAssistantSid.toString() - ); - path = path.replace("{" + "TaskSid" + "}", this.pathTaskSid.toString()); - - Request request = new Request( - HttpMethod.GET, - Domains.PREVIEW.toString(), - path - ); - - addQueryParams(request); - return pageForRequest(client, request); - } - - private Page pageForRequest( - final TwilioRestClient client, - final Request request - ) { - Response response = client.request(request); - - if (response == null) { - throw new ApiConnectionException( - "Field 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( - "fields", - response.getContent(), - Field.class, - client.getObjectMapper() - ); - } - - @Override - public Page previousPage( - final Page page, - final TwilioRestClient client - ) { - Request request = new Request( - HttpMethod.GET, - page.getPreviousPageUrl(Domains.PREVIEW.toString()) - ); - return pageForRequest(client, request); - } - - @Override - public Page nextPage( - final Page page, - final TwilioRestClient client - ) { - Request request = new Request( - HttpMethod.GET, - page.getNextPageUrl(Domains.PREVIEW.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/preview/understand/assistant/task/Sample.java b/src/main/java/com/twilio/rest/preview/understand/assistant/task/Sample.java deleted file mode 100644 index c249018843..0000000000 --- a/src/main/java/com/twilio/rest/preview/understand/assistant/task/Sample.java +++ /dev/null @@ -1,246 +0,0 @@ -/* - * This code was generated by - * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ - * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ - * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ - * - * Twilio - Preview - * 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.preview.understand.assistant.task; - -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 Sample extends Resource { - - private static final long serialVersionUID = 197447215274163L; - - public static SampleCreator creator( - final String pathAssistantSid, - final String pathTaskSid, - final String language, - final String taggedText - ) { - return new SampleCreator( - pathAssistantSid, - pathTaskSid, - language, - taggedText - ); - } - - public static SampleDeleter deleter( - final String pathAssistantSid, - final String pathTaskSid, - final String pathSid - ) { - return new SampleDeleter(pathAssistantSid, pathTaskSid, pathSid); - } - - public static SampleFetcher fetcher( - final String pathAssistantSid, - final String pathTaskSid, - final String pathSid - ) { - return new SampleFetcher(pathAssistantSid, pathTaskSid, pathSid); - } - - public static SampleReader reader( - final String pathAssistantSid, - final String pathTaskSid - ) { - return new SampleReader(pathAssistantSid, pathTaskSid); - } - - public static SampleUpdater updater( - final String pathAssistantSid, - final String pathTaskSid, - final String pathSid - ) { - return new SampleUpdater(pathAssistantSid, pathTaskSid, pathSid); - } - - /** - * Converts a JSON String into a Sample object using the provided ObjectMapper. - * - * @param json Raw JSON String - * @param objectMapper Jackson ObjectMapper - * @return Sample object represented by the provided JSON - */ - public static Sample fromJson( - final String json, - final ObjectMapper objectMapper - ) { - // Convert all checked exceptions to Runtime - try { - return objectMapper.readValue(json, Sample.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 Sample object using the provided - * ObjectMapper. - * - * @param json Raw JSON InputStream - * @param objectMapper Jackson ObjectMapper - * @return Sample object represented by the provided JSON - */ - public static Sample fromJson( - final InputStream json, - final ObjectMapper objectMapper - ) { - // Convert all checked exceptions to Runtime - try { - return objectMapper.readValue(json, Sample.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 ZonedDateTime dateCreated; - private final ZonedDateTime dateUpdated; - private final String taskSid; - private final String language; - private final String assistantSid; - private final String sid; - private final String taggedText; - private final URI url; - private final String sourceChannel; - - @JsonCreator - private Sample( - @JsonProperty("account_sid") final String accountSid, - @JsonProperty("date_created") final String dateCreated, - @JsonProperty("date_updated") final String dateUpdated, - @JsonProperty("task_sid") final String taskSid, - @JsonProperty("language") final String language, - @JsonProperty("assistant_sid") final String assistantSid, - @JsonProperty("sid") final String sid, - @JsonProperty("tagged_text") final String taggedText, - @JsonProperty("url") final URI url, - @JsonProperty("source_channel") final String sourceChannel - ) { - this.accountSid = accountSid; - this.dateCreated = DateConverter.iso8601DateTimeFromString(dateCreated); - this.dateUpdated = DateConverter.iso8601DateTimeFromString(dateUpdated); - this.taskSid = taskSid; - this.language = language; - this.assistantSid = assistantSid; - this.sid = sid; - this.taggedText = taggedText; - this.url = url; - this.sourceChannel = sourceChannel; - } - - public final String getAccountSid() { - return this.accountSid; - } - - public final ZonedDateTime getDateCreated() { - return this.dateCreated; - } - - public final ZonedDateTime getDateUpdated() { - return this.dateUpdated; - } - - public final String getTaskSid() { - return this.taskSid; - } - - public final String getLanguage() { - return this.language; - } - - public final String getAssistantSid() { - return this.assistantSid; - } - - public final String getSid() { - return this.sid; - } - - public final String getTaggedText() { - return this.taggedText; - } - - public final URI getUrl() { - return this.url; - } - - public final String getSourceChannel() { - return this.sourceChannel; - } - - @Override - public boolean equals(final Object o) { - if (this == o) { - return true; - } - - if (o == null || getClass() != o.getClass()) { - return false; - } - - Sample other = (Sample) o; - - return ( - Objects.equals(accountSid, other.accountSid) && - Objects.equals(dateCreated, other.dateCreated) && - Objects.equals(dateUpdated, other.dateUpdated) && - Objects.equals(taskSid, other.taskSid) && - Objects.equals(language, other.language) && - Objects.equals(assistantSid, other.assistantSid) && - Objects.equals(sid, other.sid) && - Objects.equals(taggedText, other.taggedText) && - Objects.equals(url, other.url) && - Objects.equals(sourceChannel, other.sourceChannel) - ); - } - - @Override - public int hashCode() { - return Objects.hash( - accountSid, - dateCreated, - dateUpdated, - taskSid, - language, - assistantSid, - sid, - taggedText, - url, - sourceChannel - ); - } -} diff --git a/src/main/java/com/twilio/rest/preview/understand/assistant/task/SampleCreator.java b/src/main/java/com/twilio/rest/preview/understand/assistant/task/SampleCreator.java deleted file mode 100644 index d14ec489b6..0000000000 --- a/src/main/java/com/twilio/rest/preview/understand/assistant/task/SampleCreator.java +++ /dev/null @@ -1,118 +0,0 @@ -/* - * This code was generated by - * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ - * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ - * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ - * - * Twilio - Preview - * 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.preview.understand.assistant.task; - -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 SampleCreator extends Creator { - - private String pathAssistantSid; - private String pathTaskSid; - private String language; - private String taggedText; - private String sourceChannel; - - public SampleCreator( - final String pathAssistantSid, - final String pathTaskSid, - final String language, - final String taggedText - ) { - this.pathAssistantSid = pathAssistantSid; - this.pathTaskSid = pathTaskSid; - this.language = language; - this.taggedText = taggedText; - } - - public SampleCreator setLanguage(final String language) { - this.language = language; - return this; - } - - public SampleCreator setTaggedText(final String taggedText) { - this.taggedText = taggedText; - return this; - } - - public SampleCreator setSourceChannel(final String sourceChannel) { - this.sourceChannel = sourceChannel; - return this; - } - - @Override - public Sample create(final TwilioRestClient client) { - String path = - "/understand/Assistants/{AssistantSid}/Tasks/{TaskSid}/Samples"; - - path = - path.replace( - "{" + "AssistantSid" + "}", - this.pathAssistantSid.toString() - ); - path = path.replace("{" + "TaskSid" + "}", this.pathTaskSid.toString()); - path = path.replace("{" + "Language" + "}", this.language.toString()); - path = - path.replace("{" + "TaggedText" + "}", this.taggedText.toString()); - - Request request = new Request( - HttpMethod.POST, - Domains.PREVIEW.toString(), - path - ); - request.setContentType(EnumConstants.ContentType.FORM_URLENCODED); - addPostParams(request); - Response response = client.request(request); - if (response == null) { - throw new ApiConnectionException( - "Sample 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 Sample.fromJson(response.getStream(), client.getObjectMapper()); - } - - private void addPostParams(final Request request) { - if (language != null) { - request.addPostParam("Language", language); - } - if (taggedText != null) { - request.addPostParam("TaggedText", taggedText); - } - if (sourceChannel != null) { - request.addPostParam("SourceChannel", sourceChannel); - } - } -} diff --git a/src/main/java/com/twilio/rest/preview/understand/assistant/task/SampleDeleter.java b/src/main/java/com/twilio/rest/preview/understand/assistant/task/SampleDeleter.java deleted file mode 100644 index 8e784d18f5..0000000000 --- a/src/main/java/com/twilio/rest/preview/understand/assistant/task/SampleDeleter.java +++ /dev/null @@ -1,82 +0,0 @@ -/* - * This code was generated by - * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ - * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ - * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ - * - * Twilio - Preview - * 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.preview.understand.assistant.task; - -import com.twilio.base.Deleter; -import com.twilio.exception.ApiConnectionException; -import com.twilio.exception.ApiException; -import com.twilio.exception.RestException; -import com.twilio.http.HttpMethod; -import com.twilio.http.Request; -import com.twilio.http.Response; -import com.twilio.http.TwilioRestClient; -import com.twilio.rest.Domains; - -public class SampleDeleter extends Deleter { - - private String pathAssistantSid; - private String pathTaskSid; - private String pathSid; - - public SampleDeleter( - final String pathAssistantSid, - final String pathTaskSid, - final String pathSid - ) { - this.pathAssistantSid = pathAssistantSid; - this.pathTaskSid = pathTaskSid; - this.pathSid = pathSid; - } - - @Override - public boolean delete(final TwilioRestClient client) { - String path = - "/understand/Assistants/{AssistantSid}/Tasks/{TaskSid}/Samples/{Sid}"; - - path = - path.replace( - "{" + "AssistantSid" + "}", - this.pathAssistantSid.toString() - ); - path = path.replace("{" + "TaskSid" + "}", this.pathTaskSid.toString()); - path = path.replace("{" + "Sid" + "}", this.pathSid.toString()); - - Request request = new Request( - HttpMethod.DELETE, - Domains.PREVIEW.toString(), - path - ); - Response response = client.request(request); - - if (response == null) { - throw new ApiConnectionException( - "Sample 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/preview/understand/assistant/task/SampleFetcher.java b/src/main/java/com/twilio/rest/preview/understand/assistant/task/SampleFetcher.java deleted file mode 100644 index fb689f0a07..0000000000 --- a/src/main/java/com/twilio/rest/preview/understand/assistant/task/SampleFetcher.java +++ /dev/null @@ -1,83 +0,0 @@ -/* - * This code was generated by - * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ - * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ - * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ - * - * Twilio - Preview - * 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.preview.understand.assistant.task; - -import com.twilio.base.Fetcher; -import com.twilio.exception.ApiConnectionException; -import com.twilio.exception.ApiException; -import com.twilio.exception.RestException; -import com.twilio.http.HttpMethod; -import com.twilio.http.Request; -import com.twilio.http.Response; -import com.twilio.http.TwilioRestClient; -import com.twilio.rest.Domains; - -public class SampleFetcher extends Fetcher { - - private String pathAssistantSid; - private String pathTaskSid; - private String pathSid; - - public SampleFetcher( - final String pathAssistantSid, - final String pathTaskSid, - final String pathSid - ) { - this.pathAssistantSid = pathAssistantSid; - this.pathTaskSid = pathTaskSid; - this.pathSid = pathSid; - } - - @Override - public Sample fetch(final TwilioRestClient client) { - String path = - "/understand/Assistants/{AssistantSid}/Tasks/{TaskSid}/Samples/{Sid}"; - - path = - path.replace( - "{" + "AssistantSid" + "}", - this.pathAssistantSid.toString() - ); - path = path.replace("{" + "TaskSid" + "}", this.pathTaskSid.toString()); - path = path.replace("{" + "Sid" + "}", this.pathSid.toString()); - - Request request = new Request( - HttpMethod.GET, - Domains.PREVIEW.toString(), - path - ); - Response response = client.request(request); - - if (response == null) { - throw new ApiConnectionException( - "Sample 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 Sample.fromJson(response.getStream(), client.getObjectMapper()); - } -} diff --git a/src/main/java/com/twilio/rest/preview/understand/assistant/task/SampleReader.java b/src/main/java/com/twilio/rest/preview/understand/assistant/task/SampleReader.java deleted file mode 100644 index 6def4f31c9..0000000000 --- a/src/main/java/com/twilio/rest/preview/understand/assistant/task/SampleReader.java +++ /dev/null @@ -1,157 +0,0 @@ -/* - * This code was generated by - * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ - * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ - * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ - * - * Twilio - Preview - * 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.preview.understand.assistant.task; - -import com.twilio.base.Page; -import com.twilio.base.Reader; -import com.twilio.base.ResourceSet; -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 SampleReader extends Reader { - - private String pathAssistantSid; - private String pathTaskSid; - private String language; - private Integer pageSize; - - public SampleReader( - final String pathAssistantSid, - final String pathTaskSid - ) { - this.pathAssistantSid = pathAssistantSid; - this.pathTaskSid = pathTaskSid; - } - - public SampleReader setLanguage(final String language) { - this.language = language; - return this; - } - - public SampleReader 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 = - "/understand/Assistants/{AssistantSid}/Tasks/{TaskSid}/Samples"; - path = - path.replace( - "{" + "AssistantSid" + "}", - this.pathAssistantSid.toString() - ); - path = path.replace("{" + "TaskSid" + "}", this.pathTaskSid.toString()); - - Request request = new Request( - HttpMethod.GET, - Domains.PREVIEW.toString(), - path - ); - - addQueryParams(request); - return pageForRequest(client, request); - } - - private Page pageForRequest( - final TwilioRestClient client, - final Request request - ) { - Response response = client.request(request); - - if (response == null) { - throw new ApiConnectionException( - "Sample 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( - "samples", - response.getContent(), - Sample.class, - client.getObjectMapper() - ); - } - - @Override - public Page previousPage( - final Page page, - final TwilioRestClient client - ) { - Request request = new Request( - HttpMethod.GET, - page.getPreviousPageUrl(Domains.PREVIEW.toString()) - ); - return pageForRequest(client, request); - } - - @Override - public Page nextPage( - final Page page, - final TwilioRestClient client - ) { - Request request = new Request( - HttpMethod.GET, - page.getNextPageUrl(Domains.PREVIEW.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 (language != null) { - request.addQueryParam("Language", language); - } - 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/preview/understand/assistant/task/SampleUpdater.java b/src/main/java/com/twilio/rest/preview/understand/assistant/task/SampleUpdater.java deleted file mode 100644 index e8dd665077..0000000000 --- a/src/main/java/com/twilio/rest/preview/understand/assistant/task/SampleUpdater.java +++ /dev/null @@ -1,115 +0,0 @@ -/* - * This code was generated by - * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ - * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ - * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ - * - * Twilio - Preview - * 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.preview.understand.assistant.task; - -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 SampleUpdater extends Updater { - - private String pathAssistantSid; - private String pathTaskSid; - private String pathSid; - private String language; - private String taggedText; - private String sourceChannel; - - public SampleUpdater( - final String pathAssistantSid, - final String pathTaskSid, - final String pathSid - ) { - this.pathAssistantSid = pathAssistantSid; - this.pathTaskSid = pathTaskSid; - this.pathSid = pathSid; - } - - public SampleUpdater setLanguage(final String language) { - this.language = language; - return this; - } - - public SampleUpdater setTaggedText(final String taggedText) { - this.taggedText = taggedText; - return this; - } - - public SampleUpdater setSourceChannel(final String sourceChannel) { - this.sourceChannel = sourceChannel; - return this; - } - - @Override - public Sample update(final TwilioRestClient client) { - String path = - "/understand/Assistants/{AssistantSid}/Tasks/{TaskSid}/Samples/{Sid}"; - - path = - path.replace( - "{" + "AssistantSid" + "}", - this.pathAssistantSid.toString() - ); - path = path.replace("{" + "TaskSid" + "}", this.pathTaskSid.toString()); - path = path.replace("{" + "Sid" + "}", this.pathSid.toString()); - - Request request = new Request( - HttpMethod.POST, - Domains.PREVIEW.toString(), - path - ); - request.setContentType(EnumConstants.ContentType.FORM_URLENCODED); - addPostParams(request); - Response response = client.request(request); - if (response == null) { - throw new ApiConnectionException( - "Sample 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 Sample.fromJson(response.getStream(), client.getObjectMapper()); - } - - private void addPostParams(final Request request) { - if (language != null) { - request.addPostParam("Language", language); - } - if (taggedText != null) { - request.addPostParam("TaggedText", taggedText); - } - if (sourceChannel != null) { - request.addPostParam("SourceChannel", sourceChannel); - } - } -} diff --git a/src/main/java/com/twilio/rest/preview/understand/assistant/task/TaskActions.java b/src/main/java/com/twilio/rest/preview/understand/assistant/task/TaskActions.java deleted file mode 100644 index 55ba162c50..0000000000 --- a/src/main/java/com/twilio/rest/preview/understand/assistant/task/TaskActions.java +++ /dev/null @@ -1,164 +0,0 @@ -/* - * This code was generated by - * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ - * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ - * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ - * - * Twilio - Preview - * 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.preview.understand.assistant.task; - -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.exception.ApiConnectionException; -import com.twilio.exception.ApiException; -import java.io.IOException; -import java.io.InputStream; -import java.net.URI; -import java.util.Map; -import java.util.Map; -import java.util.Objects; -import lombok.ToString; -import lombok.ToString; - -@JsonIgnoreProperties(ignoreUnknown = true) -@ToString -public class TaskActions extends Resource { - - private static final long serialVersionUID = 36530790788418L; - - public static TaskActionsFetcher fetcher( - final String pathAssistantSid, - final String pathTaskSid - ) { - return new TaskActionsFetcher(pathAssistantSid, pathTaskSid); - } - - public static TaskActionsUpdater updater( - final String pathAssistantSid, - final String pathTaskSid - ) { - return new TaskActionsUpdater(pathAssistantSid, pathTaskSid); - } - - /** - * Converts a JSON String into a TaskActions object using the provided ObjectMapper. - * - * @param json Raw JSON String - * @param objectMapper Jackson ObjectMapper - * @return TaskActions object represented by the provided JSON - */ - public static TaskActions fromJson( - final String json, - final ObjectMapper objectMapper - ) { - // Convert all checked exceptions to Runtime - try { - return objectMapper.readValue(json, TaskActions.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 TaskActions object using the provided - * ObjectMapper. - * - * @param json Raw JSON InputStream - * @param objectMapper Jackson ObjectMapper - * @return TaskActions object represented by the provided JSON - */ - public static TaskActions fromJson( - final InputStream json, - final ObjectMapper objectMapper - ) { - // Convert all checked exceptions to Runtime - try { - return objectMapper.readValue(json, TaskActions.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 assistantSid; - private final String taskSid; - private final URI url; - private final Map data; - - @JsonCreator - private TaskActions( - @JsonProperty("account_sid") final String accountSid, - @JsonProperty("assistant_sid") final String assistantSid, - @JsonProperty("task_sid") final String taskSid, - @JsonProperty("url") final URI url, - @JsonProperty("data") final Map data - ) { - this.accountSid = accountSid; - this.assistantSid = assistantSid; - this.taskSid = taskSid; - this.url = url; - this.data = data; - } - - public final String getAccountSid() { - return this.accountSid; - } - - public final String getAssistantSid() { - return this.assistantSid; - } - - public final String getTaskSid() { - return this.taskSid; - } - - public final URI getUrl() { - return this.url; - } - - public final Map getData() { - return this.data; - } - - @Override - public boolean equals(final Object o) { - if (this == o) { - return true; - } - - if (o == null || getClass() != o.getClass()) { - return false; - } - - TaskActions other = (TaskActions) o; - - return ( - Objects.equals(accountSid, other.accountSid) && - Objects.equals(assistantSid, other.assistantSid) && - Objects.equals(taskSid, other.taskSid) && - Objects.equals(url, other.url) && - Objects.equals(data, other.data) - ); - } - - @Override - public int hashCode() { - return Objects.hash(accountSid, assistantSid, taskSid, url, data); - } -} diff --git a/src/main/java/com/twilio/rest/preview/understand/assistant/task/TaskActionsFetcher.java b/src/main/java/com/twilio/rest/preview/understand/assistant/task/TaskActionsFetcher.java deleted file mode 100644 index de66d19bbf..0000000000 --- a/src/main/java/com/twilio/rest/preview/understand/assistant/task/TaskActionsFetcher.java +++ /dev/null @@ -1,82 +0,0 @@ -/* - * This code was generated by - * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ - * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ - * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ - * - * Twilio - Preview - * 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.preview.understand.assistant.task; - -import com.twilio.base.Fetcher; -import com.twilio.exception.ApiConnectionException; -import com.twilio.exception.ApiException; -import com.twilio.exception.RestException; -import com.twilio.http.HttpMethod; -import com.twilio.http.Request; -import com.twilio.http.Response; -import com.twilio.http.TwilioRestClient; -import com.twilio.rest.Domains; - -public class TaskActionsFetcher extends Fetcher { - - private String pathAssistantSid; - private String pathTaskSid; - - public TaskActionsFetcher( - final String pathAssistantSid, - final String pathTaskSid - ) { - this.pathAssistantSid = pathAssistantSid; - this.pathTaskSid = pathTaskSid; - } - - @Override - public TaskActions fetch(final TwilioRestClient client) { - String path = - "/understand/Assistants/{AssistantSid}/Tasks/{TaskSid}/Actions"; - - path = - path.replace( - "{" + "AssistantSid" + "}", - this.pathAssistantSid.toString() - ); - path = path.replace("{" + "TaskSid" + "}", this.pathTaskSid.toString()); - - Request request = new Request( - HttpMethod.GET, - Domains.PREVIEW.toString(), - path - ); - Response response = client.request(request); - - if (response == null) { - throw new ApiConnectionException( - "TaskActions 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 TaskActions.fromJson( - response.getStream(), - client.getObjectMapper() - ); - } -} diff --git a/src/main/java/com/twilio/rest/preview/understand/assistant/task/TaskActionsUpdater.java b/src/main/java/com/twilio/rest/preview/understand/assistant/task/TaskActionsUpdater.java deleted file mode 100644 index d9eb9262b3..0000000000 --- a/src/main/java/com/twilio/rest/preview/understand/assistant/task/TaskActionsUpdater.java +++ /dev/null @@ -1,98 +0,0 @@ -/* - * This code was generated by - * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ - * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ - * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ - * - * Twilio - Preview - * 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.preview.understand.assistant.task; - -import com.twilio.base.Updater; -import com.twilio.constant.EnumConstants; -import com.twilio.converter.Converter; -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; -import java.util.Map; - -public class TaskActionsUpdater extends Updater { - - private String pathAssistantSid; - private String pathTaskSid; - private Map actions; - - public TaskActionsUpdater( - final String pathAssistantSid, - final String pathTaskSid - ) { - this.pathAssistantSid = pathAssistantSid; - this.pathTaskSid = pathTaskSid; - } - - public TaskActionsUpdater setActions(final Map actions) { - this.actions = actions; - return this; - } - - @Override - public TaskActions update(final TwilioRestClient client) { - String path = - "/understand/Assistants/{AssistantSid}/Tasks/{TaskSid}/Actions"; - - path = - path.replace( - "{" + "AssistantSid" + "}", - this.pathAssistantSid.toString() - ); - path = path.replace("{" + "TaskSid" + "}", this.pathTaskSid.toString()); - - Request request = new Request( - HttpMethod.POST, - Domains.PREVIEW.toString(), - path - ); - request.setContentType(EnumConstants.ContentType.FORM_URLENCODED); - addPostParams(request); - Response response = client.request(request); - if (response == null) { - throw new ApiConnectionException( - "TaskActions 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 TaskActions.fromJson( - response.getStream(), - client.getObjectMapper() - ); - } - - private void addPostParams(final Request request) { - if (actions != null) { - request.addPostParam("Actions", Converter.mapToJson(actions)); - } - } -} diff --git a/src/main/java/com/twilio/rest/preview/understand/assistant/task/TaskStatistics.java b/src/main/java/com/twilio/rest/preview/understand/assistant/task/TaskStatistics.java deleted file mode 100644 index 5df490f2db..0000000000 --- a/src/main/java/com/twilio/rest/preview/understand/assistant/task/TaskStatistics.java +++ /dev/null @@ -1,170 +0,0 @@ -/* - * This code was generated by - * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ - * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ - * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ - * - * Twilio - Preview - * 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.preview.understand.assistant.task; - -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.exception.ApiConnectionException; -import com.twilio.exception.ApiException; -import java.io.IOException; -import java.io.InputStream; -import java.net.URI; -import java.util.Objects; -import lombok.ToString; -import lombok.ToString; - -@JsonIgnoreProperties(ignoreUnknown = true) -@ToString -public class TaskStatistics extends Resource { - - private static final long serialVersionUID = 99044881135361L; - - public static TaskStatisticsFetcher fetcher( - final String pathAssistantSid, - final String pathTaskSid - ) { - return new TaskStatisticsFetcher(pathAssistantSid, pathTaskSid); - } - - /** - * Converts a JSON String into a TaskStatistics object using the provided ObjectMapper. - * - * @param json Raw JSON String - * @param objectMapper Jackson ObjectMapper - * @return TaskStatistics object represented by the provided JSON - */ - public static TaskStatistics fromJson( - final String json, - final ObjectMapper objectMapper - ) { - // Convert all checked exceptions to Runtime - try { - return objectMapper.readValue(json, TaskStatistics.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 TaskStatistics object using the provided - * ObjectMapper. - * - * @param json Raw JSON InputStream - * @param objectMapper Jackson ObjectMapper - * @return TaskStatistics object represented by the provided JSON - */ - public static TaskStatistics fromJson( - final InputStream json, - final ObjectMapper objectMapper - ) { - // Convert all checked exceptions to Runtime - try { - return objectMapper.readValue(json, TaskStatistics.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 assistantSid; - private final String taskSid; - private final Integer samplesCount; - private final Integer fieldsCount; - private final URI url; - - @JsonCreator - private TaskStatistics( - @JsonProperty("account_sid") final String accountSid, - @JsonProperty("assistant_sid") final String assistantSid, - @JsonProperty("task_sid") final String taskSid, - @JsonProperty("samples_count") final Integer samplesCount, - @JsonProperty("fields_count") final Integer fieldsCount, - @JsonProperty("url") final URI url - ) { - this.accountSid = accountSid; - this.assistantSid = assistantSid; - this.taskSid = taskSid; - this.samplesCount = samplesCount; - this.fieldsCount = fieldsCount; - this.url = url; - } - - public final String getAccountSid() { - return this.accountSid; - } - - public final String getAssistantSid() { - return this.assistantSid; - } - - public final String getTaskSid() { - return this.taskSid; - } - - public final Integer getSamplesCount() { - return this.samplesCount; - } - - public final Integer getFieldsCount() { - return this.fieldsCount; - } - - 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; - } - - TaskStatistics other = (TaskStatistics) o; - - return ( - Objects.equals(accountSid, other.accountSid) && - Objects.equals(assistantSid, other.assistantSid) && - Objects.equals(taskSid, other.taskSid) && - Objects.equals(samplesCount, other.samplesCount) && - Objects.equals(fieldsCount, other.fieldsCount) && - Objects.equals(url, other.url) - ); - } - - @Override - public int hashCode() { - return Objects.hash( - accountSid, - assistantSid, - taskSid, - samplesCount, - fieldsCount, - url - ); - } -} diff --git a/src/main/java/com/twilio/rest/preview/understand/assistant/task/TaskStatisticsFetcher.java b/src/main/java/com/twilio/rest/preview/understand/assistant/task/TaskStatisticsFetcher.java deleted file mode 100644 index 4aa2cef985..0000000000 --- a/src/main/java/com/twilio/rest/preview/understand/assistant/task/TaskStatisticsFetcher.java +++ /dev/null @@ -1,82 +0,0 @@ -/* - * This code was generated by - * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ - * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ - * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ - * - * Twilio - Preview - * 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.preview.understand.assistant.task; - -import com.twilio.base.Fetcher; -import com.twilio.exception.ApiConnectionException; -import com.twilio.exception.ApiException; -import com.twilio.exception.RestException; -import com.twilio.http.HttpMethod; -import com.twilio.http.Request; -import com.twilio.http.Response; -import com.twilio.http.TwilioRestClient; -import com.twilio.rest.Domains; - -public class TaskStatisticsFetcher extends Fetcher { - - private String pathAssistantSid; - private String pathTaskSid; - - public TaskStatisticsFetcher( - final String pathAssistantSid, - final String pathTaskSid - ) { - this.pathAssistantSid = pathAssistantSid; - this.pathTaskSid = pathTaskSid; - } - - @Override - public TaskStatistics fetch(final TwilioRestClient client) { - String path = - "/understand/Assistants/{AssistantSid}/Tasks/{TaskSid}/Statistics"; - - path = - path.replace( - "{" + "AssistantSid" + "}", - this.pathAssistantSid.toString() - ); - path = path.replace("{" + "TaskSid" + "}", this.pathTaskSid.toString()); - - Request request = new Request( - HttpMethod.GET, - Domains.PREVIEW.toString(), - path - ); - Response response = client.request(request); - - if (response == null) { - throw new ApiConnectionException( - "TaskStatistics 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 TaskStatistics.fromJson( - response.getStream(), - client.getObjectMapper() - ); - } -}