From 6d1557db7a0dd32cbac3654d7d7793ab1b6bff1b Mon Sep 17 00:00:00 2001 From: Twilio Date: Mon, 12 Oct 2026 11:25:55 +0000 Subject: [PATCH 1/3] [Librarian] Regenerated @ 65f186ed432e7d4763681d0938b6100538958867 2b3e568afcb1fbfda7817580051fd5956ab4801b --- CHANGES.md | 76 ++ .../com/twilio/rest/content/v1/Content.java | 6 +- .../twilio/rest/conversations/v2/Action.java | 14 + .../rest/conversations/v2/Communication.java | 18 + .../rest/conversations/v2/Configuration.java | 99 ++ .../rest/conversations/v2/Conversation.java | 103 +- .../rest/insights/v3/CustomFieldMapping.java | 1031 +++++++++++++---- .../v3/CustomFieldMappingFetcher.java | 14 +- .../v3/CustomFieldMappingPatcher.java | 131 +++ .../insights/v3/CustomFieldMappingReader.java | 246 ++++ ....java => CustomFieldMappingsCapacity.java} | 127 +- ...> CustomFieldMappingsCapacityFetcher.java} | 27 +- .../twilio/rest/knowledge/v2/Operation.java | 32 +- .../rest/messaging/v2/ChannelsSender.java | 97 ++ .../rest/numbers/v1/SmsVerification.java | 109 +- .../rest/numbers/v1/SmsVerificationCheck.java | 117 +- .../v1/SmsVerificationCheckCreator.java | 33 +- .../numbers/v1/SmsVerificationCreator.java | 31 +- .../rest/numbers/v1/VoiceVerification.java | 245 +++- .../numbers/v1/VoiceVerificationCheck.java | 136 --- .../numbers/v1/VoiceVerificationCreator.java | 33 +- .../hostedNumbers/AuthorizationDocument.java | 4 + .../AuthorizationDocumentDeleter.java} | 49 +- .../twilio/rest/routes/v3/IsoCountryCode.java | 499 ++++++++ .../rest/routes/v3/IsoCountryCodeFetcher.java | 114 ++ .../rest/routes/v3/IsoCountryCodeUpdater.java | 153 +++ 26 files changed, 3069 insertions(+), 475 deletions(-) create mode 100644 src/main/java/com/twilio/rest/insights/v3/CustomFieldMappingPatcher.java create mode 100644 src/main/java/com/twilio/rest/insights/v3/CustomFieldMappingReader.java rename src/main/java/com/twilio/rest/insights/v3/{Capacity.java => CustomFieldMappingsCapacity.java} (74%) rename src/main/java/com/twilio/rest/insights/v3/{CapacityFetcher.java => CustomFieldMappingsCapacityFetcher.java} (76%) delete mode 100644 src/main/java/com/twilio/rest/numbers/v1/VoiceVerificationCheck.java rename src/main/java/com/twilio/rest/{numbers/v1/VoiceVerificationCheckCreator.java => preview/hostedNumbers/AuthorizationDocumentDeleter.java} (63%) create mode 100644 src/main/java/com/twilio/rest/routes/v3/IsoCountryCode.java create mode 100644 src/main/java/com/twilio/rest/routes/v3/IsoCountryCodeFetcher.java create mode 100644 src/main/java/com/twilio/rest/routes/v3/IsoCountryCodeUpdater.java diff --git a/CHANGES.md b/CHANGES.md index 298e3cbb24..0129663a3f 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -2,6 +2,82 @@ twilio-java changelog ===================== +[2026-10-12] Version 13.1.0 +--------------------------- +**Audiences** +- ## 2026-10-06 +- Minor updates (formatting, metadata) +- ## 2026-10-05 +- Minor updates (formatting, metadata) +- ## 2026-10-02 +- **Added 1 new path(s)**: +- `/preview/Cohorts/{cohortId}/Operations` (AdminListCohortOperations) +- ## 2026-10-01 +- **Content updates**: +- Updated description for `AdminListSnapshotOperations` +- ## 2026-09-28 +- **Content updates**: +- Updated description for `AdminListCohortSnapshots` +- Updated description for `AdminFetchCohortSnapshot` +- Updated schema description for `Criteria` +- Added properties to `OperationPayload`: cohortId +- Removed properties from `OperationPayload`: audienceId +- Updated schema description for `OperationResult` +- Added properties to `OperationResult`: cohortId +- Removed properties from `OperationResult`: audienceId +- Updated schema description for `Record` +- Updated schema description for `Cohort` +- ...and 3 more changes +- ## 2026-10-01 +- Minor updates (formatting, metadata) +- ## 2026-09-28 +- **Content updates**: +- Updated schema description for `CohortOperationResult` +- Updated schema description for `PartitionCount` + +**Conversations** +- Add PATCH /v2/Imports/{id} to cancel an import, and the `CANCELED` import status (dev-us1 and stage-us1) +- Add Imports endpoints for 1console (private visibility, dev-us1 and stage-us1) +- Add `traitExtractionStrategyIds` and `observationExtractionStrategyIds` to the Conversations v2 Admin Configuration schema. +- Align the Conversations v2 Capabilities list and create contracts with the backend `domainId` field. + +**Data-ingress** +- ## 2026-10-01 +- Minor updates (formatting, metadata) +- ## 2026-09-17 +- Add support for Hubspot connector +- ## 2026-10-01 +- Minor updates (formatting, metadata) +- ## 2026-09-17 +- Add support for Hubspot connector + +**Events** +- Remove the Replays API (`/v1/Replays`, beta feature `api.eventstreams.replay`); the feature was never GA and is being sunset **(breaking change)** + +**Knowledge** +- ## 2026-09-24 +- **Routing updates**: +- Changed `downstreamServiceName` from `memora-domain` to `enterprise-knowledge-domain` for all operations + +**Memory** +- ## 2026-09-30 +- The `source` field on observations and conversation summaries, and the `source` filter +- on `ListProfileObservations`, now also accept forward slashes (`/`). The pattern is +- `^[a-zA-Z0-9 _./-]+$`. This is additive and backwards compatible: every previously +- valid value is still accepted. +- `UpdateStore`, `UpdateTraitGroup`, and `UpdateDataMapping` now require a body with at least one property. An empty `{}` gets a 400. + +**Messaging** +- Add opt-out configuration admin endpoints (`GET/PUT/DELETE /v1/Accounts/{AccountSid}/OptOuts/{OptOutSid}/...`) to the messaging admin-api (dev-us1 and stage-us1 only) +- Add create opt-out configuration endpoint (`POST /v1/Accounts/{AccountSid}/OptOuts`) to the messaging admin-api (dev-us1 and stage-us1 only) +- Add update messaging service endpoint (`PUT /v1/Accounts/{AccountSid}/Services/{MessagingServiceSid}`) to the messaging admin-api (dev-us1 and stage-us1 only) +- Enable messaging service add-ons, update messaging service, and opt-out configuration admin endpoints in prod-us1 and prod-ie1 +- Add WhatsApp display name change support to Sender API: `pending_display_name`, `pending_display_name_status` and `pending_display_name_status_date` on fetch, and `display_name_status` on update and partial update + +**Routes** +- Set SDK and docs visibility of `GET`/`POST` `/v3/ShortCodes/{isoCountryCode}/{shortCode}` to `public`, maturity to `ga` + + [2026-09-28] Version 13.0.2 --------------------------- **Twiml** diff --git a/src/main/java/com/twilio/rest/content/v1/Content.java b/src/main/java/com/twilio/rest/content/v1/Content.java index caa9e68dbf..e052b955c8 100644 --- a/src/main/java/com/twilio/rest/content/v1/Content.java +++ b/src/main/java/com/twilio/rest/content/v1/Content.java @@ -2882,7 +2882,7 @@ public static class TwilioSchedule { private final String title; @JsonInclude(JsonInclude.Include.NON_EMPTY) - @JsonProperty("timeSlots") + @JsonProperty("time_slots") @Getter private final String timeSlots; @@ -2917,14 +2917,14 @@ public static class Builder { @JsonProperty("title") private String title; - @JsonProperty("timeSlots") + @JsonProperty("time_slots") private String timeSlots; @JsonCreator public Builder( @JsonProperty("id") final String id, @JsonProperty("title") final String title, - @JsonProperty("timeSlots") final String timeSlots + @JsonProperty("time_slots") final String timeSlots ) { this.id = id; this.title = title; diff --git a/src/main/java/com/twilio/rest/conversations/v2/Action.java b/src/main/java/com/twilio/rest/conversations/v2/Action.java index 814c98f511..a2a0264fbc 100644 --- a/src/main/java/com/twilio/rest/conversations/v2/Action.java +++ b/src/main/java/com/twilio/rest/conversations/v2/Action.java @@ -60,6 +60,9 @@ public static class CreateActionResponse extends Resource { @Getter private final ZonedDateTime createdAt; + @Getter + private final String failureReason; + @Getter private final String id; @@ -80,6 +83,7 @@ private CreateActionResponse( @JsonProperty("completedAt") final ZonedDateTime completedAt, @JsonProperty("conversationId") final String conversationId, @JsonProperty("createdAt") final ZonedDateTime createdAt, + @JsonProperty("failureReason") final String failureReason, @JsonProperty("id") final String id, @JsonProperty("related") final Map related, @JsonProperty( @@ -91,6 +95,7 @@ private CreateActionResponse( this.completedAt = completedAt; this.conversationId = conversationId; this.createdAt = createdAt; + this.failureReason = failureReason; this.id = id; this.related = related; this.status = status; @@ -126,6 +131,7 @@ public boolean equals(final Object o) { Objects.equals(completedAt, other.completedAt) && Objects.equals(conversationId, other.conversationId) && Objects.equals(createdAt, other.createdAt) && + Objects.equals(failureReason, other.failureReason) && Objects.equals(id, other.id) && Objects.equals(related, other.related) && Objects.equals(status, other.status) && @@ -140,6 +146,7 @@ public int hashCode() { completedAt, conversationId, createdAt, + failureReason, id, related, status, @@ -317,6 +324,9 @@ public static class FetchActionResponse extends Resource { @Getter private final ZonedDateTime createdAt; + @Getter + private final String failureReason; + @Getter private final String id; @@ -337,6 +347,7 @@ private FetchActionResponse( @JsonProperty("completedAt") final ZonedDateTime completedAt, @JsonProperty("conversationId") final String conversationId, @JsonProperty("createdAt") final ZonedDateTime createdAt, + @JsonProperty("failureReason") final String failureReason, @JsonProperty("id") final String id, @JsonProperty("related") final Map related, @JsonProperty( @@ -348,6 +359,7 @@ private FetchActionResponse( this.completedAt = completedAt; this.conversationId = conversationId; this.createdAt = createdAt; + this.failureReason = failureReason; this.id = id; this.related = related; this.status = status; @@ -383,6 +395,7 @@ public boolean equals(final Object o) { Objects.equals(completedAt, other.completedAt) && Objects.equals(conversationId, other.conversationId) && Objects.equals(createdAt, other.createdAt) && + Objects.equals(failureReason, other.failureReason) && Objects.equals(id, other.id) && Objects.equals(related, other.related) && Objects.equals(status, other.status) && @@ -397,6 +410,7 @@ public int hashCode() { completedAt, conversationId, createdAt, + failureReason, id, related, status, diff --git a/src/main/java/com/twilio/rest/conversations/v2/Communication.java b/src/main/java/com/twilio/rest/conversations/v2/Communication.java index b6d3de7b07..25bdadf5d5 100644 --- a/src/main/java/com/twilio/rest/conversations/v2/Communication.java +++ b/src/main/java/com/twilio/rest/conversations/v2/Communication.java @@ -1457,6 +1457,11 @@ public static class CreateCommunicationInConversationRequest { @Getter private final String channelId; + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("resourceId") + @Getter + private final String resourceId; + @JsonInclude(JsonInclude.Include.NON_EMPTY) @JsonProperty("recipients") @Getter @@ -1475,6 +1480,7 @@ private CreateCommunicationInConversationRequest(Builder builder) { this.author = builder.author; this.content = builder.content; this.channelId = builder.channelId; + this.resourceId = builder.resourceId; this.recipients = builder.recipients; this.occurredAt = builder.occurredAt; } @@ -1512,6 +1518,9 @@ public static class Builder { @JsonProperty("channelId") private String channelId; + @JsonProperty("resourceId") + private String resourceId; + @JsonProperty("recipients") private List< CreateCommunicationInConversationRequestRecipients @@ -1548,6 +1557,13 @@ public Builder channelId(String channelId) { return this; } + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("resourceId") + public Builder resourceId(String resourceId) { + this.resourceId = resourceId; + return this; + } + @JsonDeserialize( using = com.twilio.converter.ISO8601Deserializer.class ) @@ -1580,6 +1596,7 @@ public boolean equals(final Object o) { Objects.equals(author, other.author) && Objects.equals(content, other.content) && Objects.equals(channelId, other.channelId) && + Objects.equals(resourceId, other.resourceId) && Objects.equals(recipients, other.recipients) && Objects.equals(occurredAt, other.occurredAt) ); @@ -1591,6 +1608,7 @@ public int hashCode() { author, content, channelId, + resourceId, recipients, occurredAt ); diff --git a/src/main/java/com/twilio/rest/conversations/v2/Configuration.java b/src/main/java/com/twilio/rest/conversations/v2/Configuration.java index 68fe403e71..a782e9a5e2 100644 --- a/src/main/java/com/twilio/rest/conversations/v2/Configuration.java +++ b/src/main/java/com/twilio/rest/conversations/v2/Configuration.java @@ -256,9 +256,15 @@ public static class ListConfigurationResponse extends Resource { @Getter private final String memoryStoreId; + @Getter + private final List observationExtractionStrategyIds; + @Getter private final List statusCallbacks; + @Getter + private final List traitExtractionStrategyIds; + @Getter private final ZonedDateTime updatedAt; @@ -288,9 +294,15 @@ private ListConfigurationResponse( "memoryExtractionEnabled" ) final Boolean memoryExtractionEnabled, @JsonProperty("memoryStoreId") final String memoryStoreId, + @JsonProperty("observationExtractionStrategyIds") final List< + String + > observationExtractionStrategyIds, @JsonProperty("statusCallbacks") final List< ConversationsV2StatusCallbackConfig > statusCallbacks, + @JsonProperty("traitExtractionStrategyIds") final List< + String + > traitExtractionStrategyIds, @JsonProperty("updatedAt") final ZonedDateTime updatedAt, @JsonProperty("version") final Long version ) { @@ -304,7 +316,10 @@ private ListConfigurationResponse( this.intelligenceConfigurationIds = intelligenceConfigurationIds; this.memoryExtractionEnabled = memoryExtractionEnabled; this.memoryStoreId = memoryStoreId; + this.observationExtractionStrategyIds = + observationExtractionStrategyIds; this.statusCallbacks = statusCallbacks; + this.traitExtractionStrategyIds = traitExtractionStrategyIds; this.updatedAt = updatedAt; this.version = version; } @@ -359,7 +374,15 @@ public boolean equals(final Object o) { other.memoryExtractionEnabled ) && Objects.equals(memoryStoreId, other.memoryStoreId) && + Objects.equals( + observationExtractionStrategyIds, + other.observationExtractionStrategyIds + ) && Objects.equals(statusCallbacks, other.statusCallbacks) && + Objects.equals( + traitExtractionStrategyIds, + other.traitExtractionStrategyIds + ) && Objects.equals(updatedAt, other.updatedAt) && Objects.equals(version, other.version) ); @@ -378,7 +401,9 @@ public int hashCode() { intelligenceConfigurationIds, memoryExtractionEnabled, memoryStoreId, + observationExtractionStrategyIds, statusCallbacks, + traitExtractionStrategyIds, updatedAt, version ); @@ -478,9 +503,15 @@ public static class FetchConfigurationResponse extends Resource { @Getter private final String memoryStoreId; + @Getter + private final List observationExtractionStrategyIds; + @Getter private final List statusCallbacks; + @Getter + private final List traitExtractionStrategyIds; + @Getter private final ZonedDateTime updatedAt; @@ -510,9 +541,15 @@ private FetchConfigurationResponse( "memoryExtractionEnabled" ) final Boolean memoryExtractionEnabled, @JsonProperty("memoryStoreId") final String memoryStoreId, + @JsonProperty("observationExtractionStrategyIds") final List< + String + > observationExtractionStrategyIds, @JsonProperty("statusCallbacks") final List< ConversationsV2StatusCallbackConfig > statusCallbacks, + @JsonProperty("traitExtractionStrategyIds") final List< + String + > traitExtractionStrategyIds, @JsonProperty("updatedAt") final ZonedDateTime updatedAt, @JsonProperty("version") final Long version ) { @@ -526,7 +563,10 @@ private FetchConfigurationResponse( this.intelligenceConfigurationIds = intelligenceConfigurationIds; this.memoryExtractionEnabled = memoryExtractionEnabled; this.memoryStoreId = memoryStoreId; + this.observationExtractionStrategyIds = + observationExtractionStrategyIds; this.statusCallbacks = statusCallbacks; + this.traitExtractionStrategyIds = traitExtractionStrategyIds; this.updatedAt = updatedAt; this.version = version; } @@ -581,7 +621,15 @@ public boolean equals(final Object o) { other.memoryExtractionEnabled ) && Objects.equals(memoryStoreId, other.memoryStoreId) && + Objects.equals( + observationExtractionStrategyIds, + other.observationExtractionStrategyIds + ) && Objects.equals(statusCallbacks, other.statusCallbacks) && + Objects.equals( + traitExtractionStrategyIds, + other.traitExtractionStrategyIds + ) && Objects.equals(updatedAt, other.updatedAt) && Objects.equals(version, other.version) ); @@ -600,7 +648,9 @@ public int hashCode() { intelligenceConfigurationIds, memoryExtractionEnabled, memoryStoreId, + observationExtractionStrategyIds, statusCallbacks, + traitExtractionStrategyIds, updatedAt, version ); @@ -2901,6 +2951,16 @@ public static class ListConfiguration200ResponseConfigurations { @Getter private final List intelligenceConfigurationIds; + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("traitExtractionStrategyIds") + @Getter + private final List traitExtractionStrategyIds; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("observationExtractionStrategyIds") + @Getter + private final List observationExtractionStrategyIds; + @JsonInclude(JsonInclude.Include.NON_EMPTY) @JsonProperty("memoryExtractionEnabled") @Getter @@ -2940,6 +3000,10 @@ private ListConfiguration200ResponseConfigurations(Builder builder) { this.statusCallbacks = builder.statusCallbacks; this.intelligenceConfigurationIds = builder.intelligenceConfigurationIds; + this.traitExtractionStrategyIds = + builder.traitExtractionStrategyIds; + this.observationExtractionStrategyIds = + builder.observationExtractionStrategyIds; this.memoryExtractionEnabled = builder.memoryExtractionEnabled; this.conversationsV1Bridge = builder.conversationsV1Bridge; this.createdAt = builder.createdAt; @@ -3001,6 +3065,12 @@ public static class Builder { @JsonProperty("intelligenceConfigurationIds") private List intelligenceConfigurationIds; + @JsonProperty("traitExtractionStrategyIds") + private List traitExtractionStrategyIds; + + @JsonProperty("observationExtractionStrategyIds") + private List observationExtractionStrategyIds; + @JsonProperty("memoryExtractionEnabled") private Boolean memoryExtractionEnabled; @@ -3069,6 +3139,25 @@ public Builder intelligenceConfigurationIds( return this; } + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("traitExtractionStrategyIds") + public Builder traitExtractionStrategyIds( + List traitExtractionStrategyIds + ) { + this.traitExtractionStrategyIds = traitExtractionStrategyIds; + return this; + } + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("observationExtractionStrategyIds") + public Builder observationExtractionStrategyIds( + List observationExtractionStrategyIds + ) { + this.observationExtractionStrategyIds = + observationExtractionStrategyIds; + return this; + } + @JsonInclude(JsonInclude.Include.NON_EMPTY) @JsonProperty("memoryExtractionEnabled") public Builder memoryExtractionEnabled( @@ -3148,6 +3237,14 @@ public boolean equals(final Object o) { intelligenceConfigurationIds, other.intelligenceConfigurationIds ) && + Objects.equals( + traitExtractionStrategyIds, + other.traitExtractionStrategyIds + ) && + Objects.equals( + observationExtractionStrategyIds, + other.observationExtractionStrategyIds + ) && Objects.equals( memoryExtractionEnabled, other.memoryExtractionEnabled @@ -3173,6 +3270,8 @@ public int hashCode() { channelSettings, statusCallbacks, intelligenceConfigurationIds, + traitExtractionStrategyIds, + observationExtractionStrategyIds, memoryExtractionEnabled, conversationsV1Bridge, createdAt, diff --git a/src/main/java/com/twilio/rest/conversations/v2/Conversation.java b/src/main/java/com/twilio/rest/conversations/v2/Conversation.java index 2f95235a8b..2b1fb1c50e 100644 --- a/src/main/java/com/twilio/rest/conversations/v2/Conversation.java +++ b/src/main/java/com/twilio/rest/conversations/v2/Conversation.java @@ -1086,6 +1086,16 @@ public static class ListConversationByAccount200ResponseConversationsConfigurati @Getter private final List intelligenceConfigurationIds; + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("traitExtractionStrategyIds") + @Getter + private final List traitExtractionStrategyIds; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("observationExtractionStrategyIds") + @Getter + private final List observationExtractionStrategyIds; + @JsonInclude(JsonInclude.Include.NON_EMPTY) @JsonProperty("memoryExtractionEnabled") @Getter @@ -1107,6 +1117,10 @@ private ListConversationByAccount200ResponseConversationsConfiguration( this.statusCallbacks = builder.statusCallbacks; this.intelligenceConfigurationIds = builder.intelligenceConfigurationIds; + this.traitExtractionStrategyIds = + builder.traitExtractionStrategyIds; + this.observationExtractionStrategyIds = + builder.observationExtractionStrategyIds; this.memoryExtractionEnabled = builder.memoryExtractionEnabled; this.conversationsV1Bridge = builder.conversationsV1Bridge; } @@ -1150,6 +1164,12 @@ public static class Builder { @JsonProperty("intelligenceConfigurationIds") private List intelligenceConfigurationIds; + @JsonProperty("traitExtractionStrategyIds") + private List traitExtractionStrategyIds; + + @JsonProperty("observationExtractionStrategyIds") + private List observationExtractionStrategyIds; + @JsonProperty("memoryExtractionEnabled") private Boolean memoryExtractionEnabled; @@ -1214,6 +1234,25 @@ public Builder intelligenceConfigurationIds( return this; } + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("traitExtractionStrategyIds") + public Builder traitExtractionStrategyIds( + List traitExtractionStrategyIds + ) { + this.traitExtractionStrategyIds = traitExtractionStrategyIds; + return this; + } + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("observationExtractionStrategyIds") + public Builder observationExtractionStrategyIds( + List observationExtractionStrategyIds + ) { + this.observationExtractionStrategyIds = + observationExtractionStrategyIds; + return this; + } + @JsonInclude(JsonInclude.Include.NON_EMPTY) @JsonProperty("memoryExtractionEnabled") public Builder memoryExtractionEnabled( @@ -1265,6 +1304,14 @@ public boolean equals(final Object o) { intelligenceConfigurationIds, other.intelligenceConfigurationIds ) && + Objects.equals( + traitExtractionStrategyIds, + other.traitExtractionStrategyIds + ) && + Objects.equals( + observationExtractionStrategyIds, + other.observationExtractionStrategyIds + ) && Objects.equals( memoryExtractionEnabled, other.memoryExtractionEnabled @@ -1286,6 +1333,8 @@ public int hashCode() { channelSettings, statusCallbacks, intelligenceConfigurationIds, + traitExtractionStrategyIds, + observationExtractionStrategyIds, memoryExtractionEnabled, conversationsV1Bridge ); @@ -1687,6 +1736,16 @@ public static class CreateConversationWithConfigRequestConfiguration { @Getter private final List intelligenceConfigurationIds; + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("traitExtractionStrategyIds") + @Getter + private final List traitExtractionStrategyIds; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("observationExtractionStrategyIds") + @Getter + private final List observationExtractionStrategyIds; + @JsonInclude(JsonInclude.Include.NON_EMPTY) @JsonProperty("workflows") @Getter @@ -1697,6 +1756,10 @@ private CreateConversationWithConfigRequestConfiguration( ) { this.intelligenceConfigurationIds = builder.intelligenceConfigurationIds; + this.traitExtractionStrategyIds = + builder.traitExtractionStrategyIds; + this.observationExtractionStrategyIds = + builder.observationExtractionStrategyIds; this.workflows = builder.workflows; } @@ -1721,6 +1784,12 @@ public static class Builder { @JsonProperty("intelligenceConfigurationIds") private List intelligenceConfigurationIds; + @JsonProperty("traitExtractionStrategyIds") + private List traitExtractionStrategyIds; + + @JsonProperty("observationExtractionStrategyIds") + private List observationExtractionStrategyIds; + @JsonProperty("workflows") private List workflows; @@ -1734,6 +1803,25 @@ public Builder intelligenceConfigurationIds( return this; } + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("traitExtractionStrategyIds") + public Builder traitExtractionStrategyIds( + List traitExtractionStrategyIds + ) { + this.traitExtractionStrategyIds = traitExtractionStrategyIds; + return this; + } + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("observationExtractionStrategyIds") + public Builder observationExtractionStrategyIds( + List observationExtractionStrategyIds + ) { + this.observationExtractionStrategyIds = + observationExtractionStrategyIds; + return this; + } + @JsonInclude(JsonInclude.Include.NON_EMPTY) @JsonProperty("workflows") public Builder workflows(List workflows) { @@ -1765,13 +1853,26 @@ public boolean equals(final Object o) { intelligenceConfigurationIds, other.intelligenceConfigurationIds ) && + Objects.equals( + traitExtractionStrategyIds, + other.traitExtractionStrategyIds + ) && + Objects.equals( + observationExtractionStrategyIds, + other.observationExtractionStrategyIds + ) && Objects.equals(workflows, other.workflows) ); } @Override public int hashCode() { - return Objects.hash(intelligenceConfigurationIds, workflows); + return Objects.hash( + intelligenceConfigurationIds, + traitExtractionStrategyIds, + observationExtractionStrategyIds, + workflows + ); } } diff --git a/src/main/java/com/twilio/rest/insights/v3/CustomFieldMapping.java b/src/main/java/com/twilio/rest/insights/v3/CustomFieldMapping.java index bf581c0f82..a8651c9506 100644 --- a/src/main/java/com/twilio/rest/insights/v3/CustomFieldMapping.java +++ b/src/main/java/com/twilio/rest/insights/v3/CustomFieldMapping.java @@ -37,7 +37,6 @@ import java.io.IOException; import java.io.InputStream; import java.time.ZonedDateTime; -import java.util.List; import java.util.Objects; import lombok.Builder; import lombok.Getter; @@ -60,7 +59,7 @@ public static class CreateCustomFieldMappingResponse extends Resource { private final String description; @Getter - private final IntelligenceOperatorEntityMetadata entityMetadata; + private final EntityMetadata entityMetadata; @Getter private final String id; @@ -78,9 +77,7 @@ private CreateCustomFieldMappingResponse( ) final CustomFieldMapping.MappingCategory category, @JsonProperty("createdAt") final ZonedDateTime createdAt, @JsonProperty("description") final String description, - @JsonProperty( - "entityMetadata" - ) final IntelligenceOperatorEntityMetadata entityMetadata, + @JsonProperty("entityMetadata") final EntityMetadata entityMetadata, @JsonProperty("id") final String id, @JsonProperty("name") final String name, @JsonProperty("updatedAt") final ZonedDateTime updatedAt @@ -236,8 +233,47 @@ public int hashCode() { @JsonIgnoreProperties(ignoreUnknown = true) public static class ListCustomFieldMappingResponse extends Resource { + @Getter + private final CustomFieldMapping.MappingCategory category; + + @Getter + private final ZonedDateTime createdAt; + + @Getter + private final String description; + + @Getter + private final EntityMetadata entityMetadata; + + @Getter + private final String id; + + @Getter + private final String name; + + @Getter + private final ZonedDateTime updatedAt; + @JsonCreator - private ListCustomFieldMappingResponse() {} + private ListCustomFieldMappingResponse( + @JsonProperty( + "category" + ) final CustomFieldMapping.MappingCategory category, + @JsonProperty("createdAt") final ZonedDateTime createdAt, + @JsonProperty("description") final String description, + @JsonProperty("entityMetadata") final EntityMetadata entityMetadata, + @JsonProperty("id") final String id, + @JsonProperty("name") final String name, + @JsonProperty("updatedAt") final ZonedDateTime updatedAt + ) { + this.category = category; + this.createdAt = createdAt; + this.description = description; + this.entityMetadata = entityMetadata; + this.id = id; + this.name = name; + this.updatedAt = updatedAt; + } public static ListCustomFieldMappingResponse fromJson( final InputStream json, @@ -267,20 +303,75 @@ public boolean equals(final Object o) { } ListCustomFieldMappingResponse other = (ListCustomFieldMappingResponse) o; - return (true); + return ( + Objects.equals(category, other.category) && + Objects.equals(createdAt, other.createdAt) && + Objects.equals(description, other.description) && + Objects.equals(entityMetadata, other.entityMetadata) && + Objects.equals(id, other.id) && + Objects.equals(name, other.name) && + Objects.equals(updatedAt, other.updatedAt) + ); } @Override public int hashCode() { - return Objects.hash(); + return Objects.hash( + category, + createdAt, + description, + entityMetadata, + id, + name, + updatedAt + ); } } @JsonIgnoreProperties(ignoreUnknown = true) public static class PatchCustomFieldMappingResponse extends Resource { + @Getter + private final CustomFieldMapping.MappingCategory category; + + @Getter + private final ZonedDateTime createdAt; + + @Getter + private final String description; + + @Getter + private final EntityMetadata entityMetadata; + + @Getter + private final String id; + + @Getter + private final String name; + + @Getter + private final ZonedDateTime updatedAt; + @JsonCreator - private PatchCustomFieldMappingResponse() {} + private PatchCustomFieldMappingResponse( + @JsonProperty( + "category" + ) final CustomFieldMapping.MappingCategory category, + @JsonProperty("createdAt") final ZonedDateTime createdAt, + @JsonProperty("description") final String description, + @JsonProperty("entityMetadata") final EntityMetadata entityMetadata, + @JsonProperty("id") final String id, + @JsonProperty("name") final String name, + @JsonProperty("updatedAt") final ZonedDateTime updatedAt + ) { + this.category = category; + this.createdAt = createdAt; + this.description = description; + this.entityMetadata = entityMetadata; + this.id = id; + this.name = name; + this.updatedAt = updatedAt; + } public static PatchCustomFieldMappingResponse fromJson( final InputStream json, @@ -310,12 +401,28 @@ public boolean equals(final Object o) { } PatchCustomFieldMappingResponse other = (PatchCustomFieldMappingResponse) o; - return true; + return ( + Objects.equals(category, other.category) && + Objects.equals(createdAt, other.createdAt) && + Objects.equals(description, other.description) && + Objects.equals(entityMetadata, other.entityMetadata) && + Objects.equals(id, other.id) && + Objects.equals(name, other.name) && + Objects.equals(updatedAt, other.updatedAt) + ); } @Override public int hashCode() { - return Objects.hash(); + return Objects.hash( + category, + createdAt, + description, + entityMetadata, + id, + name, + updatedAt + ); } } @@ -323,15 +430,45 @@ public int hashCode() { public static class FetchCustomFieldMappingResponse extends Resource { @Getter - private final List mappings; + private final CustomFieldMapping.MappingCategory category; + + @Getter + private final ZonedDateTime createdAt; + + @Getter + private final String description; + + @Getter + private final EntityMetadata entityMetadata; + + @Getter + private final String id; + + @Getter + private final String name; + + @Getter + private final ZonedDateTime updatedAt; @JsonCreator private FetchCustomFieldMappingResponse( - @JsonProperty("mappings") final List< - CustomFieldMappingResponse - > mappings + @JsonProperty( + "category" + ) final CustomFieldMapping.MappingCategory category, + @JsonProperty("createdAt") final ZonedDateTime createdAt, + @JsonProperty("description") final String description, + @JsonProperty("entityMetadata") final EntityMetadata entityMetadata, + @JsonProperty("id") final String id, + @JsonProperty("name") final String name, + @JsonProperty("updatedAt") final ZonedDateTime updatedAt ) { - this.mappings = mappings; + this.category = category; + this.createdAt = createdAt; + this.description = description; + this.entityMetadata = entityMetadata; + this.id = id; + this.name = name; + this.updatedAt = updatedAt; } public static FetchCustomFieldMappingResponse fromJson( @@ -362,12 +499,28 @@ public boolean equals(final Object o) { } FetchCustomFieldMappingResponse other = (FetchCustomFieldMappingResponse) o; - return Objects.equals(mappings, other.mappings); + return ( + Objects.equals(category, other.category) && + Objects.equals(createdAt, other.createdAt) && + Objects.equals(description, other.description) && + Objects.equals(entityMetadata, other.entityMetadata) && + Objects.equals(id, other.id) && + Objects.equals(name, other.name) && + Objects.equals(updatedAt, other.updatedAt) + ); } @Override public int hashCode() { - return Objects.hash(mappings); + return Objects.hash( + category, + createdAt, + description, + entityMetadata, + id, + name, + updatedAt + ); } } @@ -377,8 +530,24 @@ public static CustomFieldMappingCreator creator( return new CustomFieldMappingCreator(customFieldMappingRequest); } - public static CustomFieldMappingFetcher fetcher() { - return new CustomFieldMappingFetcher(); + public static CustomFieldMappingFetcher fetcher( + final String pathMappingId + ) { + return new CustomFieldMappingFetcher(pathMappingId); + } + + public static CustomFieldMappingReader reader() { + return new CustomFieldMappingReader(); + } + + public static CustomFieldMappingPatcher patcher( + final String pathMappingId, + final CustomFieldMapping.CustomFieldMappingUpdateRequest customFieldMappingUpdateRequest + ) { + return new CustomFieldMappingPatcher( + pathMappingId, + customFieldMappingUpdateRequest + ); } public enum SourceType { @@ -421,54 +590,32 @@ public static MappingCategory forValue(final String value) { } } - @JsonDeserialize(builder = CustomFieldMappingRequest.Builder.class) + @JsonDeserialize(builder = CustomFieldMappingUpdateRequest.Builder.class) @JsonIgnoreProperties(ignoreUnknown = true) @JsonInclude(JsonInclude.Include.NON_EMPTY) @ToString - public static class CustomFieldMappingRequest { - - @JsonInclude(JsonInclude.Include.NON_EMPTY) - @JsonProperty("category") - @Getter - private final CustomFieldMapping.MappingCategory category; - - @JsonInclude(JsonInclude.Include.NON_EMPTY) - @JsonProperty("name") - @Getter - private final String name; - - @JsonInclude(JsonInclude.Include.NON_EMPTY) - @JsonProperty("description") - @Getter - private final String description; + public static class CustomFieldMappingUpdateRequest { @JsonInclude(JsonInclude.Include.NON_EMPTY) @JsonProperty("entityMetadata") @Getter - private final IntelligenceOperatorEntityMetadata entityMetadata; + private final EntityMetadataUpdate entityMetadata; - private CustomFieldMappingRequest(Builder builder) { - this.category = builder.category; - this.name = builder.name; - this.description = builder.description; + private CustomFieldMappingUpdateRequest(Builder builder) { this.entityMetadata = builder.entityMetadata; } - public static Builder builder( - final CustomFieldMapping.MappingCategory category, - final String name, - final IntelligenceOperatorEntityMetadata entityMetadata - ) { - return new Builder(category, name, entityMetadata); + public static Builder builder() { + return new Builder(); } - public static CustomFieldMappingRequest fromJson( + public static CustomFieldMappingUpdateRequest fromJson( String jsonString, ObjectMapper mapper ) throws IOException { return mapper.readValue( jsonString, - CustomFieldMappingRequest.class + CustomFieldMappingUpdateRequest.class ); } @@ -476,42 +623,18 @@ public static CustomFieldMappingRequest fromJson( @JsonPOJOBuilder(withPrefix = "") public static class Builder { - @JsonProperty("category") - private CustomFieldMapping.MappingCategory category; - - @JsonProperty("name") - private String name; - - @JsonProperty("description") - private String description; - @JsonProperty("entityMetadata") - private IntelligenceOperatorEntityMetadata entityMetadata; - - @JsonCreator - public Builder( - @JsonProperty( - "category" - ) final CustomFieldMapping.MappingCategory category, - @JsonProperty("name") final String name, - @JsonProperty( - "entityMetadata" - ) final IntelligenceOperatorEntityMetadata entityMetadata - ) { - this.category = category; - this.name = name; - this.entityMetadata = entityMetadata; - } + private EntityMetadataUpdate entityMetadata; @JsonInclude(JsonInclude.Include.NON_EMPTY) - @JsonProperty("description") - public Builder description(String description) { - this.description = description; + @JsonProperty("entityMetadata") + public Builder entityMetadata(EntityMetadataUpdate entityMetadata) { + this.entityMetadata = entityMetadata; return this; } - public CustomFieldMappingRequest build() { - return new CustomFieldMappingRequest(this); + public CustomFieldMappingUpdateRequest build() { + return new CustomFieldMappingUpdateRequest(this); } } @@ -525,51 +648,633 @@ public boolean equals(final Object o) { return false; } - CustomFieldMappingRequest other = (CustomFieldMappingRequest) o; - return ( - Objects.equals(category, other.category) && - Objects.equals(name, other.name) && - Objects.equals(description, other.description) && - Objects.equals(entityMetadata, other.entityMetadata) - ); + CustomFieldMappingUpdateRequest other = + (CustomFieldMappingUpdateRequest) o; + return (Objects.equals(entityMetadata, other.entityMetadata)); } @Override public int hashCode() { - return Objects.hash(category, name, description, entityMetadata); + return Objects.hash(entityMetadata); } } - @JsonDeserialize(builder = CustomFieldMappingResponse.Builder.class) + @JsonDeserialize(builder = IntelligenceOperatorSource.Builder.class) @JsonIgnoreProperties(ignoreUnknown = true) @JsonInclude(JsonInclude.Include.NON_EMPTY) @ToString - public static class CustomFieldMappingResponse { + public static class IntelligenceOperatorSource { @JsonInclude(JsonInclude.Include.NON_EMPTY) - @JsonProperty("id") + @JsonProperty("operatorId") @Getter - private final String id; + private final String operatorId; @JsonInclude(JsonInclude.Include.NON_EMPTY) - @JsonProperty("category") + @JsonProperty("operatorName") @Getter - private final CustomFieldMapping.MappingCategory category; + private final String operatorName; @JsonInclude(JsonInclude.Include.NON_EMPTY) - @JsonProperty("name") + @JsonProperty("field") @Getter - private final String name; + private final String field; - @JsonInclude(JsonInclude.Include.NON_EMPTY) - @JsonProperty("description") - @Getter - private final String description; + private IntelligenceOperatorSource(Builder builder) { + this.operatorId = builder.operatorId; + this.operatorName = builder.operatorName; + this.field = builder.field; + } + + public static Builder builder( + final String operatorId, + final String field + ) { + return new Builder(operatorId, field); + } + + public static IntelligenceOperatorSource fromJson( + String jsonString, + ObjectMapper mapper + ) throws IOException { + return mapper.readValue( + jsonString, + IntelligenceOperatorSource.class + ); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + @JsonPOJOBuilder(withPrefix = "") + public static class Builder { + + @JsonProperty("operatorId") + private String operatorId; + + @JsonProperty("operatorName") + private String operatorName; + + @JsonProperty("field") + private String field; + + @JsonCreator + public Builder( + @JsonProperty("operatorId") final String operatorId, + @JsonProperty("field") final String field + ) { + this.operatorId = operatorId; + this.field = field; + } + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("operatorName") + public Builder operatorName(String operatorName) { + this.operatorName = operatorName; + return this; + } + + public IntelligenceOperatorSource build() { + return new IntelligenceOperatorSource(this); + } + } + + @Override + public boolean equals(final Object o) { + if (this == o) { + return true; + } + + if (o == null || getClass() != o.getClass()) { + return false; + } + + IntelligenceOperatorSource other = (IntelligenceOperatorSource) o; + return ( + Objects.equals(operatorId, other.operatorId) && + Objects.equals(operatorName, other.operatorName) && + Objects.equals(field, other.field) + ); + } + + @Override + public int hashCode() { + return Objects.hash(operatorId, operatorName, field); + } + } + + @JsonDeserialize(builder = PaginationMeta.Builder.class) + @JsonIgnoreProperties(ignoreUnknown = true) + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @ToString + public static class PaginationMeta { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("key") + @Getter + private final String key; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("pageSize") + @Getter + private final Integer pageSize; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("previousToken") + @Getter + private final String previousToken; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("nextToken") + @Getter + private final String nextToken; + + private PaginationMeta(Builder builder) { + this.key = builder.key; + this.pageSize = builder.pageSize; + this.previousToken = builder.previousToken; + this.nextToken = builder.nextToken; + } + + public static Builder builder( + final String key, + final Integer pageSize + ) { + return new Builder(key, pageSize); + } + + public static PaginationMeta fromJson( + String jsonString, + ObjectMapper mapper + ) throws IOException { + return mapper.readValue(jsonString, PaginationMeta.class); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + @JsonPOJOBuilder(withPrefix = "") + public static class Builder { + + @JsonProperty("key") + private String key; + + @JsonProperty("pageSize") + private Integer pageSize; + + @JsonProperty("previousToken") + private String previousToken; + + @JsonProperty("nextToken") + private String nextToken; + + @JsonCreator + public Builder( + @JsonProperty("key") final String key, + @JsonProperty("pageSize") final Integer pageSize + ) { + this.key = key; + this.pageSize = pageSize; + } + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("previousToken") + public Builder previousToken(String previousToken) { + this.previousToken = previousToken; + return this; + } + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("nextToken") + public Builder nextToken(String nextToken) { + this.nextToken = nextToken; + return this; + } + + public PaginationMeta build() { + return new PaginationMeta(this); + } + } + + @Override + public boolean equals(final Object o) { + if (this == o) { + return true; + } + + if (o == null || getClass() != o.getClass()) { + return false; + } + + PaginationMeta other = (PaginationMeta) o; + return ( + Objects.equals(key, other.key) && + Objects.equals(pageSize, other.pageSize) && + Objects.equals(previousToken, other.previousToken) && + Objects.equals(nextToken, other.nextToken) + ); + } + + @Override + public int hashCode() { + return Objects.hash(key, pageSize, previousToken, nextToken); + } + } + + @JsonDeserialize(builder = EntityMetadataUpdate.Builder.class) + @JsonIgnoreProperties(ignoreUnknown = true) + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @ToString + public static class EntityMetadataUpdate { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("sourceType") + @Getter + private final CustomFieldMapping.SourceType sourceType; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("intelligenceOperator") + @Getter + private final IntelligenceOperatorSourceUpdate intelligenceOperator; + + private EntityMetadataUpdate(Builder builder) { + this.sourceType = builder.sourceType; + this.intelligenceOperator = builder.intelligenceOperator; + } + + public static Builder builder( + final CustomFieldMapping.SourceType sourceType + ) { + return new Builder(sourceType); + } + + public static EntityMetadataUpdate fromJson( + String jsonString, + ObjectMapper mapper + ) throws IOException { + return mapper.readValue(jsonString, EntityMetadataUpdate.class); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + @JsonPOJOBuilder(withPrefix = "") + public static class Builder { + + @JsonProperty("sourceType") + private CustomFieldMapping.SourceType sourceType; + + @JsonProperty("intelligenceOperator") + private IntelligenceOperatorSourceUpdate intelligenceOperator; + + @JsonCreator + public Builder( + @JsonProperty( + "sourceType" + ) final CustomFieldMapping.SourceType sourceType + ) { + this.sourceType = sourceType; + } + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("intelligenceOperator") + public Builder intelligenceOperator( + IntelligenceOperatorSourceUpdate intelligenceOperator + ) { + this.intelligenceOperator = intelligenceOperator; + return this; + } + + public EntityMetadataUpdate build() { + return new EntityMetadataUpdate(this); + } + } + + @Override + public boolean equals(final Object o) { + if (this == o) { + return true; + } + + if (o == null || getClass() != o.getClass()) { + return false; + } + + EntityMetadataUpdate other = (EntityMetadataUpdate) o; + return ( + Objects.equals(sourceType, other.sourceType) && + Objects.equals(intelligenceOperator, other.intelligenceOperator) + ); + } + + @Override + public int hashCode() { + return Objects.hash(sourceType, intelligenceOperator); + } + } + + @JsonDeserialize(builder = CustomFieldMappingRequest.Builder.class) + @JsonIgnoreProperties(ignoreUnknown = true) + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @ToString + public static class CustomFieldMappingRequest { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("category") + @Getter + private final CustomFieldMapping.MappingCategory category; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("name") + @Getter + private final String name; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("description") + @Getter + private final String description; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("entityMetadata") + @Getter + private final EntityMetadata entityMetadata; + + private CustomFieldMappingRequest(Builder builder) { + this.category = builder.category; + this.name = builder.name; + this.description = builder.description; + this.entityMetadata = builder.entityMetadata; + } + + public static Builder builder( + final CustomFieldMapping.MappingCategory category, + final String name, + final EntityMetadata entityMetadata + ) { + return new Builder(category, name, entityMetadata); + } + + public static CustomFieldMappingRequest fromJson( + String jsonString, + ObjectMapper mapper + ) throws IOException { + return mapper.readValue( + jsonString, + CustomFieldMappingRequest.class + ); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + @JsonPOJOBuilder(withPrefix = "") + public static class Builder { + + @JsonProperty("category") + private CustomFieldMapping.MappingCategory category; + + @JsonProperty("name") + private String name; + + @JsonProperty("description") + private String description; + + @JsonProperty("entityMetadata") + private EntityMetadata entityMetadata; + + @JsonCreator + public Builder( + @JsonProperty( + "category" + ) final CustomFieldMapping.MappingCategory category, + @JsonProperty("name") final String name, + @JsonProperty( + "entityMetadata" + ) final EntityMetadata entityMetadata + ) { + this.category = category; + this.name = name; + this.entityMetadata = entityMetadata; + } + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("description") + public Builder description(String description) { + this.description = description; + return this; + } + + public CustomFieldMappingRequest build() { + return new CustomFieldMappingRequest(this); + } + } + + @Override + public boolean equals(final Object o) { + if (this == o) { + return true; + } + + if (o == null || getClass() != o.getClass()) { + return false; + } + + CustomFieldMappingRequest other = (CustomFieldMappingRequest) o; + return ( + Objects.equals(category, other.category) && + Objects.equals(name, other.name) && + Objects.equals(description, other.description) && + Objects.equals(entityMetadata, other.entityMetadata) + ); + } + + @Override + public int hashCode() { + return Objects.hash(category, name, description, entityMetadata); + } + } + + @JsonDeserialize(builder = EntityMetadata.Builder.class) + @JsonIgnoreProperties(ignoreUnknown = true) + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @ToString + public static class EntityMetadata { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("sourceType") + @Getter + private final CustomFieldMapping.SourceType sourceType; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("intelligenceOperator") + @Getter + private final IntelligenceOperatorSource intelligenceOperator; + + private EntityMetadata(Builder builder) { + this.sourceType = builder.sourceType; + this.intelligenceOperator = builder.intelligenceOperator; + } + + public static Builder builder( + final CustomFieldMapping.SourceType sourceType + ) { + return new Builder(sourceType); + } + + public static EntityMetadata fromJson( + String jsonString, + ObjectMapper mapper + ) throws IOException { + return mapper.readValue(jsonString, EntityMetadata.class); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + @JsonPOJOBuilder(withPrefix = "") + public static class Builder { + + @JsonProperty("sourceType") + private CustomFieldMapping.SourceType sourceType; + + @JsonProperty("intelligenceOperator") + private IntelligenceOperatorSource intelligenceOperator; + + @JsonCreator + public Builder( + @JsonProperty( + "sourceType" + ) final CustomFieldMapping.SourceType sourceType + ) { + this.sourceType = sourceType; + } + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("intelligenceOperator") + public Builder intelligenceOperator( + IntelligenceOperatorSource intelligenceOperator + ) { + this.intelligenceOperator = intelligenceOperator; + return this; + } + + public EntityMetadata build() { + return new EntityMetadata(this); + } + } + + @Override + public boolean equals(final Object o) { + if (this == o) { + return true; + } + + if (o == null || getClass() != o.getClass()) { + return false; + } + + EntityMetadata other = (EntityMetadata) o; + return ( + Objects.equals(sourceType, other.sourceType) && + Objects.equals(intelligenceOperator, other.intelligenceOperator) + ); + } + + @Override + public int hashCode() { + return Objects.hash(sourceType, intelligenceOperator); + } + } + + @JsonDeserialize(builder = IntelligenceOperatorSourceUpdate.Builder.class) + @JsonIgnoreProperties(ignoreUnknown = true) + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @ToString + public static class IntelligenceOperatorSourceUpdate { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("field") + @Getter + private final String field; + + private IntelligenceOperatorSourceUpdate(Builder builder) { + this.field = builder.field; + } + + public static Builder builder() { + return new Builder(); + } + + public static IntelligenceOperatorSourceUpdate fromJson( + String jsonString, + ObjectMapper mapper + ) throws IOException { + return mapper.readValue( + jsonString, + IntelligenceOperatorSourceUpdate.class + ); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + @JsonPOJOBuilder(withPrefix = "") + public static class Builder { + + @JsonProperty("field") + private String field; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("field") + public Builder field(String field) { + this.field = field; + return this; + } + + public IntelligenceOperatorSourceUpdate build() { + return new IntelligenceOperatorSourceUpdate(this); + } + } + + @Override + public boolean equals(final Object o) { + if (this == o) { + return true; + } + + if (o == null || getClass() != o.getClass()) { + return false; + } + + IntelligenceOperatorSourceUpdate other = + (IntelligenceOperatorSourceUpdate) o; + return (Objects.equals(field, other.field)); + } + + @Override + public int hashCode() { + return Objects.hash(field); + } + } + + @JsonDeserialize(builder = CustomFieldMappingResponse.Builder.class) + @JsonIgnoreProperties(ignoreUnknown = true) + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @ToString + public static class CustomFieldMappingResponse { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("id") + @Getter + private final String id; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("category") + @Getter + private final CustomFieldMapping.MappingCategory category; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("name") + @Getter + private final String name; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("description") + @Getter + private final String description; @JsonInclude(JsonInclude.Include.NON_EMPTY) @JsonProperty("entityMetadata") @Getter - private final IntelligenceOperatorEntityMetadata entityMetadata; + private final EntityMetadata entityMetadata; @JsonDeserialize(using = com.twilio.converter.ISO8601Deserializer.class) @JsonSerialize(using = com.twilio.converter.ISO8601Serializer.class) @@ -598,7 +1303,7 @@ private CustomFieldMappingResponse(Builder builder) { public static Builder builder( final CustomFieldMapping.MappingCategory category, final String name, - final IntelligenceOperatorEntityMetadata entityMetadata + final EntityMetadata entityMetadata ) { return new Builder(category, name, entityMetadata); } @@ -630,7 +1335,7 @@ public static class Builder { private String description; @JsonProperty("entityMetadata") - private IntelligenceOperatorEntityMetadata entityMetadata; + private EntityMetadata entityMetadata; @JsonDeserialize( using = com.twilio.converter.ISO8601Deserializer.class @@ -654,7 +1359,7 @@ public Builder( @JsonProperty("name") final String name, @JsonProperty( "entityMetadata" - ) final IntelligenceOperatorEntityMetadata entityMetadata + ) final EntityMetadata entityMetadata ) { this.category = category; this.name = name; @@ -738,124 +1443,6 @@ public int hashCode() { } } - @JsonDeserialize(builder = IntelligenceOperatorEntityMetadata.Builder.class) - @JsonIgnoreProperties(ignoreUnknown = true) - @JsonInclude(JsonInclude.Include.NON_EMPTY) - @ToString - public static class IntelligenceOperatorEntityMetadata { - - @JsonInclude(JsonInclude.Include.NON_EMPTY) - @JsonProperty("sourceType") - @Getter - private final CustomFieldMapping.SourceType sourceType; - - @JsonInclude(JsonInclude.Include.NON_EMPTY) - @JsonProperty("operatorId") - @Getter - private final String operatorId; - - @JsonInclude(JsonInclude.Include.NON_EMPTY) - @JsonProperty("operatorName") - @Getter - private final String operatorName; - - @JsonInclude(JsonInclude.Include.NON_EMPTY) - @JsonProperty("field") - @Getter - private final String field; - - private IntelligenceOperatorEntityMetadata(Builder builder) { - this.sourceType = builder.sourceType; - this.operatorId = builder.operatorId; - this.operatorName = builder.operatorName; - this.field = builder.field; - } - - public static Builder builder( - final CustomFieldMapping.SourceType sourceType, - final String operatorId, - final String field - ) { - return new Builder(sourceType, operatorId, field); - } - - public static IntelligenceOperatorEntityMetadata fromJson( - String jsonString, - ObjectMapper mapper - ) throws IOException { - return mapper.readValue( - jsonString, - IntelligenceOperatorEntityMetadata.class - ); - } - - @JsonIgnoreProperties(ignoreUnknown = true) - @JsonPOJOBuilder(withPrefix = "") - public static class Builder { - - @JsonProperty("sourceType") - private CustomFieldMapping.SourceType sourceType; - - @JsonProperty("operatorId") - private String operatorId; - - @JsonProperty("operatorName") - private String operatorName; - - @JsonProperty("field") - private String field; - - @JsonCreator - public Builder( - @JsonProperty( - "sourceType" - ) final CustomFieldMapping.SourceType sourceType, - @JsonProperty("operatorId") final String operatorId, - @JsonProperty("field") final String field - ) { - this.sourceType = sourceType; - this.operatorId = operatorId; - this.field = field; - } - - @JsonInclude(JsonInclude.Include.NON_EMPTY) - @JsonProperty("operatorName") - public Builder operatorName(String operatorName) { - this.operatorName = operatorName; - return this; - } - - public IntelligenceOperatorEntityMetadata build() { - return new IntelligenceOperatorEntityMetadata(this); - } - } - - @Override - public boolean equals(final Object o) { - if (this == o) { - return true; - } - - if (o == null || getClass() != o.getClass()) { - return false; - } - - IntelligenceOperatorEntityMetadata other = - (IntelligenceOperatorEntityMetadata) o; - return ( - Objects.equals(sourceType, other.sourceType) && - Objects.equals(operatorId, other.operatorId) && - Objects.equals(operatorName, other.operatorName) && - Objects.equals(field, other.field) - ); - } - - @Override - public int hashCode() { - return Objects.hash(sourceType, operatorId, operatorName, field); - } - } - /** * Converts a JSON String into a CustomFieldMapping object using the provided ObjectMapper. * diff --git a/src/main/java/com/twilio/rest/insights/v3/CustomFieldMappingFetcher.java b/src/main/java/com/twilio/rest/insights/v3/CustomFieldMappingFetcher.java index 60a89a2525..a5cd156b89 100644 --- a/src/main/java/com/twilio/rest/insights/v3/CustomFieldMappingFetcher.java +++ b/src/main/java/com/twilio/rest/insights/v3/CustomFieldMappingFetcher.java @@ -30,11 +30,21 @@ public class CustomFieldMappingFetcher extends Fetcher { - public CustomFieldMappingFetcher() {} + private String pathMappingId; + + public CustomFieldMappingFetcher(final String pathMappingId) { + this.pathMappingId = pathMappingId; + } private Response makeRequest(final TwilioRestClient client) { String path = - "/v3/ControlPlane/ConversationInsights/CustomFieldMappings"; + "/v3/ControlPlane/ConversationInsights/CustomFieldMappings/{mappingId}"; + + path = + path.replace( + "{" + "mappingId" + "}", + this.pathMappingId.toString() + ); Request request = new Request( HttpMethod.GET, diff --git a/src/main/java/com/twilio/rest/insights/v3/CustomFieldMappingPatcher.java b/src/main/java/com/twilio/rest/insights/v3/CustomFieldMappingPatcher.java new file mode 100644 index 0000000000..a01873f880 --- /dev/null +++ b/src/main/java/com/twilio/rest/insights/v3/CustomFieldMappingPatcher.java @@ -0,0 +1,131 @@ +/* + * This code was generated by + * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + * + * Twilio - Insights + * The Twilio Insights v3 API provides semantic query access to Conversations analytics data. Resources include synchronous Query, Metadata, and asynchronous QueryJobs for long-running queries. + * + * NOTE: This class is auto generated by OpenAPI Generator. + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.twilio.rest.insights.v3; + +import com.fasterxml.jackson.databind.ObjectMapper; +import com.twilio.base.Patcher; +import com.twilio.constant.EnumConstants; +import com.twilio.constant.EnumConstants.ParameterType; +import com.twilio.converter.Serializer; +import com.twilio.exception.ApiConnectionException; +import com.twilio.exception.ApiException; +import com.twilio.exception.RestException; +import com.twilio.http.HttpMethod; +import com.twilio.http.Request; +import com.twilio.http.Response; +import com.twilio.http.TwilioRestClient; +import com.twilio.rest.Domains; +import com.twilio.type.*; +import java.io.InputStream; + +public class CustomFieldMappingPatcher + extends Patcher { + + private String pathMappingId; + private String ifMatch; + private CustomFieldMapping.CustomFieldMappingUpdateRequest customFieldMappingUpdateRequest; + + public CustomFieldMappingPatcher( + final String pathMappingId, + final CustomFieldMapping.CustomFieldMappingUpdateRequest customFieldMappingUpdateRequest + ) { + this.pathMappingId = pathMappingId; + this.customFieldMappingUpdateRequest = customFieldMappingUpdateRequest; + } + + public CustomFieldMappingPatcher setCustomFieldMappingUpdateRequest( + final CustomFieldMapping.CustomFieldMappingUpdateRequest customFieldMappingUpdateRequest + ) { + this.customFieldMappingUpdateRequest = customFieldMappingUpdateRequest; + return this; + } + + public CustomFieldMappingPatcher setIfMatch(final String ifMatch) { + this.ifMatch = ifMatch; + return this; + } + + @Override + public CustomFieldMapping.PatchCustomFieldMappingResponse patch( + final TwilioRestClient client + ) { + String path = + "/v3/ControlPlane/ConversationInsights/CustomFieldMappings/{mappingId}"; + + path = + path.replace( + "{" + "mappingId" + "}", + this.pathMappingId.toString() + ); + + Request request = new Request( + HttpMethod.PATCH, + Domains.INSIGHTS.toString(), + path + ); + request.setContentType(EnumConstants.ContentType.JSON); + addHeaderParams(request); + addPostParams(request, client); + + Response response = client.request(request); + + if (response == null) { + throw new ApiConnectionException( + "CustomFieldMapping patch failed: Unable to connect to server" + ); + } else if (!TwilioRestClient.SUCCESS.test(response.getStatusCode())) { + InputStream inputStream = response.getStream(); + RestException restException = RestException.fromJson( + inputStream, + client.getObjectMapper() + ); + if (restException == null) { + throw new ApiException( + "Server Error, no content", + response.getStatusCode() + ); + } + throw new ApiException(restException); + } + + return CustomFieldMapping.PatchCustomFieldMappingResponse.fromJson( + response.getStream(), + client.getObjectMapper() + ); + } + + private void addHeaderParams(final Request request) { + if (ifMatch != null) { + Serializer.toString( + request, + "If-Match", + ifMatch, + ParameterType.HEADER + ); + } + } + + private void addPostParams(final Request request, TwilioRestClient client) { + ObjectMapper objectMapper = client.getObjectMapper(); + if (customFieldMappingUpdateRequest != null) { + request.setBody( + CustomFieldMapping.toJson( + customFieldMappingUpdateRequest, + objectMapper + ) + ); + } + } +} diff --git a/src/main/java/com/twilio/rest/insights/v3/CustomFieldMappingReader.java b/src/main/java/com/twilio/rest/insights/v3/CustomFieldMappingReader.java new file mode 100644 index 0000000000..befbeea35e --- /dev/null +++ b/src/main/java/com/twilio/rest/insights/v3/CustomFieldMappingReader.java @@ -0,0 +1,246 @@ +/* + * This code was generated by + * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + * + * Twilio - Insights + * The Twilio Insights v3 API provides semantic query access to Conversations analytics data. Resources include synchronous Query, Metadata, and asynchronous QueryJobs for long-running queries. + * + * NOTE: This class is auto generated by OpenAPI Generator. + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.twilio.rest.insights.v3; + +import com.twilio.base.Page; +import com.twilio.base.Reader; +import com.twilio.base.ResourceSet; +import com.twilio.base.ResourceSetResponse; +import com.twilio.base.TokenPaginationPage; +import com.twilio.base.TwilioResponse; +import com.twilio.constant.EnumConstants.ParameterType; +import com.twilio.converter.Serializer; +import com.twilio.exception.ApiConnectionException; +import com.twilio.exception.ApiException; +import com.twilio.exception.RestException; +import com.twilio.exception.RestStandardException; +import com.twilio.http.HttpMethod; +import com.twilio.http.HttpUtility; +import com.twilio.http.Request; +import com.twilio.http.Response; +import com.twilio.http.TwilioRestClient; +import com.twilio.rest.Domains; +import com.twilio.type.*; +import java.io.InputStream; + +public class CustomFieldMappingReader + extends Reader { + + private Integer pageSize; + private String pageToken; + + public CustomFieldMappingReader() {} + + public CustomFieldMappingReader setPageSize(final Integer pageSize) { + this.pageSize = pageSize; + return this; + } + + public CustomFieldMappingReader setPageToken(final String pageToken) { + this.pageToken = pageToken; + return this; + } + + public ResourceSetResponse< + CustomFieldMapping.ListCustomFieldMappingResponse + > readWithResponse(final TwilioRestClient client) { + Request request = buildFirstPageRequest(client); + Response response = makeRequest(client, request); + Page page = + Page.fromJson( + "items", + response.getContent(), + CustomFieldMapping.ListCustomFieldMappingResponse.class, + client.getObjectMapper() + ); + ResourceSet< + CustomFieldMapping.ListCustomFieldMappingResponse + > resourceSet = new ResourceSet<>(this, client, page); + return new ResourceSetResponse<>( + resourceSet, + response.getStatusCode(), + response.getHeaders() + ); + } + + private Request buildFirstPageRequest(final TwilioRestClient client) { + String path = + "/v3/ControlPlane/ConversationInsights/CustomFieldMappings"; + + Request request = new Request( + HttpMethod.GET, + Domains.INSIGHTS.toString(), + path + ); + addQueryParams(request); + return request; + } + + @Override + public ResourceSet read( + final TwilioRestClient client + ) { + return new ResourceSet<>(this, client, firstPage(client)); + } + + public Page firstPage( + final TwilioRestClient client + ) { + Request request = buildFirstPageRequest(client); + return pageForRequest(client, request); + } + + public TwilioResponse< + Page + > firstPageWithResponse(final TwilioRestClient client) { + Request request = buildFirstPageRequest(client); + Response response = makeRequest(client, request); + Page page = + Page.fromJson( + "items", + response.getContent(), + CustomFieldMapping.ListCustomFieldMappingResponse.class, + client.getObjectMapper() + ); + return new TwilioResponse<>( + page, + response.getStatusCode(), + response.getHeaders() + ); + } + + private Response makeRequest( + final TwilioRestClient client, + final Request request + ) { + Response response = client.request(request); + if (response == null) { + throw new ApiConnectionException( + "CustomFieldMapping read failed: Unable to connect to server" + ); + } else if (!TwilioRestClient.SUCCESS.test(response.getStatusCode())) { + InputStream inputStream = response.getStream(); + RestStandardException standardException = + RestStandardException.fromJson( + inputStream, + client.getObjectMapper() + ); + if ( + standardException != null && standardException.getType() != null + ) { + throw new ApiException(standardException); + } + RestException restException = RestException.fromJson( + inputStream, + client.getObjectMapper() + ); + + if (restException == null) { + throw new ApiException( + "Server Error, no content", + response.getStatusCode() + ); + } + throw new ApiException(restException); + } + return response; + } + + private Page< + CustomFieldMapping.ListCustomFieldMappingResponse + > pageForRequest(final TwilioRestClient client, final Request request) { + Response response = makeRequest(client, request); + return TokenPaginationPage.fromJson( + "items", + response.getContent(), + CustomFieldMapping.ListCustomFieldMappingResponse.class, + client.getObjectMapper() + ); + } + + @Override + public Page previousPage( + final Page page, + final TwilioRestClient client + ) { + String path = + "/v3/ControlPlane/ConversationInsights/CustomFieldMappings"; + + path = path + page.previousQueryString(); + Request request = new Request( + HttpMethod.GET, + Domains.INSIGHTS.toString(), + path + ); + + return pageForRequest(client, request); + } + + @Override + public Page nextPage( + final Page page, + final TwilioRestClient client + ) { + String path = + "/v3/ControlPlane/ConversationInsights/CustomFieldMappings"; + + path = path + page.nextQueryString(); + Request request = new Request( + HttpMethod.GET, + Domains.INSIGHTS.toString(), + path + ); + + return pageForRequest(client, request); + } + + @Override + public Page getPage( + final String targetUrl, + final TwilioRestClient client + ) { + if (!com.twilio.http.HttpUtility.isValidTwilioUrl(targetUrl)) { + throw new ApiException( + "Invalid URL: URL must be a valid Twilio domain" + ); + } + Request request = new Request(HttpMethod.GET, targetUrl); + return pageForRequest(client, request); + } + + private void addQueryParams(final Request request) { + if (pageSize != null) { + Serializer.toString( + request, + "pageSize", + pageSize, + ParameterType.QUERY + ); + } + + if (pageToken != null) { + Serializer.toString( + request, + "pageToken", + pageToken, + ParameterType.QUERY + ); + } + + if (getPageSize() != null) { + request.addQueryParam("PageSize", Integer.toString(getPageSize())); + } + } +} diff --git a/src/main/java/com/twilio/rest/insights/v3/Capacity.java b/src/main/java/com/twilio/rest/insights/v3/CustomFieldMappingsCapacity.java similarity index 74% rename from src/main/java/com/twilio/rest/insights/v3/Capacity.java rename to src/main/java/com/twilio/rest/insights/v3/CustomFieldMappingsCapacity.java index 8c411e26f5..9cd4894399 100644 --- a/src/main/java/com/twilio/rest/insights/v3/Capacity.java +++ b/src/main/java/com/twilio/rest/insights/v3/CustomFieldMappingsCapacity.java @@ -40,15 +40,16 @@ @JsonIgnoreProperties(ignoreUnknown = true) @ToString -public class Capacity extends Resource { +public class CustomFieldMappingsCapacity extends Resource { @JsonIgnoreProperties(ignoreUnknown = true) - public static class CreateCapacityResponse extends Resource { + public static class CreateCustomFieldMappingsCapacityResponse + extends Resource { @JsonCreator - private CreateCapacityResponse() {} + private CreateCustomFieldMappingsCapacityResponse() {} - public static CreateCapacityResponse fromJson( + public static CreateCustomFieldMappingsCapacityResponse fromJson( final InputStream json, final ObjectMapper objectMapper ) { @@ -56,7 +57,7 @@ public static CreateCapacityResponse fromJson( try { return objectMapper.readValue( json, - CreateCapacityResponse.class + CreateCustomFieldMappingsCapacityResponse.class ); } catch (final JsonMappingException | JsonParseException e) { throw new ApiException(e.getMessage(), e); @@ -74,7 +75,8 @@ public boolean equals(final Object o) { if (o == null || getClass() != o.getClass()) { return false; } - CreateCapacityResponse other = (CreateCapacityResponse) o; + CreateCustomFieldMappingsCapacityResponse other = + (CreateCustomFieldMappingsCapacityResponse) o; return true; } @@ -85,12 +87,13 @@ public int hashCode() { } @JsonIgnoreProperties(ignoreUnknown = true) - public static class UpdateCapacityResponse extends Resource { + public static class UpdateCustomFieldMappingsCapacityResponse + extends Resource { @JsonCreator - private UpdateCapacityResponse() {} + private UpdateCustomFieldMappingsCapacityResponse() {} - public static UpdateCapacityResponse fromJson( + public static UpdateCustomFieldMappingsCapacityResponse fromJson( final InputStream json, final ObjectMapper objectMapper ) { @@ -98,7 +101,7 @@ public static UpdateCapacityResponse fromJson( try { return objectMapper.readValue( json, - UpdateCapacityResponse.class + UpdateCustomFieldMappingsCapacityResponse.class ); } catch (final JsonMappingException | JsonParseException e) { throw new ApiException(e.getMessage(), e); @@ -116,7 +119,8 @@ public boolean equals(final Object o) { if (o == null || getClass() != o.getClass()) { return false; } - UpdateCapacityResponse other = (UpdateCapacityResponse) o; + UpdateCustomFieldMappingsCapacityResponse other = + (UpdateCustomFieldMappingsCapacityResponse) o; return (true); } @@ -127,12 +131,13 @@ public int hashCode() { } @JsonIgnoreProperties(ignoreUnknown = true) - public static class DeleteCapacityResponse extends Resource { + public static class DeleteCustomFieldMappingsCapacityResponse + extends Resource { @JsonCreator - private DeleteCapacityResponse() {} + private DeleteCustomFieldMappingsCapacityResponse() {} - public static DeleteCapacityResponse fromJson( + public static DeleteCustomFieldMappingsCapacityResponse fromJson( final InputStream json, final ObjectMapper objectMapper ) { @@ -140,7 +145,7 @@ public static DeleteCapacityResponse fromJson( try { return objectMapper.readValue( json, - DeleteCapacityResponse.class + DeleteCustomFieldMappingsCapacityResponse.class ); } catch (final JsonMappingException | JsonParseException e) { throw new ApiException(e.getMessage(), e); @@ -158,7 +163,8 @@ public boolean equals(final Object o) { if (o == null || getClass() != o.getClass()) { return false; } - DeleteCapacityResponse other = (DeleteCapacityResponse) o; + DeleteCustomFieldMappingsCapacityResponse other = + (DeleteCustomFieldMappingsCapacityResponse) o; return true; } @@ -169,18 +175,22 @@ public int hashCode() { } @JsonIgnoreProperties(ignoreUnknown = true) - public static class ListCapacityResponse extends Resource { + public static class ListCustomFieldMappingsCapacityResponse + extends Resource { @JsonCreator - private ListCapacityResponse() {} + private ListCustomFieldMappingsCapacityResponse() {} - public static ListCapacityResponse fromJson( + public static ListCustomFieldMappingsCapacityResponse fromJson( final InputStream json, final ObjectMapper objectMapper ) { // Convert all checked exceptions to Runtime try { - return objectMapper.readValue(json, ListCapacityResponse.class); + return objectMapper.readValue( + json, + ListCustomFieldMappingsCapacityResponse.class + ); } catch (final JsonMappingException | JsonParseException e) { throw new ApiException(e.getMessage(), e); } catch (final IOException e) { @@ -197,7 +207,8 @@ public boolean equals(final Object o) { if (o == null || getClass() != o.getClass()) { return false; } - ListCapacityResponse other = (ListCapacityResponse) o; + ListCustomFieldMappingsCapacityResponse other = + (ListCustomFieldMappingsCapacityResponse) o; return (true); } @@ -208,12 +219,13 @@ public int hashCode() { } @JsonIgnoreProperties(ignoreUnknown = true) - public static class PatchCapacityResponse extends Resource { + public static class PatchCustomFieldMappingsCapacityResponse + extends Resource { @JsonCreator - private PatchCapacityResponse() {} + private PatchCustomFieldMappingsCapacityResponse() {} - public static PatchCapacityResponse fromJson( + public static PatchCustomFieldMappingsCapacityResponse fromJson( final InputStream json, final ObjectMapper objectMapper ) { @@ -221,7 +233,7 @@ public static PatchCapacityResponse fromJson( try { return objectMapper.readValue( json, - PatchCapacityResponse.class + PatchCustomFieldMappingsCapacityResponse.class ); } catch (final JsonMappingException | JsonParseException e) { throw new ApiException(e.getMessage(), e); @@ -239,7 +251,8 @@ public boolean equals(final Object o) { if (o == null || getClass() != o.getClass()) { return false; } - PatchCapacityResponse other = (PatchCapacityResponse) o; + PatchCustomFieldMappingsCapacityResponse other = + (PatchCustomFieldMappingsCapacityResponse) o; return true; } @@ -250,19 +263,20 @@ public int hashCode() { } @JsonIgnoreProperties(ignoreUnknown = true) - public static class FetchCapacityResponse extends Resource { + public static class FetchCustomFieldMappingsCapacityResponse + extends Resource { @Getter private final CategoryCapacity measure; @JsonCreator - private FetchCapacityResponse( + private FetchCustomFieldMappingsCapacityResponse( @JsonProperty("measure") final CategoryCapacity measure ) { this.measure = measure; } - public static FetchCapacityResponse fromJson( + public static FetchCustomFieldMappingsCapacityResponse fromJson( final InputStream json, final ObjectMapper objectMapper ) { @@ -270,7 +284,7 @@ public static FetchCapacityResponse fromJson( try { return objectMapper.readValue( json, - FetchCapacityResponse.class + FetchCustomFieldMappingsCapacityResponse.class ); } catch (final JsonMappingException | JsonParseException e) { throw new ApiException(e.getMessage(), e); @@ -288,7 +302,8 @@ public boolean equals(final Object o) { if (o == null || getClass() != o.getClass()) { return false; } - FetchCapacityResponse other = (FetchCapacityResponse) o; + FetchCustomFieldMappingsCapacityResponse other = + (FetchCustomFieldMappingsCapacityResponse) o; return Objects.equals(measure, other.measure); } @@ -298,8 +313,8 @@ public int hashCode() { } } - public static CapacityFetcher fetcher() { - return new CapacityFetcher(); + public static CustomFieldMappingsCapacityFetcher fetcher() { + return new CustomFieldMappingsCapacityFetcher(); } @JsonDeserialize(builder = CategoryCapacity.Builder.class) @@ -323,8 +338,11 @@ private CategoryCapacity(Builder builder) { this.remaining = builder.remaining; } - public static Builder builder() { - return new Builder(); + public static Builder builder( + final Integer consumed, + final Integer remaining + ) { + return new Builder(consumed, remaining); } public static CategoryCapacity fromJson( @@ -344,18 +362,13 @@ public static class Builder { @JsonProperty("remaining") private Integer remaining; - @JsonInclude(JsonInclude.Include.NON_EMPTY) - @JsonProperty("consumed") - public Builder consumed(Integer consumed) { + @JsonCreator + public Builder( + @JsonProperty("consumed") final Integer consumed, + @JsonProperty("remaining") final Integer remaining + ) { this.consumed = consumed; - return this; - } - - @JsonInclude(JsonInclude.Include.NON_EMPTY) - @JsonProperty("remaining") - public Builder remaining(Integer remaining) { this.remaining = remaining; - return this; } public CategoryCapacity build() { @@ -387,19 +400,22 @@ public int hashCode() { } /** - * Converts a JSON String into a Capacity object using the provided ObjectMapper. + * Converts a JSON String into a CustomFieldMappingsCapacity object using the provided ObjectMapper. * * @param json Raw JSON String * @param objectMapper Jackson ObjectMapper - * @return Capacity object represented by the provided JSON + * @return CustomFieldMappingsCapacity object represented by the provided JSON */ - public static Capacity fromJson( + public static CustomFieldMappingsCapacity fromJson( final String json, final ObjectMapper objectMapper ) { // Convert all checked exceptions to Runtime try { - return objectMapper.readValue(json, Capacity.class); + return objectMapper.readValue( + json, + CustomFieldMappingsCapacity.class + ); } catch (final JsonMappingException | JsonParseException e) { throw new ApiException(e.getMessage(), e); } catch (final IOException e) { @@ -408,20 +424,23 @@ public static Capacity fromJson( } /** - * Converts a JSON InputStream into a Capacity object using the provided + * Converts a JSON InputStream into a CustomFieldMappingsCapacity object using the provided * ObjectMapper. * * @param json Raw JSON InputStream * @param objectMapper Jackson ObjectMapper - * @return Capacity object represented by the provided JSON + * @return CustomFieldMappingsCapacity object represented by the provided JSON */ - public static Capacity fromJson( + public static CustomFieldMappingsCapacity fromJson( final InputStream json, final ObjectMapper objectMapper ) { // Convert all checked exceptions to Runtime try { - return objectMapper.readValue(json, Capacity.class); + return objectMapper.readValue( + json, + CustomFieldMappingsCapacity.class + ); } catch (final JsonMappingException | JsonParseException e) { throw new ApiException(e.getMessage(), e); } catch (final IOException e) { @@ -442,7 +461,7 @@ public static String toJson(Object object, ObjectMapper mapper) { } @JsonCreator - private Capacity() {} + private CustomFieldMappingsCapacity() {} @Override public boolean equals(Object obj) { diff --git a/src/main/java/com/twilio/rest/insights/v3/CapacityFetcher.java b/src/main/java/com/twilio/rest/insights/v3/CustomFieldMappingsCapacityFetcher.java similarity index 76% rename from src/main/java/com/twilio/rest/insights/v3/CapacityFetcher.java rename to src/main/java/com/twilio/rest/insights/v3/CustomFieldMappingsCapacityFetcher.java index f87249b2d6..9c4dd48e63 100644 --- a/src/main/java/com/twilio/rest/insights/v3/CapacityFetcher.java +++ b/src/main/java/com/twilio/rest/insights/v3/CustomFieldMappingsCapacityFetcher.java @@ -27,13 +27,16 @@ import com.twilio.type.*; import java.io.InputStream; -public class CapacityFetcher extends Fetcher { +public class CustomFieldMappingsCapacityFetcher + extends Fetcher< + CustomFieldMappingsCapacity.FetchCustomFieldMappingsCapacityResponse + > { - public CapacityFetcher() {} + public CustomFieldMappingsCapacityFetcher() {} private Response makeRequest(final TwilioRestClient client) { String path = - "/v3/ControlPlane/ConversationInsights/CustomFieldMappings/Capacity"; + "/v3/ControlPlane/ConversationInsights/CustomFieldMappingsCapacity"; Request request = new Request( HttpMethod.GET, @@ -45,7 +48,7 @@ private Response makeRequest(final TwilioRestClient client) { if (response == null) { throw new ApiConnectionException( - "Capacity fetch failed: Unable to connect to server" + "CustomFieldMappingsCapacity fetch failed: Unable to connect to server" ); } else if (!TwilioRestClient.SUCCESS.test(response.getStatusCode())) { InputStream inputStream = response.getStream(); @@ -65,21 +68,23 @@ private Response makeRequest(final TwilioRestClient client) { } @Override - public Capacity.FetchCapacityResponse fetch(final TwilioRestClient client) { + public CustomFieldMappingsCapacity.FetchCustomFieldMappingsCapacityResponse fetch( + final TwilioRestClient client + ) { Response response = makeRequest(client); - return Capacity.FetchCapacityResponse.fromJson( + return CustomFieldMappingsCapacity.FetchCustomFieldMappingsCapacityResponse.fromJson( response.getStream(), client.getObjectMapper() ); } @Override - public TwilioResponse fetchWithResponse( - final TwilioRestClient client - ) { + public TwilioResponse< + CustomFieldMappingsCapacity.FetchCustomFieldMappingsCapacityResponse + > fetchWithResponse(final TwilioRestClient client) { Response response = makeRequest(client); - Capacity.FetchCapacityResponse content = - Capacity.FetchCapacityResponse.fromJson( + CustomFieldMappingsCapacity.FetchCustomFieldMappingsCapacityResponse content = + CustomFieldMappingsCapacity.FetchCustomFieldMappingsCapacityResponse.fromJson( response.getStream(), client.getObjectMapper() ); diff --git a/src/main/java/com/twilio/rest/knowledge/v2/Operation.java b/src/main/java/com/twilio/rest/knowledge/v2/Operation.java index 335713b43f..45d1bced39 100644 --- a/src/main/java/com/twilio/rest/knowledge/v2/Operation.java +++ b/src/main/java/com/twilio/rest/knowledge/v2/Operation.java @@ -413,25 +413,25 @@ public static Type forValue(final String value) { public static class OperationResultResourceId { @JsonInclude(JsonInclude.Include.NON_EMPTY) - @JsonProperty("type") + @JsonProperty("id") @Getter - private final Operation.Type type; + private final String id; @JsonInclude(JsonInclude.Include.NON_EMPTY) - @JsonProperty("id") + @JsonProperty("type") @Getter - private final String id; + private final Operation.Type type; private OperationResultResourceId(Builder builder) { - this.type = builder.type; this.id = builder.id; + this.type = builder.type; } public static Builder builder( - final Operation.Type type, - final String id + final String id, + final Operation.Type type ) { - return new Builder(type, id); + return new Builder(id, type); } public static OperationResultResourceId fromJson( @@ -448,19 +448,19 @@ public static OperationResultResourceId fromJson( @JsonPOJOBuilder(withPrefix = "") public static class Builder { - @JsonProperty("type") - private Operation.Type type; - @JsonProperty("id") private String id; + @JsonProperty("type") + private Operation.Type type; + @JsonCreator public Builder( - @JsonProperty("type") final Operation.Type type, - @JsonProperty("id") final String id + @JsonProperty("id") final String id, + @JsonProperty("type") final Operation.Type type ) { - this.type = type; this.id = id; + this.type = type; } public OperationResultResourceId build() { @@ -480,13 +480,13 @@ public boolean equals(final Object o) { OperationResultResourceId other = (OperationResultResourceId) o; return ( - Objects.equals(type, other.type) && Objects.equals(id, other.id) + Objects.equals(id, other.id) && Objects.equals(type, other.type) ); } @Override public int hashCode() { - return Objects.hash(type, id); + return Objects.hash(id, type); } } diff --git a/src/main/java/com/twilio/rest/messaging/v2/ChannelsSender.java b/src/main/java/com/twilio/rest/messaging/v2/ChannelsSender.java index 5621537ae9..37b3095e0a 100644 --- a/src/main/java/com/twilio/rest/messaging/v2/ChannelsSender.java +++ b/src/main/java/com/twilio/rest/messaging/v2/ChannelsSender.java @@ -26,6 +26,7 @@ import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.annotation.JsonDeserialize; import com.fasterxml.jackson.databind.annotation.JsonPOJOBuilder; +import com.fasterxml.jackson.databind.annotation.JsonSerialize; import com.twilio.base.Resource; import com.twilio.base.Resource; import com.twilio.converter.Promoter; @@ -36,6 +37,7 @@ import java.io.IOException; import java.io.InputStream; import java.net.URI; +import java.time.ZonedDateTime; import java.util.List; import java.util.Objects; import lombok.Builder; @@ -119,6 +121,35 @@ public static CallbackMethod forValue(final String value) { } } + public enum PendingDisplayNameStatus { + PENDING_REVIEW("PENDING_REVIEW"), + APPROVED("APPROVED"), + DECLINED("DECLINED"), + PIN_MISMATCH("PIN_MISMATCH"), + REGISTRATION_FAILED("REGISTRATION_FAILED"), + EXPIRED("EXPIRED"), + COMPLETED("COMPLETED"); + + private final String value; + + private PendingDisplayNameStatus(final String value) { + this.value = value; + } + + @JsonValue + public String toString() { + return value; + } + + @JsonCreator + public static PendingDisplayNameStatus forValue(final String value) { + return Promoter.enumFromString( + value, + PendingDisplayNameStatus.values() + ); + } + } + public enum MessagingV2RcsCarrierStatus { UNKNOWN("UNKNOWN"), UNLAUNCHED("UNLAUNCHED"), @@ -212,6 +243,29 @@ public static AccountType forValue(final String value) { } } + public enum DisplayNameStatus { + UPDATING("updating"), + NO_CHANGE("no_change"), + PENDING_REVIEW("pending_review"), + ERROR("error"); + + private final String value; + + private DisplayNameStatus(final String value) { + this.value = value; + } + + @JsonValue + public String toString() { + return value; + } + + @JsonCreator + public static DisplayNameStatus forValue(final String value) { + return Promoter.enumFromString(value, DisplayNameStatus.values()); + } + } + public enum FallbackMethod { POST("POST"), PUT("PUT"); @@ -2335,6 +2389,9 @@ public static String toJson(Object object, ObjectMapper mapper) { @Getter private final MessagingV2ChannelsSenderConfiguration configuration; + @Getter + private final ChannelsSender.DisplayNameStatus displayNameStatus; + @Getter private final String friendlyName; @@ -2343,6 +2400,16 @@ public static String toJson(Object object, ObjectMapper mapper) { MessagingV2ChannelsSenderOfflineReasonsItems > offlineReasons; + @Getter + private final String pendingDisplayName; + + @Getter + private final ChannelsSender.PendingDisplayNameStatus pendingDisplayNameStatus; + + @JsonSerialize(using = com.twilio.converter.ISO8601Serializer.class) + @Getter + private final ZonedDateTime pendingDisplayNameStatusDate; + @Getter private final MessagingV2ChannelsSenderProfileGenericResponse profile; @@ -2372,10 +2439,22 @@ private ChannelsSender( @JsonProperty( "configuration" ) final MessagingV2ChannelsSenderConfiguration configuration, + @JsonProperty( + "display_name_status" + ) final ChannelsSender.DisplayNameStatus displayNameStatus, @JsonProperty("friendly_name") final String friendlyName, @JsonProperty("offline_reasons") final List< MessagingV2ChannelsSenderOfflineReasonsItems > offlineReasons, + @JsonProperty("pending_display_name") final String pendingDisplayName, + @JsonProperty( + "pending_display_name_status" + ) final ChannelsSender.PendingDisplayNameStatus pendingDisplayNameStatus, + @JsonProperty("pending_display_name_status_date") @JsonDeserialize( + using = com.twilio.converter.ISO8601Deserializer.class + ) @JsonSerialize( + using = com.twilio.converter.ISO8601Serializer.class + ) final ZonedDateTime pendingDisplayNameStatusDate, @JsonProperty( "profile" ) final MessagingV2ChannelsSenderProfileGenericResponse profile, @@ -2390,8 +2469,12 @@ private ChannelsSender( ) { this.compliance = compliance; this.configuration = configuration; + this.displayNameStatus = displayNameStatus; this.friendlyName = friendlyName; this.offlineReasons = offlineReasons; + this.pendingDisplayName = pendingDisplayName; + this.pendingDisplayNameStatus = pendingDisplayNameStatus; + this.pendingDisplayNameStatusDate = pendingDisplayNameStatusDate; this.profile = profile; this.properties = properties; this.senderId = senderId; @@ -2415,8 +2498,18 @@ public boolean equals(final Object o) { return ( Objects.equals(compliance, other.compliance) && Objects.equals(configuration, other.configuration) && + Objects.equals(displayNameStatus, other.displayNameStatus) && Objects.equals(friendlyName, other.friendlyName) && Objects.equals(offlineReasons, other.offlineReasons) && + Objects.equals(pendingDisplayName, other.pendingDisplayName) && + Objects.equals( + pendingDisplayNameStatus, + other.pendingDisplayNameStatus + ) && + Objects.equals( + pendingDisplayNameStatusDate, + other.pendingDisplayNameStatusDate + ) && Objects.equals(profile, other.profile) && Objects.equals(properties, other.properties) && Objects.equals(senderId, other.senderId) && @@ -2432,8 +2525,12 @@ public int hashCode() { return Objects.hash( compliance, configuration, + displayNameStatus, friendlyName, offlineReasons, + pendingDisplayName, + pendingDisplayNameStatus, + pendingDisplayNameStatusDate, profile, properties, senderId, diff --git a/src/main/java/com/twilio/rest/numbers/v1/SmsVerification.java b/src/main/java/com/twilio/rest/numbers/v1/SmsVerification.java index 45dc277bf3..c2e7db26fd 100644 --- a/src/main/java/com/twilio/rest/numbers/v1/SmsVerification.java +++ b/src/main/java/com/twilio/rest/numbers/v1/SmsVerification.java @@ -43,8 +43,113 @@ @ToString public class SmsVerification extends Resource { - public static SmsVerificationCreator creator() { - return new SmsVerificationCreator(); + public static SmsVerificationCreator creator( + final SmsVerification.NumbersV1SmsVerificationRequest numbersV1SmsVerificationRequest + ) { + return new SmsVerificationCreator(numbersV1SmsVerificationRequest); + } + + @JsonDeserialize(builder = NumbersV1SmsVerificationRequest.Builder.class) + @JsonIgnoreProperties(ignoreUnknown = true) + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @ToString + public static class NumbersV1SmsVerificationRequest { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("to") + @Getter + private final String to; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("locale") + @Getter + private final String locale; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("friendly_name") + @Getter + private final String friendlyName; + + private NumbersV1SmsVerificationRequest(Builder builder) { + this.to = builder.to; + this.locale = builder.locale; + this.friendlyName = builder.friendlyName; + } + + public static Builder builder(final String to) { + return new Builder(to); + } + + public static NumbersV1SmsVerificationRequest fromJson( + String jsonString, + ObjectMapper mapper + ) throws IOException { + return mapper.readValue( + jsonString, + NumbersV1SmsVerificationRequest.class + ); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + @JsonPOJOBuilder(withPrefix = "") + public static class Builder { + + @JsonProperty("to") + private String to; + + @JsonProperty("locale") + private String locale; + + @JsonProperty("friendly_name") + private String friendlyName; + + @JsonCreator + public Builder(@JsonProperty("to") final String to) { + this.to = to; + } + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("locale") + public Builder locale(String locale) { + this.locale = locale; + return this; + } + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("friendly_name") + public Builder friendlyName(String friendlyName) { + this.friendlyName = friendlyName; + return this; + } + + public NumbersV1SmsVerificationRequest build() { + return new NumbersV1SmsVerificationRequest(this); + } + } + + @Override + public boolean equals(final Object o) { + if (this == o) { + return true; + } + + if (o == null || getClass() != o.getClass()) { + return false; + } + + NumbersV1SmsVerificationRequest other = + (NumbersV1SmsVerificationRequest) o; + return ( + Objects.equals(to, other.to) && + Objects.equals(locale, other.locale) && + Objects.equals(friendlyName, other.friendlyName) + ); + } + + @Override + public int hashCode() { + return Objects.hash(to, locale, friendlyName); + } } @JsonDeserialize( diff --git a/src/main/java/com/twilio/rest/numbers/v1/SmsVerificationCheck.java b/src/main/java/com/twilio/rest/numbers/v1/SmsVerificationCheck.java index 661e0f5967..c975c3313b 100644 --- a/src/main/java/com/twilio/rest/numbers/v1/SmsVerificationCheck.java +++ b/src/main/java/com/twilio/rest/numbers/v1/SmsVerificationCheck.java @@ -16,12 +16,15 @@ import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.core.JsonParseException; import com.fasterxml.jackson.core.JsonParseException; import com.fasterxml.jackson.core.JsonProcessingException; import com.fasterxml.jackson.databind.JsonMappingException; import com.fasterxml.jackson.databind.ObjectMapper; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.fasterxml.jackson.databind.annotation.JsonPOJOBuilder; import com.twilio.base.Resource; import com.twilio.base.Resource; import com.twilio.exception.ApiConnectionException; @@ -31,6 +34,7 @@ import java.io.IOException; import java.io.InputStream; import java.util.Objects; +import lombok.Builder; import lombok.Getter; import lombok.ToString; @@ -38,8 +42,117 @@ @ToString public class SmsVerificationCheck extends Resource { - public static SmsVerificationCheckCreator creator() { - return new SmsVerificationCheckCreator(); + public static SmsVerificationCheckCreator creator( + final SmsVerificationCheck.NumbersV1SmsVerificationCheckRequest numbersV1SmsVerificationCheckRequest + ) { + return new SmsVerificationCheckCreator( + numbersV1SmsVerificationCheckRequest + ); + } + + @JsonDeserialize( + builder = NumbersV1SmsVerificationCheckRequest.Builder.class + ) + @JsonIgnoreProperties(ignoreUnknown = true) + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @ToString + public static class NumbersV1SmsVerificationCheckRequest { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("to") + @Getter + private final String to; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("verification_code") + @Getter + private final String verificationCode; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("friendly_name") + @Getter + private final String friendlyName; + + private NumbersV1SmsVerificationCheckRequest(Builder builder) { + this.to = builder.to; + this.verificationCode = builder.verificationCode; + this.friendlyName = builder.friendlyName; + } + + public static Builder builder( + final String to, + final String verificationCode + ) { + return new Builder(to, verificationCode); + } + + public static NumbersV1SmsVerificationCheckRequest fromJson( + String jsonString, + ObjectMapper mapper + ) throws IOException { + return mapper.readValue( + jsonString, + NumbersV1SmsVerificationCheckRequest.class + ); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + @JsonPOJOBuilder(withPrefix = "") + public static class Builder { + + @JsonProperty("to") + private String to; + + @JsonProperty("verification_code") + private String verificationCode; + + @JsonProperty("friendly_name") + private String friendlyName; + + @JsonCreator + public Builder( + @JsonProperty("to") final String to, + @JsonProperty("verification_code") final String verificationCode + ) { + this.to = to; + this.verificationCode = verificationCode; + } + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("friendly_name") + public Builder friendlyName(String friendlyName) { + this.friendlyName = friendlyName; + return this; + } + + public NumbersV1SmsVerificationCheckRequest build() { + return new NumbersV1SmsVerificationCheckRequest(this); + } + } + + @Override + public boolean equals(final Object o) { + if (this == o) { + return true; + } + + if (o == null || getClass() != o.getClass()) { + return false; + } + + NumbersV1SmsVerificationCheckRequest other = + (NumbersV1SmsVerificationCheckRequest) o; + return ( + Objects.equals(to, other.to) && + Objects.equals(verificationCode, other.verificationCode) && + Objects.equals(friendlyName, other.friendlyName) + ); + } + + @Override + public int hashCode() { + return Objects.hash(to, verificationCode, friendlyName); + } } /** diff --git a/src/main/java/com/twilio/rest/numbers/v1/SmsVerificationCheckCreator.java b/src/main/java/com/twilio/rest/numbers/v1/SmsVerificationCheckCreator.java index fcae1f207c..474f227a2f 100644 --- a/src/main/java/com/twilio/rest/numbers/v1/SmsVerificationCheckCreator.java +++ b/src/main/java/com/twilio/rest/numbers/v1/SmsVerificationCheckCreator.java @@ -14,8 +14,10 @@ package com.twilio.rest.numbers.v1; +import com.fasterxml.jackson.databind.ObjectMapper; import com.twilio.base.Creator; import com.twilio.base.TwilioResponse; +import com.twilio.constant.EnumConstants; import com.twilio.exception.ApiConnectionException; import com.twilio.exception.ApiException; import com.twilio.exception.RestException; @@ -29,7 +31,22 @@ public class SmsVerificationCheckCreator extends Creator { - public SmsVerificationCheckCreator() {} + private SmsVerificationCheck.NumbersV1SmsVerificationCheckRequest numbersV1SmsVerificationCheckRequest; + + public SmsVerificationCheckCreator( + final SmsVerificationCheck.NumbersV1SmsVerificationCheckRequest numbersV1SmsVerificationCheckRequest + ) { + this.numbersV1SmsVerificationCheckRequest = + numbersV1SmsVerificationCheckRequest; + } + + public SmsVerificationCheckCreator setNumbersV1SmsVerificationCheckRequest( + final SmsVerificationCheck.NumbersV1SmsVerificationCheckRequest numbersV1SmsVerificationCheckRequest + ) { + this.numbersV1SmsVerificationCheckRequest = + numbersV1SmsVerificationCheckRequest; + return this; + } private Response makeRequest(final TwilioRestClient client) { String path = "/v1/CallerIds/SmsVerificationChecks"; @@ -39,6 +56,8 @@ private Response makeRequest(final TwilioRestClient client) { Domains.NUMBERS.toString(), path ); + request.setContentType(EnumConstants.ContentType.JSON); + addPostParams(request, client); Response response = client.request(request); @@ -87,4 +106,16 @@ public TwilioResponse createWithResponse( response.getHeaders() ); } + + private void addPostParams(final Request request, TwilioRestClient client) { + ObjectMapper objectMapper = client.getObjectMapper(); + if (numbersV1SmsVerificationCheckRequest != null) { + request.setBody( + SmsVerificationCheck.toJson( + numbersV1SmsVerificationCheckRequest, + objectMapper + ) + ); + } + } } diff --git a/src/main/java/com/twilio/rest/numbers/v1/SmsVerificationCreator.java b/src/main/java/com/twilio/rest/numbers/v1/SmsVerificationCreator.java index 5cf07d8b74..24731d3fa8 100644 --- a/src/main/java/com/twilio/rest/numbers/v1/SmsVerificationCreator.java +++ b/src/main/java/com/twilio/rest/numbers/v1/SmsVerificationCreator.java @@ -14,8 +14,10 @@ package com.twilio.rest.numbers.v1; +import com.fasterxml.jackson.databind.ObjectMapper; import com.twilio.base.Creator; import com.twilio.base.TwilioResponse; +import com.twilio.constant.EnumConstants; import com.twilio.exception.ApiConnectionException; import com.twilio.exception.ApiException; import com.twilio.exception.RestException; @@ -29,7 +31,20 @@ public class SmsVerificationCreator extends Creator { - public SmsVerificationCreator() {} + private SmsVerification.NumbersV1SmsVerificationRequest numbersV1SmsVerificationRequest; + + public SmsVerificationCreator( + final SmsVerification.NumbersV1SmsVerificationRequest numbersV1SmsVerificationRequest + ) { + this.numbersV1SmsVerificationRequest = numbersV1SmsVerificationRequest; + } + + public SmsVerificationCreator setNumbersV1SmsVerificationRequest( + final SmsVerification.NumbersV1SmsVerificationRequest numbersV1SmsVerificationRequest + ) { + this.numbersV1SmsVerificationRequest = numbersV1SmsVerificationRequest; + return this; + } private Response makeRequest(final TwilioRestClient client) { String path = "/v1/CallerIds/SmsVerifications"; @@ -39,6 +54,8 @@ private Response makeRequest(final TwilioRestClient client) { Domains.NUMBERS.toString(), path ); + request.setContentType(EnumConstants.ContentType.JSON); + addPostParams(request, client); Response response = client.request(request); @@ -87,4 +104,16 @@ public TwilioResponse createWithResponse( response.getHeaders() ); } + + private void addPostParams(final Request request, TwilioRestClient client) { + ObjectMapper objectMapper = client.getObjectMapper(); + if (numbersV1SmsVerificationRequest != null) { + request.setBody( + SmsVerification.toJson( + numbersV1SmsVerificationRequest, + objectMapper + ) + ); + } + } } diff --git a/src/main/java/com/twilio/rest/numbers/v1/VoiceVerification.java b/src/main/java/com/twilio/rest/numbers/v1/VoiceVerification.java index d825facc66..36ccaf544e 100644 --- a/src/main/java/com/twilio/rest/numbers/v1/VoiceVerification.java +++ b/src/main/java/com/twilio/rest/numbers/v1/VoiceVerification.java @@ -16,21 +16,28 @@ import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonValue; import com.fasterxml.jackson.core.JsonParseException; import com.fasterxml.jackson.core.JsonParseException; import com.fasterxml.jackson.core.JsonProcessingException; import com.fasterxml.jackson.databind.JsonMappingException; import com.fasterxml.jackson.databind.ObjectMapper; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.fasterxml.jackson.databind.annotation.JsonPOJOBuilder; import com.twilio.base.Resource; import com.twilio.base.Resource; +import com.twilio.converter.Promoter; import com.twilio.exception.ApiConnectionException; import com.twilio.exception.ApiException; import com.twilio.type.*; import java.io.IOException; import java.io.IOException; import java.io.InputStream; +import java.net.URI; import java.util.Objects; +import lombok.Builder; import lombok.Getter; import lombok.ToString; @@ -38,8 +45,242 @@ @ToString public class VoiceVerification extends Resource { - public static VoiceVerificationCreator creator() { - return new VoiceVerificationCreator(); + public static VoiceVerificationCreator creator( + final VoiceVerification.NumbersV1VoiceVerificationRequest numbersV1VoiceVerificationRequest + ) { + return new VoiceVerificationCreator(numbersV1VoiceVerificationRequest); + } + + public enum StatusCallbackMethod { + HEAD("HEAD"), + GET("GET"), + POST("POST"), + PATCH("PATCH"), + PUT("PUT"), + DELETE("DELETE"); + + private final String value; + + private StatusCallbackMethod(final String value) { + this.value = value; + } + + @JsonValue + public String toString() { + return value; + } + + @JsonCreator + public static StatusCallbackMethod forValue(final String value) { + return Promoter.enumFromString( + value, + StatusCallbackMethod.values() + ); + } + } + + @JsonDeserialize(builder = NumbersV1VoiceVerificationRequest.Builder.class) + @JsonIgnoreProperties(ignoreUnknown = true) + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @ToString + public static class NumbersV1VoiceVerificationRequest { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("phone_number") + @Getter + private final String phoneNumber; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("friendly_name") + @Getter + private final String friendlyName; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("custom_code") + @Getter + private final String customCode; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("call_delay") + @Getter + private final String callDelay; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("status_callback") + @Getter + private final URI statusCallback; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("status_callback_method") + @Getter + private final VoiceVerification.StatusCallbackMethod statusCallbackMethod; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("extension") + @Getter + private final String extension; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("custom_success_message") + @Getter + private final String customSuccessMessage; + + private NumbersV1VoiceVerificationRequest(Builder builder) { + this.phoneNumber = builder.phoneNumber; + this.friendlyName = builder.friendlyName; + this.customCode = builder.customCode; + this.callDelay = builder.callDelay; + this.statusCallback = builder.statusCallback; + this.statusCallbackMethod = builder.statusCallbackMethod; + this.extension = builder.extension; + this.customSuccessMessage = builder.customSuccessMessage; + } + + public static Builder builder(final String phoneNumber) { + return new Builder(phoneNumber); + } + + public static NumbersV1VoiceVerificationRequest fromJson( + String jsonString, + ObjectMapper mapper + ) throws IOException { + return mapper.readValue( + jsonString, + NumbersV1VoiceVerificationRequest.class + ); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + @JsonPOJOBuilder(withPrefix = "") + public static class Builder { + + @JsonProperty("phone_number") + private String phoneNumber; + + @JsonProperty("friendly_name") + private String friendlyName; + + @JsonProperty("custom_code") + private String customCode; + + @JsonProperty("call_delay") + private String callDelay; + + @JsonProperty("status_callback") + private URI statusCallback; + + @JsonProperty("status_callback_method") + private VoiceVerification.StatusCallbackMethod statusCallbackMethod; + + @JsonProperty("extension") + private String extension; + + @JsonProperty("custom_success_message") + private String customSuccessMessage; + + @JsonCreator + public Builder( + @JsonProperty("phone_number") final String phoneNumber + ) { + this.phoneNumber = phoneNumber; + } + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("friendly_name") + public Builder friendlyName(String friendlyName) { + this.friendlyName = friendlyName; + return this; + } + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("custom_code") + public Builder customCode(String customCode) { + this.customCode = customCode; + return this; + } + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("call_delay") + public Builder callDelay(String callDelay) { + this.callDelay = callDelay; + return this; + } + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("status_callback") + public Builder statusCallback(URI statusCallback) { + this.statusCallback = statusCallback; + return this; + } + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("status_callback_method") + public Builder statusCallbackMethod( + VoiceVerification.StatusCallbackMethod statusCallbackMethod + ) { + this.statusCallbackMethod = statusCallbackMethod; + return this; + } + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("extension") + public Builder extension(String extension) { + this.extension = extension; + return this; + } + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("custom_success_message") + public Builder customSuccessMessage(String customSuccessMessage) { + this.customSuccessMessage = customSuccessMessage; + return this; + } + + public NumbersV1VoiceVerificationRequest build() { + return new NumbersV1VoiceVerificationRequest(this); + } + } + + @Override + public boolean equals(final Object o) { + if (this == o) { + return true; + } + + if (o == null || getClass() != o.getClass()) { + return false; + } + + NumbersV1VoiceVerificationRequest other = + (NumbersV1VoiceVerificationRequest) o; + return ( + Objects.equals(phoneNumber, other.phoneNumber) && + Objects.equals(friendlyName, other.friendlyName) && + Objects.equals(customCode, other.customCode) && + Objects.equals(callDelay, other.callDelay) && + Objects.equals(statusCallback, other.statusCallback) && + Objects.equals( + statusCallbackMethod, + other.statusCallbackMethod + ) && + Objects.equals(extension, other.extension) && + Objects.equals(customSuccessMessage, other.customSuccessMessage) + ); + } + + @Override + public int hashCode() { + return Objects.hash( + phoneNumber, + friendlyName, + customCode, + callDelay, + statusCallback, + statusCallbackMethod, + extension, + customSuccessMessage + ); + } } /** diff --git a/src/main/java/com/twilio/rest/numbers/v1/VoiceVerificationCheck.java b/src/main/java/com/twilio/rest/numbers/v1/VoiceVerificationCheck.java deleted file mode 100644 index 3b46aacc60..0000000000 --- a/src/main/java/com/twilio/rest/numbers/v1/VoiceVerificationCheck.java +++ /dev/null @@ -1,136 +0,0 @@ -/* - * This code was generated by - * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ - * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ - * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ - * - * Twilio - Numbers - * This is the public Twilio REST API. - * - * NOTE: This class is auto generated by OpenAPI Generator. - * https://openapi-generator.tech - * Do not edit the class manually. - */ - -package com.twilio.rest.numbers.v1; - -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.core.JsonParseException; -import com.fasterxml.jackson.core.JsonParseException; -import com.fasterxml.jackson.core.JsonProcessingException; -import com.fasterxml.jackson.databind.JsonMappingException; -import com.fasterxml.jackson.databind.ObjectMapper; -import com.twilio.base.Resource; -import com.twilio.base.Resource; -import com.twilio.exception.ApiConnectionException; -import com.twilio.exception.ApiException; -import com.twilio.type.*; -import java.io.IOException; -import java.io.IOException; -import java.io.InputStream; -import java.util.Objects; -import lombok.Getter; -import lombok.ToString; - -@JsonIgnoreProperties(ignoreUnknown = true) -@ToString -public class VoiceVerificationCheck extends Resource { - - public static VoiceVerificationCheckCreator creator() { - return new VoiceVerificationCheckCreator(); - } - - /** - * Converts a JSON String into a VoiceVerificationCheck object using the provided ObjectMapper. - * - * @param json Raw JSON String - * @param objectMapper Jackson ObjectMapper - * @return VoiceVerificationCheck object represented by the provided JSON - */ - public static VoiceVerificationCheck fromJson( - final String json, - final ObjectMapper objectMapper - ) { - // Convert all checked exceptions to Runtime - try { - return objectMapper.readValue(json, VoiceVerificationCheck.class); - } catch (final JsonMappingException | JsonParseException e) { - throw new ApiException(e.getMessage(), e); - } catch (final IOException e) { - throw new ApiConnectionException(e.getMessage(), e); - } - } - - /** - * Converts a JSON InputStream into a VoiceVerificationCheck object using the provided - * ObjectMapper. - * - * @param json Raw JSON InputStream - * @param objectMapper Jackson ObjectMapper - * @return VoiceVerificationCheck object represented by the provided JSON - */ - public static VoiceVerificationCheck fromJson( - final InputStream json, - final ObjectMapper objectMapper - ) { - // Convert all checked exceptions to Runtime - try { - return objectMapper.readValue(json, VoiceVerificationCheck.class); - } catch (final JsonMappingException | JsonParseException e) { - throw new ApiException(e.getMessage(), e); - } catch (final IOException e) { - throw new ApiConnectionException(e.getMessage(), e); - } - } - - public static String toJson(Object object, ObjectMapper mapper) { - try { - return mapper.writeValueAsString(object); - } catch (final JsonMappingException e) { - throw new ApiException(e.getMessage(), e); - } catch (JsonProcessingException e) { - throw new ApiException(e.getMessage(), e); - } catch (final IOException e) { - throw new ApiConnectionException(e.getMessage(), e); - } - } - - @Getter - private final String callerIdSid; - - @Getter - private final String to; - - @JsonCreator - private VoiceVerificationCheck( - @JsonProperty("callerIdSid") final String callerIdSid, - @JsonProperty("to") final String to - ) { - this.callerIdSid = callerIdSid; - this.to = to; - } - - @Override - public boolean equals(final Object o) { - if (this == o) { - return true; - } - - if (o == null || getClass() != o.getClass()) { - return false; - } - - VoiceVerificationCheck other = (VoiceVerificationCheck) o; - return ( - Objects.equals(callerIdSid, other.callerIdSid) && - Objects.equals(to, other.to) - ); - } - - @Override - public int hashCode() { - return Objects.hash(callerIdSid, to); - } -} diff --git a/src/main/java/com/twilio/rest/numbers/v1/VoiceVerificationCreator.java b/src/main/java/com/twilio/rest/numbers/v1/VoiceVerificationCreator.java index eee57ca8b4..00f15b4832 100644 --- a/src/main/java/com/twilio/rest/numbers/v1/VoiceVerificationCreator.java +++ b/src/main/java/com/twilio/rest/numbers/v1/VoiceVerificationCreator.java @@ -14,8 +14,10 @@ package com.twilio.rest.numbers.v1; +import com.fasterxml.jackson.databind.ObjectMapper; import com.twilio.base.Creator; import com.twilio.base.TwilioResponse; +import com.twilio.constant.EnumConstants; import com.twilio.exception.ApiConnectionException; import com.twilio.exception.ApiException; import com.twilio.exception.RestException; @@ -29,7 +31,22 @@ public class VoiceVerificationCreator extends Creator { - public VoiceVerificationCreator() {} + private VoiceVerification.NumbersV1VoiceVerificationRequest numbersV1VoiceVerificationRequest; + + public VoiceVerificationCreator( + final VoiceVerification.NumbersV1VoiceVerificationRequest numbersV1VoiceVerificationRequest + ) { + this.numbersV1VoiceVerificationRequest = + numbersV1VoiceVerificationRequest; + } + + public VoiceVerificationCreator setNumbersV1VoiceVerificationRequest( + final VoiceVerification.NumbersV1VoiceVerificationRequest numbersV1VoiceVerificationRequest + ) { + this.numbersV1VoiceVerificationRequest = + numbersV1VoiceVerificationRequest; + return this; + } private Response makeRequest(final TwilioRestClient client) { String path = "/v1/CallerIds/VoiceVerifications"; @@ -39,6 +56,8 @@ private Response makeRequest(final TwilioRestClient client) { Domains.NUMBERS.toString(), path ); + request.setContentType(EnumConstants.ContentType.JSON); + addPostParams(request, client); Response response = client.request(request); @@ -87,4 +106,16 @@ public TwilioResponse createWithResponse( response.getHeaders() ); } + + private void addPostParams(final Request request, TwilioRestClient client) { + ObjectMapper objectMapper = client.getObjectMapper(); + if (numbersV1VoiceVerificationRequest != null) { + request.setBody( + VoiceVerification.toJson( + numbersV1VoiceVerificationRequest, + objectMapper + ) + ); + } + } } diff --git a/src/main/java/com/twilio/rest/preview/hostedNumbers/AuthorizationDocument.java b/src/main/java/com/twilio/rest/preview/hostedNumbers/AuthorizationDocument.java index 37eb18f2dc..1a8f6419c0 100644 --- a/src/main/java/com/twilio/rest/preview/hostedNumbers/AuthorizationDocument.java +++ b/src/main/java/com/twilio/rest/preview/hostedNumbers/AuthorizationDocument.java @@ -62,6 +62,10 @@ public static AuthorizationDocumentCreator creator( ); } + public static AuthorizationDocumentDeleter deleter(final String pathSid) { + return new AuthorizationDocumentDeleter(pathSid); + } + public static AuthorizationDocumentFetcher fetcher(final String pathSid) { return new AuthorizationDocumentFetcher(pathSid); } diff --git a/src/main/java/com/twilio/rest/numbers/v1/VoiceVerificationCheckCreator.java b/src/main/java/com/twilio/rest/preview/hostedNumbers/AuthorizationDocumentDeleter.java similarity index 63% rename from src/main/java/com/twilio/rest/numbers/v1/VoiceVerificationCheckCreator.java rename to src/main/java/com/twilio/rest/preview/hostedNumbers/AuthorizationDocumentDeleter.java index c8ddbc1a42..5971d49814 100644 --- a/src/main/java/com/twilio/rest/numbers/v1/VoiceVerificationCheckCreator.java +++ b/src/main/java/com/twilio/rest/preview/hostedNumbers/AuthorizationDocumentDeleter.java @@ -4,7 +4,7 @@ * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ * - * Twilio - Numbers + * Twilio - Preview * This is the public Twilio REST API. * * NOTE: This class is auto generated by OpenAPI Generator. @@ -12,9 +12,9 @@ * Do not edit the class manually. */ -package com.twilio.rest.numbers.v1; +package com.twilio.rest.preview.hostedNumbers; -import com.twilio.base.Creator; +import com.twilio.base.Deleter; import com.twilio.base.TwilioResponse; import com.twilio.exception.ApiConnectionException; import com.twilio.exception.ApiException; @@ -26,18 +26,27 @@ import com.twilio.rest.Domains; import com.twilio.type.*; import java.io.InputStream; +import java.util.function.Predicate; -public class VoiceVerificationCheckCreator - extends Creator { +public class AuthorizationDocumentDeleter + extends Deleter { - public VoiceVerificationCheckCreator() {} + private String pathSid; + + public AuthorizationDocumentDeleter(final String pathSid) { + this.pathSid = pathSid; + } private Response makeRequest(final TwilioRestClient client) { - String path = "/v1/CallerIds/VoiceVerificationChecks"; + String path = "/HostedNumbers/AuthorizationDocuments/{Sid}"; + + path = path.replace("{" + "Sid" + "}", this.pathSid.toString()); + Predicate deleteStatuses = i -> + i != null && i >= 200 && i < 300; Request request = new Request( - HttpMethod.POST, - Domains.NUMBERS.toString(), + HttpMethod.DELETE, + Domains.PREVIEW.toString(), path ); @@ -45,7 +54,7 @@ private Response makeRequest(final TwilioRestClient client) { if (response == null) { throw new ApiConnectionException( - "VoiceVerificationCheck creation failed: Unable to connect to server" + "AuthorizationDocument delete failed: Unable to connect to server" ); } else if (!TwilioRestClient.SUCCESS.test(response.getStatusCode())) { InputStream inputStream = response.getStream(); @@ -65,25 +74,23 @@ private Response makeRequest(final TwilioRestClient client) { } @Override - public VoiceVerificationCheck create(final TwilioRestClient client) { + public boolean delete(final TwilioRestClient client) { Response response = makeRequest(client); - return VoiceVerificationCheck.fromJson( - response.getStream(), - client.getObjectMapper() - ); + Predicate deleteStatuses = i -> + i != null && i >= 200 && i < 300; + return deleteStatuses.test(response.getStatusCode()); } @Override - public TwilioResponse createWithResponse( + public TwilioResponse deleteWithResponse( final TwilioRestClient client ) { Response response = makeRequest(client); - VoiceVerificationCheck content = VoiceVerificationCheck.fromJson( - response.getStream(), - client.getObjectMapper() - ); + Predicate deleteStatuses = i -> + i != null && i >= 200 && i < 300; + Boolean deleted = deleteStatuses.test(response.getStatusCode()); return new TwilioResponse<>( - content, + deleted, response.getStatusCode(), response.getHeaders() ); diff --git a/src/main/java/com/twilio/rest/routes/v3/IsoCountryCode.java b/src/main/java/com/twilio/rest/routes/v3/IsoCountryCode.java new file mode 100644 index 0000000000..326cf6b71c --- /dev/null +++ b/src/main/java/com/twilio/rest/routes/v3/IsoCountryCode.java @@ -0,0 +1,499 @@ +/* + * This code was generated by + * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + * + * Twilio - Routes + * This is the public Twilio REST API. + * + * NOTE: This class is auto generated by OpenAPI Generator. + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.twilio.rest.routes.v3; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.core.JsonParseException; +import com.fasterxml.jackson.core.JsonParseException; +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.databind.JsonMappingException; +import com.fasterxml.jackson.databind.ObjectMapper; +import com.twilio.base.Resource; +import com.twilio.base.Resource; +import com.twilio.exception.ApiConnectionException; +import com.twilio.exception.ApiException; +import com.twilio.type.*; +import java.io.IOException; +import java.io.IOException; +import java.io.InputStream; +import java.net.URI; +import java.time.ZonedDateTime; +import java.util.Objects; +import lombok.Getter; +import lombok.ToString; + +@JsonIgnoreProperties(ignoreUnknown = true) +@ToString +public class IsoCountryCode extends Resource { + + @JsonIgnoreProperties(ignoreUnknown = true) + public static class CreateIsoCountryCodeResponse extends Resource { + + @JsonCreator + private CreateIsoCountryCodeResponse() {} + + public static CreateIsoCountryCodeResponse fromJson( + final InputStream json, + final ObjectMapper objectMapper + ) { + // Convert all checked exceptions to Runtime + try { + return objectMapper.readValue( + json, + CreateIsoCountryCodeResponse.class + ); + } catch (final JsonMappingException | JsonParseException e) { + throw new ApiException(e.getMessage(), e); + } catch (final IOException e) { + throw new ApiConnectionException(e.getMessage(), e); + } + } + + @Override + public boolean equals(final Object o) { + if (this == o) { + return true; + } + + if (o == null || getClass() != o.getClass()) { + return false; + } + CreateIsoCountryCodeResponse other = + (CreateIsoCountryCodeResponse) o; + return true; + } + + @Override + public int hashCode() { + return Objects.hash(); + } + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static class UpdateIsoCountryCodeResponse extends Resource { + + @Getter + private final String accountSid; + + @Getter + private final ZonedDateTime dateCreated; + + @Getter + private final ZonedDateTime dateUpdated; + + @Getter + private final String friendlyName; + + @Getter + private final String isoCountryCode; + + @Getter + private final String messagingRegion; + + @Getter + private final String shortCode; + + @Getter + private final URI url; + + @JsonCreator + private UpdateIsoCountryCodeResponse( + @JsonProperty("accountSid") final String accountSid, + @JsonProperty("dateCreated") final ZonedDateTime dateCreated, + @JsonProperty("dateUpdated") final ZonedDateTime dateUpdated, + @JsonProperty("friendlyName") final String friendlyName, + @JsonProperty("isoCountryCode") final String isoCountryCode, + @JsonProperty("messagingRegion") final String messagingRegion, + @JsonProperty("shortCode") final String shortCode, + @JsonProperty("url") final URI url + ) { + this.accountSid = accountSid; + this.dateCreated = dateCreated; + this.dateUpdated = dateUpdated; + this.friendlyName = friendlyName; + this.isoCountryCode = isoCountryCode; + this.messagingRegion = messagingRegion; + this.shortCode = shortCode; + this.url = url; + } + + public static UpdateIsoCountryCodeResponse fromJson( + final InputStream json, + final ObjectMapper objectMapper + ) { + // Convert all checked exceptions to Runtime + try { + return objectMapper.readValue( + json, + UpdateIsoCountryCodeResponse.class + ); + } catch (final JsonMappingException | JsonParseException e) { + throw new ApiException(e.getMessage(), e); + } catch (final IOException e) { + throw new ApiConnectionException(e.getMessage(), e); + } + } + + @Override + public boolean equals(final Object o) { + if (this == o) { + return true; + } + + if (o == null || getClass() != o.getClass()) { + return false; + } + UpdateIsoCountryCodeResponse other = + (UpdateIsoCountryCodeResponse) o; + return ( + Objects.equals(accountSid, other.accountSid) && + Objects.equals(dateCreated, other.dateCreated) && + Objects.equals(dateUpdated, other.dateUpdated) && + Objects.equals(friendlyName, other.friendlyName) && + Objects.equals(isoCountryCode, other.isoCountryCode) && + Objects.equals(messagingRegion, other.messagingRegion) && + Objects.equals(shortCode, other.shortCode) && + Objects.equals(url, other.url) + ); + } + + @Override + public int hashCode() { + return Objects.hash( + accountSid, + dateCreated, + dateUpdated, + friendlyName, + isoCountryCode, + messagingRegion, + shortCode, + url + ); + } + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static class DeleteIsoCountryCodeResponse extends Resource { + + @JsonCreator + private DeleteIsoCountryCodeResponse() {} + + public static DeleteIsoCountryCodeResponse fromJson( + final InputStream json, + final ObjectMapper objectMapper + ) { + // Convert all checked exceptions to Runtime + try { + return objectMapper.readValue( + json, + DeleteIsoCountryCodeResponse.class + ); + } catch (final JsonMappingException | JsonParseException e) { + throw new ApiException(e.getMessage(), e); + } catch (final IOException e) { + throw new ApiConnectionException(e.getMessage(), e); + } + } + + @Override + public boolean equals(final Object o) { + if (this == o) { + return true; + } + + if (o == null || getClass() != o.getClass()) { + return false; + } + DeleteIsoCountryCodeResponse other = + (DeleteIsoCountryCodeResponse) o; + return true; + } + + @Override + public int hashCode() { + return Objects.hash(); + } + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static class ListIsoCountryCodeResponse extends Resource { + + @JsonCreator + private ListIsoCountryCodeResponse() {} + + public static ListIsoCountryCodeResponse fromJson( + final InputStream json, + final ObjectMapper objectMapper + ) { + // Convert all checked exceptions to Runtime + try { + return objectMapper.readValue( + json, + ListIsoCountryCodeResponse.class + ); + } catch (final JsonMappingException | JsonParseException e) { + throw new ApiException(e.getMessage(), e); + } catch (final IOException e) { + throw new ApiConnectionException(e.getMessage(), e); + } + } + + @Override + public boolean equals(final Object o) { + if (this == o) { + return true; + } + + if (o == null || getClass() != o.getClass()) { + return false; + } + ListIsoCountryCodeResponse other = (ListIsoCountryCodeResponse) o; + return (true); + } + + @Override + public int hashCode() { + return Objects.hash(); + } + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static class PatchIsoCountryCodeResponse extends Resource { + + @JsonCreator + private PatchIsoCountryCodeResponse() {} + + public static PatchIsoCountryCodeResponse fromJson( + final InputStream json, + final ObjectMapper objectMapper + ) { + // Convert all checked exceptions to Runtime + try { + return objectMapper.readValue( + json, + PatchIsoCountryCodeResponse.class + ); + } catch (final JsonMappingException | JsonParseException e) { + throw new ApiException(e.getMessage(), e); + } catch (final IOException e) { + throw new ApiConnectionException(e.getMessage(), e); + } + } + + @Override + public boolean equals(final Object o) { + if (this == o) { + return true; + } + + if (o == null || getClass() != o.getClass()) { + return false; + } + PatchIsoCountryCodeResponse other = (PatchIsoCountryCodeResponse) o; + return true; + } + + @Override + public int hashCode() { + return Objects.hash(); + } + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static class FetchIsoCountryCodeResponse extends Resource { + + @Getter + private final String accountSid; + + @Getter + private final ZonedDateTime dateCreated; + + @Getter + private final ZonedDateTime dateUpdated; + + @Getter + private final String friendlyName; + + @Getter + private final String isoCountryCode; + + @Getter + private final String messagingRegion; + + @Getter + private final String shortCode; + + @Getter + private final URI url; + + @JsonCreator + private FetchIsoCountryCodeResponse( + @JsonProperty("accountSid") final String accountSid, + @JsonProperty("dateCreated") final ZonedDateTime dateCreated, + @JsonProperty("dateUpdated") final ZonedDateTime dateUpdated, + @JsonProperty("friendlyName") final String friendlyName, + @JsonProperty("isoCountryCode") final String isoCountryCode, + @JsonProperty("messagingRegion") final String messagingRegion, + @JsonProperty("shortCode") final String shortCode, + @JsonProperty("url") final URI url + ) { + this.accountSid = accountSid; + this.dateCreated = dateCreated; + this.dateUpdated = dateUpdated; + this.friendlyName = friendlyName; + this.isoCountryCode = isoCountryCode; + this.messagingRegion = messagingRegion; + this.shortCode = shortCode; + this.url = url; + } + + public static FetchIsoCountryCodeResponse fromJson( + final InputStream json, + final ObjectMapper objectMapper + ) { + // Convert all checked exceptions to Runtime + try { + return objectMapper.readValue( + json, + FetchIsoCountryCodeResponse.class + ); + } catch (final JsonMappingException | JsonParseException e) { + throw new ApiException(e.getMessage(), e); + } catch (final IOException e) { + throw new ApiConnectionException(e.getMessage(), e); + } + } + + @Override + public boolean equals(final Object o) { + if (this == o) { + return true; + } + + if (o == null || getClass() != o.getClass()) { + return false; + } + FetchIsoCountryCodeResponse other = (FetchIsoCountryCodeResponse) o; + return ( + Objects.equals(accountSid, other.accountSid) && + Objects.equals(dateCreated, other.dateCreated) && + Objects.equals(dateUpdated, other.dateUpdated) && + Objects.equals(friendlyName, other.friendlyName) && + Objects.equals(isoCountryCode, other.isoCountryCode) && + Objects.equals(messagingRegion, other.messagingRegion) && + Objects.equals(shortCode, other.shortCode) && + Objects.equals(url, other.url) + ); + } + + @Override + public int hashCode() { + return Objects.hash( + accountSid, + dateCreated, + dateUpdated, + friendlyName, + isoCountryCode, + messagingRegion, + shortCode, + url + ); + } + } + + public static IsoCountryCodeFetcher fetcher( + final String pathIsoCountryCode, + final String pathShortCode + ) { + return new IsoCountryCodeFetcher(pathIsoCountryCode, pathShortCode); + } + + public static IsoCountryCodeUpdater updater( + final String pathIsoCountryCode, + final String pathShortCode + ) { + return new IsoCountryCodeUpdater(pathIsoCountryCode, pathShortCode); + } + + /** + * Converts a JSON String into a IsoCountryCode object using the provided ObjectMapper. + * + * @param json Raw JSON String + * @param objectMapper Jackson ObjectMapper + * @return IsoCountryCode object represented by the provided JSON + */ + public static IsoCountryCode fromJson( + final String json, + final ObjectMapper objectMapper + ) { + // Convert all checked exceptions to Runtime + try { + return objectMapper.readValue(json, IsoCountryCode.class); + } catch (final JsonMappingException | JsonParseException e) { + throw new ApiException(e.getMessage(), e); + } catch (final IOException e) { + throw new ApiConnectionException(e.getMessage(), e); + } + } + + /** + * Converts a JSON InputStream into a IsoCountryCode object using the provided + * ObjectMapper. + * + * @param json Raw JSON InputStream + * @param objectMapper Jackson ObjectMapper + * @return IsoCountryCode object represented by the provided JSON + */ + public static IsoCountryCode fromJson( + final InputStream json, + final ObjectMapper objectMapper + ) { + // Convert all checked exceptions to Runtime + try { + return objectMapper.readValue(json, IsoCountryCode.class); + } catch (final JsonMappingException | JsonParseException e) { + throw new ApiException(e.getMessage(), e); + } catch (final IOException e) { + throw new ApiConnectionException(e.getMessage(), e); + } + } + + public static String toJson(Object object, ObjectMapper mapper) { + try { + return mapper.writeValueAsString(object); + } catch (final JsonMappingException e) { + throw new ApiException(e.getMessage(), e); + } catch (JsonProcessingException e) { + throw new ApiException(e.getMessage(), e); + } catch (final IOException e) { + throw new ApiConnectionException(e.getMessage(), e); + } + } + + @JsonCreator + private IsoCountryCode() {} + + @Override + public boolean equals(Object obj) { + return obj != null && obj.getClass() == this.getClass(); + } + + @Override + public int hashCode() { + return 1; + } +} diff --git a/src/main/java/com/twilio/rest/routes/v3/IsoCountryCodeFetcher.java b/src/main/java/com/twilio/rest/routes/v3/IsoCountryCodeFetcher.java new file mode 100644 index 0000000000..2139a05713 --- /dev/null +++ b/src/main/java/com/twilio/rest/routes/v3/IsoCountryCodeFetcher.java @@ -0,0 +1,114 @@ +/* + * This code was generated by + * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + * + * Twilio - Routes + * This is the public Twilio REST API. + * + * NOTE: This class is auto generated by OpenAPI Generator. + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.twilio.rest.routes.v3; + +import com.twilio.base.Fetcher; +import com.twilio.base.TwilioResponse; +import com.twilio.exception.ApiConnectionException; +import com.twilio.exception.ApiException; +import com.twilio.exception.RestException; +import com.twilio.http.HttpMethod; +import com.twilio.http.Request; +import com.twilio.http.Response; +import com.twilio.http.TwilioRestClient; +import com.twilio.rest.Domains; +import com.twilio.type.*; +import java.io.InputStream; + +public class IsoCountryCodeFetcher + extends Fetcher { + + private String pathIsoCountryCode; + private String pathShortCode; + + public IsoCountryCodeFetcher( + final String pathIsoCountryCode, + final String pathShortCode + ) { + this.pathIsoCountryCode = pathIsoCountryCode; + this.pathShortCode = pathShortCode; + } + + private Response makeRequest(final TwilioRestClient client) { + String path = "/v3/ShortCodes/{isoCountryCode}/{shortCode}"; + + path = + path.replace( + "{" + "isoCountryCode" + "}", + this.pathIsoCountryCode.toString() + ); + path = + path.replace( + "{" + "shortCode" + "}", + this.pathShortCode.toString() + ); + + Request request = new Request( + HttpMethod.GET, + Domains.ROUTES.toString(), + path + ); + + Response response = client.request(request); + + if (response == null) { + throw new ApiConnectionException( + "IsoCountryCode fetch failed: Unable to connect to server" + ); + } else if (!TwilioRestClient.SUCCESS.test(response.getStatusCode())) { + InputStream inputStream = response.getStream(); + RestException restException = RestException.fromJson( + inputStream, + client.getObjectMapper() + ); + if (restException == null) { + throw new ApiException( + "Server Error, no content", + response.getStatusCode() + ); + } + throw new ApiException(restException); + } + return response; + } + + @Override + public IsoCountryCode.FetchIsoCountryCodeResponse fetch( + final TwilioRestClient client + ) { + Response response = makeRequest(client); + return IsoCountryCode.FetchIsoCountryCodeResponse.fromJson( + response.getStream(), + client.getObjectMapper() + ); + } + + @Override + public TwilioResponse< + IsoCountryCode.FetchIsoCountryCodeResponse + > fetchWithResponse(final TwilioRestClient client) { + Response response = makeRequest(client); + IsoCountryCode.FetchIsoCountryCodeResponse content = + IsoCountryCode.FetchIsoCountryCodeResponse.fromJson( + response.getStream(), + client.getObjectMapper() + ); + return new TwilioResponse<>( + content, + response.getStatusCode(), + response.getHeaders() + ); + } +} diff --git a/src/main/java/com/twilio/rest/routes/v3/IsoCountryCodeUpdater.java b/src/main/java/com/twilio/rest/routes/v3/IsoCountryCodeUpdater.java new file mode 100644 index 0000000000..1632238d52 --- /dev/null +++ b/src/main/java/com/twilio/rest/routes/v3/IsoCountryCodeUpdater.java @@ -0,0 +1,153 @@ +/* + * This code was generated by + * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + * + * Twilio - Routes + * This is the public Twilio REST API. + * + * NOTE: This class is auto generated by OpenAPI Generator. + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.twilio.rest.routes.v3; + +import com.twilio.base.TwilioResponse; +import com.twilio.base.Updater; +import com.twilio.constant.EnumConstants; +import com.twilio.constant.EnumConstants.ParameterType; +import com.twilio.converter.Serializer; +import com.twilio.exception.ApiConnectionException; +import com.twilio.exception.ApiException; +import com.twilio.exception.RestException; +import com.twilio.http.HttpMethod; +import com.twilio.http.Request; +import com.twilio.http.Response; +import com.twilio.http.TwilioRestClient; +import com.twilio.rest.Domains; +import com.twilio.type.*; +import java.io.InputStream; + +public class IsoCountryCodeUpdater + extends Updater { + + private String pathIsoCountryCode; + private String pathShortCode; + private String messagingRegion; + private String friendlyName; + + public IsoCountryCodeUpdater( + final String pathIsoCountryCode, + final String pathShortCode + ) { + this.pathIsoCountryCode = pathIsoCountryCode; + this.pathShortCode = pathShortCode; + } + + public IsoCountryCodeUpdater setMessagingRegion( + final String messagingRegion + ) { + this.messagingRegion = messagingRegion; + return this; + } + + public IsoCountryCodeUpdater setFriendlyName(final String friendlyName) { + this.friendlyName = friendlyName; + return this; + } + + private Response makeRequest(final TwilioRestClient client) { + String path = "/v3/ShortCodes/{isoCountryCode}/{shortCode}"; + + path = + path.replace( + "{" + "isoCountryCode" + "}", + this.pathIsoCountryCode.toString() + ); + path = + path.replace( + "{" + "shortCode" + "}", + this.pathShortCode.toString() + ); + + Request request = new Request( + HttpMethod.POST, + Domains.ROUTES.toString(), + path + ); + request.setContentType(EnumConstants.ContentType.FORM_URLENCODED); + addPostParams(request); + + Response response = client.request(request); + + if (response == null) { + throw new ApiConnectionException( + "IsoCountryCode update failed: Unable to connect to server" + ); + } else if (!TwilioRestClient.SUCCESS.test(response.getStatusCode())) { + InputStream inputStream = response.getStream(); + RestException restException = RestException.fromJson( + inputStream, + client.getObjectMapper() + ); + if (restException == null) { + throw new ApiException( + "Server Error, no content", + response.getStatusCode() + ); + } + throw new ApiException(restException); + } + return response; + } + + @Override + public IsoCountryCode.UpdateIsoCountryCodeResponse update( + final TwilioRestClient client + ) { + Response response = makeRequest(client); + return IsoCountryCode.UpdateIsoCountryCodeResponse.fromJson( + response.getStream(), + client.getObjectMapper() + ); + } + + @Override + public TwilioResponse< + IsoCountryCode.UpdateIsoCountryCodeResponse + > updateWithResponse(final TwilioRestClient client) { + Response response = makeRequest(client); + IsoCountryCode.UpdateIsoCountryCodeResponse content = + IsoCountryCode.UpdateIsoCountryCodeResponse.fromJson( + response.getStream(), + client.getObjectMapper() + ); + return new TwilioResponse<>( + content, + response.getStatusCode(), + response.getHeaders() + ); + } + + private void addPostParams(final Request request) { + if (messagingRegion != null) { + Serializer.toString( + request, + "messagingRegion", + messagingRegion, + ParameterType.URLENCODED + ); + } + + if (friendlyName != null) { + Serializer.toString( + request, + "friendlyName", + friendlyName, + ParameterType.URLENCODED + ); + } + } +} From 5aeba88d5f42398289599e90e8f5213360cd3a67 Mon Sep 17 00:00:00 2001 From: Twilio Date: Mon, 12 Oct 2026 11:28:38 +0000 Subject: [PATCH 2/3] [Librarian] Regenerated @ 65f186ed432e7d4763681d0938b6100538958867 2b3e568afcb1fbfda7817580051fd5956ab4801b --- pom.xml | 4 ++-- src/main/java/com/twilio/Twilio.java | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/pom.xml b/pom.xml index 9bd12f660a..547f806b76 100644 --- a/pom.xml +++ b/pom.xml @@ -5,7 +5,7 @@ twilio jar twilio - 13.0.2 + 13.1.0 Twilio Java Helper Library https://www.twilio.com @@ -19,7 +19,7 @@ git@github.com:twilio/twilio-java.git scm:git:git@github.com:twilio/twilio-java.git scm:git:git@github.com:twilio/twilio-java.git - 13.0.2 + 13.1.0 diff --git a/src/main/java/com/twilio/Twilio.java b/src/main/java/com/twilio/Twilio.java index 01a2a33c68..1365b605a4 100644 --- a/src/main/java/com/twilio/Twilio.java +++ b/src/main/java/com/twilio/Twilio.java @@ -41,7 +41,7 @@ */ public class Twilio { - public static final String VERSION = "13.0.2"; + public static final String VERSION = "13.1.0"; public static final String JAVA_VERSION = System.getProperty("java.version"); public static final String OS_NAME = System.getProperty("os.name"); public static final String OS_ARCH = System.getProperty("os.arch"); From 0cb522a5dbff79a47bb99091605b3eb393df0908 Mon Sep 17 00:00:00 2001 From: twilio-dx <76711946+twilio-dx@users.noreply.github.com> Date: Mon, 12 Oct 2026 17:45:16 +0530 Subject: [PATCH 3/3] Update pom.xml --- pom.xml | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/pom.xml b/pom.xml index 547f806b76..85e0095bfa 100644 --- a/pom.xml +++ b/pom.xml @@ -505,10 +505,6 @@ - - org.apache.maven.plugins - maven-surefire-plugin - org.apache.maven.plugins maven-surefire-plugin @@ -560,4 +556,4 @@ - \ No newline at end of file +