From f88c93945b89613b33ec34491cbaa3425b11f439 Mon Sep 17 00:00:00 2001 From: Twilio Date: Mon, 28 Sep 2026 07:32:18 +0000 Subject: [PATCH 1/2] [Librarian] Regenerated @ 65f186ed432e7d4763681d0938b6100538958867 c0286c343096d9f96068fc34bee16c5c5f4460fc --- CHANGES.md | 193 ++++ .../rest/conversations/v2/Conversation.java | 258 ++++- .../com/twilio/rest/insights/v3/Capacity.java | 456 +++++++++ .../rest/insights/v3/CapacityFetcher.java | 92 ++ .../rest/insights/v3/CustomFieldMapping.java | 926 +++++++++++++++++ .../v3/CustomFieldMappingCreator.java | 124 +++ .../v3/CustomFieldMappingFetcher.java | 95 ++ .../rest/intelligence/v3/RuleExecution.java | 173 +++- .../twilio/rest/memory/v1/DataMapping.java | 9 +- .../rest/memory/v1/DataMappingPatcher.java | 4 +- .../java/com/twilio/rest/memory/v1/Store.java | 7 +- .../twilio/rest/memory/v1/StorePatcher.java | 6 +- .../com/twilio/rest/memory/v1/TraitGroup.java | 9 +- .../rest/memory/v1/TraitGroupPatcher.java | 4 +- .../RecordingAccountDefaultConfiguration.java | 947 ++++++++++++++++++ ...ingAccountDefaultConfigurationCreator.java | 120 +++ ...ingAccountDefaultConfigurationDeleter.java | 92 ++ ...ingAccountDefaultConfigurationFetcher.java | 94 ++ ...ingAccountDefaultConfigurationUpdater.java | 120 +++ .../java/com/twilio/twiml/voice/Stream.java | 48 + ...hannelsSenderForwardCompatibilityTest.java | 260 ----- .../com/twilio/twiml/voice/ConnectTest.java | 8 +- .../com/twilio/twiml/voice/StartTest.java | 8 +- .../java/com/twilio/twiml/voice/StopTest.java | 8 +- .../com/twilio/twiml/voice/StreamTest.java | 8 +- 25 files changed, 3780 insertions(+), 289 deletions(-) create mode 100644 src/main/java/com/twilio/rest/insights/v3/Capacity.java create mode 100644 src/main/java/com/twilio/rest/insights/v3/CapacityFetcher.java create mode 100644 src/main/java/com/twilio/rest/insights/v3/CustomFieldMapping.java create mode 100644 src/main/java/com/twilio/rest/insights/v3/CustomFieldMappingCreator.java create mode 100644 src/main/java/com/twilio/rest/insights/v3/CustomFieldMappingFetcher.java create mode 100644 src/main/java/com/twilio/rest/voice/v2/RecordingAccountDefaultConfiguration.java create mode 100644 src/main/java/com/twilio/rest/voice/v2/RecordingAccountDefaultConfigurationCreator.java create mode 100644 src/main/java/com/twilio/rest/voice/v2/RecordingAccountDefaultConfigurationDeleter.java create mode 100644 src/main/java/com/twilio/rest/voice/v2/RecordingAccountDefaultConfigurationFetcher.java create mode 100644 src/main/java/com/twilio/rest/voice/v2/RecordingAccountDefaultConfigurationUpdater.java delete mode 100644 src/test/java/com/twilio/rest/messaging/v2/ChannelsSenderForwardCompatibilityTest.java diff --git a/CHANGES.md b/CHANGES.md index e37c4f3335..298e3cbb24 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -2,6 +2,199 @@ twilio-java changelog ===================== +[2026-09-28] Version 13.0.2 +--------------------------- +**Twiml** +- Add `audio_format` and `sample_rate` to Stream for HDCodec + +**Api** +- # API Changes +- ## 2026-09-22 +- Simplified the `criteria` field description. +- ## 2026-09-18 +- Moved `readOnly` on the snapshot count fields (`profileCount`, `partitionCount`) from the shared schema to the response usage sites, so the counts stay read-only in responses (no change for API consumers). +- ## 2026-09-17 +- Renamed 3 `Get*` operations to `Fetch*` to match the operationId standard: `FetchCohort`, `FetchSnapshot`, `FetchOperation`. +- Removed the unused `ExpressionId` schema and made the operation error example cohort-native, so no `aud_` identifiers remain in the spec. +- Kept `libraryVisibility: hidden` across the whole surface (info, path items, and operations). +- ## 2026-09-08 +- Removed the deprecated header-based-versioning unified specs, consolidating audiences onto the path-based `api.twilio.com/v1` surface. +- ## 2026-08-31 +- Published the unified audiences spec at `api.twilio.com/v1`. +- ## 2026-08-26 +- Fixed the Cohort operation response mapping in the unified audiences API. +- ## 2026-08-19 +- Migrated the unified audiences spec to the Cohort surface (Audiences renamed to Cohorts). +- Switched `downstreamServiceName` to `audiences-domain`. +- ## 2026-08-05 +- Added the `api.unified.version.preview` beta feature. +- Made the unified APIs available in prod us1. +- ## 2026-07-30 +- Fixed example values. +- ## 2026-07-29 +- Added the initial version of the audiences API to the unified APIs. +- ## 2026-07-20 +- Deployed the audiences-domain OAS to the dev edge. +- ## 2026-07-06 +- Added the prod-us1 realm to the audiences public API. +- ## 2026-06-23 +- Changed the `storeType` enum from `MEMORA` to `TWILIO`. +- ## 2026-05-04 +- Added the stage-us1 realm and `x-rate-limit` to the audiences API. +- ## 2026-04-08 +- Added the initial audiences endpoints. +- Add `TwimlProcessStatusCallbackEvents` parameter to CreateTwimlProcess endpoint +- Add `twiml_process` resource alongside `twiml_session` (`twiml_session` is deprecated and will be removed in a future release) + +**Audiences** +- ## 2026-09-14 +- Minor updates (formatting, metadata) +- ## 2026-09-11 +- **Content updates**: +- Updated summary for `AdminFetchRecord` +- Updated summary for `AdminFetchCohort` +- Updated summary for `AdminFetchCohortSnapshot` +- Updated summary for `AdminFetchCohortOperation` +- Updated schema description for `ResourceLabels` +- ## 2026-09-22 +- **Content updates**: +- Updated schema description for `Criteria` +- ## 2026-09-18 +- Minor updates (formatting, metadata) +- ## 2026-09-17 +- Minor updates (formatting, metadata) +- ## 2026-09-17 +- **Content updates**: +- Updated description for `CreateCohort` +- Updated description for `ListCohortSnapshots` +- Updated description for `CreateCohortSnapshot` +- Updated description for `FetchCohortSnapshot` +- Updated description for `ListCohortSnapshotProfiles` +- Updated schema description for `Criteria` +- Updated schema description for `Cohort` +- Updated schema description for `CohortSnapshot` +- Updated schema description for `CohortOperationResult` +- Updated schema description for `CohortOperation` +- ## 2026-09-15 +- Minor updates (formatting, metadata) +- ## 2026-09-14 +- **Content updates**: +- Updated summary for `FetchCohort` +- Updated summary for `FetchCohortSnapshot` +- Updated summary for `FetchCohortOperation` +- Updated schema description for `ResourceLabels` + +**Capabilities** +- Add a feature-gated preview endpoint to create Capabilities. + +**Conversations** +- Add the feature-gated Capabilities list and create endpoints to Conversations v2. + +**Data-ingress** +- ## 2026-09-07 +- Minor updates (formatting, metadata) +- ## 2026-09-09 +- **Added 16 new path(s)**: +- `/v1/DataSyncs/{syncId}` (FetchDataSync) +- `/v1/CloudAppSources/{sourceId}/Objects` (ListCloudAppObjects) +- `/v1/WarehouseSources/{sourceId}/Preview` (CreateWarehousePreview) +- `/v1/WarehouseSources/{sourceId}/Preview/{operationId}` (FetchWarehousePreview) +- `/v1/DataSample/{operationId}` (FetchDataSample) +- `/v1/ControlPlane/CloudAppSources/{sourceId}` (FetchCloudAppSource, PatchCloudAppSource, DeleteCloudAppSource) +- `/v1/ControlPlane/CloudAppSources/{sourceId}/Datasets` (ListCloudAppDatasets, CreateCloudAppDataset) +- `/v1/ControlPlane/CloudAppSources/{sourceId}/Datasets/{datasetId}` (FetchCloudAppDataset, PatchCloudAppDataset, DeleteCloudAppDataset) +- `/v1/ControlPlane/WarehouseSources/{sourceId}` (FetchWarehouseSource, PatchWarehouseSource, DeleteWarehouseSource) +- `/v1/ControlPlane/WarehouseSources/{sourceId}/Datasets` (ListWarehouseDatasets, CreateWarehouseDataset) +- ...and 6 more paths +- **Removed 31 path(s)**: +- `/v1/DataSyncs/{SyncId}` (FetchDataSync) +- `/v1/CloudAppSources/{SourceId}/Objects` (ListCloudAppObjects) +- `/v1/WarehouseSources/{SourceId}/Preview` (CreateWarehousePreview) +- `/v1/WarehouseSources/{SourceId}/Preview/{OperationId}` (FetchWarehousePreview) +- `/v1/DataSample/{OperationId}` (FetchDataSample) +- `/v1/ControlPlane/CloudAppSources/{SourceId}` (FetchCloudAppSource, PatchCloudAppSource, DeleteCloudAppSource) +- `/v1/ControlPlane/CloudAppSources/{SourceId}/Datasets` (ListCloudAppDatasets, CreateCloudAppDataset) +- `/v1/ControlPlane/CloudAppSources/{SourceId}/Datasets/{DatasetId}` (FetchCloudAppDataset, PatchCloudAppDataset, DeleteCloudAppDataset) +- `/v1/ControlPlane/WarehouseSources/{SourceId}` (FetchWarehouseSource, PatchWarehouseSource, DeleteWarehouseSource) +- `/v1/ControlPlane/WarehouseSources/{SourceId}/Datasets` (ListWarehouseDatasets, CreateWarehouseDataset) +- ...and 21 more paths + +**Destinations** +- ## 2026-09-24 +- **Content updates**: +- Removed `GET` from the `method` enum on the `webhook` destination type's config options +- ## 2026-09-22 +- **Content updates**: +- Added `CDP` to the `categories` enum on `DestinationType` +- ## 2026-09-14 +- Enable admin APIs for stage-us1 and prod-ie1 realms +- ## 2026-09-11 +- **Content updates**: +- Updated description for `CreateDestination` +- Updated description for `UpdateDestination` +- Updated description for `DeleteDestination` +- Updated schema description for `CredentialInput` +- Updated schema description for `DestinationCredentialOptions` +- ## 2026-09-11 +- **Content updates**: +- Updated description for `ListDestinationTypes` +- Updated description for `GetDestinationType` +- Updated description for `CreateDestination` +- Updated description for `UpdateDestination` +- ## 2026-09-10 +- Made `ListDestinationTypes` and `GetDestinationType` unauthenticated (`security: []`). +- Removed `iamOperation`, `addAuthorizationHeader`, and `betaFeature` from these operations. + +**Iam** +- Removed user_context from the POST /v1/actions/post_login (PostLoginActionRequest) webhook payload; the login email is read from authentication_context.methods +- Replaced acr and completed_factors with authentication_context (acr, amr, methods) on the POST /v1/actions/post_login (PostLoginActionRequest) webhook payload +- Made request_context and request_context.ip_address required on the POST /v1/actions/post_login (PostLoginActionRequest) webhook payload + +**Intelligence** +- Added optional `rule.operators[]` parameter override field to `POST /v3/RuleExecutions +- Change Summary in `POST /v3/RuleExecutions` + +**Knowledge** +- ## 2026-09-23 +- **Content updates**: +- Added properties to `WebSourceDetails`: errors +- **Routing updates**: +- Changed `downstreamServiceName` from `memora-domain` to `enterprise-knowledge-domain` for all operations + +**Memory** +- ## 2026-09-18 +- **Added 2 new path(s)**: +- `/v1/ControlPlane/TraitExtractionStrategies` (AdminListTraitExtractionStrategies) +- `/v1/ControlPlane/TraitExtractionStrategies/{traitStrategyId}` (AdminFetchTraitExtractionStrategy) +- ## 2026-09-03 +- No path changes (schema description only) +- Clarified the `DataMappingCore` description: the PATCH body requires at least one field. +- ## 2026-09-10 +- **Added 2 new path(s)** for Observation Extraction Strategies: +- `/v1/ControlPlane/ObservationExtractionStrategies` (ListObservationExtractionStrategies, CreateObservationExtractionStrategy) +- `/v1/ControlPlane/ObservationExtractionStrategies/{observationExtractionStrategyId}` (FetchObservationExtractionStrategy, UpdateObservationExtractionStrategy, DeleteObservationExtractionStrategy) +- **Content updates**: +- Updated `CreateObservationExtractionStrategyInput` description to document that at least one of `allowedCategories`/`prohibitedCategories` must be provided with a non-empty list +- ## 2026-09-07 +- **Added 1 new path(s)** for Profile: +- `/v1/Stores/{storeId}/Profiles/BulkDeletions` (CreateProfilesBulkDeletion) +- ## 2026-09-03 +- `UpdateStore`, `UpdateTraitGroup`, `UpdateDataMapping`, and `UpdateTraitExtractionStrategy` now require a body with at least one property. An empty `{}` gets a 400. + +**Routes** +- Add `GET`/`POST` `/v3/ShortCodes/{isoCountryCode}/{shortCode}` to assign and fetch the Inbound Processing Region for short codes + +**Verify** +- Add `aaguid` and `date_last_approved` to passkeys factors `metadata`. + +**Voice** +- Add typed Recording AccountDefaultConfiguration public API endpoints. + +**Webhooks** +- ## 2026-09-24 +- **Changed**: `GET /v1/Webhooks/Settings` now documents each item as the full `Setting` rather than `SettingSummary`, adding `auth`, `signature`, `connection` and `edgeZones` to the list response. The service already returned these fields; only the schema understated them. Additive for consumers — no field is removed or renamed. The now-unreferenced `SettingSummary` schema is removed. + + [2026-09-09] Version 13.0.1 --------------------------- **Library - Chore** 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 33f4b8b776..2f95235a8b 100644 --- a/src/main/java/com/twilio/rest/conversations/v2/Conversation.java +++ b/src/main/java/com/twilio/rest/conversations/v2/Conversation.java @@ -55,6 +55,9 @@ public static class CreateConversationResponse extends Resource { @Getter private final String accountId; + @Getter + private final String actionId; + @Getter private final ListConversationByAccount200ResponseConversationsConfiguration configuration; @@ -67,6 +70,9 @@ public static class CreateConversationResponse extends Resource { @Getter private final String id; + @Getter + private final Map metadata; + @Getter private final String name; @@ -82,12 +88,14 @@ public static class CreateConversationResponse extends Resource { @JsonCreator private CreateConversationResponse( @JsonProperty("accountId") final String accountId, + @JsonProperty("actionId") final String actionId, @JsonProperty( "configuration" ) final ListConversationByAccount200ResponseConversationsConfiguration configuration, @JsonProperty("configurationId") final String configurationId, @JsonProperty("createdAt") final ZonedDateTime createdAt, @JsonProperty("id") final String id, + @JsonProperty("metadata") final Map metadata, @JsonProperty("name") final String name, @JsonProperty("participants") final List< ConversationsV2Participant @@ -98,10 +106,12 @@ private CreateConversationResponse( @JsonProperty("updatedAt") final ZonedDateTime updatedAt ) { this.accountId = accountId; + this.actionId = actionId; this.configuration = configuration; this.configurationId = configurationId; this.createdAt = createdAt; this.id = id; + this.metadata = metadata; this.name = name; this.participants = participants; this.status = status; @@ -137,10 +147,12 @@ public boolean equals(final Object o) { CreateConversationResponse other = (CreateConversationResponse) o; return ( Objects.equals(accountId, other.accountId) && + Objects.equals(actionId, other.actionId) && Objects.equals(configuration, other.configuration) && Objects.equals(configurationId, other.configurationId) && Objects.equals(createdAt, other.createdAt) && Objects.equals(id, other.id) && + Objects.equals(metadata, other.metadata) && Objects.equals(name, other.name) && Objects.equals(participants, other.participants) && Objects.equals(status, other.status) && @@ -152,10 +164,12 @@ public boolean equals(final Object o) { public int hashCode() { return Objects.hash( accountId, + actionId, configuration, configurationId, createdAt, id, + metadata, name, participants, status, @@ -170,6 +184,9 @@ public static class UpdateConversationResponse extends Resource { @Getter private final String accountId; + @Getter + private final String actionId; + @Getter private final ListConversationByAccount200ResponseConversationsConfiguration configuration; @@ -182,6 +199,9 @@ public static class UpdateConversationResponse extends Resource { @Getter private final String id; + @Getter + private final Map metadata; + @Getter private final String name; @@ -197,12 +217,14 @@ public static class UpdateConversationResponse extends Resource { @JsonCreator private UpdateConversationResponse( @JsonProperty("accountId") final String accountId, + @JsonProperty("actionId") final String actionId, @JsonProperty( "configuration" ) final ListConversationByAccount200ResponseConversationsConfiguration configuration, @JsonProperty("configurationId") final String configurationId, @JsonProperty("createdAt") final ZonedDateTime createdAt, @JsonProperty("id") final String id, + @JsonProperty("metadata") final Map metadata, @JsonProperty("name") final String name, @JsonProperty("participants") final List< ConversationsV2Participant @@ -213,10 +235,12 @@ private UpdateConversationResponse( @JsonProperty("updatedAt") final ZonedDateTime updatedAt ) { this.accountId = accountId; + this.actionId = actionId; this.configuration = configuration; this.configurationId = configurationId; this.createdAt = createdAt; this.id = id; + this.metadata = metadata; this.name = name; this.participants = participants; this.status = status; @@ -252,10 +276,12 @@ public boolean equals(final Object o) { UpdateConversationResponse other = (UpdateConversationResponse) o; return ( Objects.equals(accountId, other.accountId) && + Objects.equals(actionId, other.actionId) && Objects.equals(configuration, other.configuration) && Objects.equals(configurationId, other.configurationId) && Objects.equals(createdAt, other.createdAt) && Objects.equals(id, other.id) && + Objects.equals(metadata, other.metadata) && Objects.equals(name, other.name) && Objects.equals(participants, other.participants) && Objects.equals(status, other.status) && @@ -267,10 +293,12 @@ public boolean equals(final Object o) { public int hashCode() { return Objects.hash( accountId, + actionId, configuration, configurationId, createdAt, id, + metadata, name, participants, status, @@ -342,6 +370,9 @@ public static class ListConversationResponse extends Resource { @Getter private final String accountId; + @Getter + private final String actionId; + @Getter private final ListConversationByAccount200ResponseConversationsConfiguration configuration; @@ -354,6 +385,9 @@ public static class ListConversationResponse extends Resource { @Getter private final String id; + @Getter + private final Map metadata; + @Getter private final String name; @@ -369,12 +403,14 @@ public static class ListConversationResponse extends Resource { @JsonCreator private ListConversationResponse( @JsonProperty("accountId") final String accountId, + @JsonProperty("actionId") final String actionId, @JsonProperty( "configuration" ) final ListConversationByAccount200ResponseConversationsConfiguration configuration, @JsonProperty("configurationId") final String configurationId, @JsonProperty("createdAt") final ZonedDateTime createdAt, @JsonProperty("id") final String id, + @JsonProperty("metadata") final Map metadata, @JsonProperty("name") final String name, @JsonProperty("participants") final List< ConversationsV2Participant @@ -385,10 +421,12 @@ private ListConversationResponse( @JsonProperty("updatedAt") final ZonedDateTime updatedAt ) { this.accountId = accountId; + this.actionId = actionId; this.configuration = configuration; this.configurationId = configurationId; this.createdAt = createdAt; this.id = id; + this.metadata = metadata; this.name = name; this.participants = participants; this.status = status; @@ -424,10 +462,12 @@ public boolean equals(final Object o) { ListConversationResponse other = (ListConversationResponse) o; return ( Objects.equals(accountId, other.accountId) && + Objects.equals(actionId, other.actionId) && Objects.equals(configuration, other.configuration) && Objects.equals(configurationId, other.configurationId) && Objects.equals(createdAt, other.createdAt) && Objects.equals(id, other.id) && + Objects.equals(metadata, other.metadata) && Objects.equals(name, other.name) && Objects.equals(participants, other.participants) && Objects.equals(status, other.status) && @@ -439,10 +479,12 @@ public boolean equals(final Object o) { public int hashCode() { return Objects.hash( accountId, + actionId, configuration, configurationId, createdAt, id, + metadata, name, participants, status, @@ -457,6 +499,9 @@ public static class PatchConversationResponse extends Resource { @Getter private final String accountId; + @Getter + private final String actionId; + @Getter private final ListConversationByAccount200ResponseConversationsConfiguration configuration; @@ -469,6 +514,9 @@ public static class PatchConversationResponse extends Resource { @Getter private final String id; + @Getter + private final Map metadata; + @Getter private final String name; @@ -484,12 +532,14 @@ public static class PatchConversationResponse extends Resource { @JsonCreator private PatchConversationResponse( @JsonProperty("accountId") final String accountId, + @JsonProperty("actionId") final String actionId, @JsonProperty( "configuration" ) final ListConversationByAccount200ResponseConversationsConfiguration configuration, @JsonProperty("configurationId") final String configurationId, @JsonProperty("createdAt") final ZonedDateTime createdAt, @JsonProperty("id") final String id, + @JsonProperty("metadata") final Map metadata, @JsonProperty("name") final String name, @JsonProperty("participants") final List< ConversationsV2Participant @@ -500,10 +550,12 @@ private PatchConversationResponse( @JsonProperty("updatedAt") final ZonedDateTime updatedAt ) { this.accountId = accountId; + this.actionId = actionId; this.configuration = configuration; this.configurationId = configurationId; this.createdAt = createdAt; this.id = id; + this.metadata = metadata; this.name = name; this.participants = participants; this.status = status; @@ -539,10 +591,12 @@ public boolean equals(final Object o) { PatchConversationResponse other = (PatchConversationResponse) o; return ( Objects.equals(accountId, other.accountId) && + Objects.equals(actionId, other.actionId) && Objects.equals(configuration, other.configuration) && Objects.equals(configurationId, other.configurationId) && Objects.equals(createdAt, other.createdAt) && Objects.equals(id, other.id) && + Objects.equals(metadata, other.metadata) && Objects.equals(name, other.name) && Objects.equals(participants, other.participants) && Objects.equals(status, other.status) && @@ -554,10 +608,12 @@ public boolean equals(final Object o) { public int hashCode() { return Objects.hash( accountId, + actionId, configuration, configurationId, createdAt, id, + metadata, name, participants, status, @@ -572,6 +628,9 @@ public static class FetchConversationResponse extends Resource { @Getter private final String accountId; + @Getter + private final String actionId; + @Getter private final ListConversationByAccount200ResponseConversationsConfiguration configuration; @@ -584,6 +643,9 @@ public static class FetchConversationResponse extends Resource { @Getter private final String id; + @Getter + private final Map metadata; + @Getter private final String name; @@ -599,12 +661,14 @@ public static class FetchConversationResponse extends Resource { @JsonCreator private FetchConversationResponse( @JsonProperty("accountId") final String accountId, + @JsonProperty("actionId") final String actionId, @JsonProperty( "configuration" ) final ListConversationByAccount200ResponseConversationsConfiguration configuration, @JsonProperty("configurationId") final String configurationId, @JsonProperty("createdAt") final ZonedDateTime createdAt, @JsonProperty("id") final String id, + @JsonProperty("metadata") final Map metadata, @JsonProperty("name") final String name, @JsonProperty("participants") final List< ConversationsV2Participant @@ -615,10 +679,12 @@ private FetchConversationResponse( @JsonProperty("updatedAt") final ZonedDateTime updatedAt ) { this.accountId = accountId; + this.actionId = actionId; this.configuration = configuration; this.configurationId = configurationId; this.createdAt = createdAt; this.id = id; + this.metadata = metadata; this.name = name; this.participants = participants; this.status = status; @@ -654,10 +720,12 @@ public boolean equals(final Object o) { FetchConversationResponse other = (FetchConversationResponse) o; return ( Objects.equals(accountId, other.accountId) && + Objects.equals(actionId, other.actionId) && Objects.equals(configuration, other.configuration) && Objects.equals(configurationId, other.configurationId) && Objects.equals(createdAt, other.createdAt) && Objects.equals(id, other.id) && + Objects.equals(metadata, other.metadata) && Objects.equals(name, other.name) && Objects.equals(participants, other.participants) && Objects.equals(status, other.status) && @@ -669,10 +737,12 @@ public boolean equals(final Object o) { public int hashCode() { return Objects.hash( accountId, + actionId, configuration, configurationId, createdAt, id, + metadata, name, participants, status, @@ -910,6 +980,69 @@ public static ConversationsV2ConversationGroupingType forValue( } } + @JsonDeserialize(builder = ConversationWorkflow.Builder.class) + @JsonIgnoreProperties(ignoreUnknown = true) + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @ToString + public static class ConversationWorkflow { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("flowId") + @Getter + private final String flowId; + + private ConversationWorkflow(Builder builder) { + this.flowId = builder.flowId; + } + + public static Builder builder(final String flowId) { + return new Builder(flowId); + } + + public static ConversationWorkflow fromJson( + String jsonString, + ObjectMapper mapper + ) throws IOException { + return mapper.readValue(jsonString, ConversationWorkflow.class); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + @JsonPOJOBuilder(withPrefix = "") + public static class Builder { + + @JsonProperty("flowId") + private String flowId; + + @JsonCreator + public Builder(@JsonProperty("flowId") final String flowId) { + this.flowId = flowId; + } + + public ConversationWorkflow build() { + return new ConversationWorkflow(this); + } + } + + @Override + public boolean equals(final Object o) { + if (this == o) { + return true; + } + + if (o == null || getClass() != o.getClass()) { + return false; + } + + ConversationWorkflow other = (ConversationWorkflow) o; + return (Objects.equals(flowId, other.flowId)); + } + + @Override + public int hashCode() { + return Objects.hash(flowId); + } + } + @JsonDeserialize( builder = ListConversationByAccount200ResponseConversationsConfiguration.Builder.class ) @@ -1316,10 +1449,16 @@ public static class PatchConversationByIdRequest { @Getter private final PatchConversationByIdRequestConfiguration configuration; + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("metadata") + @Getter + private final Map metadata; + private PatchConversationByIdRequest(Builder builder) { this.name = builder.name; this.status = builder.status; this.configuration = builder.configuration; + this.metadata = builder.metadata; } public static Builder builder() { @@ -1349,6 +1488,9 @@ public static class Builder { @JsonProperty("configuration") private PatchConversationByIdRequestConfiguration configuration; + @JsonProperty("metadata") + private Map metadata; + @JsonInclude(JsonInclude.Include.NON_EMPTY) @JsonProperty("name") public Builder name(String name) { @@ -1372,6 +1514,13 @@ public Builder configuration( return this; } + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("metadata") + public Builder metadata(Map metadata) { + this.metadata = metadata; + return this; + } + public PatchConversationByIdRequest build() { return new PatchConversationByIdRequest(this); } @@ -1392,13 +1541,14 @@ public boolean equals(final Object o) { return ( Objects.equals(name, other.name) && Objects.equals(status, other.status) && - Objects.equals(configuration, other.configuration) + Objects.equals(configuration, other.configuration) && + Objects.equals(metadata, other.metadata) ); } @Override public int hashCode() { - return Objects.hash(name, status, configuration); + return Objects.hash(name, status, configuration, metadata); } } @@ -1537,11 +1687,17 @@ public static class CreateConversationWithConfigRequestConfiguration { @Getter private final List intelligenceConfigurationIds; + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("workflows") + @Getter + private final List workflows; + private CreateConversationWithConfigRequestConfiguration( Builder builder ) { this.intelligenceConfigurationIds = builder.intelligenceConfigurationIds; + this.workflows = builder.workflows; } public static Builder builder() { @@ -1565,6 +1721,9 @@ public static class Builder { @JsonProperty("intelligenceConfigurationIds") private List intelligenceConfigurationIds; + @JsonProperty("workflows") + private List workflows; + @JsonInclude(JsonInclude.Include.NON_EMPTY) @JsonProperty("intelligenceConfigurationIds") public Builder intelligenceConfigurationIds( @@ -1575,6 +1734,13 @@ public Builder intelligenceConfigurationIds( return this; } + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("workflows") + public Builder workflows(List workflows) { + this.workflows = workflows; + return this; + } + public CreateConversationWithConfigRequestConfiguration build() { return new CreateConversationWithConfigRequestConfiguration( this @@ -1598,13 +1764,14 @@ public boolean equals(final Object o) { Objects.equals( intelligenceConfigurationIds, other.intelligenceConfigurationIds - ) + ) && + Objects.equals(workflows, other.workflows) ); } @Override public int hashCode() { - return Objects.hash(intelligenceConfigurationIds); + return Objects.hash(intelligenceConfigurationIds, workflows); } } @@ -1856,9 +2023,15 @@ public static class UpdateConversationByIdRequest { @Getter private final Conversation.Status status; + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("metadata") + @Getter + private final Map metadata; + private UpdateConversationByIdRequest(Builder builder) { this.name = builder.name; this.status = builder.status; + this.metadata = builder.metadata; } public static Builder builder(final Conversation.Status status) { @@ -1885,6 +2058,9 @@ public static class Builder { @JsonProperty("status") private Conversation.Status status; + @JsonProperty("metadata") + private Map metadata; + @JsonCreator public Builder( @JsonProperty("status") final Conversation.Status status @@ -1899,6 +2075,13 @@ public Builder name(String name) { return this; } + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("metadata") + public Builder metadata(Map metadata) { + this.metadata = metadata; + return this; + } + public UpdateConversationByIdRequest build() { return new UpdateConversationByIdRequest(this); } @@ -1918,13 +2101,14 @@ public boolean equals(final Object o) { (UpdateConversationByIdRequest) o; return ( Objects.equals(name, other.name) && - Objects.equals(status, other.status) + Objects.equals(status, other.status) && + Objects.equals(metadata, other.metadata) ); } @Override public int hashCode() { - return Objects.hash(name, status); + return Objects.hash(name, status, metadata); } } @@ -2141,11 +2325,21 @@ public static class ListConversationByAccount200ResponseConversations { @Getter private final ListConversationByAccount200ResponseConversationsConfiguration configuration; + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("metadata") + @Getter + private final Map metadata; + @JsonInclude(JsonInclude.Include.NON_EMPTY) @JsonProperty("participants") @Getter private final List participants; + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("actionId") + @Getter + private final String actionId; + private ListConversationByAccount200ResponseConversations( Builder builder ) { @@ -2157,7 +2351,9 @@ private ListConversationByAccount200ResponseConversations( this.createdAt = builder.createdAt; this.updatedAt = builder.updatedAt; this.configuration = builder.configuration; + this.metadata = builder.metadata; this.participants = builder.participants; + this.actionId = builder.actionId; } public static Builder builder( @@ -2214,9 +2410,15 @@ public static class Builder { @JsonProperty("configuration") private ListConversationByAccount200ResponseConversationsConfiguration configuration; + @JsonProperty("metadata") + private Map metadata; + @JsonProperty("participants") private List participants; + @JsonProperty("actionId") + private String actionId; + @JsonCreator public Builder( @JsonProperty("id") final String id, @@ -2275,6 +2477,13 @@ public Builder configuration( return this; } + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("metadata") + public Builder metadata(Map metadata) { + this.metadata = metadata; + return this; + } + @JsonInclude(JsonInclude.Include.NON_EMPTY) @JsonProperty("participants") public Builder participants( @@ -2284,6 +2493,13 @@ public Builder participants( return this; } + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("actionId") + public Builder actionId(String actionId) { + this.actionId = actionId; + return this; + } + public ListConversationByAccount200ResponseConversations build() { return new ListConversationByAccount200ResponseConversations( this @@ -2312,7 +2528,9 @@ public boolean equals(final Object o) { Objects.equals(createdAt, other.createdAt) && Objects.equals(updatedAt, other.updatedAt) && Objects.equals(configuration, other.configuration) && - Objects.equals(participants, other.participants) + Objects.equals(metadata, other.metadata) && + Objects.equals(participants, other.participants) && + Objects.equals(actionId, other.actionId) ); } @@ -2327,7 +2545,9 @@ public int hashCode() { createdAt, updatedAt, configuration, - participants + metadata, + participants, + actionId ); } } @@ -2362,11 +2582,17 @@ public static class CreateConversationWithConfigRequest { CreateConversationWithConfigRequestParticipants > participants; + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("metadata") + @Getter + private final Map metadata; + private CreateConversationWithConfigRequest(Builder builder) { this.configurationId = builder.configurationId; this.name = builder.name; this.configuration = builder.configuration; this.participants = builder.participants; + this.metadata = builder.metadata; } public static Builder builder(final String configurationId) { @@ -2401,6 +2627,9 @@ public static class Builder { CreateConversationWithConfigRequestParticipants > participants; + @JsonProperty("metadata") + private Map metadata; + @JsonCreator public Builder( @JsonProperty("configurationId") final String configurationId @@ -2435,6 +2664,13 @@ public Builder participants( return this; } + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("metadata") + public Builder metadata(Map metadata) { + this.metadata = metadata; + return this; + } + public CreateConversationWithConfigRequest build() { return new CreateConversationWithConfigRequest(this); } @@ -2456,7 +2692,8 @@ public boolean equals(final Object o) { Objects.equals(configurationId, other.configurationId) && Objects.equals(name, other.name) && Objects.equals(configuration, other.configuration) && - Objects.equals(participants, other.participants) + Objects.equals(participants, other.participants) && + Objects.equals(metadata, other.metadata) ); } @@ -2466,7 +2703,8 @@ public int hashCode() { configurationId, name, configuration, - participants + participants, + metadata ); } } diff --git a/src/main/java/com/twilio/rest/insights/v3/Capacity.java b/src/main/java/com/twilio/rest/insights/v3/Capacity.java new file mode 100644 index 0000000000..8c411e26f5 --- /dev/null +++ b/src/main/java/com/twilio/rest/insights/v3/Capacity.java @@ -0,0 +1,456 @@ +/* + * 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.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; +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.Builder; +import lombok.Getter; +import lombok.ToString; + +@JsonIgnoreProperties(ignoreUnknown = true) +@ToString +public class Capacity extends Resource { + + @JsonIgnoreProperties(ignoreUnknown = true) + public static class CreateCapacityResponse extends Resource { + + @JsonCreator + private CreateCapacityResponse() {} + + public static CreateCapacityResponse fromJson( + final InputStream json, + final ObjectMapper objectMapper + ) { + // Convert all checked exceptions to Runtime + try { + return objectMapper.readValue( + json, + CreateCapacityResponse.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; + } + CreateCapacityResponse other = (CreateCapacityResponse) o; + return true; + } + + @Override + public int hashCode() { + return Objects.hash(); + } + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static class UpdateCapacityResponse extends Resource { + + @JsonCreator + private UpdateCapacityResponse() {} + + public static UpdateCapacityResponse fromJson( + final InputStream json, + final ObjectMapper objectMapper + ) { + // Convert all checked exceptions to Runtime + try { + return objectMapper.readValue( + json, + UpdateCapacityResponse.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; + } + UpdateCapacityResponse other = (UpdateCapacityResponse) o; + return (true); + } + + @Override + public int hashCode() { + return Objects.hash(); + } + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static class DeleteCapacityResponse extends Resource { + + @JsonCreator + private DeleteCapacityResponse() {} + + public static DeleteCapacityResponse fromJson( + final InputStream json, + final ObjectMapper objectMapper + ) { + // Convert all checked exceptions to Runtime + try { + return objectMapper.readValue( + json, + DeleteCapacityResponse.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; + } + DeleteCapacityResponse other = (DeleteCapacityResponse) o; + return true; + } + + @Override + public int hashCode() { + return Objects.hash(); + } + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static class ListCapacityResponse extends Resource { + + @JsonCreator + private ListCapacityResponse() {} + + public static ListCapacityResponse fromJson( + final InputStream json, + final ObjectMapper objectMapper + ) { + // Convert all checked exceptions to Runtime + try { + return objectMapper.readValue(json, ListCapacityResponse.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; + } + ListCapacityResponse other = (ListCapacityResponse) o; + return (true); + } + + @Override + public int hashCode() { + return Objects.hash(); + } + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static class PatchCapacityResponse extends Resource { + + @JsonCreator + private PatchCapacityResponse() {} + + public static PatchCapacityResponse fromJson( + final InputStream json, + final ObjectMapper objectMapper + ) { + // Convert all checked exceptions to Runtime + try { + return objectMapper.readValue( + json, + PatchCapacityResponse.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; + } + PatchCapacityResponse other = (PatchCapacityResponse) o; + return true; + } + + @Override + public int hashCode() { + return Objects.hash(); + } + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static class FetchCapacityResponse extends Resource { + + @Getter + private final CategoryCapacity measure; + + @JsonCreator + private FetchCapacityResponse( + @JsonProperty("measure") final CategoryCapacity measure + ) { + this.measure = measure; + } + + public static FetchCapacityResponse fromJson( + final InputStream json, + final ObjectMapper objectMapper + ) { + // Convert all checked exceptions to Runtime + try { + return objectMapper.readValue( + json, + FetchCapacityResponse.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; + } + FetchCapacityResponse other = (FetchCapacityResponse) o; + return Objects.equals(measure, other.measure); + } + + @Override + public int hashCode() { + return Objects.hash(measure); + } + } + + public static CapacityFetcher fetcher() { + return new CapacityFetcher(); + } + + @JsonDeserialize(builder = CategoryCapacity.Builder.class) + @JsonIgnoreProperties(ignoreUnknown = true) + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @ToString + public static class CategoryCapacity { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("consumed") + @Getter + private final Integer consumed; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("remaining") + @Getter + private final Integer remaining; + + private CategoryCapacity(Builder builder) { + this.consumed = builder.consumed; + this.remaining = builder.remaining; + } + + public static Builder builder() { + return new Builder(); + } + + public static CategoryCapacity fromJson( + String jsonString, + ObjectMapper mapper + ) throws IOException { + return mapper.readValue(jsonString, CategoryCapacity.class); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + @JsonPOJOBuilder(withPrefix = "") + public static class Builder { + + @JsonProperty("consumed") + private Integer consumed; + + @JsonProperty("remaining") + private Integer remaining; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("consumed") + public Builder consumed(Integer consumed) { + 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() { + return new CategoryCapacity(this); + } + } + + @Override + public boolean equals(final Object o) { + if (this == o) { + return true; + } + + if (o == null || getClass() != o.getClass()) { + return false; + } + + CategoryCapacity other = (CategoryCapacity) o; + return ( + Objects.equals(consumed, other.consumed) && + Objects.equals(remaining, other.remaining) + ); + } + + @Override + public int hashCode() { + return Objects.hash(consumed, remaining); + } + } + + /** + * Converts a JSON String into a Capacity object using the provided ObjectMapper. + * + * @param json Raw JSON String + * @param objectMapper Jackson ObjectMapper + * @return Capacity object represented by the provided JSON + */ + public static Capacity fromJson( + final String json, + final ObjectMapper objectMapper + ) { + // Convert all checked exceptions to Runtime + try { + return objectMapper.readValue(json, Capacity.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 Capacity object using the provided + * ObjectMapper. + * + * @param json Raw JSON InputStream + * @param objectMapper Jackson ObjectMapper + * @return Capacity object represented by the provided JSON + */ + public static Capacity fromJson( + final InputStream json, + final ObjectMapper objectMapper + ) { + // Convert all checked exceptions to Runtime + try { + return objectMapper.readValue(json, Capacity.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 Capacity() {} + + @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/insights/v3/CapacityFetcher.java b/src/main/java/com/twilio/rest/insights/v3/CapacityFetcher.java new file mode 100644 index 0000000000..f87249b2d6 --- /dev/null +++ b/src/main/java/com/twilio/rest/insights/v3/CapacityFetcher.java @@ -0,0 +1,92 @@ +/* + * 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.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 CapacityFetcher extends Fetcher { + + public CapacityFetcher() {} + + private Response makeRequest(final TwilioRestClient client) { + String path = + "/v3/ControlPlane/ConversationInsights/CustomFieldMappings/Capacity"; + + Request request = new Request( + HttpMethod.GET, + Domains.INSIGHTS.toString(), + path + ); + + Response response = client.request(request); + + if (response == null) { + throw new ApiConnectionException( + "Capacity 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 Capacity.FetchCapacityResponse fetch(final TwilioRestClient client) { + Response response = makeRequest(client); + return Capacity.FetchCapacityResponse.fromJson( + response.getStream(), + client.getObjectMapper() + ); + } + + @Override + public TwilioResponse fetchWithResponse( + final TwilioRestClient client + ) { + Response response = makeRequest(client); + Capacity.FetchCapacityResponse content = + Capacity.FetchCapacityResponse.fromJson( + response.getStream(), + client.getObjectMapper() + ); + return new TwilioResponse<>( + content, + response.getStatusCode(), + response.getHeaders() + ); + } +} diff --git a/src/main/java/com/twilio/rest/insights/v3/CustomFieldMapping.java b/src/main/java/com/twilio/rest/insights/v3/CustomFieldMapping.java new file mode 100644 index 0000000000..bf581c0f82 --- /dev/null +++ b/src/main/java/com/twilio/rest/insights/v3/CustomFieldMapping.java @@ -0,0 +1,926 @@ +/* + * 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.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.fasterxml.jackson.databind.annotation.JsonSerialize; +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.time.ZonedDateTime; +import java.util.List; +import java.util.Objects; +import lombok.Builder; +import lombok.Getter; +import lombok.ToString; + +@JsonIgnoreProperties(ignoreUnknown = true) +@ToString +public class CustomFieldMapping extends Resource { + + @JsonIgnoreProperties(ignoreUnknown = true) + public static class CreateCustomFieldMappingResponse extends Resource { + + @Getter + private final CustomFieldMapping.MappingCategory category; + + @Getter + private final ZonedDateTime createdAt; + + @Getter + private final String description; + + @Getter + private final IntelligenceOperatorEntityMetadata entityMetadata; + + @Getter + private final String id; + + @Getter + private final String name; + + @Getter + private final ZonedDateTime updatedAt; + + @JsonCreator + private CreateCustomFieldMappingResponse( + @JsonProperty( + "category" + ) final CustomFieldMapping.MappingCategory category, + @JsonProperty("createdAt") final ZonedDateTime createdAt, + @JsonProperty("description") final String description, + @JsonProperty( + "entityMetadata" + ) final IntelligenceOperatorEntityMetadata 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 CreateCustomFieldMappingResponse fromJson( + final InputStream json, + final ObjectMapper objectMapper + ) { + // Convert all checked exceptions to Runtime + try { + return objectMapper.readValue( + json, + CreateCustomFieldMappingResponse.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; + } + CreateCustomFieldMappingResponse other = + (CreateCustomFieldMappingResponse) o; + 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( + category, + createdAt, + description, + entityMetadata, + id, + name, + updatedAt + ); + } + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static class UpdateCustomFieldMappingResponse extends Resource { + + @JsonCreator + private UpdateCustomFieldMappingResponse() {} + + public static UpdateCustomFieldMappingResponse fromJson( + final InputStream json, + final ObjectMapper objectMapper + ) { + // Convert all checked exceptions to Runtime + try { + return objectMapper.readValue( + json, + UpdateCustomFieldMappingResponse.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; + } + UpdateCustomFieldMappingResponse other = + (UpdateCustomFieldMappingResponse) o; + return (true); + } + + @Override + public int hashCode() { + return Objects.hash(); + } + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static class DeleteCustomFieldMappingResponse extends Resource { + + @JsonCreator + private DeleteCustomFieldMappingResponse() {} + + public static DeleteCustomFieldMappingResponse fromJson( + final InputStream json, + final ObjectMapper objectMapper + ) { + // Convert all checked exceptions to Runtime + try { + return objectMapper.readValue( + json, + DeleteCustomFieldMappingResponse.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; + } + DeleteCustomFieldMappingResponse other = + (DeleteCustomFieldMappingResponse) o; + return true; + } + + @Override + public int hashCode() { + return Objects.hash(); + } + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static class ListCustomFieldMappingResponse extends Resource { + + @JsonCreator + private ListCustomFieldMappingResponse() {} + + public static ListCustomFieldMappingResponse fromJson( + final InputStream json, + final ObjectMapper objectMapper + ) { + // Convert all checked exceptions to Runtime + try { + return objectMapper.readValue( + json, + ListCustomFieldMappingResponse.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; + } + ListCustomFieldMappingResponse other = + (ListCustomFieldMappingResponse) o; + return (true); + } + + @Override + public int hashCode() { + return Objects.hash(); + } + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static class PatchCustomFieldMappingResponse extends Resource { + + @JsonCreator + private PatchCustomFieldMappingResponse() {} + + public static PatchCustomFieldMappingResponse fromJson( + final InputStream json, + final ObjectMapper objectMapper + ) { + // Convert all checked exceptions to Runtime + try { + return objectMapper.readValue( + json, + PatchCustomFieldMappingResponse.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; + } + PatchCustomFieldMappingResponse other = + (PatchCustomFieldMappingResponse) o; + return true; + } + + @Override + public int hashCode() { + return Objects.hash(); + } + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static class FetchCustomFieldMappingResponse extends Resource { + + @Getter + private final List mappings; + + @JsonCreator + private FetchCustomFieldMappingResponse( + @JsonProperty("mappings") final List< + CustomFieldMappingResponse + > mappings + ) { + this.mappings = mappings; + } + + public static FetchCustomFieldMappingResponse fromJson( + final InputStream json, + final ObjectMapper objectMapper + ) { + // Convert all checked exceptions to Runtime + try { + return objectMapper.readValue( + json, + FetchCustomFieldMappingResponse.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; + } + FetchCustomFieldMappingResponse other = + (FetchCustomFieldMappingResponse) o; + return Objects.equals(mappings, other.mappings); + } + + @Override + public int hashCode() { + return Objects.hash(mappings); + } + } + + public static CustomFieldMappingCreator creator( + final CustomFieldMapping.CustomFieldMappingRequest customFieldMappingRequest + ) { + return new CustomFieldMappingCreator(customFieldMappingRequest); + } + + public static CustomFieldMappingFetcher fetcher() { + return new CustomFieldMappingFetcher(); + } + + public enum SourceType { + INTELLIGENCE_OPERATOR("INTELLIGENCE_OPERATOR"); + + private final String value; + + private SourceType(final String value) { + this.value = value; + } + + @JsonValue + public String toString() { + return value; + } + + @JsonCreator + public static SourceType forValue(final String value) { + return Promoter.enumFromString(value, SourceType.values()); + } + } + + public enum MappingCategory { + MEASURE("MEASURE"); + + private final String value; + + private MappingCategory(final String value) { + this.value = value; + } + + @JsonValue + public String toString() { + return value; + } + + @JsonCreator + public static MappingCategory forValue(final String value) { + return Promoter.enumFromString(value, MappingCategory.values()); + } + } + + @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 IntelligenceOperatorEntityMetadata 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 IntelligenceOperatorEntityMetadata 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 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; + } + + @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 = 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; + + @JsonDeserialize(using = com.twilio.converter.ISO8601Deserializer.class) + @JsonSerialize(using = com.twilio.converter.ISO8601Serializer.class) + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("createdAt") + @Getter + private final ZonedDateTime createdAt; + + @JsonDeserialize(using = com.twilio.converter.ISO8601Deserializer.class) + @JsonSerialize(using = com.twilio.converter.ISO8601Serializer.class) + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("updatedAt") + @Getter + private final ZonedDateTime updatedAt; + + private CustomFieldMappingResponse(Builder builder) { + this.id = builder.id; + this.category = builder.category; + this.name = builder.name; + this.description = builder.description; + this.entityMetadata = builder.entityMetadata; + this.createdAt = builder.createdAt; + this.updatedAt = builder.updatedAt; + } + + public static Builder builder( + final CustomFieldMapping.MappingCategory category, + final String name, + final IntelligenceOperatorEntityMetadata entityMetadata + ) { + return new Builder(category, name, entityMetadata); + } + + public static CustomFieldMappingResponse fromJson( + String jsonString, + ObjectMapper mapper + ) throws IOException { + return mapper.readValue( + jsonString, + CustomFieldMappingResponse.class + ); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + @JsonPOJOBuilder(withPrefix = "") + public static class Builder { + + @JsonProperty("id") + private String id; + + @JsonProperty("category") + private CustomFieldMapping.MappingCategory category; + + @JsonProperty("name") + private String name; + + @JsonProperty("description") + private String description; + + @JsonProperty("entityMetadata") + private IntelligenceOperatorEntityMetadata entityMetadata; + + @JsonDeserialize( + using = com.twilio.converter.ISO8601Deserializer.class + ) + @JsonSerialize(using = com.twilio.converter.ISO8601Serializer.class) + @JsonProperty("createdAt") + private ZonedDateTime createdAt; + + @JsonDeserialize( + using = com.twilio.converter.ISO8601Deserializer.class + ) + @JsonSerialize(using = com.twilio.converter.ISO8601Serializer.class) + @JsonProperty("updatedAt") + private ZonedDateTime updatedAt; + + @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; + } + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("id") + public Builder id(String id) { + this.id = id; + return this; + } + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("description") + public Builder description(String description) { + this.description = description; + return this; + } + + @JsonDeserialize( + using = com.twilio.converter.ISO8601Deserializer.class + ) + @JsonSerialize(using = com.twilio.converter.ISO8601Serializer.class) + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("createdAt") + public Builder createdAt(ZonedDateTime createdAt) { + this.createdAt = createdAt; + return this; + } + + @JsonDeserialize( + using = com.twilio.converter.ISO8601Deserializer.class + ) + @JsonSerialize(using = com.twilio.converter.ISO8601Serializer.class) + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("updatedAt") + public Builder updatedAt(ZonedDateTime updatedAt) { + this.updatedAt = updatedAt; + return this; + } + + public CustomFieldMappingResponse build() { + return new CustomFieldMappingResponse(this); + } + } + + @Override + public boolean equals(final Object o) { + if (this == o) { + return true; + } + + if (o == null || getClass() != o.getClass()) { + return false; + } + + CustomFieldMappingResponse other = (CustomFieldMappingResponse) o; + return ( + Objects.equals(id, other.id) && + Objects.equals(category, other.category) && + Objects.equals(name, other.name) && + Objects.equals(description, other.description) && + Objects.equals(entityMetadata, other.entityMetadata) && + Objects.equals(createdAt, other.createdAt) && + Objects.equals(updatedAt, other.updatedAt) + ); + } + + @Override + public int hashCode() { + return Objects.hash( + id, + category, + name, + description, + entityMetadata, + createdAt, + updatedAt + ); + } + } + + @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. + * + * @param json Raw JSON String + * @param objectMapper Jackson ObjectMapper + * @return CustomFieldMapping object represented by the provided JSON + */ + public static CustomFieldMapping fromJson( + final String json, + final ObjectMapper objectMapper + ) { + // Convert all checked exceptions to Runtime + try { + return objectMapper.readValue(json, CustomFieldMapping.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 CustomFieldMapping object using the provided + * ObjectMapper. + * + * @param json Raw JSON InputStream + * @param objectMapper Jackson ObjectMapper + * @return CustomFieldMapping object represented by the provided JSON + */ + public static CustomFieldMapping fromJson( + final InputStream json, + final ObjectMapper objectMapper + ) { + // Convert all checked exceptions to Runtime + try { + return objectMapper.readValue(json, CustomFieldMapping.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 CustomFieldMapping() {} + + @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/insights/v3/CustomFieldMappingCreator.java b/src/main/java/com/twilio/rest/insights/v3/CustomFieldMappingCreator.java new file mode 100644 index 0000000000..9b4ed47ed3 --- /dev/null +++ b/src/main/java/com/twilio/rest/insights/v3/CustomFieldMappingCreator.java @@ -0,0 +1,124 @@ +/* + * 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.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; +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 CustomFieldMappingCreator + extends Creator { + + private CustomFieldMapping.CustomFieldMappingRequest customFieldMappingRequest; + + public CustomFieldMappingCreator( + final CustomFieldMapping.CustomFieldMappingRequest customFieldMappingRequest + ) { + this.customFieldMappingRequest = customFieldMappingRequest; + } + + public CustomFieldMappingCreator setCustomFieldMappingRequest( + final CustomFieldMapping.CustomFieldMappingRequest customFieldMappingRequest + ) { + this.customFieldMappingRequest = customFieldMappingRequest; + return this; + } + + private Response makeRequest(final TwilioRestClient client) { + String path = + "/v3/ControlPlane/ConversationInsights/CustomFieldMappings"; + + Request request = new Request( + HttpMethod.POST, + Domains.INSIGHTS.toString(), + path + ); + request.setContentType(EnumConstants.ContentType.JSON); + addPostParams(request, client); + + Response response = client.request(request); + + if (response == null) { + throw new ApiConnectionException( + "CustomFieldMapping creation 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 CustomFieldMapping.CreateCustomFieldMappingResponse create( + final TwilioRestClient client + ) { + Response response = makeRequest(client); + return CustomFieldMapping.CreateCustomFieldMappingResponse.fromJson( + response.getStream(), + client.getObjectMapper() + ); + } + + @Override + public TwilioResponse< + CustomFieldMapping.CreateCustomFieldMappingResponse + > createWithResponse(final TwilioRestClient client) { + Response response = makeRequest(client); + CustomFieldMapping.CreateCustomFieldMappingResponse content = + CustomFieldMapping.CreateCustomFieldMappingResponse.fromJson( + response.getStream(), + client.getObjectMapper() + ); + return new TwilioResponse<>( + content, + response.getStatusCode(), + response.getHeaders() + ); + } + + private void addPostParams(final Request request, TwilioRestClient client) { + ObjectMapper objectMapper = client.getObjectMapper(); + if (customFieldMappingRequest != null) { + request.setBody( + CustomFieldMapping.toJson( + customFieldMappingRequest, + 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 new file mode 100644 index 0000000000..60a89a2525 --- /dev/null +++ b/src/main/java/com/twilio/rest/insights/v3/CustomFieldMappingFetcher.java @@ -0,0 +1,95 @@ +/* + * 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.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 CustomFieldMappingFetcher + extends Fetcher { + + public CustomFieldMappingFetcher() {} + + private Response makeRequest(final TwilioRestClient client) { + String path = + "/v3/ControlPlane/ConversationInsights/CustomFieldMappings"; + + Request request = new Request( + HttpMethod.GET, + Domains.INSIGHTS.toString(), + path + ); + + Response response = client.request(request); + + if (response == null) { + throw new ApiConnectionException( + "CustomFieldMapping 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 CustomFieldMapping.FetchCustomFieldMappingResponse fetch( + final TwilioRestClient client + ) { + Response response = makeRequest(client); + return CustomFieldMapping.FetchCustomFieldMappingResponse.fromJson( + response.getStream(), + client.getObjectMapper() + ); + } + + @Override + public TwilioResponse< + CustomFieldMapping.FetchCustomFieldMappingResponse + > fetchWithResponse(final TwilioRestClient client) { + Response response = makeRequest(client); + CustomFieldMapping.FetchCustomFieldMappingResponse content = + CustomFieldMapping.FetchCustomFieldMappingResponse.fromJson( + response.getStream(), + client.getObjectMapper() + ); + return new TwilioResponse<>( + content, + response.getStatusCode(), + response.getHeaders() + ); + } +} diff --git a/src/main/java/com/twilio/rest/intelligence/v3/RuleExecution.java b/src/main/java/com/twilio/rest/intelligence/v3/RuleExecution.java index 62bad65312..ac1e6b2f95 100644 --- a/src/main/java/com/twilio/rest/intelligence/v3/RuleExecution.java +++ b/src/main/java/com/twilio/rest/intelligence/v3/RuleExecution.java @@ -33,6 +33,8 @@ import java.io.IOException; import java.io.IOException; import java.io.InputStream; +import java.util.List; +import java.util.Map; import java.util.Objects; import lombok.Builder; import lombok.Getter; @@ -321,11 +323,17 @@ public static class CreateRuleExecutionRequest { @Getter private final String conversationId; + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("rule") + @Getter + private final RuleOverride rule; + private CreateRuleExecutionRequest(Builder builder) { this.intelligenceConfigurationId = builder.intelligenceConfigurationId; this.ruleId = builder.ruleId; this.conversationId = builder.conversationId; + this.rule = builder.rule; } public static Builder builder( @@ -363,6 +371,9 @@ public static class Builder { @JsonProperty("conversationId") private String conversationId; + @JsonProperty("rule") + private RuleOverride rule; + @JsonCreator public Builder( @JsonProperty( @@ -376,6 +387,13 @@ public Builder( this.conversationId = conversationId; } + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("rule") + public Builder rule(RuleOverride rule) { + this.rule = rule; + return this; + } + public CreateRuleExecutionRequest build() { return new CreateRuleExecutionRequest(this); } @@ -398,7 +416,8 @@ public boolean equals(final Object o) { other.intelligenceConfigurationId ) && Objects.equals(ruleId, other.ruleId) && - Objects.equals(conversationId, other.conversationId) + Objects.equals(conversationId, other.conversationId) && + Objects.equals(rule, other.rule) ); } @@ -407,11 +426,161 @@ public int hashCode() { return Objects.hash( intelligenceConfigurationId, ruleId, - conversationId + conversationId, + rule ); } } + @JsonDeserialize(builder = RuleOverride.Builder.class) + @JsonIgnoreProperties(ignoreUnknown = true) + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @ToString + public static class RuleOverride { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("operators") + @Getter + private final List operators; + + private RuleOverride(Builder builder) { + this.operators = builder.operators; + } + + public static Builder builder(final List operators) { + return new Builder(operators); + } + + public static RuleOverride fromJson( + String jsonString, + ObjectMapper mapper + ) throws IOException { + return mapper.readValue(jsonString, RuleOverride.class); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + @JsonPOJOBuilder(withPrefix = "") + public static class Builder { + + @JsonProperty("operators") + private List operators; + + @JsonCreator + public Builder( + @JsonProperty("operators") final List< + OperatorOverride + > operators + ) { + this.operators = operators; + } + + public RuleOverride build() { + return new RuleOverride(this); + } + } + + @Override + public boolean equals(final Object o) { + if (this == o) { + return true; + } + + if (o == null || getClass() != o.getClass()) { + return false; + } + + RuleOverride other = (RuleOverride) o; + return (Objects.equals(operators, other.operators)); + } + + @Override + public int hashCode() { + return Objects.hash(operators); + } + } + + @JsonDeserialize(builder = OperatorOverride.Builder.class) + @JsonIgnoreProperties(ignoreUnknown = true) + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @ToString + public static class OperatorOverride { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("id") + @Getter + private final String id; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("parameters") + @Getter + private final Map parameters; + + private OperatorOverride(Builder builder) { + this.id = builder.id; + this.parameters = builder.parameters; + } + + public static Builder builder( + final String id, + final Map parameters + ) { + return new Builder(id, parameters); + } + + public static OperatorOverride fromJson( + String jsonString, + ObjectMapper mapper + ) throws IOException { + return mapper.readValue(jsonString, OperatorOverride.class); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + @JsonPOJOBuilder(withPrefix = "") + public static class Builder { + + @JsonProperty("id") + private String id; + + @JsonProperty("parameters") + private Map parameters; + + @JsonCreator + public Builder( + @JsonProperty("id") final String id, + @JsonProperty("parameters") final Map parameters + ) { + this.id = id; + this.parameters = parameters; + } + + public OperatorOverride build() { + return new OperatorOverride(this); + } + } + + @Override + public boolean equals(final Object o) { + if (this == o) { + return true; + } + + if (o == null || getClass() != o.getClass()) { + return false; + } + + OperatorOverride other = (OperatorOverride) o; + return ( + Objects.equals(id, other.id) && + Objects.equals(parameters, other.parameters) + ); + } + + @Override + public int hashCode() { + return Objects.hash(id, parameters); + } + } + /** * Converts a JSON String into a RuleExecution object using the provided ObjectMapper. * diff --git a/src/main/java/com/twilio/rest/memory/v1/DataMapping.java b/src/main/java/com/twilio/rest/memory/v1/DataMapping.java index 14d77fcc36..6afb69eb3f 100644 --- a/src/main/java/com/twilio/rest/memory/v1/DataMapping.java +++ b/src/main/java/com/twilio/rest/memory/v1/DataMapping.java @@ -505,9 +505,14 @@ public static DataMappingReader reader(final String pathStoreId) { public static DataMappingPatcher patcher( final String pathStoreId, - final String pathDataMappingId + final String pathDataMappingId, + final DataMapping.DataMappingCore dataMappingCore ) { - return new DataMappingPatcher(pathStoreId, pathDataMappingId); + return new DataMappingPatcher( + pathStoreId, + pathDataMappingId, + dataMappingCore + ); } public enum OrderBy { diff --git a/src/main/java/com/twilio/rest/memory/v1/DataMappingPatcher.java b/src/main/java/com/twilio/rest/memory/v1/DataMappingPatcher.java index ef7c04691b..c682a46a22 100644 --- a/src/main/java/com/twilio/rest/memory/v1/DataMappingPatcher.java +++ b/src/main/java/com/twilio/rest/memory/v1/DataMappingPatcher.java @@ -40,10 +40,12 @@ public class DataMappingPatcher public DataMappingPatcher( final String pathStoreId, - final String pathDataMappingId + final String pathDataMappingId, + final DataMapping.DataMappingCore dataMappingCore ) { this.pathStoreId = pathStoreId; this.pathDataMappingId = pathDataMappingId; + this.dataMappingCore = dataMappingCore; } public DataMappingPatcher setDataMappingCore( diff --git a/src/main/java/com/twilio/rest/memory/v1/Store.java b/src/main/java/com/twilio/rest/memory/v1/Store.java index a24089a121..fffa40c5ed 100644 --- a/src/main/java/com/twilio/rest/memory/v1/Store.java +++ b/src/main/java/com/twilio/rest/memory/v1/Store.java @@ -400,8 +400,11 @@ public static StoreReader reader() { return new StoreReader(); } - public static StorePatcher patcher(final String pathStoreId) { - return new StorePatcher(pathStoreId); + public static StorePatcher patcher( + final String pathStoreId, + final Store.PatchStoreRequest patchStoreRequest + ) { + return new StorePatcher(pathStoreId, patchStoreRequest); } public enum Status { diff --git a/src/main/java/com/twilio/rest/memory/v1/StorePatcher.java b/src/main/java/com/twilio/rest/memory/v1/StorePatcher.java index 25b264d39f..65a47ab923 100644 --- a/src/main/java/com/twilio/rest/memory/v1/StorePatcher.java +++ b/src/main/java/com/twilio/rest/memory/v1/StorePatcher.java @@ -36,8 +36,12 @@ public class StorePatcher extends Patcher { private String ifMatch; private Store.PatchStoreRequest patchStoreRequest; - public StorePatcher(final String pathStoreId) { + public StorePatcher( + final String pathStoreId, + final Store.PatchStoreRequest patchStoreRequest + ) { this.pathStoreId = pathStoreId; + this.patchStoreRequest = patchStoreRequest; } public StorePatcher setPatchStoreRequest( diff --git a/src/main/java/com/twilio/rest/memory/v1/TraitGroup.java b/src/main/java/com/twilio/rest/memory/v1/TraitGroup.java index 53f7922ac4..fdb7c0f9e6 100644 --- a/src/main/java/com/twilio/rest/memory/v1/TraitGroup.java +++ b/src/main/java/com/twilio/rest/memory/v1/TraitGroup.java @@ -412,9 +412,14 @@ public static TraitGroupReader reader(final String pathStoreId) { public static TraitGroupPatcher patcher( final String pathStoreId, - final String pathTraitGroupName + final String pathTraitGroupName, + final TraitGroup.PatchTraitGroupRequest patchTraitGroupRequest ) { - return new TraitGroupPatcher(pathStoreId, pathTraitGroupName); + return new TraitGroupPatcher( + pathStoreId, + pathTraitGroupName, + patchTraitGroupRequest + ); } public enum OrderBy { diff --git a/src/main/java/com/twilio/rest/memory/v1/TraitGroupPatcher.java b/src/main/java/com/twilio/rest/memory/v1/TraitGroupPatcher.java index 50522be723..1610799550 100644 --- a/src/main/java/com/twilio/rest/memory/v1/TraitGroupPatcher.java +++ b/src/main/java/com/twilio/rest/memory/v1/TraitGroupPatcher.java @@ -40,10 +40,12 @@ public class TraitGroupPatcher public TraitGroupPatcher( final String pathStoreId, - final String pathTraitGroupName + final String pathTraitGroupName, + final TraitGroup.PatchTraitGroupRequest patchTraitGroupRequest ) { this.pathStoreId = pathStoreId; this.pathTraitGroupName = pathTraitGroupName; + this.patchTraitGroupRequest = patchTraitGroupRequest; } public TraitGroupPatcher setPatchTraitGroupRequest( diff --git a/src/main/java/com/twilio/rest/voice/v2/RecordingAccountDefaultConfiguration.java b/src/main/java/com/twilio/rest/voice/v2/RecordingAccountDefaultConfiguration.java new file mode 100644 index 0000000000..7c3eba7531 --- /dev/null +++ b/src/main/java/com/twilio/rest/voice/v2/RecordingAccountDefaultConfiguration.java @@ -0,0 +1,947 @@ +/* + * This code was generated by + * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + * + * Twilio API definition for public-api voice + * Powers Twilio public-api voice + * + * NOTE: This class is auto generated by OpenAPI Generator. + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.twilio.rest.voice.v2; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.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.fasterxml.jackson.databind.annotation.JsonSerialize; +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.time.ZonedDateTime; +import java.util.List; +import java.util.Objects; +import lombok.Builder; +import lombok.Getter; +import lombok.ToString; + +@JsonIgnoreProperties(ignoreUnknown = true) +@ToString +public class RecordingAccountDefaultConfiguration extends Resource { + + public static RecordingAccountDefaultConfigurationCreator creator() { + return new RecordingAccountDefaultConfigurationCreator(); + } + + public static RecordingAccountDefaultConfigurationDeleter deleter() { + return new RecordingAccountDefaultConfigurationDeleter(); + } + + public static RecordingAccountDefaultConfigurationFetcher fetcher() { + return new RecordingAccountDefaultConfigurationFetcher(); + } + + public static RecordingAccountDefaultConfigurationUpdater updater() { + return new RecordingAccountDefaultConfigurationUpdater(); + } + + public enum ConfigurationType { + RECORDING("Recording"); + + private final String value; + + private ConfigurationType(final String value) { + this.value = value; + } + + @JsonValue + public String toString() { + return value; + } + + @JsonCreator + public static ConfigurationType forValue(final String value) { + return Promoter.enumFromString(value, ConfigurationType.values()); + } + } + + public enum Type { + TRANSCRIPTION_CONFIGURATION("transcriptionConfiguration"); + + private final String value; + + private Type(final String value) { + this.value = value; + } + + @JsonValue + public String toString() { + return value; + } + + @JsonCreator + public static Type forValue(final String value) { + return Promoter.enumFromString(value, Type.values()); + } + } + + public enum Trim { + TRIM_SILENCE("trim-silence"), + DO_NOT_TRIM("do-not-trim"); + + private final String value; + + private Trim(final String value) { + this.value = value; + } + + @JsonValue + public String toString() { + return value; + } + + @JsonCreator + public static Trim forValue(final String value) { + return Promoter.enumFromString(value, Trim.values()); + } + } + + public enum Events { + IN_PROGRESS("in-progress"), + COMPLETED("completed"), + ABSENT("absent"), + FAILED("failed"); + + private final String value; + + private Events(final String value) { + this.value = value; + } + + @JsonValue + public String toString() { + return value; + } + + @JsonCreator + public static Events forValue(final String value) { + return Promoter.enumFromString(value, Events.values()); + } + } + + public enum Method { + GET("GET"), + POST("POST"); + + private final String value; + + private Method(final String value) { + this.value = value; + } + + @JsonValue + public String toString() { + return value; + } + + @JsonCreator + public static Method forValue(final String value) { + return Promoter.enumFromString(value, Method.values()); + } + } + + public enum Channels { + DUAL("dual"), + MONO("mono"); + + private final String value; + + private Channels(final String value) { + this.value = value; + } + + @JsonValue + public String toString() { + return value; + } + + @JsonCreator + public static Channels forValue(final String value) { + return Promoter.enumFromString(value, Channels.values()); + } + } + + public enum Track { + INBOUND("inbound"), + OUTBOUND("outbound"), + BOTH("both"); + + private final String value; + + private Track(final String value) { + this.value = value; + } + + @JsonValue + public String toString() { + return value; + } + + @JsonCreator + public static Track forValue(final String value) { + return Promoter.enumFromString(value, Track.values()); + } + } + + @JsonDeserialize( + builder = VoiceV2ConfigurationRecordingStatusCallback.Builder.class + ) + @JsonIgnoreProperties(ignoreUnknown = true) + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @ToString + public static class VoiceV2ConfigurationRecordingStatusCallback { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("url") + @Getter + private final String url; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("method") + @Getter + private final RecordingAccountDefaultConfiguration.Method method; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("events") + @Getter + private final List events; + + private VoiceV2ConfigurationRecordingStatusCallback(Builder builder) { + this.url = builder.url; + this.method = builder.method; + this.events = builder.events; + } + + public static Builder builder() { + return new Builder(); + } + + public static VoiceV2ConfigurationRecordingStatusCallback fromJson( + String jsonString, + ObjectMapper mapper + ) throws IOException { + return mapper.readValue( + jsonString, + VoiceV2ConfigurationRecordingStatusCallback.class + ); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + @JsonPOJOBuilder(withPrefix = "") + public static class Builder { + + @JsonProperty("url") + private String url; + + @JsonProperty("method") + private RecordingAccountDefaultConfiguration.Method method; + + @JsonProperty("events") + private List events; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("url") + public Builder url(String url) { + this.url = url; + return this; + } + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("method") + public Builder method( + RecordingAccountDefaultConfiguration.Method method + ) { + this.method = method; + return this; + } + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("events") + public Builder events( + List events + ) { + this.events = events; + return this; + } + + public VoiceV2ConfigurationRecordingStatusCallback build() { + return new VoiceV2ConfigurationRecordingStatusCallback(this); + } + } + + @Override + public boolean equals(final Object o) { + if (this == o) { + return true; + } + + if (o == null || getClass() != o.getClass()) { + return false; + } + + VoiceV2ConfigurationRecordingStatusCallback other = + (VoiceV2ConfigurationRecordingStatusCallback) o; + return ( + Objects.equals(url, other.url) && + Objects.equals(method, other.method) && + Objects.equals(events, other.events) + ); + } + + @Override + public int hashCode() { + return Objects.hash(url, method, events); + } + } + + @JsonDeserialize( + builder = VoiceV2ConfigurationRecordingFeature.Builder.class + ) + @JsonIgnoreProperties(ignoreUnknown = true) + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @ToString + public static class VoiceV2ConfigurationRecordingFeature { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("type") + @Getter + private final RecordingAccountDefaultConfiguration.Type type; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("featureId") + @Getter + private final String featureId; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("description") + @Getter + private final String description; + + private VoiceV2ConfigurationRecordingFeature(Builder builder) { + this.type = builder.type; + this.featureId = builder.featureId; + this.description = builder.description; + } + + public static Builder builder( + final RecordingAccountDefaultConfiguration.Type type, + final String featureId + ) { + return new Builder(type, featureId); + } + + public static VoiceV2ConfigurationRecordingFeature fromJson( + String jsonString, + ObjectMapper mapper + ) throws IOException { + return mapper.readValue( + jsonString, + VoiceV2ConfigurationRecordingFeature.class + ); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + @JsonPOJOBuilder(withPrefix = "") + public static class Builder { + + @JsonProperty("type") + private RecordingAccountDefaultConfiguration.Type type; + + @JsonProperty("featureId") + private String featureId; + + @JsonProperty("description") + private String description; + + @JsonCreator + public Builder( + @JsonProperty( + "type" + ) final RecordingAccountDefaultConfiguration.Type type, + @JsonProperty("featureId") final String featureId + ) { + this.type = type; + this.featureId = featureId; + } + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("description") + public Builder description(String description) { + this.description = description; + return this; + } + + public VoiceV2ConfigurationRecordingFeature build() { + return new VoiceV2ConfigurationRecordingFeature(this); + } + } + + @Override + public boolean equals(final Object o) { + if (this == o) { + return true; + } + + if (o == null || getClass() != o.getClass()) { + return false; + } + + VoiceV2ConfigurationRecordingFeature other = + (VoiceV2ConfigurationRecordingFeature) o; + return ( + Objects.equals(type, other.type) && + Objects.equals(featureId, other.featureId) && + Objects.equals(description, other.description) + ); + } + + @Override + public int hashCode() { + return Objects.hash(type, featureId, description); + } + } + + @JsonDeserialize( + builder = VoiceV2ConfigurationRecordingCompositionPolicy.Builder.class + ) + @JsonIgnoreProperties(ignoreUnknown = true) + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @ToString + public static class VoiceV2ConfigurationRecordingCompositionPolicy { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("channels") + @Getter + private final RecordingAccountDefaultConfiguration.Channels channels; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("trim") + @Getter + private final RecordingAccountDefaultConfiguration.Trim trim; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("track") + @Getter + private final RecordingAccountDefaultConfiguration.Track track; + + private VoiceV2ConfigurationRecordingCompositionPolicy( + Builder builder + ) { + this.channels = builder.channels; + this.trim = builder.trim; + this.track = builder.track; + } + + public static Builder builder() { + return new Builder(); + } + + public static VoiceV2ConfigurationRecordingCompositionPolicy fromJson( + String jsonString, + ObjectMapper mapper + ) throws IOException { + return mapper.readValue( + jsonString, + VoiceV2ConfigurationRecordingCompositionPolicy.class + ); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + @JsonPOJOBuilder(withPrefix = "") + public static class Builder { + + @JsonProperty("channels") + private RecordingAccountDefaultConfiguration.Channels channels; + + @JsonProperty("trim") + private RecordingAccountDefaultConfiguration.Trim trim; + + @JsonProperty("track") + private RecordingAccountDefaultConfiguration.Track track; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("channels") + public Builder channels( + RecordingAccountDefaultConfiguration.Channels channels + ) { + this.channels = channels; + return this; + } + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("trim") + public Builder trim( + RecordingAccountDefaultConfiguration.Trim trim + ) { + this.trim = trim; + return this; + } + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("track") + public Builder track( + RecordingAccountDefaultConfiguration.Track track + ) { + this.track = track; + return this; + } + + public VoiceV2ConfigurationRecordingCompositionPolicy build() { + return new VoiceV2ConfigurationRecordingCompositionPolicy(this); + } + } + + @Override + public boolean equals(final Object o) { + if (this == o) { + return true; + } + + if (o == null || getClass() != o.getClass()) { + return false; + } + + VoiceV2ConfigurationRecordingCompositionPolicy other = + (VoiceV2ConfigurationRecordingCompositionPolicy) o; + return ( + Objects.equals(channels, other.channels) && + Objects.equals(trim, other.trim) && + Objects.equals(track, other.track) + ); + } + + @Override + public int hashCode() { + return Objects.hash(channels, trim, track); + } + } + + @JsonDeserialize( + builder = VoiceV2AccountDefaultConfigurationRecordingRequest.Builder.class + ) + @JsonIgnoreProperties(ignoreUnknown = true) + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @ToString + public static class VoiceV2AccountDefaultConfigurationRecordingRequest { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("description") + @Getter + private final String description; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("configuration") + @Getter + private final VoiceV2ConfigurationRecordingConfiguration configuration; + + private VoiceV2AccountDefaultConfigurationRecordingRequest( + Builder builder + ) { + this.description = builder.description; + this.configuration = builder.configuration; + } + + public static Builder builder( + final VoiceV2ConfigurationRecordingConfiguration configuration + ) { + return new Builder(configuration); + } + + public static VoiceV2AccountDefaultConfigurationRecordingRequest fromJson( + String jsonString, + ObjectMapper mapper + ) throws IOException { + return mapper.readValue( + jsonString, + VoiceV2AccountDefaultConfigurationRecordingRequest.class + ); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + @JsonPOJOBuilder(withPrefix = "") + public static class Builder { + + @JsonProperty("description") + private String description; + + @JsonProperty("configuration") + private VoiceV2ConfigurationRecordingConfiguration configuration; + + @JsonCreator + public Builder( + @JsonProperty( + "configuration" + ) final VoiceV2ConfigurationRecordingConfiguration configuration + ) { + this.configuration = configuration; + } + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("description") + public Builder description(String description) { + this.description = description; + return this; + } + + public VoiceV2AccountDefaultConfigurationRecordingRequest build() { + return new VoiceV2AccountDefaultConfigurationRecordingRequest( + this + ); + } + } + + @Override + public boolean equals(final Object o) { + if (this == o) { + return true; + } + + if (o == null || getClass() != o.getClass()) { + return false; + } + + VoiceV2AccountDefaultConfigurationRecordingRequest other = + (VoiceV2AccountDefaultConfigurationRecordingRequest) o; + return ( + Objects.equals(description, other.description) && + Objects.equals(configuration, other.configuration) + ); + } + + @Override + public int hashCode() { + return Objects.hash(description, configuration); + } + } + + @JsonDeserialize( + builder = VoiceV2ConfigurationRecordingConfiguration.Builder.class + ) + @JsonIgnoreProperties(ignoreUnknown = true) + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @ToString + public static class VoiceV2ConfigurationRecordingConfiguration { + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("configurationType") + @Getter + private final RecordingAccountDefaultConfiguration.ConfigurationType configurationType; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("compositionPolicy") + @Getter + private final VoiceV2ConfigurationRecordingCompositionPolicy compositionPolicy; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("callRecordingStatusCallback") + @Getter + private final VoiceV2ConfigurationRecordingStatusCallback callRecordingStatusCallback; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("conferenceRecordingStatusCallback") + @Getter + private final VoiceV2ConfigurationRecordingStatusCallback conferenceRecordingStatusCallback; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("features") + @Getter + private final List features; + + private VoiceV2ConfigurationRecordingConfiguration(Builder builder) { + this.configurationType = builder.configurationType; + this.compositionPolicy = builder.compositionPolicy; + this.callRecordingStatusCallback = + builder.callRecordingStatusCallback; + this.conferenceRecordingStatusCallback = + builder.conferenceRecordingStatusCallback; + this.features = builder.features; + } + + public static Builder builder( + final RecordingAccountDefaultConfiguration.ConfigurationType configurationType + ) { + return new Builder(configurationType); + } + + public static VoiceV2ConfigurationRecordingConfiguration fromJson( + String jsonString, + ObjectMapper mapper + ) throws IOException { + return mapper.readValue( + jsonString, + VoiceV2ConfigurationRecordingConfiguration.class + ); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + @JsonPOJOBuilder(withPrefix = "") + public static class Builder { + + @JsonProperty("configurationType") + private RecordingAccountDefaultConfiguration.ConfigurationType configurationType; + + @JsonProperty("compositionPolicy") + private VoiceV2ConfigurationRecordingCompositionPolicy compositionPolicy; + + @JsonProperty("callRecordingStatusCallback") + private VoiceV2ConfigurationRecordingStatusCallback callRecordingStatusCallback; + + @JsonProperty("conferenceRecordingStatusCallback") + private VoiceV2ConfigurationRecordingStatusCallback conferenceRecordingStatusCallback; + + @JsonProperty("features") + private List features; + + @JsonCreator + public Builder( + @JsonProperty( + "configurationType" + ) final RecordingAccountDefaultConfiguration.ConfigurationType configurationType + ) { + this.configurationType = configurationType; + } + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("compositionPolicy") + public Builder compositionPolicy( + VoiceV2ConfigurationRecordingCompositionPolicy compositionPolicy + ) { + this.compositionPolicy = compositionPolicy; + return this; + } + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("callRecordingStatusCallback") + public Builder callRecordingStatusCallback( + VoiceV2ConfigurationRecordingStatusCallback callRecordingStatusCallback + ) { + this.callRecordingStatusCallback = callRecordingStatusCallback; + return this; + } + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("conferenceRecordingStatusCallback") + public Builder conferenceRecordingStatusCallback( + VoiceV2ConfigurationRecordingStatusCallback conferenceRecordingStatusCallback + ) { + this.conferenceRecordingStatusCallback = + conferenceRecordingStatusCallback; + return this; + } + + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @JsonProperty("features") + public Builder features( + List features + ) { + this.features = features; + return this; + } + + public VoiceV2ConfigurationRecordingConfiguration build() { + return new VoiceV2ConfigurationRecordingConfiguration(this); + } + } + + @Override + public boolean equals(final Object o) { + if (this == o) { + return true; + } + + if (o == null || getClass() != o.getClass()) { + return false; + } + + VoiceV2ConfigurationRecordingConfiguration other = + (VoiceV2ConfigurationRecordingConfiguration) o; + return ( + Objects.equals(configurationType, other.configurationType) && + Objects.equals(compositionPolicy, other.compositionPolicy) && + Objects.equals( + callRecordingStatusCallback, + other.callRecordingStatusCallback + ) && + Objects.equals( + conferenceRecordingStatusCallback, + other.conferenceRecordingStatusCallback + ) && + Objects.equals(features, other.features) + ); + } + + @Override + public int hashCode() { + return Objects.hash( + configurationType, + compositionPolicy, + callRecordingStatusCallback, + conferenceRecordingStatusCallback, + features + ); + } + } + + /** + * Converts a JSON String into a RecordingAccountDefaultConfiguration object using the provided ObjectMapper. + * + * @param json Raw JSON String + * @param objectMapper Jackson ObjectMapper + * @return RecordingAccountDefaultConfiguration object represented by the provided JSON + */ + public static RecordingAccountDefaultConfiguration fromJson( + final String json, + final ObjectMapper objectMapper + ) { + // Convert all checked exceptions to Runtime + try { + return objectMapper.readValue( + json, + RecordingAccountDefaultConfiguration.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 RecordingAccountDefaultConfiguration object using the provided + * ObjectMapper. + * + * @param json Raw JSON InputStream + * @param objectMapper Jackson ObjectMapper + * @return RecordingAccountDefaultConfiguration object represented by the provided JSON + */ + public static RecordingAccountDefaultConfiguration fromJson( + final InputStream json, + final ObjectMapper objectMapper + ) { + // Convert all checked exceptions to Runtime + try { + return objectMapper.readValue( + json, + RecordingAccountDefaultConfiguration.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 accountSid; + + @Getter + private final VoiceV2ConfigurationRecordingConfiguration configuration; + + @JsonSerialize(using = com.twilio.converter.ISO8601Serializer.class) + @Getter + private final ZonedDateTime dateCreated; + + @JsonSerialize(using = com.twilio.converter.ISO8601Serializer.class) + @Getter + private final ZonedDateTime dateUpdated; + + @Getter + private final String description; + + @JsonCreator + private RecordingAccountDefaultConfiguration( + @JsonProperty("account_sid") final String accountSid, + @JsonProperty( + "configuration" + ) final VoiceV2ConfigurationRecordingConfiguration configuration, + @JsonProperty("date_created") @JsonDeserialize( + using = com.twilio.converter.ISO8601Deserializer.class + ) @JsonSerialize( + using = com.twilio.converter.ISO8601Serializer.class + ) final ZonedDateTime dateCreated, + @JsonProperty("date_updated") @JsonDeserialize( + using = com.twilio.converter.ISO8601Deserializer.class + ) @JsonSerialize( + using = com.twilio.converter.ISO8601Serializer.class + ) final ZonedDateTime dateUpdated, + @JsonProperty("description") final String description + ) { + this.accountSid = accountSid; + this.configuration = configuration; + this.dateCreated = dateCreated; + this.dateUpdated = dateUpdated; + this.description = description; + } + + @Override + public boolean equals(final Object o) { + if (this == o) { + return true; + } + + if (o == null || getClass() != o.getClass()) { + return false; + } + + RecordingAccountDefaultConfiguration other = + (RecordingAccountDefaultConfiguration) o; + return ( + Objects.equals(accountSid, other.accountSid) && + Objects.equals(configuration, other.configuration) && + Objects.equals(dateCreated, other.dateCreated) && + Objects.equals(dateUpdated, other.dateUpdated) && + Objects.equals(description, other.description) + ); + } + + @Override + public int hashCode() { + return Objects.hash( + accountSid, + configuration, + dateCreated, + dateUpdated, + description + ); + } +} diff --git a/src/main/java/com/twilio/rest/voice/v2/RecordingAccountDefaultConfigurationCreator.java b/src/main/java/com/twilio/rest/voice/v2/RecordingAccountDefaultConfigurationCreator.java new file mode 100644 index 0000000000..1d96238c89 --- /dev/null +++ b/src/main/java/com/twilio/rest/voice/v2/RecordingAccountDefaultConfigurationCreator.java @@ -0,0 +1,120 @@ +/* + * This code was generated by + * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + * + * Twilio API definition for public-api voice + * Powers Twilio public-api voice + * + * NOTE: This class is auto generated by OpenAPI Generator. + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.twilio.rest.voice.v2; + +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; +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 RecordingAccountDefaultConfigurationCreator + extends Creator { + + private RecordingAccountDefaultConfiguration.VoiceV2AccountDefaultConfigurationRecordingRequest voiceV2AccountDefaultConfigurationRecordingRequest; + + public RecordingAccountDefaultConfigurationCreator() {} + + public RecordingAccountDefaultConfigurationCreator setVoiceV2AccountDefaultConfigurationRecordingRequest( + final RecordingAccountDefaultConfiguration.VoiceV2AccountDefaultConfigurationRecordingRequest voiceV2AccountDefaultConfigurationRecordingRequest + ) { + this.voiceV2AccountDefaultConfigurationRecordingRequest = + voiceV2AccountDefaultConfigurationRecordingRequest; + return this; + } + + private Response makeRequest(final TwilioRestClient client) { + String path = "/v2/AccountDefaultConfiguration/Recording"; + + Request request = new Request( + HttpMethod.POST, + Domains.VOICE.toString(), + path + ); + request.setContentType(EnumConstants.ContentType.JSON); + addPostParams(request, client); + + Response response = client.request(request); + + if (response == null) { + throw new ApiConnectionException( + "RecordingAccountDefaultConfiguration creation 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 RecordingAccountDefaultConfiguration create( + final TwilioRestClient client + ) { + Response response = makeRequest(client); + return RecordingAccountDefaultConfiguration.fromJson( + response.getStream(), + client.getObjectMapper() + ); + } + + @Override + public TwilioResponse< + RecordingAccountDefaultConfiguration + > createWithResponse(final TwilioRestClient client) { + Response response = makeRequest(client); + RecordingAccountDefaultConfiguration content = + RecordingAccountDefaultConfiguration.fromJson( + response.getStream(), + client.getObjectMapper() + ); + return new TwilioResponse<>( + content, + response.getStatusCode(), + response.getHeaders() + ); + } + + private void addPostParams(final Request request, TwilioRestClient client) { + ObjectMapper objectMapper = client.getObjectMapper(); + if (voiceV2AccountDefaultConfigurationRecordingRequest != null) { + request.setBody( + RecordingAccountDefaultConfiguration.toJson( + voiceV2AccountDefaultConfigurationRecordingRequest, + objectMapper + ) + ); + } + } +} diff --git a/src/main/java/com/twilio/rest/voice/v2/RecordingAccountDefaultConfigurationDeleter.java b/src/main/java/com/twilio/rest/voice/v2/RecordingAccountDefaultConfigurationDeleter.java new file mode 100644 index 0000000000..1f42845d6d --- /dev/null +++ b/src/main/java/com/twilio/rest/voice/v2/RecordingAccountDefaultConfigurationDeleter.java @@ -0,0 +1,92 @@ +/* + * This code was generated by + * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + * + * Twilio API definition for public-api voice + * Powers Twilio public-api voice + * + * NOTE: This class is auto generated by OpenAPI Generator. + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.twilio.rest.voice.v2; + +import com.twilio.base.Deleter; +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; +import java.util.function.Predicate; + +public class RecordingAccountDefaultConfigurationDeleter + extends Deleter { + + public RecordingAccountDefaultConfigurationDeleter() {} + + private Response makeRequest(final TwilioRestClient client) { + String path = "/v2/AccountDefaultConfiguration/Recording"; + + Predicate deleteStatuses = i -> + i != null && i >= 200 && i < 300; + Request request = new Request( + HttpMethod.DELETE, + Domains.VOICE.toString(), + path + ); + + Response response = client.request(request); + + if (response == null) { + throw new ApiConnectionException( + "RecordingAccountDefaultConfiguration delete 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 boolean delete(final TwilioRestClient client) { + Response response = makeRequest(client); + Predicate deleteStatuses = i -> + i != null && i >= 200 && i < 300; + return deleteStatuses.test(response.getStatusCode()); + } + + @Override + public TwilioResponse deleteWithResponse( + final TwilioRestClient client + ) { + Response response = makeRequest(client); + Predicate deleteStatuses = i -> + i != null && i >= 200 && i < 300; + Boolean deleted = deleteStatuses.test(response.getStatusCode()); + return new TwilioResponse<>( + deleted, + response.getStatusCode(), + response.getHeaders() + ); + } +} diff --git a/src/main/java/com/twilio/rest/voice/v2/RecordingAccountDefaultConfigurationFetcher.java b/src/main/java/com/twilio/rest/voice/v2/RecordingAccountDefaultConfigurationFetcher.java new file mode 100644 index 0000000000..c08cf61e19 --- /dev/null +++ b/src/main/java/com/twilio/rest/voice/v2/RecordingAccountDefaultConfigurationFetcher.java @@ -0,0 +1,94 @@ +/* + * This code was generated by + * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + * + * Twilio API definition for public-api voice + * Powers Twilio public-api voice + * + * NOTE: This class is auto generated by OpenAPI Generator. + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.twilio.rest.voice.v2; + +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 RecordingAccountDefaultConfigurationFetcher + extends Fetcher { + + public RecordingAccountDefaultConfigurationFetcher() {} + + private Response makeRequest(final TwilioRestClient client) { + String path = "/v2/AccountDefaultConfiguration/Recording"; + + Request request = new Request( + HttpMethod.GET, + Domains.VOICE.toString(), + path + ); + + Response response = client.request(request); + + if (response == null) { + throw new ApiConnectionException( + "RecordingAccountDefaultConfiguration 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 RecordingAccountDefaultConfiguration fetch( + final TwilioRestClient client + ) { + Response response = makeRequest(client); + return RecordingAccountDefaultConfiguration.fromJson( + response.getStream(), + client.getObjectMapper() + ); + } + + @Override + public TwilioResponse< + RecordingAccountDefaultConfiguration + > fetchWithResponse(final TwilioRestClient client) { + Response response = makeRequest(client); + RecordingAccountDefaultConfiguration content = + RecordingAccountDefaultConfiguration.fromJson( + response.getStream(), + client.getObjectMapper() + ); + return new TwilioResponse<>( + content, + response.getStatusCode(), + response.getHeaders() + ); + } +} diff --git a/src/main/java/com/twilio/rest/voice/v2/RecordingAccountDefaultConfigurationUpdater.java b/src/main/java/com/twilio/rest/voice/v2/RecordingAccountDefaultConfigurationUpdater.java new file mode 100644 index 0000000000..f4ab751ca6 --- /dev/null +++ b/src/main/java/com/twilio/rest/voice/v2/RecordingAccountDefaultConfigurationUpdater.java @@ -0,0 +1,120 @@ +/* + * This code was generated by + * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + * + * Twilio API definition for public-api voice + * Powers Twilio public-api voice + * + * NOTE: This class is auto generated by OpenAPI Generator. + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.twilio.rest.voice.v2; + +import com.fasterxml.jackson.databind.ObjectMapper; +import com.twilio.base.TwilioResponse; +import com.twilio.base.Updater; +import com.twilio.constant.EnumConstants; +import com.twilio.exception.ApiConnectionException; +import com.twilio.exception.ApiException; +import com.twilio.exception.RestException; +import com.twilio.http.HttpMethod; +import com.twilio.http.Request; +import com.twilio.http.Response; +import com.twilio.http.TwilioRestClient; +import com.twilio.rest.Domains; +import com.twilio.type.*; +import java.io.InputStream; + +public class RecordingAccountDefaultConfigurationUpdater + extends Updater { + + private RecordingAccountDefaultConfiguration.VoiceV2AccountDefaultConfigurationRecordingRequest voiceV2AccountDefaultConfigurationRecordingRequest; + + public RecordingAccountDefaultConfigurationUpdater() {} + + public RecordingAccountDefaultConfigurationUpdater setVoiceV2AccountDefaultConfigurationRecordingRequest( + final RecordingAccountDefaultConfiguration.VoiceV2AccountDefaultConfigurationRecordingRequest voiceV2AccountDefaultConfigurationRecordingRequest + ) { + this.voiceV2AccountDefaultConfigurationRecordingRequest = + voiceV2AccountDefaultConfigurationRecordingRequest; + return this; + } + + private Response makeRequest(final TwilioRestClient client) { + String path = "/v2/AccountDefaultConfiguration/Recording"; + + Request request = new Request( + HttpMethod.PUT, + Domains.VOICE.toString(), + path + ); + request.setContentType(EnumConstants.ContentType.JSON); + addPostParams(request, client); + + Response response = client.request(request); + + if (response == null) { + throw new ApiConnectionException( + "RecordingAccountDefaultConfiguration 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 RecordingAccountDefaultConfiguration update( + final TwilioRestClient client + ) { + Response response = makeRequest(client); + return RecordingAccountDefaultConfiguration.fromJson( + response.getStream(), + client.getObjectMapper() + ); + } + + @Override + public TwilioResponse< + RecordingAccountDefaultConfiguration + > updateWithResponse(final TwilioRestClient client) { + Response response = makeRequest(client); + RecordingAccountDefaultConfiguration content = + RecordingAccountDefaultConfiguration.fromJson( + response.getStream(), + client.getObjectMapper() + ); + return new TwilioResponse<>( + content, + response.getStatusCode(), + response.getHeaders() + ); + } + + private void addPostParams(final Request request, TwilioRestClient client) { + ObjectMapper objectMapper = client.getObjectMapper(); + if (voiceV2AccountDefaultConfigurationRecordingRequest != null) { + request.setBody( + RecordingAccountDefaultConfiguration.toJson( + voiceV2AccountDefaultConfigurationRecordingRequest, + objectMapper + ) + ); + } + } +} diff --git a/src/main/java/com/twilio/twiml/voice/Stream.java b/src/main/java/com/twilio/twiml/voice/Stream.java index 16ce30d124..49ff2790e5 100644 --- a/src/main/java/com/twilio/twiml/voice/Stream.java +++ b/src/main/java/com/twilio/twiml/voice/Stream.java @@ -59,6 +59,8 @@ public String toString() { private final Stream.Track track; private final String statusCallback; private final Stream.StatusCallbackMethod statusCallbackMethod; + private final String audioFormat; + private final String sampleRate; /** * For XML Serialization/Deserialization @@ -78,6 +80,8 @@ private Stream(Builder b) { this.track = b.track; this.statusCallback = b.statusCallback; this.statusCallbackMethod = b.statusCallbackMethod; + this.audioFormat = b.audioFormat; + this.sampleRate = b.sampleRate; } /** @@ -107,6 +111,12 @@ protected Map getElementAttributes() { if (this.getStatusCallbackMethod() != null) { attrs.put("statusCallbackMethod", this.getStatusCallbackMethod().toString()); } + if (this.getAudioFormat() != null) { + attrs.put("audioFormat", this.getAudioFormat()); + } + if (this.getSampleRate() != null) { + attrs.put("sampleRate", this.getSampleRate()); + } return attrs; } @@ -165,6 +175,24 @@ public Stream.StatusCallbackMethod getStatusCallbackMethod() { return statusCallbackMethod; } + /** + * Required Audio Format + * + * @return Required Audio Format + */ + public String getAudioFormat() { + return audioFormat; + } + + /** + * Sample Rate for HD Codec + * + * @return Sample Rate for HD Codec + */ + public String getSampleRate() { + return sampleRate; + } + /** * Create a new {@code } element */ @@ -190,6 +218,8 @@ public static Builder fromXml(final String xml) throws TwiMLException { private Stream.Track track; private String statusCallback; private Stream.StatusCallbackMethod statusCallbackMethod; + private String audioFormat; + private String sampleRate; /** * Friendly name given to the Stream @@ -245,6 +275,24 @@ public Builder statusCallbackMethod(Stream.StatusCallbackMethod statusCallbackMe return this; } + /** + * Required Audio Format + */ + @JacksonXmlProperty(isAttribute = true, localName = "audioFormat") + public Builder audioFormat(String audioFormat) { + this.audioFormat = audioFormat; + return this; + } + + /** + * Sample Rate for HD Codec + */ + @JacksonXmlProperty(isAttribute = true, localName = "sampleRate") + public Builder sampleRate(String sampleRate) { + this.sampleRate = sampleRate; + return this; + } + /** * Add a child {@code } element */ diff --git a/src/test/java/com/twilio/rest/messaging/v2/ChannelsSenderForwardCompatibilityTest.java b/src/test/java/com/twilio/rest/messaging/v2/ChannelsSenderForwardCompatibilityTest.java deleted file mode 100644 index e8c7992ae8..0000000000 --- a/src/test/java/com/twilio/rest/messaging/v2/ChannelsSenderForwardCompatibilityTest.java +++ /dev/null @@ -1,260 +0,0 @@ -package com.twilio.rest.messaging.v2; - -import com.fasterxml.jackson.databind.ObjectMapper; -import org.junit.Before; -import org.junit.Test; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertNull; - -public class ChannelsSenderForwardCompatibilityTest { - - private ObjectMapper objectMapper; - - @Before - public void setUp() { - objectMapper = new ObjectMapper(); - } - - @Test - public void testTopLevelUnknownFieldsIgnored() throws Exception { - String json = "{" - + "\"sid\": \"XE1234567890abcdef1234567890abcdef\"," - + "\"status\": \"ONLINE\"," - + "\"sender_id\": \"whatsapp:+15017122661\"," - + "\"unknown_top_level_field\": \"should be ignored\"," - + "\"another_new_field\": 12345" - + "}"; - - ChannelsSender sender = ChannelsSender.fromJson(json, objectMapper); - - assertNotNull(sender); - assertEquals("XE1234567890abcdef1234567890abcdef", sender.getSid()); - assertEquals(ChannelsSender.Status.ONLINE, sender.getStatus()); - assertEquals("whatsapp:+15017122661", sender.getSenderId()); - } - - @Test - public void testNestedProfileGenericResponseUnknownFieldsIgnored() throws Exception { - String json = "{" - + "\"sid\": \"XE1234567890abcdef1234567890abcdef\"," - + "\"status\": \"ONLINE\"," - + "\"sender_id\": \"whatsapp:+15017122661\"," - + "\"profile\": {" - + " \"name\": \"Test Business\"," - + " \"about\": \"Test about\"," - + " \"pending_display_name\": \"New Name Pending Approval\"," - + " \"some_future_field\": true" - + "}" - + "}"; - - ChannelsSender sender = ChannelsSender.fromJson(json, objectMapper); - - assertNotNull(sender); - assertNotNull(sender.getProfile()); - assertEquals("Test Business", sender.getProfile().getName()); - assertEquals("Test about", sender.getProfile().getAbout()); - } - - @Test - public void testNestedConfigurationUnknownFieldsIgnored() throws Exception { - String json = "{" - + "\"sid\": \"XE1234567890abcdef1234567890abcdef\"," - + "\"status\": \"ONLINE\"," - + "\"sender_id\": \"whatsapp:+15017122661\"," - + "\"configuration\": {" - + " \"waba_id\": \"12345678912345\"," - + " \"verification_method\": \"sms\"," - + " \"new_config_option\": \"future value\"" - + "}" - + "}"; - - ChannelsSender sender = ChannelsSender.fromJson(json, objectMapper); - - assertNotNull(sender); - assertNotNull(sender.getConfiguration()); - assertEquals("12345678912345", sender.getConfiguration().getWabaId()); - assertEquals(ChannelsSender.VerificationMethod.SMS, sender.getConfiguration().getVerificationMethod()); - } - - @Test - public void testNestedWebhookUnknownFieldsIgnored() throws Exception { - String json = "{" - + "\"sid\": \"XE1234567890abcdef1234567890abcdef\"," - + "\"status\": \"ONLINE\"," - + "\"sender_id\": \"whatsapp:+15017122661\"," - + "\"webhook\": {" - + " \"callback_url\": \"https://example.com/callback\"," - + " \"callback_method\": \"POST\"," - + " \"new_webhook_field\": \"retry_policy_v2\"" - + "}" - + "}"; - - ChannelsSender sender = ChannelsSender.fromJson(json, objectMapper); - - assertNotNull(sender); - assertNotNull(sender.getWebhook()); - assertEquals("https://example.com/callback", sender.getWebhook().getCallbackUrl()); - assertEquals(ChannelsSender.CallbackMethod.POST, sender.getWebhook().getCallbackMethod()); - } - - @Test - public void testNestedPropertiesUnknownFieldsIgnored() throws Exception { - String json = "{" - + "\"sid\": \"XE1234567890abcdef1234567890abcdef\"," - + "\"status\": \"ONLINE\"," - + "\"sender_id\": \"whatsapp:+15017122661\"," - + "\"properties\": {" - + " \"quality_rating\": \"HIGH\"," - + " \"messaging_limit\": \"10K Customers/24hr\"," - + " \"throughput_limit\": \"1000 msg/sec\"" - + "}" - + "}"; - - ChannelsSender sender = ChannelsSender.fromJson(json, objectMapper); - - assertNotNull(sender); - assertNotNull(sender.getProperties()); - assertEquals("HIGH", sender.getProperties().getQualityRating()); - assertEquals("10K Customers/24hr", sender.getProperties().getMessagingLimit()); - } - - @Test - public void testNestedComplianceUnknownFieldsIgnored() throws Exception { - String json = "{" - + "\"sid\": \"XE1234567890abcdef1234567890abcdef\"," - + "\"status\": \"ONLINE\"," - + "\"sender_id\": \"whatsapp:+15017122661\"," - + "\"compliance\": {" - + " \"registration_sid\": \"BUxxx\"," - + " \"new_compliance_field\": \"audit_status_v2\"," - + " \"countries\": [{" - + " \"country\": \"US\"," - + " \"registration_sid\": \"BUyyy\"," - + " \"status\": \"ONLINE\"," - + " \"new_country_field\": \"region_code\"," - + " \"carriers\": [{" - + " \"name\": \"Verizon\"," - + " \"status\": \"APPROVED\"," - + " \"new_carrier_field\": \"mcc_mnc\"" - + " }]" - + " }]" - + "}" - + "}"; - - ChannelsSender sender = ChannelsSender.fromJson(json, objectMapper); - - assertNotNull(sender); - assertNotNull(sender.getCompliance()); - assertEquals("BUxxx", sender.getCompliance().getRegistrationSid()); - assertNotNull(sender.getCompliance().getCountries()); - assertEquals(1, sender.getCompliance().getCountries().size()); - assertEquals("US", sender.getCompliance().getCountries().get(0).getCountry()); - assertEquals(1, sender.getCompliance().getCountries().get(0).getCarriers().size()); - assertEquals("Verizon", sender.getCompliance().getCountries().get(0).getCarriers().get(0).getName()); - } - - @Test - public void testNestedOfflineReasonsUnknownFieldsIgnored() throws Exception { - String json = "{" - + "\"sid\": \"XE1234567890abcdef1234567890abcdef\"," - + "\"status\": \"OFFLINE\"," - + "\"sender_id\": \"whatsapp:+15017122661\"," - + "\"offline_reasons\": [{" - + " \"code\": \"30008\"," - + " \"message\": \"No delivery\"," - + " \"more_info\": \"https://www.twilio.com/docs/api/errors/30008\"," - + " \"severity\": \"critical\"," - + " \"new_reason_field\": 42" - + "}]" - + "}"; - - ChannelsSender sender = ChannelsSender.fromJson(json, objectMapper); - - assertNotNull(sender); - assertNotNull(sender.getOfflineReasons()); - assertEquals(1, sender.getOfflineReasons().size()); - assertEquals("30008", sender.getOfflineReasons().get(0).getCode()); - assertEquals("No delivery", sender.getOfflineReasons().get(0).getMessage()); - } - - @Test - public void testFullResponseWithMultipleUnknownFields() throws Exception { - String json = "{" - + "\"sid\": \"XE1234567890abcdef1234567890abcdef\"," - + "\"status\": \"ONLINE\"," - + "\"sender_id\": \"whatsapp:+15017122661\"," - + "\"friendly_name\": \"My Sender\"," - + "\"new_top_level_field\": \"v2_feature\"," - + "\"configuration\": {" - + " \"waba_id\": \"12345678912345\"," - + " \"verification_method\": \"sms\"," - + " \"new_config_flag\": true" - + "}," - + "\"webhook\": {" - + " \"callback_url\": \"https://example.com/callback\"," - + " \"callback_method\": \"POST\"," - + " \"retry_config\": {\"max_retries\": 3}" - + "}," - + "\"profile\": {" - + " \"name\": \"Test Business\"," - + " \"about\": \"About text\"," - + " \"pending_display_name\": \"New Pending Name\"," - + " \"display_name_status\": \"PENDING_APPROVAL\"," - + " \"websites\": [{\"website\": \"https://example.com\", \"label\": \"Site\", \"verified\": true}]," - + " \"emails\": [{\"email\": \"test@example.com\", \"label\": \"Email\", \"primary\": true}]," - + " \"phone_numbers\": [{\"phone_number\": \"+15017122661\", \"label\": \"Phone\", \"type\": \"mobile\"}]" - + "}," - + "\"properties\": {" - + " \"quality_rating\": \"HIGH\"," - + " \"messaging_limit\": \"10K Customers/24hr\"," - + " \"health_score\": 95" - + "}," - + "\"url\": \"https://messaging.twilio.com/v2/Channels/Senders/XE1234567890abcdef1234567890abcdef\"" - + "}"; - - ChannelsSender sender = ChannelsSender.fromJson(json, objectMapper); - - assertNotNull(sender); - assertEquals("XE1234567890abcdef1234567890abcdef", sender.getSid()); - assertEquals(ChannelsSender.Status.ONLINE, sender.getStatus()); - assertEquals("whatsapp:+15017122661", sender.getSenderId()); - assertNotNull(sender.getConfiguration()); - assertEquals("12345678912345", sender.getConfiguration().getWabaId()); - assertNotNull(sender.getWebhook()); - assertEquals("https://example.com/callback", sender.getWebhook().getCallbackUrl()); - assertNotNull(sender.getProfile()); - assertEquals("Test Business", sender.getProfile().getName()); - assertNotNull(sender.getProperties()); - assertEquals("HIGH", sender.getProperties().getQualityRating()); - } - - @Test - public void testNullNestedObjectsStillWork() throws Exception { - String json = "{" - + "\"sid\": \"XE1234567890abcdef1234567890abcdef\"," - + "\"status\": \"CREATING\"," - + "\"sender_id\": \"whatsapp:+15017122661\"," - + "\"configuration\": null," - + "\"webhook\": null," - + "\"profile\": null," - + "\"properties\": null," - + "\"compliance\": null," - + "\"offline_reasons\": null," - + "\"future_field\": \"should not cause issues\"" - + "}"; - - ChannelsSender sender = ChannelsSender.fromJson(json, objectMapper); - - assertNotNull(sender); - assertEquals("XE1234567890abcdef1234567890abcdef", sender.getSid()); - assertEquals(ChannelsSender.Status.CREATING, sender.getStatus()); - assertNull(sender.getConfiguration()); - assertNull(sender.getWebhook()); - assertNull(sender.getProfile()); - assertNull(sender.getProperties()); - assertNull(sender.getCompliance()); - assertNull(sender.getOfflineReasons()); - } -} diff --git a/src/test/java/com/twilio/twiml/voice/ConnectTest.java b/src/test/java/com/twilio/twiml/voice/ConnectTest.java index a13ad07b22..fa9d79bf4a 100644 --- a/src/test/java/com/twilio/twiml/voice/ConnectTest.java +++ b/src/test/java/com/twilio/twiml/voice/ConnectTest.java @@ -75,6 +75,8 @@ public void testElementWithChildren() { .track(Stream.Track.INBOUND_TRACK) .statusCallback("status_callback") .statusCallbackMethod(Stream.StatusCallbackMethod.GET) + .audioFormat("audio_format") + .sampleRate("sample_rate") .build()); builder.virtualAgent(new VirtualAgent.Builder() @@ -148,7 +150,7 @@ public void testElementWithChildren() { "" + "name" + "name" + - "" + + "" + "" + "" + "" + @@ -262,6 +264,8 @@ public void testXmlChildrenDeserialization() { .track(Stream.Track.INBOUND_TRACK) .statusCallback("status_callback") .statusCallbackMethod(Stream.StatusCallbackMethod.GET) + .audioFormat("audio_format") + .sampleRate("sample_rate") .build()); builder.virtualAgent(new VirtualAgent.Builder() @@ -334,7 +338,7 @@ public void testXmlChildrenDeserialization() { Connect.Builder.fromXml("" + "name" + "name" + - "" + + "" + "" + "" + "" + diff --git a/src/test/java/com/twilio/twiml/voice/StartTest.java b/src/test/java/com/twilio/twiml/voice/StartTest.java index add4b23c88..c54edf64a8 100644 --- a/src/test/java/com/twilio/twiml/voice/StartTest.java +++ b/src/test/java/com/twilio/twiml/voice/StartTest.java @@ -71,6 +71,8 @@ public void testElementWithChildren() { .track(Stream.Track.INBOUND_TRACK) .statusCallback("status_callback") .statusCallbackMethod(Stream.StatusCallbackMethod.GET) + .audioFormat("audio_format") + .sampleRate("sample_rate") .build()); builder.siprec(new Siprec.Builder() @@ -113,7 +115,7 @@ public void testElementWithChildren() { Assert.assertEquals( "" + "" + - "" + + "" + "" + "" + "" + @@ -221,6 +223,8 @@ public void testXmlChildrenDeserialization() { .track(Stream.Track.INBOUND_TRACK) .statusCallback("status_callback") .statusCallbackMethod(Stream.StatusCallbackMethod.GET) + .audioFormat("audio_format") + .sampleRate("sample_rate") .build()); builder.siprec(new Siprec.Builder() @@ -262,7 +266,7 @@ public void testXmlChildrenDeserialization() { Assert.assertEquals( Start.Builder.fromXml("" + - "" + + "" + "" + "" + "" + diff --git a/src/test/java/com/twilio/twiml/voice/StopTest.java b/src/test/java/com/twilio/twiml/voice/StopTest.java index cc1f06f1ad..c29afc68d0 100644 --- a/src/test/java/com/twilio/twiml/voice/StopTest.java +++ b/src/test/java/com/twilio/twiml/voice/StopTest.java @@ -55,6 +55,8 @@ public void testElementWithChildren() { .track(Stream.Track.INBOUND_TRACK) .statusCallback("status_callback") .statusCallbackMethod(Stream.StatusCallbackMethod.GET) + .audioFormat("audio_format") + .sampleRate("sample_rate") .build()); builder.siprec(new Siprec.Builder() @@ -87,7 +89,7 @@ public void testElementWithChildren() { Assert.assertEquals( "" + "" + - "" + + "" + "" + "" + "", @@ -194,6 +196,8 @@ public void testXmlChildrenDeserialization() { .track(Stream.Track.INBOUND_TRACK) .statusCallback("status_callback") .statusCallbackMethod(Stream.StatusCallbackMethod.GET) + .audioFormat("audio_format") + .sampleRate("sample_rate") .build()); builder.siprec(new Siprec.Builder() @@ -225,7 +229,7 @@ public void testXmlChildrenDeserialization() { Assert.assertEquals( Stop.Builder.fromXml("" + - "" + + "" + "" + "" + "").build().toXml(), diff --git a/src/test/java/com/twilio/twiml/voice/StreamTest.java b/src/test/java/com/twilio/twiml/voice/StreamTest.java index 7a25c2c36c..8cb5d039a2 100644 --- a/src/test/java/com/twilio/twiml/voice/StreamTest.java +++ b/src/test/java/com/twilio/twiml/voice/StreamTest.java @@ -42,11 +42,13 @@ public void testElementWithParams() { .track(Stream.Track.INBOUND_TRACK) .statusCallback("status_callback") .statusCallbackMethod(Stream.StatusCallbackMethod.GET) + .audioFormat("audio_format") + .sampleRate("sample_rate") .build(); Assert.assertEquals( "" + - "", + "", elem.toXml() ); } @@ -166,10 +168,12 @@ public void testXmlAttributesDeserialization() { .track(Stream.Track.INBOUND_TRACK) .statusCallback("status_callback") .statusCallbackMethod(Stream.StatusCallbackMethod.GET) + .audioFormat("audio_format") + .sampleRate("sample_rate") .build(); Assert.assertEquals( - Stream.Builder.fromXml("").build().toXml(), + Stream.Builder.fromXml("").build().toXml(), elem.toXml() ); } From 05154a5cdc7979b8c83f769d1b9e8b77329369b2 Mon Sep 17 00:00:00 2001 From: Twilio Date: Mon, 28 Sep 2026 07:34:59 +0000 Subject: [PATCH 2/2] [Librarian] Regenerated @ 65f186ed432e7d4763681d0938b6100538958867 c0286c343096d9f96068fc34bee16c5c5f4460fc --- 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 e7c4fc8c1c..9bd12f660a 100644 --- a/pom.xml +++ b/pom.xml @@ -5,7 +5,7 @@ twilio jar twilio - 13.0.1 + 13.0.2 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.1 + 13.0.2 diff --git a/src/main/java/com/twilio/Twilio.java b/src/main/java/com/twilio/Twilio.java index a34810c948..01a2a33c68 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.1"; + public static final String VERSION = "13.0.2"; 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");