From 8d120d94f71acb0e0de8c289f99ff481bb744ce4 Mon Sep 17 00:00:00 2001 From: kridai Date: Tue, 12 Jul 2022 19:30:05 +0530 Subject: [PATCH 1/8] fix: added enum schema changes support for go --- .../go-client/helper/rest/api/v2010/README.md | 6 +-- .../api/v2010/model_test_response_object.go | 4 ++ .../com/twilio/rest/api/v2010/Account.java | 14 +++++-- .../twilio/rest/api/v2010/account/Call.java | 14 +++++-- .../account/call/FeedbackCallSummary.java | 14 +++++-- .../twilio/rest/api/v2010/credential/Aws.java | 14 +++++-- .../api/v2010/credential/NewCredentials.java | 14 +++++-- examples/node/lib/rest/api/v2010/accounts.ts | 9 ++++- .../node/lib/rest/api/v2010/accounts/calls.ts | 9 ++++- .../lib/rest/api/v2010/credentials/aWS.ts | 9 ++++- examples/twilio_api_v2010.yaml | 12 ++++++ .../twilio/oai/AbstractTwilioGoGenerator.java | 24 +++++++++--- .../com/twilio/oai/TwilioGoGenerator.java | 37 ++++++++++++++++++- .../com/twilio/oai/TwilioGeneratorTest.java | 6 +-- 14 files changed, 156 insertions(+), 30 deletions(-) diff --git a/examples/go/go-client/helper/rest/api/v2010/README.md b/examples/go/go-client/helper/rest/api/v2010/README.md index f2a08bf6c..8aacd3ebc 100644 --- a/examples/go/go-client/helper/rest/api/v2010/README.md +++ b/examples/go/go-client/helper/rest/api/v2010/README.md @@ -49,12 +49,12 @@ Class | Method | HTTP request | Description ## Documentation For Models - - [ListAccountResponse](docs/ListAccountResponse.md) - [ListCredentialAwsResponse](docs/ListCredentialAwsResponse.md) - - [ListCredentialAwsResponseMeta](docs/ListCredentialAwsResponseMeta.md) + - [ListAccountResponse](docs/ListAccountResponse.md) + - [TestResponseObjectTestObject](docs/TestResponseObjectTestObject.md) - [TestResponseObject](docs/TestResponseObject.md) + - [ListCredentialAwsResponseMeta](docs/ListCredentialAwsResponseMeta.md) - [TestResponseObjectTestArrayOfObjects](docs/TestResponseObjectTestArrayOfObjects.md) - - [TestResponseObjectTestObject](docs/TestResponseObjectTestObject.md) ## Documentation For Authorization diff --git a/examples/go/go-client/helper/rest/api/v2010/model_test_response_object.go b/examples/go/go-client/helper/rest/api/v2010/model_test_response_object.go index 3bd88e611..f9653a35d 100644 --- a/examples/go/go-client/helper/rest/api/v2010/model_test_response_object.go +++ b/examples/go/go-client/helper/rest/api/v2010/model_test_response_object.go @@ -35,6 +35,8 @@ type TestResponseObject struct { TestArrayOfIntegers []int `json:"test_array_of_integers,omitempty"` TestArrayOfArrayOfIntegers [][]int `json:"test_array_of_array_of_integers,omitempty"` TestArrayOfObjects *[]TestResponseObjectTestArrayOfObjects `json:"test_array_of_objects,omitempty"` + // Permissions authorized to the app + TestArrayOfEnum *[]string `json:"test_array_of_enum,omitempty"` } func (response *TestResponseObject) UnmarshalJSON(bytes []byte) (err error) { @@ -52,6 +54,7 @@ func (response *TestResponseObject) UnmarshalJSON(bytes []byte) (err error) { TestArrayOfIntegers []int `json:"test_array_of_integers"` TestArrayOfArrayOfIntegers [][]int `json:"test_array_of_array_of_integers"` TestArrayOfObjects *[]TestResponseObjectTestArrayOfObjects `json:"test_array_of_objects"` + TestArrayOfEnum *[]string `json:"test_array_of_enum"` }{} if err = json.Unmarshal(bytes, &raw); err != nil { @@ -70,6 +73,7 @@ func (response *TestResponseObject) UnmarshalJSON(bytes []byte) (err error) { TestArrayOfIntegers: raw.TestArrayOfIntegers, TestArrayOfArrayOfIntegers: raw.TestArrayOfArrayOfIntegers, TestArrayOfObjects: raw.TestArrayOfObjects, + TestArrayOfEnum: raw.TestArrayOfEnum, } responseTestNumber, err := client.UnmarshalFloat32(raw.TestNumber) diff --git a/examples/java/src/main/java/com/twilio/rest/api/v2010/Account.java b/examples/java/src/main/java/com/twilio/rest/api/v2010/Account.java index 6f33163e5..c5f52e3a0 100644 --- a/examples/java/src/main/java/com/twilio/rest/api/v2010/Account.java +++ b/examples/java/src/main/java/com/twilio/rest/api/v2010/Account.java @@ -71,7 +71,7 @@ @JsonIgnoreProperties(ignoreUnknown = true) @ToString public class Account extends Resource { - private static final long serialVersionUID = 101016944188709L; + private static final long serialVersionUID = 269191311206549L; public static AccountCreator creator(){ return new AccountCreator(); @@ -213,6 +213,7 @@ public static Status forValue(final String value) { private final List testArrayOfIntegers; private final List> testArrayOfArrayOfIntegers; private final List testArrayOfObjects; + private final List testArrayOfEnum; private final Account.XTwilioWebhookEnabled xTwilioWebhookEnabled; private final Account.Status status; @@ -258,6 +259,9 @@ private Account( @JsonProperty("test_array_of_objects") final List testArrayOfObjects, + @JsonProperty("test_array_of_enum") + final List testArrayOfEnum, + @JsonProperty("x_twilio_webhook_enabled") final Account.XTwilioWebhookEnabled xTwilioWebhookEnabled, @@ -277,6 +281,7 @@ private Account( this.testArrayOfIntegers = testArrayOfIntegers; this.testArrayOfArrayOfIntegers = testArrayOfArrayOfIntegers; this.testArrayOfObjects = testArrayOfObjects; + this.testArrayOfEnum = testArrayOfEnum; this.xTwilioWebhookEnabled = xTwilioWebhookEnabled; this.status = status; } @@ -320,6 +325,9 @@ public final List> getTestArrayOfArrayOfIntegers() { public final List getTestArrayOfObjects() { return this.testArrayOfObjects; } + public final List getTestArrayOfEnum() { + return this.testArrayOfEnum; + } public final Account.XTwilioWebhookEnabled getXTwilioWebhookEnabled() { return this.xTwilioWebhookEnabled; } @@ -339,12 +347,12 @@ public boolean equals(final Object o) { Account other = (Account) o; - return Objects.equals(accountSid, other.accountSid) && Objects.equals(sid, other.sid) && Objects.equals(testString, other.testString) && Objects.equals(testInteger, other.testInteger) && Objects.equals(testObject, other.testObject) && Objects.equals(testDateTime, other.testDateTime) && Objects.equals(testNumber, other.testNumber) && Objects.equals(priceUnit, other.priceUnit) && Objects.equals(testNumberFloat, other.testNumberFloat) && Objects.equals(testEnum, other.testEnum) && Objects.equals(testArrayOfIntegers, other.testArrayOfIntegers) && Objects.equals(testArrayOfArrayOfIntegers, other.testArrayOfArrayOfIntegers) && Objects.equals(testArrayOfObjects, other.testArrayOfObjects) && Objects.equals(xTwilioWebhookEnabled, other.xTwilioWebhookEnabled) && Objects.equals(status, other.status) ; + return Objects.equals(accountSid, other.accountSid) && Objects.equals(sid, other.sid) && Objects.equals(testString, other.testString) && Objects.equals(testInteger, other.testInteger) && Objects.equals(testObject, other.testObject) && Objects.equals(testDateTime, other.testDateTime) && Objects.equals(testNumber, other.testNumber) && Objects.equals(priceUnit, other.priceUnit) && Objects.equals(testNumberFloat, other.testNumberFloat) && Objects.equals(testEnum, other.testEnum) && Objects.equals(testArrayOfIntegers, other.testArrayOfIntegers) && Objects.equals(testArrayOfArrayOfIntegers, other.testArrayOfArrayOfIntegers) && Objects.equals(testArrayOfObjects, other.testArrayOfObjects) && Objects.equals(testArrayOfEnum, other.testArrayOfEnum) && Objects.equals(xTwilioWebhookEnabled, other.xTwilioWebhookEnabled) && Objects.equals(status, other.status) ; } @Override public int hashCode() { - return Objects.hash(accountSid, sid, testString, testInteger, testObject, testDateTime, testNumber, priceUnit, testNumberFloat, testEnum, testArrayOfIntegers, testArrayOfArrayOfIntegers, testArrayOfObjects, xTwilioWebhookEnabled, status); + return Objects.hash(accountSid, sid, testString, testInteger, testObject, testDateTime, testNumber, priceUnit, testNumberFloat, testEnum, testArrayOfIntegers, testArrayOfArrayOfIntegers, testArrayOfObjects, testArrayOfEnum, xTwilioWebhookEnabled, status); } } diff --git a/examples/java/src/main/java/com/twilio/rest/api/v2010/account/Call.java b/examples/java/src/main/java/com/twilio/rest/api/v2010/account/Call.java index 12ec1f240..b51a5c2cf 100644 --- a/examples/java/src/main/java/com/twilio/rest/api/v2010/account/Call.java +++ b/examples/java/src/main/java/com/twilio/rest/api/v2010/account/Call.java @@ -71,7 +71,7 @@ @JsonIgnoreProperties(ignoreUnknown = true) @ToString public class Call extends Resource { - private static final long serialVersionUID = 191475196031556L; + private static final long serialVersionUID = 157497464051388L; public static CallCreator creator(final String requiredStringProperty){ return new CallCreator(requiredStringProperty); @@ -207,6 +207,7 @@ public static Status forValue(final String value) { private final List testArrayOfIntegers; private final List> testArrayOfArrayOfIntegers; private final List testArrayOfObjects; + private final List testArrayOfEnum; private final Call.XTwilioWebhookEnabled xTwilioWebhookEnabled; private final Call.Status status; @@ -252,6 +253,9 @@ private Call( @JsonProperty("test_array_of_objects") final List testArrayOfObjects, + @JsonProperty("test_array_of_enum") + final List testArrayOfEnum, + @JsonProperty("x_twilio_webhook_enabled") final Call.XTwilioWebhookEnabled xTwilioWebhookEnabled, @@ -271,6 +275,7 @@ private Call( this.testArrayOfIntegers = testArrayOfIntegers; this.testArrayOfArrayOfIntegers = testArrayOfArrayOfIntegers; this.testArrayOfObjects = testArrayOfObjects; + this.testArrayOfEnum = testArrayOfEnum; this.xTwilioWebhookEnabled = xTwilioWebhookEnabled; this.status = status; } @@ -314,6 +319,9 @@ public final List> getTestArrayOfArrayOfIntegers() { public final List getTestArrayOfObjects() { return this.testArrayOfObjects; } + public final List getTestArrayOfEnum() { + return this.testArrayOfEnum; + } public final Call.XTwilioWebhookEnabled getXTwilioWebhookEnabled() { return this.xTwilioWebhookEnabled; } @@ -333,12 +341,12 @@ public boolean equals(final Object o) { Call other = (Call) o; - return Objects.equals(accountSid, other.accountSid) && Objects.equals(sid, other.sid) && Objects.equals(testString, other.testString) && Objects.equals(testInteger, other.testInteger) && Objects.equals(testObject, other.testObject) && Objects.equals(testDateTime, other.testDateTime) && Objects.equals(testNumber, other.testNumber) && Objects.equals(priceUnit, other.priceUnit) && Objects.equals(testNumberFloat, other.testNumberFloat) && Objects.equals(testEnum, other.testEnum) && Objects.equals(testArrayOfIntegers, other.testArrayOfIntegers) && Objects.equals(testArrayOfArrayOfIntegers, other.testArrayOfArrayOfIntegers) && Objects.equals(testArrayOfObjects, other.testArrayOfObjects) && Objects.equals(xTwilioWebhookEnabled, other.xTwilioWebhookEnabled) && Objects.equals(status, other.status) ; + return Objects.equals(accountSid, other.accountSid) && Objects.equals(sid, other.sid) && Objects.equals(testString, other.testString) && Objects.equals(testInteger, other.testInteger) && Objects.equals(testObject, other.testObject) && Objects.equals(testDateTime, other.testDateTime) && Objects.equals(testNumber, other.testNumber) && Objects.equals(priceUnit, other.priceUnit) && Objects.equals(testNumberFloat, other.testNumberFloat) && Objects.equals(testEnum, other.testEnum) && Objects.equals(testArrayOfIntegers, other.testArrayOfIntegers) && Objects.equals(testArrayOfArrayOfIntegers, other.testArrayOfArrayOfIntegers) && Objects.equals(testArrayOfObjects, other.testArrayOfObjects) && Objects.equals(testArrayOfEnum, other.testArrayOfEnum) && Objects.equals(xTwilioWebhookEnabled, other.xTwilioWebhookEnabled) && Objects.equals(status, other.status) ; } @Override public int hashCode() { - return Objects.hash(accountSid, sid, testString, testInteger, testObject, testDateTime, testNumber, priceUnit, testNumberFloat, testEnum, testArrayOfIntegers, testArrayOfArrayOfIntegers, testArrayOfObjects, xTwilioWebhookEnabled, status); + return Objects.hash(accountSid, sid, testString, testInteger, testObject, testDateTime, testNumber, priceUnit, testNumberFloat, testEnum, testArrayOfIntegers, testArrayOfArrayOfIntegers, testArrayOfObjects, testArrayOfEnum, xTwilioWebhookEnabled, status); } } diff --git a/examples/java/src/main/java/com/twilio/rest/api/v2010/account/call/FeedbackCallSummary.java b/examples/java/src/main/java/com/twilio/rest/api/v2010/account/call/FeedbackCallSummary.java index d1dad0d40..b9d4bb953 100644 --- a/examples/java/src/main/java/com/twilio/rest/api/v2010/account/call/FeedbackCallSummary.java +++ b/examples/java/src/main/java/com/twilio/rest/api/v2010/account/call/FeedbackCallSummary.java @@ -71,7 +71,7 @@ @JsonIgnoreProperties(ignoreUnknown = true) @ToString public class FeedbackCallSummary extends Resource { - private static final long serialVersionUID = 191475196031556L; + private static final long serialVersionUID = 157497464051388L; public static FeedbackCallSummaryCreator creator(final LocalDate endDate, final LocalDate startDate){ return new FeedbackCallSummaryCreator(endDate, startDate); @@ -195,6 +195,7 @@ public static Status forValue(final String value) { private final List testArrayOfIntegers; private final List> testArrayOfArrayOfIntegers; private final List testArrayOfObjects; + private final List testArrayOfEnum; private final FeedbackCallSummary.XTwilioWebhookEnabled xTwilioWebhookEnabled; private final FeedbackCallSummary.Status status; @@ -240,6 +241,9 @@ private FeedbackCallSummary( @JsonProperty("test_array_of_objects") final List testArrayOfObjects, + @JsonProperty("test_array_of_enum") + final List testArrayOfEnum, + @JsonProperty("x_twilio_webhook_enabled") final FeedbackCallSummary.XTwilioWebhookEnabled xTwilioWebhookEnabled, @@ -259,6 +263,7 @@ private FeedbackCallSummary( this.testArrayOfIntegers = testArrayOfIntegers; this.testArrayOfArrayOfIntegers = testArrayOfArrayOfIntegers; this.testArrayOfObjects = testArrayOfObjects; + this.testArrayOfEnum = testArrayOfEnum; this.xTwilioWebhookEnabled = xTwilioWebhookEnabled; this.status = status; } @@ -302,6 +307,9 @@ public final List> getTestArrayOfArrayOfIntegers() { public final List getTestArrayOfObjects() { return this.testArrayOfObjects; } + public final List getTestArrayOfEnum() { + return this.testArrayOfEnum; + } public final FeedbackCallSummary.XTwilioWebhookEnabled getXTwilioWebhookEnabled() { return this.xTwilioWebhookEnabled; } @@ -321,12 +329,12 @@ public boolean equals(final Object o) { FeedbackCallSummary other = (FeedbackCallSummary) o; - return Objects.equals(accountSid, other.accountSid) && Objects.equals(sid, other.sid) && Objects.equals(testString, other.testString) && Objects.equals(testInteger, other.testInteger) && Objects.equals(testObject, other.testObject) && Objects.equals(testDateTime, other.testDateTime) && Objects.equals(testNumber, other.testNumber) && Objects.equals(priceUnit, other.priceUnit) && Objects.equals(testNumberFloat, other.testNumberFloat) && Objects.equals(testEnum, other.testEnum) && Objects.equals(testArrayOfIntegers, other.testArrayOfIntegers) && Objects.equals(testArrayOfArrayOfIntegers, other.testArrayOfArrayOfIntegers) && Objects.equals(testArrayOfObjects, other.testArrayOfObjects) && Objects.equals(xTwilioWebhookEnabled, other.xTwilioWebhookEnabled) && Objects.equals(status, other.status) ; + return Objects.equals(accountSid, other.accountSid) && Objects.equals(sid, other.sid) && Objects.equals(testString, other.testString) && Objects.equals(testInteger, other.testInteger) && Objects.equals(testObject, other.testObject) && Objects.equals(testDateTime, other.testDateTime) && Objects.equals(testNumber, other.testNumber) && Objects.equals(priceUnit, other.priceUnit) && Objects.equals(testNumberFloat, other.testNumberFloat) && Objects.equals(testEnum, other.testEnum) && Objects.equals(testArrayOfIntegers, other.testArrayOfIntegers) && Objects.equals(testArrayOfArrayOfIntegers, other.testArrayOfArrayOfIntegers) && Objects.equals(testArrayOfObjects, other.testArrayOfObjects) && Objects.equals(testArrayOfEnum, other.testArrayOfEnum) && Objects.equals(xTwilioWebhookEnabled, other.xTwilioWebhookEnabled) && Objects.equals(status, other.status) ; } @Override public int hashCode() { - return Objects.hash(accountSid, sid, testString, testInteger, testObject, testDateTime, testNumber, priceUnit, testNumberFloat, testEnum, testArrayOfIntegers, testArrayOfArrayOfIntegers, testArrayOfObjects, xTwilioWebhookEnabled, status); + return Objects.hash(accountSid, sid, testString, testInteger, testObject, testDateTime, testNumber, priceUnit, testNumberFloat, testEnum, testArrayOfIntegers, testArrayOfArrayOfIntegers, testArrayOfObjects, testArrayOfEnum, xTwilioWebhookEnabled, status); } } diff --git a/examples/java/src/main/java/com/twilio/rest/api/v2010/credential/Aws.java b/examples/java/src/main/java/com/twilio/rest/api/v2010/credential/Aws.java index 296c8dd36..a4354791e 100644 --- a/examples/java/src/main/java/com/twilio/rest/api/v2010/credential/Aws.java +++ b/examples/java/src/main/java/com/twilio/rest/api/v2010/credential/Aws.java @@ -71,7 +71,7 @@ @JsonIgnoreProperties(ignoreUnknown = true) @ToString public class Aws extends Resource { - private static final long serialVersionUID = 102879623605645L; + private static final long serialVersionUID = 185329949738742L; public static AwsFetcher fetcher(final String sid){ @@ -201,6 +201,7 @@ public static Status forValue(final String value) { private final List testArrayOfIntegers; private final List> testArrayOfArrayOfIntegers; private final List testArrayOfObjects; + private final List testArrayOfEnum; private final Aws.XTwilioWebhookEnabled xTwilioWebhookEnabled; private final Aws.Status status; @@ -246,6 +247,9 @@ private Aws( @JsonProperty("test_array_of_objects") final List testArrayOfObjects, + @JsonProperty("test_array_of_enum") + final List testArrayOfEnum, + @JsonProperty("x_twilio_webhook_enabled") final Aws.XTwilioWebhookEnabled xTwilioWebhookEnabled, @@ -265,6 +269,7 @@ private Aws( this.testArrayOfIntegers = testArrayOfIntegers; this.testArrayOfArrayOfIntegers = testArrayOfArrayOfIntegers; this.testArrayOfObjects = testArrayOfObjects; + this.testArrayOfEnum = testArrayOfEnum; this.xTwilioWebhookEnabled = xTwilioWebhookEnabled; this.status = status; } @@ -308,6 +313,9 @@ public final List> getTestArrayOfArrayOfIntegers() { public final List getTestArrayOfObjects() { return this.testArrayOfObjects; } + public final List getTestArrayOfEnum() { + return this.testArrayOfEnum; + } public final Aws.XTwilioWebhookEnabled getXTwilioWebhookEnabled() { return this.xTwilioWebhookEnabled; } @@ -327,12 +335,12 @@ public boolean equals(final Object o) { Aws other = (Aws) o; - return Objects.equals(accountSid, other.accountSid) && Objects.equals(sid, other.sid) && Objects.equals(testString, other.testString) && Objects.equals(testInteger, other.testInteger) && Objects.equals(testObject, other.testObject) && Objects.equals(testDateTime, other.testDateTime) && Objects.equals(testNumber, other.testNumber) && Objects.equals(priceUnit, other.priceUnit) && Objects.equals(testNumberFloat, other.testNumberFloat) && Objects.equals(testEnum, other.testEnum) && Objects.equals(testArrayOfIntegers, other.testArrayOfIntegers) && Objects.equals(testArrayOfArrayOfIntegers, other.testArrayOfArrayOfIntegers) && Objects.equals(testArrayOfObjects, other.testArrayOfObjects) && Objects.equals(xTwilioWebhookEnabled, other.xTwilioWebhookEnabled) && Objects.equals(status, other.status) ; + return Objects.equals(accountSid, other.accountSid) && Objects.equals(sid, other.sid) && Objects.equals(testString, other.testString) && Objects.equals(testInteger, other.testInteger) && Objects.equals(testObject, other.testObject) && Objects.equals(testDateTime, other.testDateTime) && Objects.equals(testNumber, other.testNumber) && Objects.equals(priceUnit, other.priceUnit) && Objects.equals(testNumberFloat, other.testNumberFloat) && Objects.equals(testEnum, other.testEnum) && Objects.equals(testArrayOfIntegers, other.testArrayOfIntegers) && Objects.equals(testArrayOfArrayOfIntegers, other.testArrayOfArrayOfIntegers) && Objects.equals(testArrayOfObjects, other.testArrayOfObjects) && Objects.equals(testArrayOfEnum, other.testArrayOfEnum) && Objects.equals(xTwilioWebhookEnabled, other.xTwilioWebhookEnabled) && Objects.equals(status, other.status) ; } @Override public int hashCode() { - return Objects.hash(accountSid, sid, testString, testInteger, testObject, testDateTime, testNumber, priceUnit, testNumberFloat, testEnum, testArrayOfIntegers, testArrayOfArrayOfIntegers, testArrayOfObjects, xTwilioWebhookEnabled, status); + return Objects.hash(accountSid, sid, testString, testInteger, testObject, testDateTime, testNumber, priceUnit, testNumberFloat, testEnum, testArrayOfIntegers, testArrayOfArrayOfIntegers, testArrayOfObjects, testArrayOfEnum, xTwilioWebhookEnabled, status); } } diff --git a/examples/java/src/main/java/com/twilio/rest/api/v2010/credential/NewCredentials.java b/examples/java/src/main/java/com/twilio/rest/api/v2010/credential/NewCredentials.java index 6357705bd..208a15ae6 100644 --- a/examples/java/src/main/java/com/twilio/rest/api/v2010/credential/NewCredentials.java +++ b/examples/java/src/main/java/com/twilio/rest/api/v2010/credential/NewCredentials.java @@ -71,7 +71,7 @@ @JsonIgnoreProperties(ignoreUnknown = true) @ToString public class NewCredentials extends Resource { - private static final long serialVersionUID = 102879623605645L; + private static final long serialVersionUID = 185329949738742L; public static NewCredentialsCreator creator(final String testString, final Integer testInteger, final Float testNumberFloat){ return new NewCredentialsCreator(testString, testInteger, testNumberFloat); @@ -220,6 +220,7 @@ public static Permissions forValue(final String value) { private final List testArrayOfIntegers; private final List> testArrayOfArrayOfIntegers; private final List testArrayOfObjects; + private final List testArrayOfEnum; private final NewCredentials.XTwilioWebhookEnabled xTwilioWebhookEnabled; private final NewCredentials.Status status; private final NewCredentials.Permissions permissions; @@ -266,6 +267,9 @@ private NewCredentials( @JsonProperty("test_array_of_objects") final List testArrayOfObjects, + @JsonProperty("test_array_of_enum") + final List testArrayOfEnum, + @JsonProperty("x_twilio_webhook_enabled") final NewCredentials.XTwilioWebhookEnabled xTwilioWebhookEnabled, @@ -288,6 +292,7 @@ private NewCredentials( this.testArrayOfIntegers = testArrayOfIntegers; this.testArrayOfArrayOfIntegers = testArrayOfArrayOfIntegers; this.testArrayOfObjects = testArrayOfObjects; + this.testArrayOfEnum = testArrayOfEnum; this.xTwilioWebhookEnabled = xTwilioWebhookEnabled; this.status = status; this.permissions = permissions; @@ -332,6 +337,9 @@ public final List> getTestArrayOfArrayOfIntegers() { public final List getTestArrayOfObjects() { return this.testArrayOfObjects; } + public final List getTestArrayOfEnum() { + return this.testArrayOfEnum; + } public final NewCredentials.XTwilioWebhookEnabled getXTwilioWebhookEnabled() { return this.xTwilioWebhookEnabled; } @@ -354,12 +362,12 @@ public boolean equals(final Object o) { NewCredentials other = (NewCredentials) o; - return Objects.equals(accountSid, other.accountSid) && Objects.equals(sid, other.sid) && Objects.equals(testString, other.testString) && Objects.equals(testInteger, other.testInteger) && Objects.equals(testObject, other.testObject) && Objects.equals(testDateTime, other.testDateTime) && Objects.equals(testNumber, other.testNumber) && Objects.equals(priceUnit, other.priceUnit) && Objects.equals(testNumberFloat, other.testNumberFloat) && Objects.equals(testEnum, other.testEnum) && Objects.equals(testArrayOfIntegers, other.testArrayOfIntegers) && Objects.equals(testArrayOfArrayOfIntegers, other.testArrayOfArrayOfIntegers) && Objects.equals(testArrayOfObjects, other.testArrayOfObjects) && Objects.equals(xTwilioWebhookEnabled, other.xTwilioWebhookEnabled) && Objects.equals(status, other.status) && Objects.equals(permissions, other.permissions) ; + return Objects.equals(accountSid, other.accountSid) && Objects.equals(sid, other.sid) && Objects.equals(testString, other.testString) && Objects.equals(testInteger, other.testInteger) && Objects.equals(testObject, other.testObject) && Objects.equals(testDateTime, other.testDateTime) && Objects.equals(testNumber, other.testNumber) && Objects.equals(priceUnit, other.priceUnit) && Objects.equals(testNumberFloat, other.testNumberFloat) && Objects.equals(testEnum, other.testEnum) && Objects.equals(testArrayOfIntegers, other.testArrayOfIntegers) && Objects.equals(testArrayOfArrayOfIntegers, other.testArrayOfArrayOfIntegers) && Objects.equals(testArrayOfObjects, other.testArrayOfObjects) && Objects.equals(testArrayOfEnum, other.testArrayOfEnum) && Objects.equals(xTwilioWebhookEnabled, other.xTwilioWebhookEnabled) && Objects.equals(status, other.status) && Objects.equals(permissions, other.permissions) ; } @Override public int hashCode() { - return Objects.hash(accountSid, sid, testString, testInteger, testObject, testDateTime, testNumber, priceUnit, testNumberFloat, testEnum, testArrayOfIntegers, testArrayOfArrayOfIntegers, testArrayOfObjects, xTwilioWebhookEnabled, status, permissions); + return Objects.hash(accountSid, sid, testString, testInteger, testObject, testDateTime, testNumber, priceUnit, testNumberFloat, testEnum, testArrayOfIntegers, testArrayOfArrayOfIntegers, testArrayOfObjects, testArrayOfEnum, xTwilioWebhookEnabled, status, permissions); } } diff --git a/examples/node/lib/rest/api/v2010/accounts.ts b/examples/node/lib/rest/api/v2010/accounts.ts index 7a356727d..c1ab3ef4d 100644 --- a/examples/node/lib/rest/api/v2010/accounts.ts +++ b/examples/node/lib/rest/api/v2010/accounts.ts @@ -213,6 +213,7 @@ interface AccountResource { test_array_of_integers?: Array; test_array_of_array_of_integers?: Array>; test_array_of_objects?: Array | null; + test_array_of_enum?: Array | null; } export class AccountInstance { @@ -233,6 +234,7 @@ export class AccountInstance { this.testArrayOfIntegers = payload.test_array_of_integers; this.testArrayOfArrayOfIntegers = payload.test_array_of_array_of_integers; this.testArrayOfObjects = payload.test_array_of_objects; + this.testArrayOfEnum = payload.test_array_of_enum; this._solution = { sid: sid || this.sid }; } @@ -255,6 +257,10 @@ export class AccountInstance { testArrayOfIntegers?: Array; testArrayOfArrayOfIntegers?: Array>; testArrayOfObjects?: Array | null; + /** + * Permissions authorized to the app + */ + testArrayOfEnum?: Array | null; /** * Remove a AccountInstance @@ -320,7 +326,8 @@ export class AccountInstance { testEnum: this.testEnum, testArrayOfIntegers: this.testArrayOfIntegers, testArrayOfArrayOfIntegers: this.testArrayOfArrayOfIntegers, - testArrayOfObjects: this.testArrayOfObjects + testArrayOfObjects: this.testArrayOfObjects, + testArrayOfEnum: this.testArrayOfEnum } } diff --git a/examples/node/lib/rest/api/v2010/accounts/calls.ts b/examples/node/lib/rest/api/v2010/accounts/calls.ts index 63d5ca6fb..6654f1b3c 100644 --- a/examples/node/lib/rest/api/v2010/accounts/calls.ts +++ b/examples/node/lib/rest/api/v2010/accounts/calls.ts @@ -233,6 +233,7 @@ interface CallResource { test_array_of_integers?: Array; test_array_of_array_of_integers?: Array>; test_array_of_objects?: Array | null; + test_array_of_enum?: Array | null; } export class CallInstance { @@ -253,6 +254,7 @@ export class CallInstance { this.testArrayOfIntegers = payload.test_array_of_integers; this.testArrayOfArrayOfIntegers = payload.test_array_of_array_of_integers; this.testArrayOfObjects = payload.test_array_of_objects; + this.testArrayOfEnum = payload.test_array_of_enum; this._solution = { accountSid, testInteger: testInteger || this.testInteger }; } @@ -275,6 +277,10 @@ export class CallInstance { testArrayOfIntegers?: Array; testArrayOfArrayOfIntegers?: Array>; testArrayOfObjects?: Array | null; + /** + * Permissions authorized to the app + */ + testArrayOfEnum?: Array | null; /** * Remove a CallInstance @@ -319,7 +325,8 @@ export class CallInstance { testEnum: this.testEnum, testArrayOfIntegers: this.testArrayOfIntegers, testArrayOfArrayOfIntegers: this.testArrayOfArrayOfIntegers, - testArrayOfObjects: this.testArrayOfObjects + testArrayOfObjects: this.testArrayOfObjects, + testArrayOfEnum: this.testArrayOfEnum } } diff --git a/examples/node/lib/rest/api/v2010/credentials/aWS.ts b/examples/node/lib/rest/api/v2010/credentials/aWS.ts index 8b1d66eac..1a798034f 100644 --- a/examples/node/lib/rest/api/v2010/credentials/aWS.ts +++ b/examples/node/lib/rest/api/v2010/credentials/aWS.ts @@ -228,6 +228,7 @@ interface AWSResource { test_array_of_integers?: Array; test_array_of_array_of_integers?: Array>; test_array_of_objects?: Array | null; + test_array_of_enum?: Array | null; } export class AWSInstance { @@ -248,6 +249,7 @@ export class AWSInstance { this.testArrayOfIntegers = payload.test_array_of_integers; this.testArrayOfArrayOfIntegers = payload.test_array_of_array_of_integers; this.testArrayOfObjects = payload.test_array_of_objects; + this.testArrayOfEnum = payload.test_array_of_enum; this._solution = { sid: sid || this.sid }; } @@ -270,6 +272,10 @@ export class AWSInstance { testArrayOfIntegers?: Array; testArrayOfArrayOfIntegers?: Array>; testArrayOfObjects?: Array | null; + /** + * Permissions authorized to the app + */ + testArrayOfEnum?: Array | null; /** * Remove a AWSInstance @@ -336,7 +342,8 @@ export class AWSInstance { testEnum: this.testEnum, testArrayOfIntegers: this.testArrayOfIntegers, testArrayOfArrayOfIntegers: this.testArrayOfArrayOfIntegers, - testArrayOfObjects: this.testArrayOfObjects + testArrayOfObjects: this.testArrayOfObjects, + testArrayOfEnum: this.testArrayOfEnum } } diff --git a/examples/twilio_api_v2010.yaml b/examples/twilio_api_v2010.yaml index 05e20db7a..e09bb768c 100644 --- a/examples/twilio_api_v2010.yaml +++ b/examples/twilio_api_v2010.yaml @@ -1,5 +1,10 @@ components: schemas: + test_enum_permission: + enum: + - get-all + - post-all + type: string test.response_object: properties: account_sid: @@ -71,6 +76,13 @@ components: type: object nullable: true type: array + test_array_of_enum: + description: Permissions authorized to the app + items: + $ref: '#/components/schemas/test_enum_permission' + type: string + nullable: true + type: array type: object examples: test.response_object.example: diff --git a/src/main/java/com/twilio/oai/AbstractTwilioGoGenerator.java b/src/main/java/com/twilio/oai/AbstractTwilioGoGenerator.java index 265c94e7a..5815197cc 100644 --- a/src/main/java/com/twilio/oai/AbstractTwilioGoGenerator.java +++ b/src/main/java/com/twilio/oai/AbstractTwilioGoGenerator.java @@ -1,10 +1,7 @@ package com.twilio.oai; -import java.util.Collection; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.Objects; +import java.util.*; +import java.util.stream.Collectors; import io.swagger.v3.oas.models.OpenAPI; import io.swagger.v3.oas.models.Operation; @@ -12,9 +9,11 @@ import io.swagger.v3.oas.models.responses.ApiResponse; import io.swagger.v3.oas.models.responses.ApiResponses; import org.openapitools.codegen.CodegenConstants; +import org.openapitools.codegen.CodegenModel; import org.openapitools.codegen.CodegenOperation; import org.openapitools.codegen.CodegenProperty; import org.openapitools.codegen.languages.GoClientCodegen; +import org.openapitools.codegen.model.ModelsMap; import org.openapitools.codegen.model.OperationMap; import org.openapitools.codegen.model.OperationsMap; import org.openapitools.codegen.model.ModelMap; @@ -113,6 +112,21 @@ public OperationsMap postProcessOperationsWithModels(final OperationsMap objs, L return objs; } + private Map filterOutEnumResults( Map results) { + HashMap resultMap = new HashMap<>(); + results.forEach((key ,value) -> { + if (!key.contains("_enum_")) { + resultMap.put(key, value); + }}); + return resultMap; + } + + @Override + public Map postProcessAllModels(final Map allModels) { + Map results = filterOutEnumResults(super.postProcessAllModels(allModels)); + return results; + } + @Override protected ApiResponse findMethodResponse(final ApiResponses responses) { final ApiResponse response = super.findMethodResponse(responses); diff --git a/src/main/java/com/twilio/oai/TwilioGoGenerator.java b/src/main/java/com/twilio/oai/TwilioGoGenerator.java index 11762b30e..abd496154 100644 --- a/src/main/java/com/twilio/oai/TwilioGoGenerator.java +++ b/src/main/java/com/twilio/oai/TwilioGoGenerator.java @@ -1,5 +1,6 @@ package com.twilio.oai; +import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; @@ -14,6 +15,7 @@ import org.openapitools.codegen.CodegenParameter; import org.openapitools.codegen.CodegenProperty; import org.openapitools.codegen.SupportingFile; +import org.openapitools.codegen.utils.StringUtils; import org.openapitools.codegen.model.ModelMap; import org.openapitools.codegen.model.ModelsMap; import org.openapitools.codegen.model.OperationMap; @@ -63,6 +65,39 @@ public ModelsMap postProcessModels(final ModelsMap objs) { return results; } + @Override + public void postProcessModelProperty(CodegenModel model, CodegenProperty property) { + super.postProcessModelProperty(model, property); + if (property.dataType.startsWith("[]") && property.dataType.contains("Enum")) { + property._enum = (List) property.items.allowableValues.get("values"); + property.allowableValues = property.items.allowableValues; + property.dataType = "[]string"; + } else if (property.dataType.contains("Enum")) { + String[] value = property.dataType.split("Enum"); + property.datatypeWithEnum = value[value.length-1]; + property.dataType = "string"; + + } + property.isEnum = property.isEnum && property.dataFormat == null; + } + + + private void processEnumParameters(final CodegenParameter parameter) { + if (parameter.dataType.startsWith("[]") && parameter.dataType.contains("Enum")) { + parameter._enum = (List) parameter.items.allowableValues.get("values"); + parameter.allowableValues = parameter.items.allowableValues; + parameter.dataType = "[]string"; + } else if (parameter.dataType.contains("Enum")) { + String[] value = parameter.dataType.split("Enum"); + parameter.datatypeWithEnum = value[value.length-1]; + parameter.dataType = "string"; + + } + parameter.isEnum = parameter.isEnum && parameter.dataFormat == null; + } + + + @SuppressWarnings("unchecked") @Override public OperationsMap postProcessOperationsWithModels(final OperationsMap objs, List allModels) { final OperationsMap results = super.postProcessOperationsWithModels(objs, allModels); @@ -125,7 +160,7 @@ public OperationsMap postProcessOperationsWithModels(final OperationsMap objs, L @Override public void postProcessParameter(final CodegenParameter parameter) { super.postProcessParameter(parameter); - + processEnumParameters(parameter); // Make sure required non-path params get into the options block. parameter.required = parameter.isPathParam; parameter.vendorExtensions.put("x-custom", parameter.baseName.equals("limit")); diff --git a/src/test/java/com/twilio/oai/TwilioGeneratorTest.java b/src/test/java/com/twilio/oai/TwilioGeneratorTest.java index a09b291c1..280abdce6 100644 --- a/src/test/java/com/twilio/oai/TwilioGeneratorTest.java +++ b/src/test/java/com/twilio/oai/TwilioGeneratorTest.java @@ -19,9 +19,9 @@ public class TwilioGeneratorTest { @Test public void launchCodeGenerator() { final CodegenConfigurator configurator = new CodegenConfigurator() - .setGeneratorName("twilio-java") - .setInputSpec("examples/twilio_api_v2010.yaml") - .setOutputDir("codegen/twilio-java"); + .setGeneratorName("twilio-go") + .setInputSpec("/Users/kgoswami/Projects/github/twilio-oai-generator/examples/twilio_api_v2010.yaml") + .setOutputDir("codegen/twilio-go"); final ClientOptInput clientOptInput = configurator.toClientOptInput(); DefaultGenerator generator = new DefaultGenerator(); From 3b5d77259932585bbbf0dd4ef8b8c95554365bcf Mon Sep 17 00:00:00 2001 From: kridai Date: Tue, 12 Jul 2022 21:03:50 +0530 Subject: [PATCH 2/8] fix: updated enum schema for yaml --- examples/twilio_api_v2010.yaml | 38 ++++++++++++------- .../com/twilio/oai/TwilioGoGenerator.java | 9 ++--- 2 files changed, 28 insertions(+), 19 deletions(-) diff --git a/examples/twilio_api_v2010.yaml b/examples/twilio_api_v2010.yaml index e09bb768c..604901477 100644 --- a/examples/twilio_api_v2010.yaml +++ b/examples/twilio_api_v2010.yaml @@ -5,6 +5,26 @@ components: - get-all - post-all type: string + test_enum_status: + enum: + - in-progress + - paused + - stopped + - processing + - completed + - absent + type: string + recording_enum_source: + enum: + - DialVerb + - Trunking + type: string + payments_enum_bank_account_type: + enum: + - consumer-checking + - consumer-savings + - commercial-checking + type: string test.response_object: properties: account_sid: @@ -50,9 +70,7 @@ components: type: number format: float test_enum: - enum: - - DialVerb - - Trunking + $ref: '#/components/schemas/recording_enum_source' nullable: true type: string test_array_of_integers: @@ -223,10 +241,8 @@ paths: type: string format: date TestEnum: - enum: - - consumer-checking - - consumer-savings - - commercial-checking + $ref: '#/components/schemas/payments_enum_bank_account_type' + type: string TestObjectArray: items: type: object @@ -534,13 +550,7 @@ paths: PauseBehavior: type: string Status: - enum: - - in-progress - - paused - - stopped - - processing - - completed - - absent + $ref: '#/components/schemas/test_enum_status' type: string required: - Status diff --git a/src/main/java/com/twilio/oai/TwilioGoGenerator.java b/src/main/java/com/twilio/oai/TwilioGoGenerator.java index abd496154..5156d81c3 100644 --- a/src/main/java/com/twilio/oai/TwilioGoGenerator.java +++ b/src/main/java/com/twilio/oai/TwilioGoGenerator.java @@ -1,6 +1,5 @@ package com.twilio.oai; -import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; @@ -15,7 +14,6 @@ import org.openapitools.codegen.CodegenParameter; import org.openapitools.codegen.CodegenProperty; import org.openapitools.codegen.SupportingFile; -import org.openapitools.codegen.utils.StringUtils; import org.openapitools.codegen.model.ModelMap; import org.openapitools.codegen.model.ModelsMap; import org.openapitools.codegen.model.OperationMap; @@ -72,13 +70,14 @@ public void postProcessModelProperty(CodegenModel model, CodegenProperty propert property._enum = (List) property.items.allowableValues.get("values"); property.allowableValues = property.items.allowableValues; property.dataType = "[]string"; + property.isEnum = property.isEnum && property.dataFormat == null; } else if (property.dataType.contains("Enum")) { String[] value = property.dataType.split("Enum"); property.datatypeWithEnum = value[value.length-1]; property.dataType = "string"; + property.isEnum = property.isEnum && property.dataFormat == null; } - property.isEnum = property.isEnum && property.dataFormat == null; } @@ -87,13 +86,13 @@ private void processEnumParameters(final CodegenParameter parameter) { parameter._enum = (List) parameter.items.allowableValues.get("values"); parameter.allowableValues = parameter.items.allowableValues; parameter.dataType = "[]string"; + parameter.isEnum = parameter.isEnum && parameter.dataFormat == null; } else if (parameter.dataType.contains("Enum")) { String[] value = parameter.dataType.split("Enum"); parameter.datatypeWithEnum = value[value.length-1]; parameter.dataType = "string"; - + parameter.isEnum = parameter.isEnum && parameter.dataFormat == null; } - parameter.isEnum = parameter.isEnum && parameter.dataFormat == null; } From 83922164c0610f44a02ecb3b299447ff74cff8a2 Mon Sep 17 00:00:00 2001 From: kridai Date: Tue, 12 Jul 2022 21:08:39 +0530 Subject: [PATCH 3/8] fix: reverting test changes --- src/test/java/com/twilio/oai/TwilioGeneratorTest.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/test/java/com/twilio/oai/TwilioGeneratorTest.java b/src/test/java/com/twilio/oai/TwilioGeneratorTest.java index 280abdce6..a09b291c1 100644 --- a/src/test/java/com/twilio/oai/TwilioGeneratorTest.java +++ b/src/test/java/com/twilio/oai/TwilioGeneratorTest.java @@ -19,9 +19,9 @@ public class TwilioGeneratorTest { @Test public void launchCodeGenerator() { final CodegenConfigurator configurator = new CodegenConfigurator() - .setGeneratorName("twilio-go") - .setInputSpec("/Users/kgoswami/Projects/github/twilio-oai-generator/examples/twilio_api_v2010.yaml") - .setOutputDir("codegen/twilio-go"); + .setGeneratorName("twilio-java") + .setInputSpec("examples/twilio_api_v2010.yaml") + .setOutputDir("codegen/twilio-java"); final ClientOptInput clientOptInput = configurator.toClientOptInput(); DefaultGenerator generator = new DefaultGenerator(); From 2ab0650dc4b9b95d583d598d0dd8a0cd70b8a6e0 Mon Sep 17 00:00:00 2001 From: kridai Date: Tue, 12 Jul 2022 23:46:49 +0530 Subject: [PATCH 4/8] fix: enum schema update --- .../java/com/twilio/oai/TwilioGoGenerator.java | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/src/main/java/com/twilio/oai/TwilioGoGenerator.java b/src/main/java/com/twilio/oai/TwilioGoGenerator.java index 5156d81c3..78bb26671 100644 --- a/src/main/java/com/twilio/oai/TwilioGoGenerator.java +++ b/src/main/java/com/twilio/oai/TwilioGoGenerator.java @@ -70,14 +70,16 @@ public void postProcessModelProperty(CodegenModel model, CodegenProperty propert property._enum = (List) property.items.allowableValues.get("values"); property.allowableValues = property.items.allowableValues; property.dataType = "[]string"; - property.isEnum = property.isEnum && property.dataFormat == null; + property.isEnum = property.dataType == null; + property.isNullable = true; } else if (property.dataType.contains("Enum")) { String[] value = property.dataType.split("Enum"); property.datatypeWithEnum = value[value.length-1]; property.dataType = "string"; - property.isEnum = property.isEnum && property.dataFormat == null; - + property.isEnum = property.dataType == null;; + property.isNullable = true; } + } @@ -86,12 +88,14 @@ private void processEnumParameters(final CodegenParameter parameter) { parameter._enum = (List) parameter.items.allowableValues.get("values"); parameter.allowableValues = parameter.items.allowableValues; parameter.dataType = "[]string"; - parameter.isEnum = parameter.isEnum && parameter.dataFormat == null; + parameter.isEnum = parameter.dataType == null; + parameter.isNullable = true; } else if (parameter.dataType.contains("Enum")) { String[] value = parameter.dataType.split("Enum"); parameter.datatypeWithEnum = value[value.length-1]; parameter.dataType = "string"; - parameter.isEnum = parameter.isEnum && parameter.dataFormat == null; + parameter.isEnum = parameter.dataType == null; + parameter.isNullable = true; } } From f553c788222e3e6a1e4ddc25ca218e22d65383d6 Mon Sep 17 00:00:00 2001 From: chsingh Date: Wed, 13 Jul 2022 21:25:06 +0530 Subject: [PATCH 5/8] fix: java generate code and remove extra enums --- .../com/twilio/rest/api/v2010/Account.java | 74 ++++----------- .../twilio/rest/api/v2010/account/Call.java | 73 ++------------- .../account/call/FeedbackCallSummary.java | 73 ++------------- .../twilio/rest/api/v2010/credential/Aws.java | 73 ++------------- .../api/v2010/credential/NewCredentials.java | 93 ++++--------------- .../credential/NewCredentialsCreator.java | 4 +- .../java/unit-test/rest/TwilioRestTest.java | 42 ++++----- examples/twilio_api_v2010.yaml | 22 +---- 8 files changed, 89 insertions(+), 365 deletions(-) diff --git a/examples/java/src/main/java/com/twilio/rest/api/v2010/Account.java b/examples/java/src/main/java/com/twilio/rest/api/v2010/Account.java index c5f52e3a0..3bc27c3e3 100644 --- a/examples/java/src/main/java/com/twilio/rest/api/v2010/Account.java +++ b/examples/java/src/main/java/com/twilio/rest/api/v2010/Account.java @@ -67,11 +67,12 @@ import com.twilio.type.OutboundSmsPrice; import com.twilio.type.OutboundCallPrice; import com.twilio.type.RecordingRule; +import com.twilio.type.SubscribeRule; @JsonIgnoreProperties(ignoreUnknown = true) @ToString public class Account extends Resource { - private static final long serialVersionUID = 269191311206549L; + private static final long serialVersionUID = 195758856312528L; public static AccountCreator creator(){ return new AccountCreator(); @@ -138,13 +139,17 @@ public static Account fromJson(final InputStream json, final ObjectMapper object throw new ApiConnectionException(e.getMessage(), e); } } - public enum TestEnum { - DIALVERB("DialVerb"), - TRUNKING("Trunking"); + public enum Status { + IN_PROGRESS("in-progress"), + PAUSED("paused"), + STOPPED("stopped"), + PROCESSING("processing"), + COMPLETED("completed"), + ABSENT("absent"); private final String value; - private TestEnum(final String value) { + private Status(final String value) { this.value = value; } @@ -153,8 +158,8 @@ public String toString() { } @JsonCreator - public static TestEnum forValue(final String value) { - return Promoter.enumFromString(value, TestEnum.values()); + public static Status forValue(final String value) { + return Promoter.enumFromString(value, Status.values()); } } public enum XTwilioWebhookEnabled { @@ -176,29 +181,6 @@ public static XTwilioWebhookEnabled forValue(final String value) { return Promoter.enumFromString(value, XTwilioWebhookEnabled.values()); } } - public enum Status { - IN_PROGRESS("in-progress"), - PAUSED("paused"), - STOPPED("stopped"), - PROCESSING("processing"), - COMPLETED("completed"), - ABSENT("absent"); - - 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 String sid; @@ -209,13 +191,11 @@ public static Status forValue(final String value) { private final BigDecimal testNumber; private final Currency priceUnit; private final Float testNumberFloat; - private final Account.TestEnum testEnum; + private final Account.Status testEnum; private final List testArrayOfIntegers; private final List> testArrayOfArrayOfIntegers; private final List testArrayOfObjects; - private final List testArrayOfEnum; - private final Account.XTwilioWebhookEnabled xTwilioWebhookEnabled; - private final Account.Status status; + private final List testArrayOfEnum; @JsonCreator private Account( @@ -248,7 +228,7 @@ private Account( final Float testNumberFloat, @JsonProperty("test_enum") - final Account.TestEnum testEnum, + final Account.Status testEnum, @JsonProperty("test_array_of_integers") final List testArrayOfIntegers, @@ -260,13 +240,7 @@ private Account( final List testArrayOfObjects, @JsonProperty("test_array_of_enum") - final List testArrayOfEnum, - - @JsonProperty("x_twilio_webhook_enabled") - final Account.XTwilioWebhookEnabled xTwilioWebhookEnabled, - - @JsonProperty("status") - final Account.Status status + final List testArrayOfEnum ) { this.accountSid = accountSid; this.sid = sid; @@ -282,8 +256,6 @@ private Account( this.testArrayOfArrayOfIntegers = testArrayOfArrayOfIntegers; this.testArrayOfObjects = testArrayOfObjects; this.testArrayOfEnum = testArrayOfEnum; - this.xTwilioWebhookEnabled = xTwilioWebhookEnabled; - this.status = status; } public final String getAccountSid() { @@ -313,7 +285,7 @@ public final Currency getPriceUnit() { public final Float getTestNumberFloat() { return this.testNumberFloat; } - public final Account.TestEnum getTestEnum() { + public final Account.Status getTestEnum() { return this.testEnum; } public final List getTestArrayOfIntegers() { @@ -325,15 +297,9 @@ public final List> getTestArrayOfArrayOfIntegers() { public final List getTestArrayOfObjects() { return this.testArrayOfObjects; } - public final List getTestArrayOfEnum() { + public final List getTestArrayOfEnum() { return this.testArrayOfEnum; } - public final Account.XTwilioWebhookEnabled getXTwilioWebhookEnabled() { - return this.xTwilioWebhookEnabled; - } - public final Account.Status getStatus() { - return this.status; - } @Override public boolean equals(final Object o) { @@ -347,12 +313,12 @@ public boolean equals(final Object o) { Account other = (Account) o; - return Objects.equals(accountSid, other.accountSid) && Objects.equals(sid, other.sid) && Objects.equals(testString, other.testString) && Objects.equals(testInteger, other.testInteger) && Objects.equals(testObject, other.testObject) && Objects.equals(testDateTime, other.testDateTime) && Objects.equals(testNumber, other.testNumber) && Objects.equals(priceUnit, other.priceUnit) && Objects.equals(testNumberFloat, other.testNumberFloat) && Objects.equals(testEnum, other.testEnum) && Objects.equals(testArrayOfIntegers, other.testArrayOfIntegers) && Objects.equals(testArrayOfArrayOfIntegers, other.testArrayOfArrayOfIntegers) && Objects.equals(testArrayOfObjects, other.testArrayOfObjects) && Objects.equals(testArrayOfEnum, other.testArrayOfEnum) && Objects.equals(xTwilioWebhookEnabled, other.xTwilioWebhookEnabled) && Objects.equals(status, other.status) ; + return Objects.equals(accountSid, other.accountSid) && Objects.equals(sid, other.sid) && Objects.equals(testString, other.testString) && Objects.equals(testInteger, other.testInteger) && Objects.equals(testObject, other.testObject) && Objects.equals(testDateTime, other.testDateTime) && Objects.equals(testNumber, other.testNumber) && Objects.equals(priceUnit, other.priceUnit) && Objects.equals(testNumberFloat, other.testNumberFloat) && Objects.equals(testEnum, other.testEnum) && Objects.equals(testArrayOfIntegers, other.testArrayOfIntegers) && Objects.equals(testArrayOfArrayOfIntegers, other.testArrayOfArrayOfIntegers) && Objects.equals(testArrayOfObjects, other.testArrayOfObjects) && Objects.equals(testArrayOfEnum, other.testArrayOfEnum) ; } @Override public int hashCode() { - return Objects.hash(accountSid, sid, testString, testInteger, testObject, testDateTime, testNumber, priceUnit, testNumberFloat, testEnum, testArrayOfIntegers, testArrayOfArrayOfIntegers, testArrayOfObjects, testArrayOfEnum, xTwilioWebhookEnabled, status); + return Objects.hash(accountSid, sid, testString, testInteger, testObject, testDateTime, testNumber, priceUnit, testNumberFloat, testEnum, testArrayOfIntegers, testArrayOfArrayOfIntegers, testArrayOfObjects, testArrayOfEnum); } } diff --git a/examples/java/src/main/java/com/twilio/rest/api/v2010/account/Call.java b/examples/java/src/main/java/com/twilio/rest/api/v2010/account/Call.java index b51a5c2cf..fa08c5ded 100644 --- a/examples/java/src/main/java/com/twilio/rest/api/v2010/account/Call.java +++ b/examples/java/src/main/java/com/twilio/rest/api/v2010/account/Call.java @@ -67,11 +67,12 @@ import com.twilio.type.OutboundSmsPrice; import com.twilio.type.OutboundCallPrice; import com.twilio.type.RecordingRule; +import com.twilio.type.SubscribeRule; @JsonIgnoreProperties(ignoreUnknown = true) @ToString public class Call extends Resource { - private static final long serialVersionUID = 157497464051388L; + private static final long serialVersionUID = 193205363285633L; public static CallCreator creator(final String requiredStringProperty){ return new CallCreator(requiredStringProperty); @@ -132,44 +133,6 @@ public static Call fromJson(final InputStream json, final ObjectMapper objectMap throw new ApiConnectionException(e.getMessage(), e); } } - public enum TestEnum { - DIALVERB("DialVerb"), - TRUNKING("Trunking"); - - private final String value; - - private TestEnum(final String value) { - this.value = value; - } - - public String toString() { - return value; - } - - @JsonCreator - public static TestEnum forValue(final String value) { - return Promoter.enumFromString(value, TestEnum.values()); - } - } - public enum XTwilioWebhookEnabled { - TRUE("true"), - FALSE("false"); - - private final String value; - - private XTwilioWebhookEnabled(final String value) { - this.value = value; - } - - public String toString() { - return value; - } - - @JsonCreator - public static XTwilioWebhookEnabled forValue(final String value) { - return Promoter.enumFromString(value, XTwilioWebhookEnabled.values()); - } - } public enum Status { IN_PROGRESS("in-progress"), PAUSED("paused"), @@ -203,13 +166,11 @@ public static Status forValue(final String value) { private final BigDecimal testNumber; private final Currency priceUnit; private final Float testNumberFloat; - private final Call.TestEnum testEnum; + private final Call.Status testEnum; private final List testArrayOfIntegers; private final List> testArrayOfArrayOfIntegers; private final List testArrayOfObjects; - private final List testArrayOfEnum; - private final Call.XTwilioWebhookEnabled xTwilioWebhookEnabled; - private final Call.Status status; + private final List testArrayOfEnum; @JsonCreator private Call( @@ -242,7 +203,7 @@ private Call( final Float testNumberFloat, @JsonProperty("test_enum") - final Call.TestEnum testEnum, + final Call.Status testEnum, @JsonProperty("test_array_of_integers") final List testArrayOfIntegers, @@ -254,13 +215,7 @@ private Call( final List testArrayOfObjects, @JsonProperty("test_array_of_enum") - final List testArrayOfEnum, - - @JsonProperty("x_twilio_webhook_enabled") - final Call.XTwilioWebhookEnabled xTwilioWebhookEnabled, - - @JsonProperty("status") - final Call.Status status + final List testArrayOfEnum ) { this.accountSid = accountSid; this.sid = sid; @@ -276,8 +231,6 @@ private Call( this.testArrayOfArrayOfIntegers = testArrayOfArrayOfIntegers; this.testArrayOfObjects = testArrayOfObjects; this.testArrayOfEnum = testArrayOfEnum; - this.xTwilioWebhookEnabled = xTwilioWebhookEnabled; - this.status = status; } public final String getAccountSid() { @@ -307,7 +260,7 @@ public final Currency getPriceUnit() { public final Float getTestNumberFloat() { return this.testNumberFloat; } - public final Call.TestEnum getTestEnum() { + public final Call.Status getTestEnum() { return this.testEnum; } public final List getTestArrayOfIntegers() { @@ -319,15 +272,9 @@ public final List> getTestArrayOfArrayOfIntegers() { public final List getTestArrayOfObjects() { return this.testArrayOfObjects; } - public final List getTestArrayOfEnum() { + public final List getTestArrayOfEnum() { return this.testArrayOfEnum; } - public final Call.XTwilioWebhookEnabled getXTwilioWebhookEnabled() { - return this.xTwilioWebhookEnabled; - } - public final Call.Status getStatus() { - return this.status; - } @Override public boolean equals(final Object o) { @@ -341,12 +288,12 @@ public boolean equals(final Object o) { Call other = (Call) o; - return Objects.equals(accountSid, other.accountSid) && Objects.equals(sid, other.sid) && Objects.equals(testString, other.testString) && Objects.equals(testInteger, other.testInteger) && Objects.equals(testObject, other.testObject) && Objects.equals(testDateTime, other.testDateTime) && Objects.equals(testNumber, other.testNumber) && Objects.equals(priceUnit, other.priceUnit) && Objects.equals(testNumberFloat, other.testNumberFloat) && Objects.equals(testEnum, other.testEnum) && Objects.equals(testArrayOfIntegers, other.testArrayOfIntegers) && Objects.equals(testArrayOfArrayOfIntegers, other.testArrayOfArrayOfIntegers) && Objects.equals(testArrayOfObjects, other.testArrayOfObjects) && Objects.equals(testArrayOfEnum, other.testArrayOfEnum) && Objects.equals(xTwilioWebhookEnabled, other.xTwilioWebhookEnabled) && Objects.equals(status, other.status) ; + return Objects.equals(accountSid, other.accountSid) && Objects.equals(sid, other.sid) && Objects.equals(testString, other.testString) && Objects.equals(testInteger, other.testInteger) && Objects.equals(testObject, other.testObject) && Objects.equals(testDateTime, other.testDateTime) && Objects.equals(testNumber, other.testNumber) && Objects.equals(priceUnit, other.priceUnit) && Objects.equals(testNumberFloat, other.testNumberFloat) && Objects.equals(testEnum, other.testEnum) && Objects.equals(testArrayOfIntegers, other.testArrayOfIntegers) && Objects.equals(testArrayOfArrayOfIntegers, other.testArrayOfArrayOfIntegers) && Objects.equals(testArrayOfObjects, other.testArrayOfObjects) && Objects.equals(testArrayOfEnum, other.testArrayOfEnum) ; } @Override public int hashCode() { - return Objects.hash(accountSid, sid, testString, testInteger, testObject, testDateTime, testNumber, priceUnit, testNumberFloat, testEnum, testArrayOfIntegers, testArrayOfArrayOfIntegers, testArrayOfObjects, testArrayOfEnum, xTwilioWebhookEnabled, status); + return Objects.hash(accountSid, sid, testString, testInteger, testObject, testDateTime, testNumber, priceUnit, testNumberFloat, testEnum, testArrayOfIntegers, testArrayOfArrayOfIntegers, testArrayOfObjects, testArrayOfEnum); } } diff --git a/examples/java/src/main/java/com/twilio/rest/api/v2010/account/call/FeedbackCallSummary.java b/examples/java/src/main/java/com/twilio/rest/api/v2010/account/call/FeedbackCallSummary.java index b9d4bb953..daf9c922e 100644 --- a/examples/java/src/main/java/com/twilio/rest/api/v2010/account/call/FeedbackCallSummary.java +++ b/examples/java/src/main/java/com/twilio/rest/api/v2010/account/call/FeedbackCallSummary.java @@ -67,11 +67,12 @@ import com.twilio.type.OutboundSmsPrice; import com.twilio.type.OutboundCallPrice; import com.twilio.type.RecordingRule; +import com.twilio.type.SubscribeRule; @JsonIgnoreProperties(ignoreUnknown = true) @ToString public class FeedbackCallSummary extends Resource { - private static final long serialVersionUID = 157497464051388L; + private static final long serialVersionUID = 193205363285633L; public static FeedbackCallSummaryCreator creator(final LocalDate endDate, final LocalDate startDate){ return new FeedbackCallSummaryCreator(endDate, startDate); @@ -120,44 +121,6 @@ public static FeedbackCallSummary fromJson(final InputStream json, final ObjectM throw new ApiConnectionException(e.getMessage(), e); } } - public enum TestEnum { - DIALVERB("DialVerb"), - TRUNKING("Trunking"); - - private final String value; - - private TestEnum(final String value) { - this.value = value; - } - - public String toString() { - return value; - } - - @JsonCreator - public static TestEnum forValue(final String value) { - return Promoter.enumFromString(value, TestEnum.values()); - } - } - public enum XTwilioWebhookEnabled { - TRUE("true"), - FALSE("false"); - - private final String value; - - private XTwilioWebhookEnabled(final String value) { - this.value = value; - } - - public String toString() { - return value; - } - - @JsonCreator - public static XTwilioWebhookEnabled forValue(final String value) { - return Promoter.enumFromString(value, XTwilioWebhookEnabled.values()); - } - } public enum Status { IN_PROGRESS("in-progress"), PAUSED("paused"), @@ -191,13 +154,11 @@ public static Status forValue(final String value) { private final BigDecimal testNumber; private final Currency priceUnit; private final Float testNumberFloat; - private final FeedbackCallSummary.TestEnum testEnum; + private final FeedbackCallSummary.Status testEnum; private final List testArrayOfIntegers; private final List> testArrayOfArrayOfIntegers; private final List testArrayOfObjects; - private final List testArrayOfEnum; - private final FeedbackCallSummary.XTwilioWebhookEnabled xTwilioWebhookEnabled; - private final FeedbackCallSummary.Status status; + private final List testArrayOfEnum; @JsonCreator private FeedbackCallSummary( @@ -230,7 +191,7 @@ private FeedbackCallSummary( final Float testNumberFloat, @JsonProperty("test_enum") - final FeedbackCallSummary.TestEnum testEnum, + final FeedbackCallSummary.Status testEnum, @JsonProperty("test_array_of_integers") final List testArrayOfIntegers, @@ -242,13 +203,7 @@ private FeedbackCallSummary( final List testArrayOfObjects, @JsonProperty("test_array_of_enum") - final List testArrayOfEnum, - - @JsonProperty("x_twilio_webhook_enabled") - final FeedbackCallSummary.XTwilioWebhookEnabled xTwilioWebhookEnabled, - - @JsonProperty("status") - final FeedbackCallSummary.Status status + final List testArrayOfEnum ) { this.accountSid = accountSid; this.sid = sid; @@ -264,8 +219,6 @@ private FeedbackCallSummary( this.testArrayOfArrayOfIntegers = testArrayOfArrayOfIntegers; this.testArrayOfObjects = testArrayOfObjects; this.testArrayOfEnum = testArrayOfEnum; - this.xTwilioWebhookEnabled = xTwilioWebhookEnabled; - this.status = status; } public final String getAccountSid() { @@ -295,7 +248,7 @@ public final Currency getPriceUnit() { public final Float getTestNumberFloat() { return this.testNumberFloat; } - public final FeedbackCallSummary.TestEnum getTestEnum() { + public final FeedbackCallSummary.Status getTestEnum() { return this.testEnum; } public final List getTestArrayOfIntegers() { @@ -307,15 +260,9 @@ public final List> getTestArrayOfArrayOfIntegers() { public final List getTestArrayOfObjects() { return this.testArrayOfObjects; } - public final List getTestArrayOfEnum() { + public final List getTestArrayOfEnum() { return this.testArrayOfEnum; } - public final FeedbackCallSummary.XTwilioWebhookEnabled getXTwilioWebhookEnabled() { - return this.xTwilioWebhookEnabled; - } - public final FeedbackCallSummary.Status getStatus() { - return this.status; - } @Override public boolean equals(final Object o) { @@ -329,12 +276,12 @@ public boolean equals(final Object o) { FeedbackCallSummary other = (FeedbackCallSummary) o; - return Objects.equals(accountSid, other.accountSid) && Objects.equals(sid, other.sid) && Objects.equals(testString, other.testString) && Objects.equals(testInteger, other.testInteger) && Objects.equals(testObject, other.testObject) && Objects.equals(testDateTime, other.testDateTime) && Objects.equals(testNumber, other.testNumber) && Objects.equals(priceUnit, other.priceUnit) && Objects.equals(testNumberFloat, other.testNumberFloat) && Objects.equals(testEnum, other.testEnum) && Objects.equals(testArrayOfIntegers, other.testArrayOfIntegers) && Objects.equals(testArrayOfArrayOfIntegers, other.testArrayOfArrayOfIntegers) && Objects.equals(testArrayOfObjects, other.testArrayOfObjects) && Objects.equals(testArrayOfEnum, other.testArrayOfEnum) && Objects.equals(xTwilioWebhookEnabled, other.xTwilioWebhookEnabled) && Objects.equals(status, other.status) ; + return Objects.equals(accountSid, other.accountSid) && Objects.equals(sid, other.sid) && Objects.equals(testString, other.testString) && Objects.equals(testInteger, other.testInteger) && Objects.equals(testObject, other.testObject) && Objects.equals(testDateTime, other.testDateTime) && Objects.equals(testNumber, other.testNumber) && Objects.equals(priceUnit, other.priceUnit) && Objects.equals(testNumberFloat, other.testNumberFloat) && Objects.equals(testEnum, other.testEnum) && Objects.equals(testArrayOfIntegers, other.testArrayOfIntegers) && Objects.equals(testArrayOfArrayOfIntegers, other.testArrayOfArrayOfIntegers) && Objects.equals(testArrayOfObjects, other.testArrayOfObjects) && Objects.equals(testArrayOfEnum, other.testArrayOfEnum) ; } @Override public int hashCode() { - return Objects.hash(accountSid, sid, testString, testInteger, testObject, testDateTime, testNumber, priceUnit, testNumberFloat, testEnum, testArrayOfIntegers, testArrayOfArrayOfIntegers, testArrayOfObjects, testArrayOfEnum, xTwilioWebhookEnabled, status); + return Objects.hash(accountSid, sid, testString, testInteger, testObject, testDateTime, testNumber, priceUnit, testNumberFloat, testEnum, testArrayOfIntegers, testArrayOfArrayOfIntegers, testArrayOfObjects, testArrayOfEnum); } } diff --git a/examples/java/src/main/java/com/twilio/rest/api/v2010/credential/Aws.java b/examples/java/src/main/java/com/twilio/rest/api/v2010/credential/Aws.java index a4354791e..519d3528d 100644 --- a/examples/java/src/main/java/com/twilio/rest/api/v2010/credential/Aws.java +++ b/examples/java/src/main/java/com/twilio/rest/api/v2010/credential/Aws.java @@ -67,11 +67,12 @@ import com.twilio.type.OutboundSmsPrice; import com.twilio.type.OutboundCallPrice; import com.twilio.type.RecordingRule; +import com.twilio.type.SubscribeRule; @JsonIgnoreProperties(ignoreUnknown = true) @ToString public class Aws extends Resource { - private static final long serialVersionUID = 185329949738742L; + private static final long serialVersionUID = 91236299650619L; public static AwsFetcher fetcher(final String sid){ @@ -126,44 +127,6 @@ public static Aws fromJson(final InputStream json, final ObjectMapper objectMapp throw new ApiConnectionException(e.getMessage(), e); } } - public enum TestEnum { - DIALVERB("DialVerb"), - TRUNKING("Trunking"); - - private final String value; - - private TestEnum(final String value) { - this.value = value; - } - - public String toString() { - return value; - } - - @JsonCreator - public static TestEnum forValue(final String value) { - return Promoter.enumFromString(value, TestEnum.values()); - } - } - public enum XTwilioWebhookEnabled { - TRUE("true"), - FALSE("false"); - - private final String value; - - private XTwilioWebhookEnabled(final String value) { - this.value = value; - } - - public String toString() { - return value; - } - - @JsonCreator - public static XTwilioWebhookEnabled forValue(final String value) { - return Promoter.enumFromString(value, XTwilioWebhookEnabled.values()); - } - } public enum Status { IN_PROGRESS("in-progress"), PAUSED("paused"), @@ -197,13 +160,11 @@ public static Status forValue(final String value) { private final BigDecimal testNumber; private final Currency priceUnit; private final Float testNumberFloat; - private final Aws.TestEnum testEnum; + private final Aws.Status testEnum; private final List testArrayOfIntegers; private final List> testArrayOfArrayOfIntegers; private final List testArrayOfObjects; - private final List testArrayOfEnum; - private final Aws.XTwilioWebhookEnabled xTwilioWebhookEnabled; - private final Aws.Status status; + private final List testArrayOfEnum; @JsonCreator private Aws( @@ -236,7 +197,7 @@ private Aws( final Float testNumberFloat, @JsonProperty("test_enum") - final Aws.TestEnum testEnum, + final Aws.Status testEnum, @JsonProperty("test_array_of_integers") final List testArrayOfIntegers, @@ -248,13 +209,7 @@ private Aws( final List testArrayOfObjects, @JsonProperty("test_array_of_enum") - final List testArrayOfEnum, - - @JsonProperty("x_twilio_webhook_enabled") - final Aws.XTwilioWebhookEnabled xTwilioWebhookEnabled, - - @JsonProperty("status") - final Aws.Status status + final List testArrayOfEnum ) { this.accountSid = accountSid; this.sid = sid; @@ -270,8 +225,6 @@ private Aws( this.testArrayOfArrayOfIntegers = testArrayOfArrayOfIntegers; this.testArrayOfObjects = testArrayOfObjects; this.testArrayOfEnum = testArrayOfEnum; - this.xTwilioWebhookEnabled = xTwilioWebhookEnabled; - this.status = status; } public final String getAccountSid() { @@ -301,7 +254,7 @@ public final Currency getPriceUnit() { public final Float getTestNumberFloat() { return this.testNumberFloat; } - public final Aws.TestEnum getTestEnum() { + public final Aws.Status getTestEnum() { return this.testEnum; } public final List getTestArrayOfIntegers() { @@ -313,15 +266,9 @@ public final List> getTestArrayOfArrayOfIntegers() { public final List getTestArrayOfObjects() { return this.testArrayOfObjects; } - public final List getTestArrayOfEnum() { + public final List getTestArrayOfEnum() { return this.testArrayOfEnum; } - public final Aws.XTwilioWebhookEnabled getXTwilioWebhookEnabled() { - return this.xTwilioWebhookEnabled; - } - public final Aws.Status getStatus() { - return this.status; - } @Override public boolean equals(final Object o) { @@ -335,12 +282,12 @@ public boolean equals(final Object o) { Aws other = (Aws) o; - return Objects.equals(accountSid, other.accountSid) && Objects.equals(sid, other.sid) && Objects.equals(testString, other.testString) && Objects.equals(testInteger, other.testInteger) && Objects.equals(testObject, other.testObject) && Objects.equals(testDateTime, other.testDateTime) && Objects.equals(testNumber, other.testNumber) && Objects.equals(priceUnit, other.priceUnit) && Objects.equals(testNumberFloat, other.testNumberFloat) && Objects.equals(testEnum, other.testEnum) && Objects.equals(testArrayOfIntegers, other.testArrayOfIntegers) && Objects.equals(testArrayOfArrayOfIntegers, other.testArrayOfArrayOfIntegers) && Objects.equals(testArrayOfObjects, other.testArrayOfObjects) && Objects.equals(testArrayOfEnum, other.testArrayOfEnum) && Objects.equals(xTwilioWebhookEnabled, other.xTwilioWebhookEnabled) && Objects.equals(status, other.status) ; + return Objects.equals(accountSid, other.accountSid) && Objects.equals(sid, other.sid) && Objects.equals(testString, other.testString) && Objects.equals(testInteger, other.testInteger) && Objects.equals(testObject, other.testObject) && Objects.equals(testDateTime, other.testDateTime) && Objects.equals(testNumber, other.testNumber) && Objects.equals(priceUnit, other.priceUnit) && Objects.equals(testNumberFloat, other.testNumberFloat) && Objects.equals(testEnum, other.testEnum) && Objects.equals(testArrayOfIntegers, other.testArrayOfIntegers) && Objects.equals(testArrayOfArrayOfIntegers, other.testArrayOfArrayOfIntegers) && Objects.equals(testArrayOfObjects, other.testArrayOfObjects) && Objects.equals(testArrayOfEnum, other.testArrayOfEnum) ; } @Override public int hashCode() { - return Objects.hash(accountSid, sid, testString, testInteger, testObject, testDateTime, testNumber, priceUnit, testNumberFloat, testEnum, testArrayOfIntegers, testArrayOfArrayOfIntegers, testArrayOfObjects, testArrayOfEnum, xTwilioWebhookEnabled, status); + return Objects.hash(accountSid, sid, testString, testInteger, testObject, testDateTime, testNumber, priceUnit, testNumberFloat, testEnum, testArrayOfIntegers, testArrayOfArrayOfIntegers, testArrayOfObjects, testArrayOfEnum); } } diff --git a/examples/java/src/main/java/com/twilio/rest/api/v2010/credential/NewCredentials.java b/examples/java/src/main/java/com/twilio/rest/api/v2010/credential/NewCredentials.java index 208a15ae6..995d048b4 100644 --- a/examples/java/src/main/java/com/twilio/rest/api/v2010/credential/NewCredentials.java +++ b/examples/java/src/main/java/com/twilio/rest/api/v2010/credential/NewCredentials.java @@ -67,11 +67,12 @@ import com.twilio.type.OutboundSmsPrice; import com.twilio.type.OutboundCallPrice; import com.twilio.type.RecordingRule; +import com.twilio.type.SubscribeRule; @JsonIgnoreProperties(ignoreUnknown = true) @ToString public class NewCredentials extends Resource { - private static final long serialVersionUID = 185329949738742L; + private static final long serialVersionUID = 91236299650619L; public static NewCredentialsCreator creator(final String testString, final Integer testInteger, final Float testNumberFloat){ return new NewCredentialsCreator(testString, testInteger, testNumberFloat); @@ -126,32 +127,13 @@ public static NewCredentials fromJson(final InputStream json, final ObjectMapper throw new ApiConnectionException(e.getMessage(), e); } } - public enum TestEnum { - DIALVERB("DialVerb"), - TRUNKING("Trunking"); - - private final String value; - - private TestEnum(final String value) { - this.value = value; - } - - public String toString() { - return value; - } - - @JsonCreator - public static TestEnum forValue(final String value) { - return Promoter.enumFromString(value, TestEnum.values()); - } - } - public enum XTwilioWebhookEnabled { - TRUE("true"), - FALSE("false"); + public enum Permissions { + GET_ALL("get-all"), + POST_ALL("post-all"); private final String value; - private XTwilioWebhookEnabled(final String value) { + private Permissions(final String value) { this.value = value; } @@ -160,8 +142,8 @@ public String toString() { } @JsonCreator - public static XTwilioWebhookEnabled forValue(final String value) { - return Promoter.enumFromString(value, XTwilioWebhookEnabled.values()); + public static Permissions forValue(final String value) { + return Promoter.enumFromString(value, Permissions.values()); } } public enum Status { @@ -187,25 +169,6 @@ public static Status forValue(final String value) { return Promoter.enumFromString(value, Status.values()); } } - public enum Permissions { - GET_ALL("get-all"), - POST_ALL("post-all"); - - private final String value; - - private Permissions(final String value) { - this.value = value; - } - - public String toString() { - return value; - } - - @JsonCreator - public static Permissions forValue(final String value) { - return Promoter.enumFromString(value, Permissions.values()); - } - } private final String accountSid; private final String sid; @@ -216,14 +179,11 @@ public static Permissions forValue(final String value) { private final BigDecimal testNumber; private final Currency priceUnit; private final Float testNumberFloat; - private final NewCredentials.TestEnum testEnum; + private final NewCredentials.Status testEnum; private final List testArrayOfIntegers; private final List> testArrayOfArrayOfIntegers; private final List testArrayOfObjects; - private final List testArrayOfEnum; - private final NewCredentials.XTwilioWebhookEnabled xTwilioWebhookEnabled; - private final NewCredentials.Status status; - private final NewCredentials.Permissions permissions; + private final List testArrayOfEnum; @JsonCreator private NewCredentials( @@ -256,7 +216,7 @@ private NewCredentials( final Float testNumberFloat, @JsonProperty("test_enum") - final NewCredentials.TestEnum testEnum, + final NewCredentials.Status testEnum, @JsonProperty("test_array_of_integers") final List testArrayOfIntegers, @@ -268,16 +228,7 @@ private NewCredentials( final List testArrayOfObjects, @JsonProperty("test_array_of_enum") - final List testArrayOfEnum, - - @JsonProperty("x_twilio_webhook_enabled") - final NewCredentials.XTwilioWebhookEnabled xTwilioWebhookEnabled, - - @JsonProperty("status") - final NewCredentials.Status status, - - @JsonProperty("permissions") - final NewCredentials.Permissions permissions + final List testArrayOfEnum ) { this.accountSid = accountSid; this.sid = sid; @@ -293,9 +244,6 @@ private NewCredentials( this.testArrayOfArrayOfIntegers = testArrayOfArrayOfIntegers; this.testArrayOfObjects = testArrayOfObjects; this.testArrayOfEnum = testArrayOfEnum; - this.xTwilioWebhookEnabled = xTwilioWebhookEnabled; - this.status = status; - this.permissions = permissions; } public final String getAccountSid() { @@ -325,7 +273,7 @@ public final Currency getPriceUnit() { public final Float getTestNumberFloat() { return this.testNumberFloat; } - public final NewCredentials.TestEnum getTestEnum() { + public final NewCredentials.Status getTestEnum() { return this.testEnum; } public final List getTestArrayOfIntegers() { @@ -337,18 +285,9 @@ public final List> getTestArrayOfArrayOfIntegers() { public final List getTestArrayOfObjects() { return this.testArrayOfObjects; } - public final List getTestArrayOfEnum() { + public final List getTestArrayOfEnum() { return this.testArrayOfEnum; } - public final NewCredentials.XTwilioWebhookEnabled getXTwilioWebhookEnabled() { - return this.xTwilioWebhookEnabled; - } - public final NewCredentials.Status getStatus() { - return this.status; - } - public final NewCredentials.Permissions getPermissions() { - return this.permissions; - } @Override public boolean equals(final Object o) { @@ -362,12 +301,12 @@ public boolean equals(final Object o) { NewCredentials other = (NewCredentials) o; - return Objects.equals(accountSid, other.accountSid) && Objects.equals(sid, other.sid) && Objects.equals(testString, other.testString) && Objects.equals(testInteger, other.testInteger) && Objects.equals(testObject, other.testObject) && Objects.equals(testDateTime, other.testDateTime) && Objects.equals(testNumber, other.testNumber) && Objects.equals(priceUnit, other.priceUnit) && Objects.equals(testNumberFloat, other.testNumberFloat) && Objects.equals(testEnum, other.testEnum) && Objects.equals(testArrayOfIntegers, other.testArrayOfIntegers) && Objects.equals(testArrayOfArrayOfIntegers, other.testArrayOfArrayOfIntegers) && Objects.equals(testArrayOfObjects, other.testArrayOfObjects) && Objects.equals(testArrayOfEnum, other.testArrayOfEnum) && Objects.equals(xTwilioWebhookEnabled, other.xTwilioWebhookEnabled) && Objects.equals(status, other.status) && Objects.equals(permissions, other.permissions) ; + return Objects.equals(accountSid, other.accountSid) && Objects.equals(sid, other.sid) && Objects.equals(testString, other.testString) && Objects.equals(testInteger, other.testInteger) && Objects.equals(testObject, other.testObject) && Objects.equals(testDateTime, other.testDateTime) && Objects.equals(testNumber, other.testNumber) && Objects.equals(priceUnit, other.priceUnit) && Objects.equals(testNumberFloat, other.testNumberFloat) && Objects.equals(testEnum, other.testEnum) && Objects.equals(testArrayOfIntegers, other.testArrayOfIntegers) && Objects.equals(testArrayOfArrayOfIntegers, other.testArrayOfArrayOfIntegers) && Objects.equals(testArrayOfObjects, other.testArrayOfObjects) && Objects.equals(testArrayOfEnum, other.testArrayOfEnum) ; } @Override public int hashCode() { - return Objects.hash(accountSid, sid, testString, testInteger, testObject, testDateTime, testNumber, priceUnit, testNumberFloat, testEnum, testArrayOfIntegers, testArrayOfArrayOfIntegers, testArrayOfObjects, testArrayOfEnum, xTwilioWebhookEnabled, status, permissions); + return Objects.hash(accountSid, sid, testString, testInteger, testObject, testDateTime, testNumber, priceUnit, testNumberFloat, testEnum, testArrayOfIntegers, testArrayOfArrayOfIntegers, testArrayOfObjects, testArrayOfEnum); } } diff --git a/examples/java/src/main/java/com/twilio/rest/api/v2010/credential/NewCredentialsCreator.java b/examples/java/src/main/java/com/twilio/rest/api/v2010/credential/NewCredentialsCreator.java index fae9e6789..363ae468e 100644 --- a/examples/java/src/main/java/com/twilio/rest/api/v2010/credential/NewCredentialsCreator.java +++ b/examples/java/src/main/java/com/twilio/rest/api/v2010/credential/NewCredentialsCreator.java @@ -72,7 +72,7 @@ public class NewCredentialsCreator extends Creator{ private Map testObject; private ZonedDateTime testDateTime; private LocalDate testDate; - private NewCredentials.TestEnum testEnum; + private NewCredentials.Status testEnum; private List testObjectArray; private Map testAnyType; private List permissions; @@ -142,7 +142,7 @@ public NewCredentialsCreator setTestDate(final LocalDate testDate){ this.testDate = testDate; return this; } - public NewCredentialsCreator setTestEnum(final NewCredentials.TestEnum testEnum){ + public NewCredentialsCreator setTestEnum(final NewCredentials.Status testEnum){ this.testEnum = testEnum; return this; } diff --git a/examples/java/unit-test/rest/TwilioRestTest.java b/examples/java/unit-test/rest/TwilioRestTest.java index 97ad62fce..7a64a7bc1 100644 --- a/examples/java/unit-test/rest/TwilioRestTest.java +++ b/examples/java/unit-test/rest/TwilioRestTest.java @@ -434,7 +434,7 @@ public void testObjectArrayTypeParamNullResponseNewCredentialsCreator() { permissions.add(NewCredentials.Permissions.GET_ALL); permissions.add(NewCredentials.Permissions.POST_ALL); credentialsCreator.setPermissions( permissions); - credentialsCreator.setTestEnum(NewCredentials.TestEnum.DIALVERB); + credentialsCreator.setTestEnum(NewCredentials.Status.PAUSED); LocalDate localDate = LocalDate.now(); ZonedDateTime zonedDateTime = ZonedDateTime.now(); credentialsCreator.setTestDate(localDate); @@ -952,11 +952,9 @@ public void testAccountCrud() { @Test public void testAccountVariables() { - Account.TestEnum testEnum = Account.TestEnum.forValue("DialVerb"); Account.XTwilioWebhookEnabled xTwilioWebhookEnabled = Account.XTwilioWebhookEnabled.forValue("true"); Account.Status status = Account.Status.forValue("paused"); - assertEquals("DialVerb", testEnum.toString()); assertEquals("true", xTwilioWebhookEnabled.toString()); assertEquals("paused", status.toString()); } @@ -1043,8 +1041,8 @@ public void testAccountObjectCreationInvalidInputStream() { @Test public void testCallGetters() { ObjectMapper objectMapper = new ObjectMapper(); - String json = "{\"accountSid\": \"a123\", \"sid\": \"123\", \"testInteger\": 123, \"testNumber\": 123.1, \"testNumberFloat\": 123.2, \"testEnum\": \"Trunking\"}"; - String jsonDuplicate = "{\"accountSid\": \"a123\", \"sid\": \"123\", \"testInteger\": 123, \"testNumber\": 123.1, \"testNumberFloat\": 123.2, \"testEnum\": \"Trunking\"}"; + String json = "{\"accountSid\": \"a123\", \"sid\": \"123\", \"testInteger\": 123, \"testNumber\": 123.1, \"testNumberFloat\": 123.2, \"testEnum\": \"paused\"}"; + String jsonDuplicate = "{\"accountSid\": \"a123\", \"sid\": \"123\", \"testInteger\": 123, \"testNumber\": 123.1, \"testNumberFloat\": 123.2, \"testEnum\": \"paused\"}"; Call call = Call.fromJson(json, objectMapper); Call callDuplicate = Call.fromJson(jsonDuplicate, objectMapper); @@ -1056,7 +1054,7 @@ public void testCallGetters() { assertEquals(BigDecimal.valueOf(123.1), call.getTestNumber()); assertNull(call.getPriceUnit()); assertEquals(Float.valueOf("123.2"), call.getTestNumberFloat()); - assertEquals("Trunking", call.getTestEnum().toString()); + assertEquals("paused", call.getTestEnum().toString()); assertNull(call.getTestArrayOfIntegers()); assertNull(call.getTestArrayOfArrayOfIntegers()); assertNull(call.getTestArrayOfObjects()); @@ -1072,10 +1070,10 @@ public void testCallGetters() { @Test public void testAwsGetters() { ObjectMapper objectMapper = new ObjectMapper(); - String json = "{\"accountSid\": \"a123\", \"sid\": \"123\", \"testInteger\": 123, \"testNumber\": 123.1, \"testNumberFloat\": 123.2, \"testEnum\": \"Trunking\", " + - "\"testEnum\": \"Trunking\"}"; - String jsonDuplicate = "{\"accountSid\": \"a123\", \"sid\": \"123\", \"testInteger\": 123, \"testNumber\": 123.1, \"testNumberFloat\": 123.2, \"testEnum\": \"Trunking\", " + - "\"testEnum\": \"Trunking\"}"; + String json = "{\"accountSid\": \"a123\", \"sid\": \"123\", \"testInteger\": 123, \"testNumber\": 123.1, \"testNumberFloat\": 123.2, " + + "\"testEnum\": \"paused\"}"; + String jsonDuplicate = "{\"accountSid\": \"a123\", \"sid\": \"123\", \"testInteger\": 123, \"testNumber\": 123.1, \"testNumberFloat\": 123.2, " + + "\"testEnum\": \"paused\"}"; Aws aws = Aws.fromJson(json, objectMapper); Aws awsDuplicate = Aws.fromJson(jsonDuplicate, objectMapper); @@ -1087,7 +1085,7 @@ public void testAwsGetters() { assertEquals(BigDecimal.valueOf(123.1), aws.getTestNumber()); assertNull(aws.getPriceUnit()); assertEquals(Float.valueOf("123.2"), aws.getTestNumberFloat()); - assertEquals("Trunking", aws.getTestEnum().toString()); + assertEquals(Aws.Status.PAUSED.toString(), aws.getTestEnum().toString()); assertNull(aws.getTestArrayOfIntegers()); assertNull(aws.getTestArrayOfArrayOfIntegers()); assertNull(aws.getTestArrayOfObjects()); @@ -1103,8 +1101,8 @@ public void testAwsGetters() { @Test public void testNewCredentialsGetters() { final ObjectMapper objectMapper = new ObjectMapper(); - final String json = "{\"accountSid\": \"a123\", \"sid\": \"123\", \"testInteger\": 123, \"testNumber\": 123.1, \"testNumberFloat\": 123.2, \"testEnum\": \"Trunking\", " + - "\"testEnum\": \"Trunking\"}"; + final String json = "{\"accountSid\": \"a123\", \"sid\": \"123\", \"testInteger\": 123, \"testNumber\": 123.1, \"testNumberFloat\": 123.2, \"testEnum\": \"paused\", " + + "\"testEnum\": \"paused\"}"; final NewCredentials credentials = NewCredentials.fromJson(json, objectMapper); final NewCredentials credentialsDuplicate = NewCredentials.fromJson(json, objectMapper); @@ -1117,7 +1115,7 @@ public void testNewCredentialsGetters() { assertEquals(BigDecimal.valueOf(123.1), credentials.getTestNumber()); assertNull(credentials.getPriceUnit()); assertEquals(Float.valueOf("123.2"), credentials.getTestNumberFloat()); - assertEquals("Trunking", credentials.getTestEnum().toString()); + assertEquals("paused", credentials.getTestEnum().toString()); assertNull(credentials.getTestArrayOfIntegers()); assertNull(credentials.getTestArrayOfArrayOfIntegers()); assertNull(credentials.getTestArrayOfObjects()); @@ -1131,10 +1129,8 @@ public void testNewCredentialsGetters() { @Test public void testAccountGetters() { ObjectMapper objectMapper = new ObjectMapper(); - String json = "{\"accountSid\": \"a123\", \"sid\": \"123\", \"testInteger\": 123, \"testNumber\": 123.1, \"testNumberFloat\": 123.2, \"testEnum\": \"Trunking\", " + - "\"testEnum\": \"Trunking\"}"; - String jsonDuplicate = "{\"accountSid\": \"a123\", \"sid\": \"123\", \"testInteger\": 123, \"testNumber\": 123.1, \"testNumberFloat\": 123.2, \"testEnum\": \"Trunking\", " + - "\"testEnum\": \"Trunking\"}"; + String json = "{\"accountSid\": \"a123\", \"sid\": \"123\", \"testInteger\": 123, \"testNumber\": 123.1, \"testNumberFloat\": 123.2, \"testEnum\": \"paused\"}"; + String jsonDuplicate = "{\"accountSid\": \"a123\", \"sid\": \"123\", \"testInteger\": 123, \"testNumber\": 123.1, \"testNumberFloat\": 123.2, \"testEnum\": \"paused\"}"; Account account = Account.fromJson(json, objectMapper); Account accountDuplicate = Account.fromJson(jsonDuplicate, objectMapper); @@ -1146,7 +1142,7 @@ public void testAccountGetters() { assertEquals(BigDecimal.valueOf(123.1), account.getTestNumber()); assertNull(account.getPriceUnit()); assertEquals(Float.valueOf("123.2"), account.getTestNumberFloat()); - assertEquals("Trunking", account.getTestEnum().toString()); + assertEquals(Account.Status.PAUSED.toString(), account.getTestEnum().toString()); assertNull(account.getTestArrayOfIntegers()); assertNull(account.getTestArrayOfArrayOfIntegers()); assertNull(account.getTestArrayOfObjects()); @@ -1291,10 +1287,8 @@ public void testFeedbackCallSummaryObjectCreationResponseNotSuccess() { @Test public void testFeedbackCallSummaryObjectCreationFromString() { - String json = "{\"accountSid\": \"a123\", \"sid\": \"123\", \"testInteger\": 123, \"testNumber\": 123.1, \"testNumberFloat\": 123.2, \"testEnum\": \"Trunking\", " + - "\"status\": \"paused\"}"; - String jsonDuplicate = "{\"accountSid\": \"a123\", \"sid\": \"123\", \"testInteger\": 123, \"testNumber\": 123.1, \"testNumberFloat\": 123.2, \"testEnum\": \"Trunking\", " + - "\"status\": \"paused\"}"; + String json = "{\"accountSid\": \"a123\", \"sid\": \"123\", \"testInteger\": 123, \"testNumber\": 123.1, \"testNumberFloat\": 123.2, \"testEnum\": \"paused\"}"; + String jsonDuplicate = "{\"accountSid\": \"a123\", \"sid\": \"123\", \"testInteger\": 123, \"testNumber\": 123.1, \"testNumberFloat\": 123.2, \"testEnum\": \"paused\"}"; ObjectMapper objectMapper = new ObjectMapper(); FeedbackCallSummary feedbackCallSummary = FeedbackCallSummary.fromJson(json, objectMapper); @@ -1308,7 +1302,7 @@ public void testFeedbackCallSummaryObjectCreationFromString() { assertEquals(BigDecimal.valueOf(123.1), feedbackCallSummary.getTestNumber()); assertNull(feedbackCallSummary.getPriceUnit()); assertEquals(Float.valueOf("123.2"), feedbackCallSummary.getTestNumberFloat()); - assertEquals("Trunking", feedbackCallSummary.getTestEnum().toString()); + assertEquals(FeedbackCallSummary.Status.PAUSED.toString(), feedbackCallSummary.getTestEnum().toString()); assertNull(feedbackCallSummary.getTestArrayOfIntegers()); assertNull(feedbackCallSummary.getTestArrayOfArrayOfIntegers()); assertNull(feedbackCallSummary.getTestArrayOfObjects()); diff --git a/examples/twilio_api_v2010.yaml b/examples/twilio_api_v2010.yaml index 604901477..75a6c9517 100644 --- a/examples/twilio_api_v2010.yaml +++ b/examples/twilio_api_v2010.yaml @@ -1,10 +1,5 @@ components: schemas: - test_enum_permission: - enum: - - get-all - - post-all - type: string test_enum_status: enum: - in-progress @@ -14,17 +9,6 @@ components: - completed - absent type: string - recording_enum_source: - enum: - - DialVerb - - Trunking - type: string - payments_enum_bank_account_type: - enum: - - consumer-checking - - consumer-savings - - commercial-checking - type: string test.response_object: properties: account_sid: @@ -70,7 +54,7 @@ components: type: number format: float test_enum: - $ref: '#/components/schemas/recording_enum_source' + $ref: '#/components/schemas/test_enum_status' nullable: true type: string test_array_of_integers: @@ -97,7 +81,7 @@ components: test_array_of_enum: description: Permissions authorized to the app items: - $ref: '#/components/schemas/test_enum_permission' + $ref: '#/components/schemas/test_enum_status' type: string nullable: true type: array @@ -241,7 +225,7 @@ paths: type: string format: date TestEnum: - $ref: '#/components/schemas/payments_enum_bank_account_type' + $ref: '#/components/schemas/test_enum_status' type: string TestObjectArray: items: From 7aa3cfbef51869892cdfa2046b063005afa7f270 Mon Sep 17 00:00:00 2001 From: kridai Date: Thu, 14 Jul 2022 13:24:52 +0530 Subject: [PATCH 6/8] fix: fixed failing test --- examples/go/go-client/helper/rest/api/v2010/api_test.go | 4 ++-- examples/twilio_api_v2010.yaml | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/examples/go/go-client/helper/rest/api/v2010/api_test.go b/examples/go/go-client/helper/rest/api/v2010/api_test.go index 043511d06..2dad8792c 100644 --- a/examples/go/go-client/helper/rest/api/v2010/api_test.go +++ b/examples/go/go-client/helper/rest/api/v2010/api_test.go @@ -47,7 +47,7 @@ func TestPost(t *testing.T) { params.SetTestNumberInt64(222) params.SetTestDateTime(time.Now()) params.SetTestDate("2022-01-01") - params.SetTestEnum("consumer-checking") + params.SetTestEnum("completed") // "Any" type should expect any type of value. We'll test with an array of maps, but any type should work. params.SetTestAnyType([]map[string]interface{}{{ @@ -116,7 +116,7 @@ func TestCustomHeaders(t *testing.T) { assert.Nil(t, err) assert.NotNil(t, resp) assert.Equal(t, float32(100.22), *resp.TestNumberFloat) - assert.Equal(t, "Trunking", *resp.TestEnum) + assert.Equal(t, "completed", *resp.TestEnum) } func TestRequiredParameters(t *testing.T) { diff --git a/examples/twilio_api_v2010.yaml b/examples/twilio_api_v2010.yaml index 75a6c9517..f61e28616 100644 --- a/examples/twilio_api_v2010.yaml +++ b/examples/twilio_api_v2010.yaml @@ -97,7 +97,7 @@ components: sms: true voice: true test_number_float: 100.22 - test_enum: "Trunking" + test_enum: "completed" securitySchemes: accountSid_authToken: scheme: basic From daab93853b5b0407bebe973b6ae303a12afc8714 Mon Sep 17 00:00:00 2001 From: kridai Date: Thu, 14 Jul 2022 18:56:06 +0530 Subject: [PATCH 7/8] fix: adding node example files --- examples/node/lib/rest/api/v2010/accounts.ts | 9 ++++----- examples/node/lib/rest/api/v2010/accounts/calls.ts | 5 ++--- .../api/v2010/accounts/calls/feedbackSummary.ts | 14 ++++++++++---- .../node/lib/rest/api/v2010/credentials/aWS.ts | 9 ++++----- 4 files changed, 20 insertions(+), 17 deletions(-) diff --git a/examples/node/lib/rest/api/v2010/accounts.ts b/examples/node/lib/rest/api/v2010/accounts.ts index f08e1ffc6..1a871df12 100644 --- a/examples/node/lib/rest/api/v2010/accounts.ts +++ b/examples/node/lib/rest/api/v2010/accounts.ts @@ -21,11 +21,11 @@ import { CallListInstance } from './Accounts/Calls'; /** * Options to pass to update a AccountInstance * - * @property { string } status + * @property { TestEnumStatus } status * @property { string } [pauseBehavior] */ export interface AccountContextUpdateOptions { - status: string; + status: TestEnumStatus; pauseBehavior?: string; } @@ -194,7 +194,6 @@ export class AccountContextImpl implements AccountContext { } } -export type AccountTestEnum = 'DialVerb'|'Trunking'; interface AccountPayload extends AccountResource, Page.TwilioResponsePayload { } @@ -209,7 +208,7 @@ interface AccountResource { test_number?: number | null; price_unit?: string | null; test_number_float?: number | null; - test_enum?: AccountTestEnum; + test_enum?: object; test_array_of_integers?: Array; test_array_of_array_of_integers?: Array>; test_array_of_objects?: Array | null; @@ -248,7 +247,7 @@ export class AccountInstance { testNumber?: number | null; priceUnit?: string | null; testNumberFloat?: number | null; - testEnum?: AccountTestEnum; + testEnum?: object; testArrayOfIntegers?: Array; testArrayOfArrayOfIntegers?: Array>; testArrayOfObjects?: Array | null; diff --git a/examples/node/lib/rest/api/v2010/accounts/calls.ts b/examples/node/lib/rest/api/v2010/accounts/calls.ts index a263d25a1..6102848a9 100644 --- a/examples/node/lib/rest/api/v2010/accounts/calls.ts +++ b/examples/node/lib/rest/api/v2010/accounts/calls.ts @@ -214,7 +214,6 @@ export class CallContextImpl implements CallContext { } } -export type CallTestEnum = 'DialVerb'|'Trunking'; interface CallPayload extends CallResource, Page.TwilioResponsePayload { } @@ -229,7 +228,7 @@ interface CallResource { test_number?: number | null; price_unit?: string | null; test_number_float?: number | null; - test_enum?: CallTestEnum; + test_enum?: object; test_array_of_integers?: Array; test_array_of_array_of_integers?: Array>; test_array_of_objects?: Array | null; @@ -268,7 +267,7 @@ export class CallInstance { testNumber?: number | null; priceUnit?: string | null; testNumberFloat?: number | null; - testEnum?: CallTestEnum; + testEnum?: object; testArrayOfIntegers?: Array; testArrayOfArrayOfIntegers?: Array>; testArrayOfObjects?: Array | null; diff --git a/examples/node/lib/rest/api/v2010/accounts/calls/feedbackSummary.ts b/examples/node/lib/rest/api/v2010/accounts/calls/feedbackSummary.ts index e51ad9ccb..3bf03690b 100644 --- a/examples/node/lib/rest/api/v2010/accounts/calls/feedbackSummary.ts +++ b/examples/node/lib/rest/api/v2010/accounts/calls/feedbackSummary.ts @@ -112,7 +112,6 @@ export function FeedbackSummaryListInstance(version: V2010, accountSid: string): return instance; } -export type FeedbackSummaryTestEnum = 'DialVerb'|'Trunking'; interface FeedbackSummaryPayload extends FeedbackSummaryResource, Page.TwilioResponsePayload { } @@ -127,10 +126,11 @@ interface FeedbackSummaryResource { test_number?: number | null; price_unit?: string | null; test_number_float?: number | null; - test_enum?: FeedbackSummaryTestEnum; + test_enum?: object; test_array_of_integers?: Array; test_array_of_array_of_integers?: Array>; test_array_of_objects?: Array | null; + test_array_of_enum?: Array | null; } export class FeedbackSummaryInstance { @@ -151,6 +151,7 @@ export class FeedbackSummaryInstance { this.testArrayOfIntegers = payload.test_array_of_integers; this.testArrayOfArrayOfIntegers = payload.test_array_of_array_of_integers; this.testArrayOfObjects = payload.test_array_of_objects; + this.testArrayOfEnum = payload.test_array_of_enum; this._solution = { accountSid: accountSid || this.accountSid }; } @@ -164,10 +165,14 @@ export class FeedbackSummaryInstance { testNumber?: number | null; priceUnit?: string | null; testNumberFloat?: number | null; - testEnum?: FeedbackSummaryTestEnum; + testEnum?: object; testArrayOfIntegers?: Array; testArrayOfArrayOfIntegers?: Array>; testArrayOfObjects?: Array | null; + /** + * Permissions authorized to the app + */ + testArrayOfEnum?: Array | null; /** * Provide a user-friendly representation @@ -188,7 +193,8 @@ export class FeedbackSummaryInstance { testEnum: this.testEnum, testArrayOfIntegers: this.testArrayOfIntegers, testArrayOfArrayOfIntegers: this.testArrayOfArrayOfIntegers, - testArrayOfObjects: this.testArrayOfObjects + testArrayOfObjects: this.testArrayOfObjects, + testArrayOfEnum: this.testArrayOfEnum } } diff --git a/examples/node/lib/rest/api/v2010/credentials/aWS.ts b/examples/node/lib/rest/api/v2010/credentials/aWS.ts index 7c7c94081..2446fe7ac 100644 --- a/examples/node/lib/rest/api/v2010/credentials/aWS.ts +++ b/examples/node/lib/rest/api/v2010/credentials/aWS.ts @@ -42,7 +42,7 @@ export interface AWSContextUpdateOptions { * @property { object } [testObject] * @property { Date } [testDateTime] * @property { string } [testDate] - * @property { string } [testEnum] + * @property { TestEnumStatus } [testEnum] * @property { Array } [testObjectArray] * @property { any } [testAnyType] * @property { Array } [permissions] A comma-separated list of the permissions you will request from the users of this ConnectApp. Can include: `get-all` and `post-all`. @@ -59,7 +59,7 @@ export interface AWSListInstanceCreateOptions { testObject?: object; testDateTime?: Date; testDate?: string; - testEnum?: string; + testEnum?: TestEnumStatus; testObjectArray?: Array; testAnyType?: any; permissions?: Array; @@ -209,7 +209,6 @@ export class AWSContextImpl implements AWSContext { } } -export type AWSTestEnum = 'DialVerb'|'Trunking'; interface AWSPayload extends AWSResource, Page.TwilioResponsePayload { } @@ -224,7 +223,7 @@ interface AWSResource { test_number?: number | null; price_unit?: string | null; test_number_float?: number | null; - test_enum?: AWSTestEnum; + test_enum?: object; test_array_of_integers?: Array; test_array_of_array_of_integers?: Array>; test_array_of_objects?: Array | null; @@ -263,7 +262,7 @@ export class AWSInstance { testNumber?: number | null; priceUnit?: string | null; testNumberFloat?: number | null; - testEnum?: AWSTestEnum; + testEnum?: object; testArrayOfIntegers?: Array; testArrayOfArrayOfIntegers?: Array>; testArrayOfObjects?: Array | null; From e5034e5810ceb5d9f3214bb6a360c1c4bf46148c Mon Sep 17 00:00:00 2001 From: kridai Date: Fri, 15 Jul 2022 13:36:08 +0530 Subject: [PATCH 8/8] fix: updated isEnum flag --- src/main/java/com/twilio/oai/TwilioGoGenerator.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/java/com/twilio/oai/TwilioGoGenerator.java b/src/main/java/com/twilio/oai/TwilioGoGenerator.java index 78bb26671..94dd6d67b 100644 --- a/src/main/java/com/twilio/oai/TwilioGoGenerator.java +++ b/src/main/java/com/twilio/oai/TwilioGoGenerator.java @@ -76,7 +76,7 @@ public void postProcessModelProperty(CodegenModel model, CodegenProperty propert String[] value = property.dataType.split("Enum"); property.datatypeWithEnum = value[value.length-1]; property.dataType = "string"; - property.isEnum = property.dataType == null;; + property.isEnum = property.dataFormat == null; property.isNullable = true; } @@ -94,7 +94,7 @@ private void processEnumParameters(final CodegenParameter parameter) { String[] value = parameter.dataType.split("Enum"); parameter.datatypeWithEnum = value[value.length-1]; parameter.dataType = "string"; - parameter.isEnum = parameter.dataType == null; + parameter.isEnum = parameter.dataFormat == null; parameter.isNullable = true; } }